Chinaunix首页 | 论坛 | 博客
  • 博客访问: 194516
  • 博文数量: 44
  • 博客积分: 1515
  • 博客等级: 上尉
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-06 16:39
文章分类

全部博文(44)

文章存档

2013年(3)

2012年(2)

2011年(2)

2009年(20)

2008年(17)

我的朋友

分类:

2009-09-30 13:46:16

Firest, name my filter CH264EncoderFilter
1 Read doctument for directshow :directshow.chm, especially Writing directshow filters.

2 Chose Base filter.For my filter will receive yuv422 video stream , convert it to yuv420 then give to libx264.lib for encoding,at end, output h264 stream to down stream.  CH264EncoderFilter will have one input pin and one output pin ,manipulate data internal,So I choose CTransformFilter as base Class.

3  Declare the Filter Class

   class CH264EncoderFilter : public CTransformFilter
   {
    /* Declarations will go here. */
    public:
      CH264EncoderFilter();
      ~CH264EncoderFilter();
   ..........................................
   };

   Declare CLSID:
   DEFINE_GUID(CLSID_H264EncoderFilter,
     0x69313aff, 0x34c1, 0x4774, 0x94, 0x31, 0xd4, 0x81, 0xb7, 0x2c, 0x4, 0xd3);
    };
   GUID is generated by Guidgen.exe.

4 Support Media Type Negotiation
  CH264EncoderFilter only accetp yuv2 and generate h264 video stream.

  CareFull!
  In GetMediaType,

   ..........
        VIDEOINFOHEADER *pVih =
            reinterpret_cast(pMediaType->pbFormat);
        pVih->bmiHeader.biCompression = FOURCC( '462H' );

   ..........................
  I'm puzzled!
  If pVih->bmiHeader.biCompression = FOURCC( 'H264' ) , the avi file recorded by avi muxer and file writer can't be play!


5 Set Allocator Properties

     pProp->cbBuffer = DIBSIZE(*pbmi) * 10
6 in Transform encoder yuv420 data.

7 register filter to System

阅读(1269) | 评论(0) | 转发(0) |
0

上一篇:alsa的命令长度

下一篇:VS2005 error c2733

给主人留下些什么吧!~~