private void InitVideo()
        {
            int hr;

            IAMTimelineGroup pVideoGroup = (IAMTimelineGroup)m_pVideoGroupObj;

            // all we set is the major type. The group will automatically use other defaults
            AMMediaType VideoGroupType = new AMMediaType();

            VideoGroupType.majorType = MediaType.Video;

            hr = pVideoGroup.SetMediaType(VideoGroupType);
            DESError.ThrowExceptionForHR(hr);
            DsUtils.FreeAMMediaType(VideoGroupType);

            // add the video group to the timeline
            hr = m_pTimeline.AddGroup(m_pVideoGroupObj);
            DESError.ThrowExceptionForHR(hr);

            IAMTimelineObj pTrack1Obj;

            hr = m_pTimeline.CreateEmptyNode(out pTrack1Obj, TimelineMajorType.Track);
            DESError.ThrowExceptionForHR(hr);

            // tell the composition about the track
            IAMTimelineComp pRootComp = (IAMTimelineComp)m_pVideoGroupObj;

            hr = pRootComp.VTrackInsBefore(pTrack1Obj, -1);
            DESError.ThrowExceptionForHR(hr);

            m_VideoTrack = (IAMTimelineTrack)pTrack1Obj;
        }
示例#2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mType">Media type of the new group</param>
        /// <param name="pTimeline">Timeline to use for the group</param>
        /// <param name="fps">FPS for the group</param>
        public MediaGroup(AMMediaType mType, IAMTimeline pTimeline, double fps)
        {
            int            hr;
            IAMTimelineObj pGroupObj;

            m_Length    = 0;
            m_Files     = new ArrayList();
            m_FPS       = fps;
            m_pTimeline = pTimeline;

            // make the root group/composition
            hr = m_pTimeline.CreateEmptyNode(out pGroupObj, TimelineMajorType.Group);
            DESError.ThrowExceptionForHR(hr);

            try
            {
                m_pGroup = (IAMTimelineGroup)pGroupObj;

                // Set the media type we just created
                hr = m_pGroup.SetMediaType(mType);
                DESError.ThrowExceptionForHR(hr);
                DsUtils.FreeAMMediaType(mType);

                // add the video group to the timeline
                hr = m_pTimeline.AddGroup(pGroupObj);
                DESError.ThrowExceptionForHR(hr);
            }
            finally
            {
                //Marshal.ReleaseComObject(pGroupObj);
            }
            //Marshal.ReleaseComObject(pTrack1Obj);  // Released as m_VideoTrack in dispose
        }
示例#3
0
    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="mType">Media type of the new group</param>
    /// <param name="pTimeline">Timeline to use for the group</param>
    /// <param name="fps">FPS for the group</param>
    public MediaGroup(AMMediaType mType, IAMTimeline pTimeline, double fps)
    {
      int hr;
      IAMTimelineObj pGroupObj;

      m_Length = 0;
      m_Files = new ArrayList();
      m_FPS = fps;
      m_pTimeline = pTimeline;

      // make the root group/composition
      hr = m_pTimeline.CreateEmptyNode(out pGroupObj, TimelineMajorType.Group);
      DESError.ThrowExceptionForHR(hr);

      try
      {
        m_pGroup = (IAMTimelineGroup)pGroupObj;

        // Set the media type we just created
        hr = m_pGroup.SetMediaType(mType);
        DESError.ThrowExceptionForHR(hr);
        DsUtils.FreeAMMediaType(mType);

        // add the video group to the timeline
        hr = m_pTimeline.AddGroup(pGroupObj);
        DESError.ThrowExceptionForHR(hr);
      }
      finally
      {
        //Marshal.ReleaseComObject(pGroupObj);
      }
      //Marshal.ReleaseComObject(pTrack1Obj);  // Released as m_VideoTrack in dispose
    }
示例#4
0
        private void TestMediaType()
        {
            int         hr;
            AMMediaType p = new AMMediaType();

            hr = m_itg.GetMediaType(p);
            DESError.ThrowExceptionForHR(hr);

            // From SetMediaTypeForVB
            Debug.Assert(p.majorType == MediaType.Video, "mediatype1");

            p.majorType = MediaType.Video;

            hr = m_itg.SetMediaType(p);
            DESError.ThrowExceptionForHR(hr);
        }
示例#5
0
        /// <summary>
        /// Inserts a group into a timeline, and assigns it the supplied media type.
        /// Will free the media type upon completion.
        /// </summary>
        /// <param name="timeline"></param>
        /// <param name="mediaType"></param>
        /// <returns></returns>
        internal static IAMTimelineGroup InsertGroup(IAMTimeline timeline, AMMediaType mediaType, string name)
        {
            try
            {
                int hr = 0;

                IAMTimelineObj groupObj;

                // make the root group/composition
                hr = timeline.CreateEmptyNode(out groupObj, TimelineMajorType.Group);
                DESError.ThrowExceptionForHR(hr);

                if (!string.IsNullOrEmpty(name))
                {
                    hr = groupObj.SetUserName(name);
                    DESError.ThrowExceptionForHR(hr);
                }

                IAMTimelineGroup group = (IAMTimelineGroup)groupObj;

                // Set the media type we just created
                hr = group.SetMediaType(mediaType);
                DESError.ThrowExceptionForHR(hr);


                // add the group to the timeline
                hr = timeline.AddGroup(groupObj);
                DESError.ThrowExceptionForHR(hr);

                return(group);
            }
            finally
            {
                DsUtils.FreeAMMediaType(mediaType);
            }
        }