Unified · Split
| @@ -31,6 +31,7 @@ · 30 unmodified lines | |||
| 31 | #include "hevc.h" | 31 | #include "hevc.h" |
| 32 | #include "startcode.h" | 32 | #include "startcode.h" |
| 33 | #include "vc1_common.h" | 33 | #include "vc1_common.h" |
| 34 | #include "vvc.h" | ||
| 34 | 35 | ||
| 35 | typedef struct ExtractExtradataContext { | 36 | typedef struct ExtractExtradataContext { |
| 36 | const AVClass *class; | 37 | const AVClass *class; |
| @@ -134,6 +135,9 @@ static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt, · 97 unmodified lines | |||
| 134 | static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, | 135 | static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, |
| 135 | uint8_t **data, int *size) | 136 | uint8_t **data, int *size) |
| 136 | { | 137 | { |
| 138 | static const int extradata_nal_types_vvc[] = { | ||
| 139 | VVC_VPS_NUT, VVC_SPS_NUT, VVC_PPS_NUT, | ||
| 140 | }; | ||
| 137 | static const int extradata_nal_types_hevc[] = { | 141 | static const int extradata_nal_types_hevc[] = { |
| 138 | HEVC_NAL_VPS, HEVC_NAL_SPS, HEVC_NAL_PPS, | 142 | HEVC_NAL_VPS, HEVC_NAL_SPS, HEVC_NAL_PPS, |
| 139 | }; | 143 | }; |
| @@ -148,7 +152,10 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, · 8 unmodified lines | |||
| 148 | int nb_extradata_nal_types; | 152 | int nb_extradata_nal_types; |
| 149 | int i, has_sps = 0, has_vps = 0, ret = 0; | 153 | int i, has_sps = 0, has_vps = 0, ret = 0; |
| 150 | 154 | ||
| 151 | if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { | 155 | if (ctx->par_in->codec_id == AV_CODEC_ID_VVC) { |
| 156 | extradata_nal_types = extradata_nal_types_vvc; | ||
| 157 | nb_extradata_nal_types = FF_ARRAY_ELEMS(extradata_nal_types_vvc); | ||
| 158 | } else if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { | ||
| 152 | extradata_nal_types = extradata_nal_types_hevc; | 159 | extradata_nal_types = extradata_nal_types_hevc; |
| 153 | nb_extradata_nal_types = FF_ARRAY_ELEMS(extradata_nal_types_hevc); | 160 | nb_extradata_nal_types = FF_ARRAY_ELEMS(extradata_nal_types_hevc); |
| 154 | } else { | 161 | } else { |
| @@ -165,7 +172,10 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, · 10 unmodified lines | |||
| 165 | H2645NAL *nal = &s->h2645_pkt.nals[i]; | 172 | H2645NAL *nal = &s->h2645_pkt.nals[i]; |
| 166 | if (val_in_array(extradata_nal_types, nb_extradata_nal_types, nal->type)) { | 173 | if (val_in_array(extradata_nal_types, nb_extradata_nal_types, nal->type)) { |
| 167 | extradata_size += nal->raw_size + 3; | 174 | extradata_size += nal->raw_size + 3; |
| 168 | if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { | 175 | if (ctx->par_in->codec_id == AV_CODEC_ID_VVC) { |
| 176 | if (nal->type == VVC_SPS_NUT) has_sps = 1; | ||
| 177 | if (nal->type == VVC_VPS_NUT) has_vps = 1; | ||
| 178 | } else if (ctx->par_in->codec_id == AV_CODEC_ID_HEVC) { | ||
| 169 | if (nal->type == HEVC_NAL_SPS) has_sps = 1; | 179 | if (nal->type == HEVC_NAL_SPS) has_sps = 1; |
| 170 | if (nal->type == HEVC_NAL_VPS) has_vps = 1; | 180 | if (nal->type == HEVC_NAL_VPS) has_vps = 1; |
| 171 | } else { | 181 | } else { |
| @@ -177,7 +187,8 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt, · 5 unmodified lines | |||
| 177 | } | 187 | } |
| 178 | 188 | ||
| 179 | if (extradata_size && | 189 | if (extradata_size && |
| 180 | ((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) || | 190 | ((ctx->par_in->codec_id == AV_CODEC_ID_VVC && has_sps) || |
| 191 | (ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) || | ||
| 181 | (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) { | 192 | (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) { |
| 182 | AVBufferRef *filtered_buf = NULL; | 193 | AVBufferRef *filtered_buf = NULL; |
| 183 | PutByteContext pb_filtered_data, pb_extradata; | 194 | PutByteContext pb_filtered_data, pb_extradata; |
| @@ -335,6 +346,7 @@ static const struct { · 151 unmodified lines | |||
| 335 | { AV_CODEC_ID_MPEG2VIDEO, extract_extradata_mpeg12 }, | 346 | { AV_CODEC_ID_MPEG2VIDEO, extract_extradata_mpeg12 }, |
| 336 | { AV_CODEC_ID_MPEG4, extract_extradata_mpeg4 }, | 347 | { AV_CODEC_ID_MPEG4, extract_extradata_mpeg4 }, |
| 337 | { AV_CODEC_ID_VC1, extract_extradata_vc1 }, | 348 | { AV_CODEC_ID_VC1, extract_extradata_vc1 }, |
| 349 | { AV_CODEC_ID_VVC, extract_extradata_h2645 }, | ||
| 338 | }; | 350 | }; |
| 339 | 351 | ||
| 340 | static int extract_extradata_init(AVBSFContext *ctx) | 352 | static int extract_extradata_init(AVBSFContext *ctx) |
| @@ -404,6 +416,7 @@ static const enum AVCodecID codec_ids[] = { · 63 unmodified lines | |||
| 404 | AV_CODEC_ID_MPEG2VIDEO, | 416 | AV_CODEC_ID_MPEG2VIDEO, |
| 405 | AV_CODEC_ID_MPEG4, | 417 | AV_CODEC_ID_MPEG4, |
| 406 | AV_CODEC_ID_VC1, | 418 | AV_CODEC_ID_VC1, |
| 419 | AV_CODEC_ID_VVC, | ||
| 407 | AV_CODEC_ID_NONE, | 420 | AV_CODEC_ID_NONE, |
| 408 | }; | 421 | }; |
| 409 | 422 | ||