首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

类型定义的方式,该怎么解决

2012-04-05 
类型定义的方式有些类型是这样定义的:typedefstructAVFrame{FF_COMMON_FRAME}AVFrame#defineFF_COMMON_FR

类型定义的方式
有些类型是这样定义的:

typedef   struct   AVFrame   {
        FF_COMMON_FRAME
}   AVFrame;

#define   FF_COMMON_FRAME   \
        /**\
          *   pointer   to   the   picture   planes.\
          *   this   might   be   different   from   the   first   allocated   byte\
          *   -   encoding:   \
          *   -   decoding:   \
          */\
        uint8_t   *data[4];\
        int   linesize[4];\
        /**\
          *   pointer   to   the   first   allocated   byte   of   the   picture.   can   be   used   in   get_buffer/release_buffer\
          *   this   isn 't   used   by   lavc   unless   the   default   get/release_buffer()   is   used\
          *   -   encoding:   \
          *   -   decoding:   \
          */\
        uint8_t   *base[4];\
        /**\
          *   1   ->   keyframe,   0->   not\
          *   -   encoding:   set   by   lavc\
          *   -   decoding:   set   by   lavc\
          */\
        int   key_frame;\
\
        /**\
          *   picture   type   of   the   frame,   see   ?_TYPE   below.\
          *   -   encoding:   set   by   lavc   for   coded_picture   (and   set   by   user   for   input)\
          *   -   decoding:   set   by   lavc\
          */\
        int   pict_type;\


请问为什么这样写?这样写有什么好处?谢谢!


[解决办法]
FF_COMMON_FRAME

这样可能 FF_COMMON_FRAME 是经常被用到的一部分定义,
那么使用 define 独立开来,
比较方便。

当然你也可以使用别的方式包装。

热点排行