Search in sources :

Example 1 with RecorderCapability

use of com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class RecorderCameraRtsp method buildRtpDepayPath.

private Pad buildRtpDepayPath(Structure capStruct) {
    Pad rtpDepaySinkPad = null;
    boolean hasMedia = this.gstCore.hasStructureField(capStruct, "media");
    boolean hasEncode = this.gstCore.hasStructureField(capStruct, "encoding-name");
    if (hasMedia && hasEncode) {
        String media = this.gstCore.getStructureString(capStruct, "media");
        String encode = this.gstCore.getStructureString(capStruct, "encoding-name");
        log.debug("media = " + media + ", encoding = " + encode);
        if (!media.equals("video") && !media.equals("audio")) {
            log.warn("Unsupported RTP media type: " + media);
        } else if (!ConfigRtp.DEPAY_INFO.containsKey(encode)) {
            log.warn("Unsupported RTP encode: " + encode);
        } else {
            RecorderCapability recCap = null;
            Element depayElm = this.gstCore.newElement(ConfigRtp.DEPAY_INFO.get(encode));
            if (media.equals("video")) {
                recCap = RecorderCapability.VIDEO_ONLY;
            } else {
                recCap = RecorderCapability.AUDIO_ONLY;
            }
            this.gstCore.addPipelineElements(this.pipeline, depayElm);
            if (ConfigCodec.PARSE_INFO.containsKey(encode)) {
                Element parseElm = this.gstCore.newElement(ConfigCodec.PARSE_INFO.get(encode));
                Pad parsePad = this.gstCore.getElementStaticPad(parseElm, "src");
                this.gstCore.addPipelineElements(this.pipeline, parseElm);
                this.gstCore.linkManyElement(depayElm, parseElm);
                this.getPadListener().onNotify(recCap, parsePad);
                this.gstCore.playElement(parseElm);
            } else {
                Pad depayPad = this.gstCore.getElementStaticPad(depayElm, "src");
                this.getPadListener().onNotify(recCap, depayPad);
            }
            this.gstCore.playElement(depayElm);
            rtpDepaySinkPad = this.gstCore.getElementStaticPad(depayElm, "sink");
        }
    }
    return rtpDepaySinkPad;
}
Also used : RecorderCapability(com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability) Pad(org.freedesktop.gstreamer.Pad) Element(org.freedesktop.gstreamer.Element)

Example 2 with RecorderCapability

use of com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class RecorderBranchBaseUnitTest method getMembersTest_invokeGetter_nonNullValue.

@Test
public void getMembersTest_invokeGetter_nonNullValue() {
    RecorderCapability cap = RecorderCapability.VIDEO_AUDIO;
    RecorderBranchTest testBranch = new RecorderBranchTest(cap);
    Assertions.assertEquals(cap, testBranch.getCapability());
    Assertions.assertNotNull(testBranch.getGstDao());
    Assertions.assertNotNull(testBranch.getPipe());
    Assertions.assertNotNull(testBranch.isAttachedExplicitly());
    Assertions.assertNotNull(testBranch.isBranchAttached());
}
Also used : RecorderCapability(com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability) Test(org.junit.jupiter.api.Test)

Example 3 with RecorderCapability

use of com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class RecorderBranchBaseUnitTest method getMuxerTest_getMuxerByInvalidType_throwException.

@Test
public void getMuxerTest_getMuxerByInvalidType_throwException() {
    RecorderCapability cap = RecorderCapability.VIDEO_AUDIO;
    ContainerType type = ContainerType.UNSUPPORTED;
    RecorderBranchTest testBranch = new RecorderBranchTest(cap);
    Assertions.assertThrows(IllegalArgumentException.class, () -> testBranch.getMuxer(type, true));
}
Also used : RecorderCapability(com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability) ContainerType(com.aws.iot.edgeconnectorforkvs.videorecorder.model.ContainerType) Test(org.junit.jupiter.api.Test)

Example 4 with RecorderCapability

use of com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class RecorderBranchBaseUnitTest method getExtensionTest_getExtensionByType_mkv.

@Test
public void getExtensionTest_getExtensionByType_mkv() {
    RecorderCapability cap = RecorderCapability.VIDEO_AUDIO;
    ContainerType type = ContainerType.MATROSKA;
    RecorderBranchTest testBranch = new RecorderBranchTest(cap);
    Assertions.assertEquals("mkv", testBranch.getExtension(type));
}
Also used : RecorderCapability(com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability) ContainerType(com.aws.iot.edgeconnectorforkvs.videorecorder.model.ContainerType) Test(org.junit.jupiter.api.Test)

Example 5 with RecorderCapability

use of com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability in project aws-iot-greengrass-edge-connector-for-kinesis-video-stream by awslabs.

the class RecorderBranchBaseUnitTest method getExtensionTest_getExtensionByInvalidType_throwException.

@Test
public void getExtensionTest_getExtensionByInvalidType_throwException() {
    RecorderCapability cap = RecorderCapability.VIDEO_AUDIO;
    ContainerType type = ContainerType.UNSUPPORTED;
    RecorderBranchTest testBranch = new RecorderBranchTest(cap);
    Assertions.assertThrows(IllegalArgumentException.class, () -> testBranch.getExtension(type));
}
Also used : RecorderCapability(com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability) ContainerType(com.aws.iot.edgeconnectorforkvs.videorecorder.model.ContainerType) Test(org.junit.jupiter.api.Test)

Aggregations

RecorderCapability (com.aws.iot.edgeconnectorforkvs.videorecorder.model.RecorderCapability)7 Test (org.junit.jupiter.api.Test)5 ContainerType (com.aws.iot.edgeconnectorforkvs.videorecorder.model.ContainerType)4 Element (org.freedesktop.gstreamer.Element)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Pad (org.freedesktop.gstreamer.Pad)1