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