一. 结构体介绍

  1. x264_nal_t结构体
typedef struct x264_nal_t
{
    int i_ref_idc;  /* nal_priority_e */
    int i_type;     /* nal_unit_type_e */
    int b_long_startcode;
    int i_first_mb; /* If this NAL is a slice, the index of the first MB in the slice. */
    int i_last_mb;  /* If this NAL is a slice, the index of the last MB in the slice. */

    /* Size of payload (including any padding) in bytes. */
    int     i_payload;
    /* If param->b_annexb is set, Annex-B bytestream with startcode.
     * Otherwise, startcode is replaced with a 4-byte size.
     * This size is the size used in mp4/similar muxing; it is equal to i_payload-4 */
    uint8_t *p_payload;

    /* Size of padding in bytes. */
    int i_padding;
} x264_nal_t;

i_ref_idc:nal_t的优先级。其包含的几个优先级的定义如下:

enum nal_priority_e
{
    NAL_PRIORITY_DISPOSABLE = 0,  // 00
    NAL_PRIORITY_LOW        = 1,  // 01
    NAL_PRIORITY_HIGH       = 2,  // 10
    NAL_PRIORITY_HIGHEST    = 3,  // 11
};

i_type:nal_t的类型。包括SPS,PPS,SS等信息,其类型信息的定义如下:

enum nal_unit_type_e
{
    NAL_UNKNOWN     = 0,                        // 00000
    NAL_SLICE       = 1,                        // 00001
    NAL_SLICE_DPA   = 2,                        // 00010
    NAL_SLICE_DPB   = 3,                        // 00011
    NAL_SLICE_DPC   = 4,                        // 00100
    NAL_SLICE_IDR   = 5,    /* ref_idc != 0 */  // 00101
    NAL_SEI         = 6,    /* ref_idc == 0 */  // 00110
    NAL_SPS         = 7,                        // 00111
    NAL_PPS         = 8,                        // 01000
    NAL_AUD         = 9,                        // 01001
    NAL_FILLER      = 12,                       // 01100
    /* ref_idc == 0 for 6,9,10,11,12 */
};

b_long_startcode:最长的开始编码,有可能是3或者4,这是由于nal的首部是以000001或者00000001开始的,包含3字节或者两个字节。
i_payload,p_payload,i_padding:待观察其使用。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 原文首发在金山云Live,请从原文转载,本文不接受再次转载! 我来自于金山云多媒体SDK团队,在移动直播、短视频等...
    fpzeng阅读 4,104评论 0 0
  • 熟悉的身影手势气息再见已是对外强中干的外表残酷挑战,能够不痛无动于衷除非所有的感情否定在心门之外。像个孩子一样无助...
    镜中花水中影阅读 884评论 0 0
  • Jashua阅读 1,293评论 0 0
  • 9.1小孩子开学啦,大人是不是很轻松呢?! 9.1我也开学啦,准确来说是开始学习啦,报了好报写作班第八期,从09月...
    小丫屠阅读 3,025评论 0 1
  • 2017年10月30日 星期一 天气 晴 下午去学校参加了我心目中的好老师的讲座,五位学生代表和四位家长代...
    言書9130阅读 1,410评论 0 11