Exemplo n.º 1
0
        private void TestMark()
        {
            short w1, w2, w3;

            m_head.GetMarkerCount(out w1);

            m_head.AddMarker("mark1", 12340000);

            m_head.GetMarkerCount(out w2);
            Debug.Assert(w2 == w1 + 1);

            long  l;
            short pLen = 0;

            m_head.GetMarker((short)(w2 - 1), null, ref pLen, out l);
            StringBuilder sb = new StringBuilder(pLen);

            m_head.GetMarker((short)(w2 - 1), sb, ref pLen, out l);

            Debug.Assert(sb.ToString() == "mark1" && l == 12340000);

            m_head.RemoveMarker((short)(w2 - 1));

            m_head.GetMarkerCount(out w3);
            Debug.Assert(w3 == w1);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Add a marher to the header info. Wraps IWMHeaderInfo.AddMarker
 /// </summary>
 /// <param name="m">Marker to add. <see cref="Marker"/></param>
 public void AddMarker(Marker m)
 {
     m_HeaderInfo.AddMarker(m.Name, m.Time);
 }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------
        // Name: CWMVCopy::CopyMarker()
        // Desc: Copies the markers from the source file to the destination file.
        //------------------------------------------------------------------------------
        protected void CopyMarker(string pwszOutputFile)
        {
            short             cMarker           = 0;
            IWMMetadataEditor pEditor           = null;
            IWMHeaderInfo     pWriterHeaderInfo = null;
            StringBuilder     pwszMarkerName    = null;

            m_pReaderHeaderInfo.GetMarkerCount(out cMarker);

            //
            // Markers can be copied only by the metadata editor.
            // Create an editor
            //
            WMUtils.WMCreateEditor(out pEditor);

            try
            {
                //
                // Open the output using the editor
                //
                pEditor.Open(pwszOutputFile);

                pWriterHeaderInfo = pEditor as IWMHeaderInfo;

                for (short i = 0; i < cMarker; i++)
                {
                    short cchMarkerNameLen = 0;
                    long  cnsMarkerTime    = 0;

                    //
                    // Get the memory size for this marker
                    //
                    m_pReaderHeaderInfo.GetMarker(i,
                                                  null,
                                                  ref cchMarkerNameLen,
                                                  out cnsMarkerTime);

                    pwszMarkerName = new StringBuilder(cchMarkerNameLen);

                    m_pReaderHeaderInfo.GetMarker(i,
                                                  pwszMarkerName,
                                                  ref cchMarkerNameLen,
                                                  out cnsMarkerTime);
                    //
                    // Add marker to the writer
                    //
                    pWriterHeaderInfo.AddMarker(pwszMarkerName.ToString(),
                                                cnsMarkerTime);
                }

                //
                // Close and release the editor
                //
                pEditor.Flush();

                pEditor.Close();
            }
            finally
            {
                Marshal.ReleaseComObject(pEditor);
            }
        }