Example #1
0
        //==========================================================================
        private static uint Video_Format(ref IntPtr opaque, ref uint chroma, ref uint width, ref uint height, ref uint pitches, ref uint lines)
        {
            Debug.WriteLine("Video_Format", "MediaPlayer");

            MediaPlayer media_player = GetMediaPlayer(opaque);

            if (media_player == null)
            {
                return(0);
            }

            VideoBuffer video_buffer;

            if (m_VideoBuffers.TryGetValue(opaque, out video_buffer))
            {
                m_VideoBuffers.TryRemove(opaque, out video_buffer);
            }
            video_buffer = new VideoBuffer(width, height, PixelFormat.RV32);
            m_VideoBuffers.TryAdd(opaque, video_buffer);
            media_player.VideoBuffer = video_buffer;
            media_player.RaiseVideoFormat();

            chroma  = BitConverter.ToUInt32(new byte[] { (byte)'R', (byte)'V', (byte)'3', (byte)'2' }, 0);
            width   = (uint)video_buffer.Width;
            height  = (uint)video_buffer.Height;
            pitches = (uint)video_buffer.Stride;
            lines   = (uint)video_buffer.Height;

            return(1);
        }
Example #2
0
    //==========================================================================
    private static uint Video_Format(ref IntPtr opaque, ref uint chroma, ref uint width, ref uint height, ref uint pitches, ref uint lines)
    {
      Debug.WriteLine("Video_Format", "MediaPlayer");

      MediaPlayer media_player = GetMediaPlayer(opaque);
      if(media_player == null)
        return 0;

      VideoBuffer video_buffer;
      if(m_VideoBuffers.TryGetValue(opaque, out video_buffer))
        m_VideoBuffers.TryRemove(opaque, out video_buffer);
      video_buffer = new VideoBuffer(width, height, PixelFormat.RV32);
      m_VideoBuffers.TryAdd(opaque, video_buffer);
      media_player.VideoBuffer = video_buffer;
      media_player.RaiseVideoFormat();

      chroma = BitConverter.ToUInt32(new byte[] { (byte)'R', (byte)'V', (byte)'3', (byte)'2' }, 0);
      width = (uint)video_buffer.Width;
      height = (uint)video_buffer.Height;
      pitches = (uint)video_buffer.Stride;
      lines = (uint)video_buffer.Height;

      return 1;
    }