首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > 多媒体 >

directshow ALLOCATOR_PROPERTIES构造解释

2012-08-07 
directshow ALLOCATOR_PROPERTIES结构解释?typedef struct _AllocatorProperties {long cBufferslong cbB

directshow ALLOCATOR_PROPERTIES结构解释?
typedef struct _AllocatorProperties {
  long cBuffers;
  long cbBuffer;
  long cbAlign;
  long cbPrefix;
} ALLOCATOR_PROPERTIES;
谁能具体说明一下long cbAlign; long cbPrefix;的意义?


[解决办法]
cbAlign 
Alignment of the buffer; buffer start will be aligned on a multiple of this value. 
cbPrefix 
Each buffer is preceded by a prefix of this many bytes. 


sdk上说的挺清楚啊,cbAlign就是buffer地址要求多少byte对齐。
cbPrefix 就是每块buffer前面有多少前缀空间。

需要注意的是下面:

Since the buffer pointer returned by IMediaSample::GetPointer points to the area immediately following the prefix, the cbPrefix address (the value returned by IMediaSample::GetPointer minus cbPrefix) should be aligned on an address that is a multiple of cbAlign bytes.
[解决办法]
楼上说的对
没有特殊要求的话,一般cbAlign就是1,cbPrefix是0
[解决办法]
如果下游filter也是你自己写的话,就可以用prefix,你可以通过sample buffer将参数传递下去,下游filter计算好buffer地址就可以。
如buffer中前10bytes存储的是数据,之后才是真正的sample data,那么下游filter就要知道这块buffer的分布情况。

热点排行