コード例 #1
0
        private object getCompressedMediaType(
            ICaptureProcessor a_ICaptureProcessor,
            int a_StreamIndex,
            int a_MediaTypeIndex,
            XmlNode aEncoderNode,
            XmlNode aEncoderModeNode,
            int aCompressedMediaTypeIndex)
        {
            object lresult = null;

            do
            {
                if (aCompressedMediaTypeIndex < 0)
                {
                    break;
                }

                object lMediaSource = null;

                mSourceControl.createSourceFromCaptureProcessor(
                    a_ICaptureProcessor,
                    out lMediaSource);

                if (lMediaSource == null)
                {
                    break;
                }

                if (a_StreamIndex < 0)
                {
                    break;
                }

                if (a_MediaTypeIndex < 0)
                {
                    break;
                }

                if (aEncoderNode == null)
                {
                    break;
                }


                if (aEncoderModeNode == null)
                {
                    break;
                }

                var lEncoderGuidAttr = aEncoderNode.Attributes["CLSID"];

                if (lEncoderGuidAttr == null)
                {
                    break;
                }

                Guid lCLSIDEncoder;

                if (!Guid.TryParse(lEncoderGuidAttr.Value, out lCLSIDEncoder))
                {
                    break;
                }

                var lEncoderModeGuidAttr = aEncoderModeNode.Attributes["GUID"];

                if (lEncoderModeGuidAttr == null)
                {
                    break;
                }

                Guid lCLSIDEncoderMode;

                if (!Guid.TryParse(lEncoderModeGuidAttr.Value, out lCLSIDEncoderMode))
                {
                    break;
                }

                uint lStreamIndex = (uint)a_StreamIndex;

                uint lMediaTypeIndex = (uint)a_MediaTypeIndex;

                object lSourceMediaType = null;

                if (!mSourceControl.getSourceOutputMediaTypeFromMediaSource(
                        lMediaSource,
                        lStreamIndex,
                        lMediaTypeIndex,
                        out lSourceMediaType))
                {
                    break;
                }

                if (lSourceMediaType == null)
                {
                    break;
                }

                IEncoderNodeFactory lEncoderNodeFactory;

                if (!mEncoderControl.createEncoderNodeFactory(
                        lCLSIDEncoder,
                        out lEncoderNodeFactory))
                {
                    break;
                }

                if (lEncoderNodeFactory == null)
                {
                    break;
                }

                object lCompressedMediaType;

                if (!lEncoderNodeFactory.createCompressedMediaType(
                        lSourceMediaType,
                        lCLSIDEncoderMode,
                        50,
                        (uint)aCompressedMediaTypeIndex,
                        out lCompressedMediaType))
                {
                    break;
                }

                lresult = lCompressedMediaType;
            } while (false);

            return(lresult);
        }
コード例 #2
0
        private object getEncoderNode(
            object aMediaSource,
            uint aStreamIndex,
            uint aMediaTypeIndex,
            Guid aCLSIDEncoder,
            Guid aCLSIDEncoderMode,
            int aCompressedMediaTypeIndex,
            object aOutputNode)
        {
            object lresult = null;

            do
            {
                if (aCompressedMediaTypeIndex < 0)
                {
                    break;
                }

                object lSourceMediaType = null;

                if (!mSourceControl.getSourceOutputMediaTypeFromMediaSource(
                        aMediaSource,
                        aStreamIndex,
                        aMediaTypeIndex,
                        out lSourceMediaType))
                {
                    break;
                }

                if (lSourceMediaType == null)
                {
                    break;
                }

                IEncoderNodeFactory lEncoderNodeFactory;

                if (!mEncoderControl.createEncoderNodeFactory(
                        aCLSIDEncoder,
                        out lEncoderNodeFactory))
                {
                    break;
                }

                if (lEncoderNodeFactory == null)
                {
                    break;
                }

                object lEncoderNode;

                if (!lEncoderNodeFactory.createEncoderNode(
                        lSourceMediaType,
                        aCLSIDEncoderMode,
                        50,
                        (uint)aCompressedMediaTypeIndex,
                        aOutputNode,
                        out lEncoderNode))
                {
                    break;
                }

                lresult = lEncoderNode;
            } while (false);

            return(lresult);
        }