[FFmpeg-devel] [PATCH v4 1/3] avformat/flvdec: support enhanced flv PacketTypeMetadata

James Almer jamrial at gmail.com
Sat Mar 2 16:25:11 EET 2024


On 3/2/2024 5:51 AM, zhupengfei via ffmpeg-devel wrote:
> @@ -1100,8 +1262,17 @@ retry:
>               video_codec_id = avio_rb32(s->pb);
>               size -= 4;
>           }
> -        if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD)
> +
> +        if (enhanced_flv && stream_type == FLV_STREAM_TYPE_VIDEO && (flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) {
> +            type = flags & 0x0F;
> +            if (type == PacketTypeMetadata) {

warning: comparison between 'enum FlvTagType' and 'enum <anonymous>' 
[-Wenum-compare]

I changed it locally to use a new packet_type variable in this scope.

Will apply the set soon if no one objects.

> +                int ret = flv_parse_video_color_info(s, st, next);
> +                av_log(s, AV_LOG_DEBUG, "enhanced flv parse metadata ret %d and skip\n", ret);
> +            }
> +            goto skip;
> +        } else if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_VIDEO_INFO_CMD) {
>               goto skip;
> +        }
>       } else if (type == FLV_TAG_TYPE_META) {
>           stream_type=FLV_STREAM_TYPE_SUBTITLE;
>           if (size > 13 + 1 + 4) { // Header-type metadata stuff
> @@ -1287,6 +1458,11 @@ retry_duration:
>               goto leave;
>           }
>   
> +        if (enhanced_flv && stream_type == FLV_STREAM_TYPE_VIDEO && flv->meta_color_info_flag) {
> +            flv_update_video_color_info(s, st); // update av packet side data
> +            flv->meta_color_info_flag = 0;
> +        }
> +
>           if (st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_MPEG4 ||
>               (st->codecpar->codec_id == AV_CODEC_ID_HEVC && type == PacketTypeCodedFrames)) {
>               // sign extension


More information about the ffmpeg-devel mailing list