自学内容网 自学内容网

x264的NALU单元

NALU单元的结构体定义

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;

其中NALU单元类型

enum nal_unit_type_e {
    NAL_UNKNOWN     = 0,
    NAL_SLICE       = 1,
    NAL_SLICE_DPA   = 2,
    NAL_SLICE_DPB   = 3,
    NAL_SLICE_DPC   = 4,
    NAL_SLICE_IDR   = 5,    /* ref_idc != 0 */
    NAL_SEI         = 6,    /* ref_idc == 0 */
    NAL_SPS         = 7,
    NAL_PPS         = 8,
    NAL_AUD         = 9,
    NAL_FILLER      = 12,
    /* ref_idc == 0 for 6,9,10,11,12 */
};

帧的类型

/* Slice type */
#define X264_TYPE_AUTO          0x0000  /* Let x264 choose the right type */
#define X264_TYPE_IDR           0x0001
#define X264_TYPE_I             0x0002
#define X264_TYPE_P             0x0003
#define X264_TYPE_BREF          0x0004  /* Non-disposable B-frame */
#define X264_TYPE_B             0x0005
#define X264_TYPE_KEYFRAME      0x0006  /* IDR or I depending on b_open_gop option */


原文地址:https://blog.csdn.net/cai742925624/article/details/140846388

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!