一. 结构体介绍

  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:待观察其使用。

你可能感兴趣的:(一. 结构体介绍)