コード例 #1
0
        private List <object> getOutputNodes(List <object> aCompressedMediaTypeList, IFileSinkFactory aFileSinkFactory)
        {
            List <object> lresult = new List <object>();

            do
            {
                if (aCompressedMediaTypeList == null)
                {
                    break;
                }

                if (aCompressedMediaTypeList.Count == 0)
                {
                    break;
                }

                if (aFileSinkFactory == null)
                {
                    break;
                }

                if (string.IsNullOrEmpty(mFilename))
                {
                    break;
                }

                aFileSinkFactory.createOutputNodes(
                    aCompressedMediaTypeList,
                    mFilename,
                    out lresult);
            } while (false);

            return(lresult);
        }
コード例 #2
0
        public bool createSinkFactory(
            Guid aContainerTypeGUID,
            out IFileSinkFactory aSinkFactory)
        {
            bool lresult = false;

            aSinkFactory = null;

            do
            {
                if (mSinkControl == null)
                {
                    break;
                }


                try
                {
                    object lIUnknown;

                    mSinkControl.createSinkFactory(
                        aContainerTypeGUID,
                        typeof(CaptureManagerLibrary.IFileSinkFactory).GUID,
                        out lIUnknown);

                    if (lIUnknown == null)
                    {
                        break;
                    }

                    var lFileSinkFactory = lIUnknown as CaptureManagerLibrary.IFileSinkFactory;

                    if (lFileSinkFactory == null)
                    {
                        break;
                    }

                    aSinkFactory = new FileSinkFactory(lFileSinkFactory);
                }
                catch (Exception exc)
                {
                    LogManager.getInstance().write(exc.Message);
                }
            } while (false);

            return(lresult);
        }
コード例 #3
0
        private List <object> getOutputNodes(List <object> aCompressedMediaTypeList, string aFileName)
        {
            List <object> lresult = new List <object>();

            do
            {
                if (aCompressedMediaTypeList == null)
                {
                    break;
                }

                if (aCompressedMediaTypeList.Count == 0)
                {
                    break;
                }

                var lselectedNode = m_FileFormatComboBox.SelectedItem as XmlNode;

                if (lselectedNode == null)
                {
                    break;
                }

                var lSelectedAttr = lselectedNode.Attributes["Value"];

                if (lSelectedAttr == null)
                {
                    break;
                }
                aFileName += "." + lSelectedAttr.Value.ToLower();

                lSelectedAttr = lselectedNode.Attributes["GUID"];

                if (lSelectedAttr == null)
                {
                    break;
                }

                mFileSinkFactory = null;

                mSinkControl.createSinkFactory(
                    Guid.Parse(lSelectedAttr.Value),
                    out mFileSinkFactory);

                if (string.IsNullOrEmpty(aFileName))
                {
                    break;
                }

                foreach (var item in mFileList.Items)
                {
                    var lFileItemControl = item as FileItemControl;

                    if (lFileItemControl != null)
                    {
                        lFileItemControl.stopAnimation();
                    }
                }

                mFileList.Items.Add(new FileItemControl(aFileName));

                String limageSourceDir = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

                mFileSinkFactory.createOutputNodes(
                    aCompressedMediaTypeList,
                    limageSourceDir + @"\" + aFileName,
                    out lresult);
            } while (false);

            return(lresult);
        }
コード例 #4
0
        private void mControlBtn_Click(object sender, RoutedEventArgs e)
        {
            if (mIsStarted)
            {
                mIsStarted = false;

                if (mISession == null)
                {
                    return;
                }

                mISession.stopSession();

                mISession.closeSession();

                mISession = null;

                m_StartStopBtn.Content = "Start";

                foreach (var item in mISourceItems)
                {
                    var lsourceitem = (ISource)item;

                    if (lsourceitem != null)
                    {
                        lsourceitem.access(true);
                    }
                }

                return;
            }
            else
            {
                IFileSinkFactory lFileSinkFactory = null;

                mSinkControl.createSinkFactory(
                    Guid.Parse("A2A56DA1-EB84-460E-9F05-FEE51D8C81E3"),
                    out lFileSinkFactory);

                if (lFileSinkFactory == null)
                {
                    return;
                }

                List <object> lCompressedMediaTypeList = new List <object>();

                foreach (var item in mISources)
                {
                    var lCompressedMediaType = item.getCompressedMediaType();

                    if (lCompressedMediaType != null)
                    {
                        lCompressedMediaTypeList.Add(lCompressedMediaType);
                    }
                }

                List <object> lOutputNodes = getOutputNodes(lCompressedMediaTypeList, lFileSinkFactory);

                if (lOutputNodes == null || lOutputNodes.Count == 0)
                {
                    return;
                }

                List <object> lSourceNodes = new List <object>();

                for (int i = 0; i < lOutputNodes.Count; i++)
                {
                    var lSourceNode = mISources[i].getSourceNode(lOutputNodes[i]);

                    if (lSourceNode != null)
                    {
                        lSourceNodes.Add(lSourceNode);
                    }
                }

                mISession = mISessionControl.createSession(lSourceNodes.ToArray());

                if (mISession == null)
                {
                    return;
                }

                if (mISession.startSession(0, Guid.Empty))
                {
                    m_StartStopBtn.Content = "Stop";
                }

                mIsStarted = true;

                foreach (var item in mISourceItems)
                {
                    var lsourceitem = (ISource)item;

                    if (lsourceitem != null)
                    {
                        lsourceitem.access(false);
                    }
                }
            }
        }
コード例 #5
0
 public FileSink(IFileSinkFactory aSinkFactory)
 {
     mSinkFactory = aSinkFactory;
 }
コード例 #6
0
        private List <object> getOutputNodes(List <object> aCompressedMediaTypeList)
        {
            List <object> lresult = new List <object>();

            do
            {
                if (aCompressedMediaTypeList == null)
                {
                    break;
                }

                if (aCompressedMediaTypeList.Count == 0)
                {
                    break;
                }

                var lselectedNode = getFileFormat();


                var lSelectedAttr = lselectedNode.Attributes["GUID"];

                if (lSelectedAttr == null)
                {
                    break;
                }

                IFileSinkFactory mFileSinkFactory = null;

                mSinkControl.createSinkFactory(
                    Guid.Parse(lSelectedAttr.Value),
                    out mFileSinkFactory);

                if (mFileSinkFactory == null)
                {
                    break;
                }

                lSelectedAttr = lselectedNode.Attributes["Value"];

                if (lSelectedAttr == null)
                {
                    break;
                }

                string s = String.Format("Video_{0:yyyy_MM_dd_HH_mm_ss}.", DateTime.Now);

                string mFilename = s + lSelectedAttr.Value.ToLower();

                mStatus.Text = "File: " + mFilename;

                mFilename = Settings.Default.StoringDir + @"\" + mFilename;

                if (string.IsNullOrEmpty(mFilename))
                {
                    break;
                }

                mFileSinkFactory.createOutputNodes(
                    aCompressedMediaTypeList,
                    mFilename,
                    out lresult);
            } while (false);

            return(lresult);
        }
コード例 #7
0
        private List <object> getOutputNodes(List <object> aCompressedMediaTypeList, XmlNode a_FileFormatXmlNode, string aFileName)
        {
            List <object> lresult = new List <object>();

            do
            {
                if (aCompressedMediaTypeList == null)
                {
                    break;
                }

                if (aCompressedMediaTypeList.Count == 0)
                {
                    break;
                }

                var lselectedNode = a_FileFormatXmlNode;

                if (lselectedNode == null)
                {
                    break;
                }

                var lSelectedAttr = lselectedNode.Attributes["Value"];

                if (lSelectedAttr == null)
                {
                    break;
                }
                aFileName += "." + lSelectedAttr.Value.ToLower();

                lSelectedAttr = lselectedNode.Attributes["GUID"];

                if (lSelectedAttr == null)
                {
                    break;
                }

                mFileSinkFactory = null;

                mSinkControl.createSinkFactory(
                    Guid.Parse(lSelectedAttr.Value),
                    out mFileSinkFactory);

                if (string.IsNullOrEmpty(aFileName))
                {
                    break;
                }


                Dispatcher.Invoke(
                    DispatcherPriority.Background,
                    new Action(() => mFileList.Items.Add(aFileName)));

                String limageSourceDir = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

                mFileSinkFactory.createOutputNodes(
                    aCompressedMediaTypeList,
                    limageSourceDir + @"\" + aFileName,
                    out lresult);
            } while (false);

            return(lresult);
        }