[FFmpeg-devel] [PATCH] libavcodec/speexdec: fix memleak in error path
--- libavcodec/speexdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c index 35270e6723..fccceab74c 100644 --- a/libavcodec/speexdec.c +++ b/libavcodec/speexdec.c @@ -1586,5 +1586,5 @@ const AVCodec ff_speex_decoder = { .close = speex_decode_close, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .priv_data_size = sizeof(SpeexContext), -.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavcodec/avpacket: add av_packet_remove_side_data
--- doc/APIchanges | 3 +++ libavcodec/avpacket.c | 15 +++ libavcodec/packet.h | 5 + libavcodec/tests/avpacket.c | 9 + libavcodec/version.h| 2 +- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 7b267a79ac..2c6b369ea9 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-10-11 - xx - lavc 59.13.100 - packet.h + Add av_packet_remove_side_data() + 2021-09-21 - xx - lavu 57.7.100 - pixfmt.h Add AV_PIX_FMT_X2BGR10. diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index d8d8fef3b9..2a9123e5fa 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -179,6 +179,21 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size) return 0; } +void av_packet_remove_side_data(AVPacket *pkt, enum AVPacketSideDataType type) +{ +for (int i = 0; i < pkt->side_data_elems; i++) { +if (pkt->side_data[i].type == type) { +av_freep(&pkt->side_data[i].data); +pkt->side_data[i] = pkt->side_data[pkt->side_data_elems - 1]; +pkt->side_data_elems--; +/* Better keep side_data sync to side_data_elems */ +if (!pkt->side_data_elems) +av_freep(&pkt->side_data); +break; +} +} +} + void av_packet_free_side_data(AVPacket *pkt) { int i; diff --git a/libavcodec/packet.h b/libavcodec/packet.h index 9baff24635..85edf87211 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -571,6 +571,11 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size); +/** + * Remove and free side data instances of the given type. + */ +void av_packet_remove_side_data(AVPacket *pkt, enum AVPacketSideDataType type); + /** * Shrink the already allocated side data buffer * diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c index 7a70ade4c3..710a964915 100644 --- a/libavcodec/tests/avpacket.c +++ b/libavcodec/tests/avpacket.c @@ -124,6 +124,15 @@ int main(void) "when \"size\" parameter is too large.\n" ); ret = 1; } +/* test remove side data */ +av_packet_remove_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA); +for (int i = 0; i < avpkt->side_data_elems; i++) { +if (avpkt->side_data[i].type == AV_PKT_DATA_NEW_EXTRADATA) { +printf("av_packet_remove_side_data failed to remove side data"); +ret = 1; +} +} + /*clean up*/ av_packet_free(&avpkt_clone); av_packet_free(&avpkt); diff --git a/libavcodec/version.h b/libavcodec/version.h index 74b8baa5f3..76af066d32 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 59 -#define LIBAVCODEC_VERSION_MINOR 12 +#define LIBAVCODEC_VERSION_MINOR 13 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/speexdec: fix memleak in error path
Zhao Zhili: > --- > libavcodec/speexdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/speexdec.c b/libavcodec/speexdec.c > index 35270e6723..fccceab74c 100644 > --- a/libavcodec/speexdec.c > +++ b/libavcodec/speexdec.c > @@ -1586,5 +1586,5 @@ const AVCodec ff_speex_decoder = { > .close = speex_decode_close, > .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, > .priv_data_size = sizeof(SpeexContext), > -.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, > +.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | > FF_CODEC_CAP_INIT_CLEANUP, > }; > LGTM. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/vf_lut3d: fix building with --disable-optimizations
On Sun, 2021-10-10 at 23:10 -0700, mindm...@gmail.com wrote: > From: Mark Reid > > --- > libavfilter/x86/vf_lut3d_init.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavfilter/x86/vf_lut3d_init.c b/libavfilter/x86/vf_lut3d_init.c > index 3b3dd18680..db1a152f51 100644 > --- a/libavfilter/x86/vf_lut3d_init.c > +++ b/libavfilter/x86/vf_lut3d_init.c > @@ -48,9 +48,11 @@ static int interp_##name##_##format##_##opt(AVFilterContext > *ctx, void *arg, int > DEFINE_INTERP_FUNC(tetrahedral, pf32, avx) > DEFINE_INTERP_FUNC(tetrahedral, p16, avx) > #endif > +#if HAVE_SSE2_EXTERNAL > DEFINE_INTERP_FUNC(tetrahedral, pf32, sse2) > DEFINE_INTERP_FUNC(tetrahedral, p16, sse2) > #endif > +#endif > > > av_cold void ff_lut3d_init_x86(LUT3DContext *s, const AVPixFmtDescriptor > *desc) > @@ -78,11 +80,13 @@ av_cold void ff_lut3d_init_x86(LUT3DContext *s, const > AVPixFmtDescriptor *desc) > } > #endif > } else if (EXTERNAL_SSE2(cpu_flags) && s->interpolation == > INTERPOLATE_TETRAHEDRAL && planar) { > +#if HAVE_SSE2_EXTERNAL > if (isfloat) { > s->interp = interp_tetrahedral_pf32_sse2; > } else if (depth == 16) { > s->interp = interp_tetrahedral_p16_sse2; > } > +#endif > } > #endif > } LGTM and thanks for fixing building issue quickly. -Haihao ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/gemdec: Use ff_set_dimensions()
On Sun, Oct 10, 2021 at 11:39:54PM +0200, Michael Niedermayer wrote: > Fixes: OOM > Fixes: > 39798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GEM_fuzzer-5611636853964800 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/gemdec.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/gemdec.c b/libavcodec/gemdec.c > index bf0927b7638..2464dda8a7e 100644 > --- a/libavcodec/gemdec.c > +++ b/libavcodec/gemdec.c > @@ -101,6 +101,7 @@ static int gem_decode_frame(AVCodecContext *avctx, > int row_width, pixel_size; > State state = {.y = 0, .pl = 0, .x = 0, .vdup = 1}; > void (*put_lines)(AVCodecContext *avctx, int planes, int row_width, int > pixel_size, State * state, uint8_t * row, AVFrame *p); > +int width, height; > > if (buf_size <= 16) > return AVERROR_INVALIDDATA; > @@ -114,8 +115,11 @@ static int gem_decode_frame(AVCodecContext *avctx, > pattern_size = bytestream2_get_be16(&gb); > avctx->sample_aspect_ratio.num = bytestream2_get_be16(&gb); > avctx->sample_aspect_ratio.den = bytestream2_get_be16(&gb); > -avctx->width = bytestream2_get_be16(&gb); > -avctx->height = bytestream2_get_be16(&gb); > +width = bytestream2_get_be16(&gb); > +height = bytestream2_get_be16(&gb); > +ret = ff_set_dimensions(avctx, width, height); > +if (ret < 0) > +return ret; > > row_width = (avctx->width + 7) / 8; > put_lines = put_lines_bits; looks good. please apply. -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avformat/argo_asf: pass name through as metadata
Signed-off-by: Zane van Iperen --- libavformat/argo_asf.c | 5 + libavformat/argo_asf.h | 3 ++- tests/ref/acodec/adpcm-argo | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 7e759c7c0c..f729a393ad 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -181,6 +181,7 @@ static int argo_asf_read_header(AVFormatContext *s) AVStream *st; ArgoASFDemuxContext *asf = s->priv_data; uint8_t buf[ASF_MIN_BUFFER_SIZE]; +char namebuf[ASF_MAX_NAME_SIZE + 1]; if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); @@ -209,6 +210,10 @@ static int argo_asf_read_header(AVFormatContext *s) ff_argo_asf_parse_chunk_header(&asf->ckhdr, buf); +memcpy(namebuf, asf->fhdr.name, ASF_MAX_NAME_SIZE); +namebuf[ASF_MAX_NAME_SIZE] = '\0'; +av_dict_set(&s->metadata, "title", namebuf, 0); + return ff_argo_asf_fill_stream(s, st, &asf->fhdr, &asf->ckhdr); } diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h index e65125fb79..f0607c7859 100644 --- a/libavformat/argo_asf.h +++ b/libavformat/argo_asf.h @@ -33,6 +33,7 @@ #define ASF_CHUNK_HEADER_SIZE 20 #define ASF_SAMPLE_COUNT32 #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, ASF_CHUNK_HEADER_SIZE) +#define ASF_MAX_NAME_SIZE 8 typedef struct ArgoASFFileHeader { uint32_tmagic; /*< Magic Number, {'A', 'S', 'F', '\0'} */ @@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader { uint16_tversion_minor; /*< File Minor Version. */ uint32_tnum_chunks; /*< No. chunks in the file. */ uint32_tchunk_offset; /*< Offset to the first chunk from the start of the file. */ -int8_t name[8];/*< Name. */ +int8_t name[ASF_MAX_NAME_SIZE]; /*< Name. */ } ArgoASFFileHeader; typedef struct ArgoASFChunkHeader { diff --git a/tests/ref/acodec/adpcm-argo b/tests/ref/acodec/adpcm-argo index 127153c081..4032a8f1fe 100644 --- a/tests/ref/acodec/adpcm-argo +++ b/tests/ref/acodec/adpcm-argo @@ -1,4 +1,4 @@ 14b2507d14e95c20bb7ae49b4fcbcbf1 *tests/data/fate/acodec-adpcm-argo.argo_asf 281190 tests/data/fate/acodec-adpcm-argo.argo_asf -cc5e5c695adeaebaa2b1f0df5ebd59ee *tests/data/fate/acodec-adpcm-argo.out.wav +446f28460bdb7ff4361cf7d82ac22c3e *tests/data/fate/acodec-adpcm-argo.out.wav stddev: 1542.05 PSNR: 32.57 MAXDIFF:59667 bytes: 1058400/ 1058432 -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/argo_asf: use title metadata when muxing
Signed-off-by: Zane van Iperen --- libavformat/argo_asf.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index f729a393ad..1171d9b7a7 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -361,18 +361,27 @@ static int argo_asf_write_header(AVFormatContext *s) .num_chunks= 1, .chunk_offset = ASF_FILE_HEADER_SIZE }; -const char *name = ctx->name, *end; +AVDictionaryEntry *t; +const char *name, *end; size_t len; /* - * If the user specified a name, use it as is. Otherwise take the - * basename and lop off the extension (if any). + * If the user specified a name, use it as is. Otherwise, + * try to use metadata (if present), then fall back to the + * filename (minus extension). */ -if (name || !(end = strrchr((name = av_basename(s->url)), '.'))) { +if (ctx->name) { +name = ctx->name; +len = strlen(ctx->name); +} else if ((t = av_dict_get(s->metadata, "title", NULL, 0))) { +name = t->value; +len = strlen(t->value); +} else if (!(end = strrchr((name = av_basename(s->url)), '.'))) { len = strlen(name); } else { len = end - name; } + memcpy(fhdr.name, name, FFMIN(len, sizeof(fhdr.name))); chdr.num_blocks= 0; -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/8] avformat: add raw avs3 muxer
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/rawenc.c | 14 ++ 3 files changed, 16 insertions(+) diff --git a/libavformat/Makefile b/libavformat/Makefile index c45caa3..66ebea5 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -130,6 +130,7 @@ OBJS-$(CONFIG_AVS_DEMUXER) += avs.o voc_packet.o voc.o OBJS-$(CONFIG_AVS2_DEMUXER) += avs2dec.o rawdec.o OBJS-$(CONFIG_AVS2_MUXER)+= rawenc.o OBJS-$(CONFIG_AVS3_DEMUXER) += avs3dec.o rawdec.o +OBJS-$(CONFIG_AVS3_MUXER)+= rawenc.o OBJS-$(CONFIG_BETHSOFTVID_DEMUXER) += bethsoftvid.o OBJS-$(CONFIG_BFI_DEMUXER) += bfi.o OBJS-$(CONFIG_BINK_DEMUXER) += bink.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 889cfcc..cbfadcb 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -88,6 +88,7 @@ extern const AVInputFormat ff_avs_demuxer; extern const AVInputFormat ff_avs2_demuxer; extern const AVOutputFormat ff_avs2_muxer; extern const AVInputFormat ff_avs3_demuxer; +extern const AVOutputFormat ff_avs3_muxer; extern const AVInputFormat ff_bethsoftvid_demuxer; extern const AVInputFormat ff_bfi_demuxer; extern const AVInputFormat ff_bintext_demuxer; diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index ad29e71..15e7051 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -142,6 +142,20 @@ const AVOutputFormat ff_avs2_muxer = { }; #endif +#if CONFIG_AVS3_MUXER +const AVOutputFormat ff_avs3_muxer = { +.name = "avs3", +.long_name = NULL_IF_CONFIG_SMALL("AVS3-P2/IEEE1857.10"), +.extensions= "avs3", +.audio_codec = AV_CODEC_ID_NONE, +.video_codec = AV_CODEC_ID_AVS3, +.init = force_one_stream, +.write_packet = ff_raw_write_packet, +.flags = AVFMT_NOTIMESTAMPS, +}; +#endif + + #if CONFIG_CAVSVIDEO_MUXER const AVOutputFormat ff_cavsvideo_muxer = { .name = "cavsvideo", -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/8] avcodec/extract_extradata_bsf: add support for AVS3
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/extract_extradata_bsf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 32c732f..dbcb850 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -328,6 +328,7 @@ static const struct { } extract_tab[] = { { AV_CODEC_ID_AV1,extract_extradata_av1 }, { AV_CODEC_ID_AVS2, extract_extradata_mpeg4 }, +{ AV_CODEC_ID_AVS3, extract_extradata_mpeg4 }, { AV_CODEC_ID_CAVS, extract_extradata_mpeg4 }, { AV_CODEC_ID_H264, extract_extradata_h2645 }, { AV_CODEC_ID_HEVC, extract_extradata_h2645 }, @@ -396,6 +397,7 @@ static void extract_extradata_close(AVBSFContext *ctx) static const enum AVCodecID codec_ids[] = { AV_CODEC_ID_AV1, AV_CODEC_ID_AVS2, +AV_CODEC_ID_AVS3, AV_CODEC_ID_CAVS, AV_CODEC_ID_H264, AV_CODEC_ID_HEVC, -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/8] avformat/mpegts: add support for stream_type 0xd2, which is AVS2
From: Limin Wang GB/T 17975.1 Information technology-Generic coding of moving pictures and associated audio information-Part 1:Systems Signed-off-by: Limin Wang --- libavformat/mpegts.h| 1 + libavformat/mpegtsenc.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h index c75ba08..910d65a 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h @@ -129,6 +129,7 @@ #define STREAM_TYPE_VIDEO_H264 0x1b #define STREAM_TYPE_VIDEO_HEVC 0x24 #define STREAM_TYPE_VIDEO_CAVS 0x42 +#define STREAM_TYPE_VIDEO_AVS2 0xd2 #define STREAM_TYPE_VIDEO_VC1 0xea #define STREAM_TYPE_VIDEO_DIRAC 0xd1 diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 98dac17..f3b7914 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -366,6 +366,9 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st) case AV_CODEC_ID_CAVS: stream_type = STREAM_TYPE_VIDEO_CAVS; break; +case AV_CODEC_ID_AVS2: +stream_type = STREAM_TYPE_VIDEO_AVS2; +break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/8] avformat/mpegts: add support for stream_type 0xd4, which is AVS3
From: Limin Wang GB/T 17975.1 Information technology-Generic coding of moving pictures and associated audio information-Part 1:Systems Signed-off-by: Limin Wang --- libavformat/mpegts.c| 1 + libavformat/mpegts.h| 1 + libavformat/mpegtsenc.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 9a6bbb1..d3a4e4e 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -807,6 +807,7 @@ static const StreamType ISO_types[] = { { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS }, { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC }, { 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2 }, +{ 0xd4, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS3 }, { 0xea, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1}, { 0 }, }; diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h index 910d65a..a48f14e 100644 --- a/libavformat/mpegts.h +++ b/libavformat/mpegts.h @@ -130,6 +130,7 @@ #define STREAM_TYPE_VIDEO_HEVC 0x24 #define STREAM_TYPE_VIDEO_CAVS 0x42 #define STREAM_TYPE_VIDEO_AVS2 0xd2 +#define STREAM_TYPE_VIDEO_AVS3 0xd4 #define STREAM_TYPE_VIDEO_VC1 0xea #define STREAM_TYPE_VIDEO_DIRAC 0xd1 diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index f3b7914..26fb1f1 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -369,6 +369,9 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream *st) case AV_CODEC_ID_AVS2: stream_type = STREAM_TYPE_VIDEO_AVS2; break; +case AV_CODEC_ID_AVS3: +stream_type = STREAM_TYPE_VIDEO_AVS3; +break; case AV_CODEC_ID_DIRAC: stream_type = STREAM_TYPE_VIDEO_DIRAC; break; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/8] avformat/mpegtsenc: add AVSV format_identifier for AVS standard
From: Limin Wang Listing of Registered Identifiers: https://smpte-ra.org/registered-mpeg-ts-ids Signed-off-by: Limin Wang --- libavformat/mpegtsenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 26fb1f1..184bb52 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -789,6 +789,9 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) put_registration_descriptor(&q, MKTAG('V', 'C', '-', '1')); } else if (stream_type == STREAM_TYPE_VIDEO_HEVC && s->strict_std_compliance <= FF_COMPLIANCE_NORMAL) { put_registration_descriptor(&q, MKTAG('H', 'E', 'V', 'C')); +} else if (stream_type == STREAM_TYPE_VIDEO_CAVS || stream_type == STREAM_TYPE_VIDEO_AVS2 || + stream_type == STREAM_TYPE_VIDEO_AVS3) { +put_registration_descriptor(&q, MKTAG('A', 'V', 'S', 'V')); } break; case AVMEDIA_TYPE_DATA: -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 6/8] avcodec/hevcdec: remove unused code
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevcdec.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 482638a..2855342 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -45,9 +45,6 @@ #define SHIFT_CTB_WPP 2 -//TODO: check if this is really the maximum -#define MAX_TRANSFORM_DEPTH 5 - #define MAX_TB_SIZE 32 #define MAX_QP 51 #define DEFAULT_INTRA_TC_OFFSET 2 -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 7/8] avcodec/hevc_filter: remove unneeded headers
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevc_filter.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 6b98240..7e9478c 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -25,11 +25,8 @@ #include "libavutil/common.h" #include "libavutil/internal.h" -#include "cabac_functions.h" #include "hevcdec.h" -#include "bit_depth_template.c" - #define LUMA 0 #define CB 1 #define CR 2 -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 8/8] avcodec/hevc_filter: Correct indention
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/hevc_filter.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 7e9478c..3c45b5a 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -138,7 +138,7 @@ static int get_qPy(HEVCContext *s, int xC, int yC) static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height, ptrdiff_t stride_dst, ptrdiff_t stride_src) { -int i, j; +int i, j; if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) { for (i = 0; i < height; i++) { @@ -319,18 +319,18 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) x_ctb, y_ctb); if (s->ps.pps->transquant_bypass_enable_flag || (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) { -dst = lc->edge_emu_buffer; -stride_dst = 2*MAX_PB_SIZE; -copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src); -s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst, -sao->offset_val[c_idx], sao->band_position[c_idx], -width, height); -restore_tqb_pixels(s, src, dst, stride_src, stride_dst, - x, y, width, height, c_idx); +dst = lc->edge_emu_buffer; +stride_dst = 2*MAX_PB_SIZE; +copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src); +s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst, +sao->offset_val[c_idx], sao->band_position[c_idx], +width, height); +restore_tqb_pixels(s, src, dst, stride_src, stride_dst, + x, y, width, height, c_idx); } else { -s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src, -sao->offset_val[c_idx], sao->band_position[c_idx], -width, height); +s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src, +sao->offset_val[c_idx], sao->band_position[c_idx], +width, height); } sao->type_idx[c_idx] = SAO_APPLIED; break; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 8/8] avformat/rtpdec_rfc4175: add support for RANGE
On Wed, Oct 06, 2021 at 06:14:11PM +0800, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavformat/rtpdec_rfc4175.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > index 23a3f4f..86ffb38 100644 > --- a/libavformat/rtpdec_rfc4175.c > +++ b/libavformat/rtpdec_rfc4175.c > @@ -32,6 +32,7 @@ struct PayloadContext { > char *framerate; > char *TCS; > char *colorimetry; > +char *range; > int depth; > int width; > int height; > @@ -97,6 +98,13 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; > } > > +if (!data->range) > +stream->codecpar->color_range = AVCOL_RANGE_MPEG; > +else if (!strncmp(data->range, "NARROW", 6)) > +stream->codecpar->color_range = AVCOL_RANGE_MPEG; > +else if (!strncmp(data->range, "FULL", 4)) > +stream->codecpar->color_range = AVCOL_RANGE_JPEG; > + > desc = av_pix_fmt_desc_get(pixfmt); > stream->codecpar->format = pixfmt; > stream->codecpar->codec_tag = tag; > @@ -132,6 +140,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, > AVStream *stream, > data->TCS = av_strdup(value); > else if (!strncmp(attr, "colorimetry", 11)) > data->colorimetry = av_strdup(value); > +else if (!strncmp(attr, "RANGE", 5)) > +data->range = av_strdup(value); > > return 0; > } > @@ -163,6 +173,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int > st_index, > av_freep(&data->framerate); > av_freep(&data->TCS); > av_freep(&data->colorimetry); > +av_freep(&data->range); > > return ret; > } > -- > 1.8.3.1 > will apply the patch set tomorrow unless there are objections. -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/8] avformat/rtpdec_rfc4175: add support for exactframerate
lance.lmw...@gmail.com: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavformat/rtpdec_rfc4175.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > index 46d30ed..367567d 100644 > --- a/libavformat/rtpdec_rfc4175.c > +++ b/libavformat/rtpdec_rfc4175.c > @@ -25,9 +25,11 @@ > #include "rtpdec_formats.h" > #include "libavutil/avstring.h" > #include "libavutil/pixdesc.h" > +#include "libavutil/parseutils.h" > > struct PayloadContext { > char *sampling; > +char *framerate; > int depth; > int width; > int height; > @@ -45,6 +47,7 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > enum AVPixelFormat pixfmt; > int tag; > const AVPixFmtDescriptor *desc; > +AVRational framerate; > > if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { > tag = MKTAG('U', 'Y', 'V', 'Y'); > @@ -69,6 +72,14 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); > data->frame_size = data->width * data->height * data->pgroup / > data->xinc; > > +if (data->framerate) { > +if (av_parse_video_rate(&framerate, data->framerate) < 0) > +return AVERROR(EINVAL); > +stream->avg_frame_rate = framerate; > +if (framerate.den) > +stream->codecpar->bit_rate = data->frame_size * > av_q2d(framerate) * 8; > +} > + > return 0; > } > > @@ -84,6 +95,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream > *stream, > data->sampling = av_strdup(value); > else if (!strncmp(attr, "depth", 5)) > data->depth = atoi(value); > +else if (!strncmp(attr, "exactframerate", 14)) > +data->framerate = av_strdup(value); > > return 0; > } > @@ -112,6 +125,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int > st_index, > > ret = rfc4175_parse_format(stream, data); > av_freep(&data->sampling); > +av_freep(&data->framerate); > > return ret; > } > Why the (unchecked!) allocation of a temporary string if you only want the number anyway? - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/8] avformat/rtpdec_rfc4175: add support for TCS
lance.lmw...@gmail.com: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavformat/rtpdec_rfc4175.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > index 367567d..db6b9b8 100644 > --- a/libavformat/rtpdec_rfc4175.c > +++ b/libavformat/rtpdec_rfc4175.c > @@ -30,6 +30,7 @@ > struct PayloadContext { > char *sampling; > char *framerate; > +char *TCS; > int depth; > int width; > int height; > @@ -66,6 +67,21 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > return AVERROR_INVALIDDATA; > } > > +if (!data->TCS) > +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; > +else if (!strncmp(data->TCS, "SDR", 3)) > +stream->codecpar->color_trc = AVCOL_TRC_BT709; > +else if (!strncmp(data->TCS, "PQ", 2)) > +stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; > +else if (!strncmp(data->TCS, "HLG", 3)) > +stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; > +else if (!strncmp(data->TCS, "LINEAR", 6)) > +stream->codecpar->color_trc = AVCOL_TRC_LINEAR; > +else if (!strncmp(data->TCS, "ST428-1", 7)) > +stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; > +else if (!strncmp(data->TCS, "UNSPECIFIED", 11)) > +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; > + > desc = av_pix_fmt_desc_get(pixfmt); > stream->codecpar->format = pixfmt; > stream->codecpar->codec_tag = tag; > @@ -97,6 +113,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream > *stream, > data->depth = atoi(value); > else if (!strncmp(attr, "exactframerate", 14)) > data->framerate = av_strdup(value); > +else if (!strncmp(attr, "TCS", 3)) > +data->TCS = av_strdup(value); > > return 0; > } > @@ -126,6 +144,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int > st_index, > ret = rfc4175_parse_format(stream, data); > av_freep(&data->sampling); > av_freep(&data->framerate); > +av_freep(&data->TCS); > > return ret; > } > Same here: Why an (unchecked) temporary value? - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avformat/argo_asf: pass name through as metadata
On 10/11/2021 8:25 AM, Zane van Iperen wrote: Signed-off-by: Zane van Iperen --- libavformat/argo_asf.c | 5 + libavformat/argo_asf.h | 3 ++- tests/ref/acodec/adpcm-argo | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 7e759c7c0c..f729a393ad 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -181,6 +181,7 @@ static int argo_asf_read_header(AVFormatContext *s) AVStream *st; ArgoASFDemuxContext *asf = s->priv_data; uint8_t buf[ASF_MIN_BUFFER_SIZE]; +char namebuf[ASF_MAX_NAME_SIZE + 1]; if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); @@ -209,6 +210,10 @@ static int argo_asf_read_header(AVFormatContext *s) ff_argo_asf_parse_chunk_header(&asf->ckhdr, buf); +memcpy(namebuf, asf->fhdr.name, ASF_MAX_NAME_SIZE); +namebuf[ASF_MAX_NAME_SIZE] = '\0'; av_strlcat() +av_dict_set(&s->metadata, "title", namebuf, 0); + return ff_argo_asf_fill_stream(s, st, &asf->fhdr, &asf->ckhdr); } diff --git a/libavformat/argo_asf.h b/libavformat/argo_asf.h index e65125fb79..f0607c7859 100644 --- a/libavformat/argo_asf.h +++ b/libavformat/argo_asf.h @@ -33,6 +33,7 @@ #define ASF_CHUNK_HEADER_SIZE 20 #define ASF_SAMPLE_COUNT32 #define ASF_MIN_BUFFER_SIZE FFMAX(ASF_FILE_HEADER_SIZE, ASF_CHUNK_HEADER_SIZE) +#define ASF_MAX_NAME_SIZE 8 typedef struct ArgoASFFileHeader { uint32_tmagic; /*< Magic Number, {'A', 'S', 'F', '\0'} */ @@ -40,7 +41,7 @@ typedef struct ArgoASFFileHeader { uint16_tversion_minor; /*< File Minor Version. */ uint32_tnum_chunks; /*< No. chunks in the file. */ uint32_tchunk_offset; /*< Offset to the first chunk from the start of the file. */ -int8_t name[8];/*< Name. */ +int8_t name[ASF_MAX_NAME_SIZE]; /*< Name. */ Why not make this ASF_MAX_NAME_SIZE + 1, and skip the stack buffer in argo_asf_read_header()? Also, ff_argo_asf_parse_file_header() could use a single AV_RL64 to read this instead of a loop reading one byte at a time. } ArgoASFFileHeader; typedef struct ArgoASFChunkHeader { diff --git a/tests/ref/acodec/adpcm-argo b/tests/ref/acodec/adpcm-argo index 127153c081..4032a8f1fe 100644 --- a/tests/ref/acodec/adpcm-argo +++ b/tests/ref/acodec/adpcm-argo @@ -1,4 +1,4 @@ 14b2507d14e95c20bb7ae49b4fcbcbf1 *tests/data/fate/acodec-adpcm-argo.argo_asf 281190 tests/data/fate/acodec-adpcm-argo.argo_asf -cc5e5c695adeaebaa2b1f0df5ebd59ee *tests/data/fate/acodec-adpcm-argo.out.wav +446f28460bdb7ff4361cf7d82ac22c3e *tests/data/fate/acodec-adpcm-argo.out.wav stddev: 1542.05 PSNR: 32.57 MAXDIFF:59667 bytes: 1058400/ 1058432 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 5/8] avformat/rtpdec_rfc4175: add support for exactframerate
On Mon, Oct 11, 2021 at 05:00:29PM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavformat/rtpdec_rfc4175.c | 14 ++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > > index 46d30ed..367567d 100644 > > --- a/libavformat/rtpdec_rfc4175.c > > +++ b/libavformat/rtpdec_rfc4175.c > > @@ -25,9 +25,11 @@ > > #include "rtpdec_formats.h" > > #include "libavutil/avstring.h" > > #include "libavutil/pixdesc.h" > > +#include "libavutil/parseutils.h" > > > > struct PayloadContext { > > char *sampling; > > +char *framerate; > > int depth; > > int width; > > int height; > > @@ -45,6 +47,7 @@ static int rfc4175_parse_format(AVStream *stream, > > PayloadContext *data) > > enum AVPixelFormat pixfmt; > > int tag; > > const AVPixFmtDescriptor *desc; > > +AVRational framerate; > > > > if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { > > tag = MKTAG('U', 'Y', 'V', 'Y'); > > @@ -69,6 +72,14 @@ static int rfc4175_parse_format(AVStream *stream, > > PayloadContext *data) > > stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); > > data->frame_size = data->width * data->height * data->pgroup / > > data->xinc; > > > > +if (data->framerate) { > > +if (av_parse_video_rate(&framerate, data->framerate) < 0) > > +return AVERROR(EINVAL); > > +stream->avg_frame_rate = framerate; > > +if (framerate.den) > > +stream->codecpar->bit_rate = data->frame_size * > > av_q2d(framerate) * 8; > > +} > > + > > return 0; > > } > > > > @@ -84,6 +95,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, > > AVStream *stream, > > data->sampling = av_strdup(value); > > else if (!strncmp(attr, "depth", 5)) > > data->depth = atoi(value); > > +else if (!strncmp(attr, "exactframerate", 14)) > > +data->framerate = av_strdup(value); > > > > return 0; > > } > > @@ -112,6 +125,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, > > int st_index, > > > > ret = rfc4175_parse_format(stream, data); > > av_freep(&data->sampling); > > +av_freep(&data->framerate); > > > > return ret; > > } > > > > Why the (unchecked!) allocation of a temporary string if you only want > the number anyway? I'm just following the same style for sampling, but I can change to parse the frame rate when parsing fmtp string to save the temporary string allocation if you prefer to. > > - Andreas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 6/8] avformat/rtpdec_rfc4175: add support for TCS
On Mon, Oct 11, 2021 at 05:01:54PM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > Signed-off-by: Limin Wang > > --- > > libavformat/rtpdec_rfc4175.c | 19 +++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > > index 367567d..db6b9b8 100644 > > --- a/libavformat/rtpdec_rfc4175.c > > +++ b/libavformat/rtpdec_rfc4175.c > > @@ -30,6 +30,7 @@ > > struct PayloadContext { > > char *sampling; > > char *framerate; > > +char *TCS; > > int depth; > > int width; > > int height; > > @@ -66,6 +67,21 @@ static int rfc4175_parse_format(AVStream *stream, > > PayloadContext *data) > > return AVERROR_INVALIDDATA; > > } > > > > +if (!data->TCS) > > +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; > > +else if (!strncmp(data->TCS, "SDR", 3)) > > +stream->codecpar->color_trc = AVCOL_TRC_BT709; > > +else if (!strncmp(data->TCS, "PQ", 2)) > > +stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; > > +else if (!strncmp(data->TCS, "HLG", 3)) > > +stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; > > +else if (!strncmp(data->TCS, "LINEAR", 6)) > > +stream->codecpar->color_trc = AVCOL_TRC_LINEAR; > > +else if (!strncmp(data->TCS, "ST428-1", 7)) > > +stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; > > +else if (!strncmp(data->TCS, "UNSPECIFIED", 11)) > > +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; > > + > > desc = av_pix_fmt_desc_get(pixfmt); > > stream->codecpar->format = pixfmt; > > stream->codecpar->codec_tag = tag; > > @@ -97,6 +113,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, > > AVStream *stream, > > data->depth = atoi(value); > > else if (!strncmp(attr, "exactframerate", 14)) > > data->framerate = av_strdup(value); > > +else if (!strncmp(attr, "TCS", 3)) > > +data->TCS = av_strdup(value); > > > > return 0; > > } > > @@ -126,6 +144,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, > > int st_index, > > ret = rfc4175_parse_format(stream, data); > > av_freep(&data->sampling); > > av_freep(&data->framerate); > > +av_freep(&data->TCS); > > > > return ret; > > } > > > > Same here: Why an (unchecked) temporary value? OK, will updated to remove the temporary value. > > - Andreas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 01/10] avcodec/binkaudio: Remove AV_CODEC_CAP_DELAY
This decoder may output multiple AVFrames for every AVPacket passed to it, but after it has returned AVERROR(EAGAIN), it is completely drained and there is no reason to flush it at the end with a NULL packet. Furthermore, there is also no delay in the common sense of the word. Signed-off-by: Andreas Rheinhardt --- libavcodec/binkaudio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index af8cb2809e..5915ba6ffb 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -346,7 +346,7 @@ const AVCodec ff_binkaudio_rdft_decoder = { .init = decode_init, .close = decode_end, .receive_frame = binkaudio_receive_frame, -.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, +.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; @@ -359,6 +359,6 @@ const AVCodec ff_binkaudio_dct_decoder = { .init = decode_init, .close = decode_end, .receive_frame = binkaudio_receive_frame, -.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1, +.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 02/10] avcodec/binkaudio: Properly flush the decoder
The packets delivered to this decoder are often decoded to more than one frame and if the internal buffer packet is not unreferenced, the decoder will still output frames derived from the old packet (from before the flush). Signed-off-by: Andreas Rheinhardt --- libavcodec/binkaudio.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 5915ba6ffb..59ecab25c6 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -337,6 +337,14 @@ fail: return ret; } +static void decode_flush(AVCodecContext *avctx) +{ +BinkAudioContext *const s = avctx->priv_data; + +av_packet_unref(s->pkt); +s->first = 1; +} + const AVCodec ff_binkaudio_rdft_decoder = { .name = "binkaudio_rdft", .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)"), @@ -344,6 +352,7 @@ const AVCodec ff_binkaudio_rdft_decoder = { .id = AV_CODEC_ID_BINKAUDIO_RDFT, .priv_data_size = sizeof(BinkAudioContext), .init = decode_init, +.flush = decode_flush, .close = decode_end, .receive_frame = binkaudio_receive_frame, .capabilities = AV_CODEC_CAP_DR1, @@ -357,6 +366,7 @@ const AVCodec ff_binkaudio_dct_decoder = { .id = AV_CODEC_ID_BINKAUDIO_DCT, .priv_data_size = sizeof(BinkAudioContext), .init = decode_init, +.flush = decode_flush, .close = decode_end, .receive_frame = binkaudio_receive_frame, .capabilities = AV_CODEC_CAP_DR1, -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 05/10] avcodec/crystalhd: Use AVCodecInternal.in_pkt instead of stack packet
Signed-off-by: Andreas Rheinhardt --- libavcodec/crystalhd.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 0238ab7378..9202a16a77 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -90,6 +90,9 @@ typedef struct OpaqueList { typedef struct { AVClass *av_class; AVCodecContext *avctx; +/* This packet coincides with AVCodecInternal.in_pkt + * and is not owned by us. */ +AVPacket *pkt; HANDLE dev; uint8_t is_70012; @@ -328,6 +331,7 @@ static av_cold int init(AVCodecContext *avctx) /* Initialize the library */ priv = avctx->priv_data; priv->avctx= avctx; +priv->pkt = avctx->internal->in_pkt; priv->draining = 0; subtype = id2subtype(priv, avctx->codec->id); @@ -703,19 +707,19 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame) BC_DTS_STATUS decoder_status = { 0, }; CopyRet rec_ret; CHDContext *priv = avctx->priv_data; +AVPacket *const pkt = priv->pkt; HANDLE dev = priv->dev; int got_frame = 0; int ret = 0; -AVPacket pkt = {0}; av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: receive_frame\n"); -ret = ff_decode_get_packet(avctx, &pkt); +ret = ff_decode_get_packet(avctx, pkt); if (ret < 0 && ret != AVERROR_EOF) { return ret; } -while (pkt.size > DtsTxFreeSize(dev)) { +while (pkt->size > DtsTxFreeSize(dev)) { /* * Block until there is space in the buffer for the next packet. * We assume that the hardware will make forward progress at this @@ -724,8 +728,8 @@ static int crystalhd_receive_frame(AVCodecContext *avctx, AVFrame *frame) av_log(avctx, AV_LOG_TRACE, "CrystalHD: Waiting for space in input buffer\n"); } -ret = crystalhd_decode_packet(avctx, &pkt); -av_packet_unref(&pkt); +ret = crystalhd_decode_packet(avctx, pkt); +av_packet_unref(pkt); // crystalhd_is_buffer_full() should avoid this. if (ret == AVERROR(EAGAIN)) { ret = AVERROR_EXTERNAL; -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 03/10] avcodec/internal: Allow receive_frame codecs to use decode_simple pkt
Decoders implementing the receive_frame API currently mostly use stack packets to temporarily hold the packet they receive from ff_decode_get_packet(). This role directly parallels the role of in_pkt, the spare packet used in decode_simple_internal for the decoders implementing the traditional decoding API. Said packet is unused by the generic code for the decoders implementing the receive_frame API, so allow them to use it to fulfill the function it already fulfills for the traditional API for both APIs. There is only one caveat in this: The packet is automatically unreferenced in avcodec_flush_buffers(). But this is actually positive as it means the decoders don't have to do this themselves (in case the packet is preserved between receive_frame calls). Signed-off-by: Andreas Rheinhardt --- libavcodec/avcodec.c | 8 libavcodec/decode.c | 3 +-- libavcodec/internal.h | 14 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index ff3d73e237..c00a9b2af8 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -181,11 +181,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code avci->buffer_frame = av_frame_alloc(); avci->buffer_pkt = av_packet_alloc(); avci->es.in_frame = av_frame_alloc(); -avci->ds.in_pkt = av_packet_alloc(); +avci->in_pkt = av_packet_alloc(); avci->last_pkt_props = av_packet_alloc(); avci->pkt_props = av_fifo_alloc(sizeof(*avci->last_pkt_props)); if (!avci->buffer_frame || !avci->buffer_pkt || -!avci->es.in_frame || !avci->ds.in_pkt || +!avci->es.in_frame || !avci->in_pkt || !avci->last_pkt_props || !avci->pkt_props) { ret = AVERROR(ENOMEM); goto free_and_end; @@ -408,7 +408,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx) av_fifo_reset(avci->pkt_props); av_frame_unref(avci->es.in_frame); -av_packet_unref(avci->ds.in_pkt); +av_packet_unref(avci->in_pkt); if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) ff_thread_flush(avctx); @@ -473,7 +473,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) } av_packet_free(&avci->last_pkt_props); -av_packet_free(&avci->ds.in_pkt); +av_packet_free(&avci->in_pkt); av_frame_free(&avci->es.in_frame); av_buffer_unref(&avci->pool); diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 294c040716..c44724d150 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -296,8 +296,7 @@ static int64_t guess_correct_pts(AVCodecContext *ctx, static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, int64_t *discarded_samples) { AVCodecInternal *avci = avctx->internal; -DecodeSimpleContext *ds = &avci->ds; -AVPacket *pkt = ds->in_pkt; +AVPacket *const pkt = avci->in_pkt; int got_frame, actual_got_frame; int ret; diff --git a/libavcodec/internal.h b/libavcodec/internal.h index b6180f15a5..a62f8dbd4e 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -112,10 +112,6 @@ # define STRIDE_ALIGN 8 #endif -typedef struct DecodeSimpleContext { -AVPacket *in_pkt; -} DecodeSimpleContext; - typedef struct EncodeSimpleContext { AVFrame *in_frame; } EncodeSimpleContext; @@ -137,7 +133,15 @@ typedef struct AVCodecInternal { void *thread_ctx; -DecodeSimpleContext ds; +/** + * This packet is used to hold the packet given to decoders + * implementing the .decode API; it is unused by the generic + * code for decoders implementing the .receive_frame API and + * may be freely used (but not freed) by them with the caveat + * that the packet will be unreferenced generically in + * avcodec_flush_buffers(). + */ +AVPacket *in_pkt; AVBSFContext *bsf; /** -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 06/10] avcodec/cuviddec: Use AVCodecInternal.in_pkt instead of stack packet
Signed-off-by: Andreas Rheinhardt --- libavcodec/cuviddec.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavcodec/cuviddec.c b/libavcodec/cuviddec.c index e15c51..f03bbd8c4b 100644 --- a/libavcodec/cuviddec.c +++ b/libavcodec/cuviddec.c @@ -53,6 +53,10 @@ typedef struct CuvidContext CUvideodecoder cudecoder; CUvideoparser cuparser; +/* This packet coincides with AVCodecInternal.in_pkt + * and is not owned by us. */ +AVPacket *pkt; + char *cu_gpu; int nb_surfaces; int drop_second_field; @@ -466,12 +470,12 @@ static int cuvid_output_frame(AVCodecContext *avctx, AVFrame *frame) } if (!cuvid_is_buffer_full(avctx)) { -AVPacket pkt = {0}; -ret = ff_decode_get_packet(avctx, &pkt); +AVPacket *const pkt = ctx->pkt; +ret = ff_decode_get_packet(avctx, pkt); if (ret < 0 && ret != AVERROR_EOF) return ret; -ret = cuvid_decode_packet(avctx, &pkt); -av_packet_unref(&pkt); +ret = cuvid_decode_packet(avctx, pkt); +av_packet_unref(pkt); // cuvid_is_buffer_full() should avoid this. if (ret == AVERROR(EAGAIN)) ret = AVERROR_EXTERNAL; @@ -797,6 +801,7 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx) if (probe_desc && probe_desc->nb_components) probed_bit_depth = probe_desc->comp[0].depth; +ctx->pkt = avctx->internal->in_pkt; // Accelerated transcoding scenarios with 'ffmpeg' require that the // pix_fmt be set to AV_PIX_FMT_CUDA early. The sw_pix_fmt, and the // pix_fmt for non-accelerated transcoding, do not need to be correct -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 04/10] avcodec/binkaudio: Use AVCodecInternal.in_pkt for buffer packet
Signed-off-by: Andreas Rheinhardt --- libavcodec/binkaudio.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 59ecab25c6..f808141ba5 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -140,9 +140,7 @@ static av_cold int decode_init(AVCodecContext *avctx) if (ret < 0) return ret; -s->pkt = av_packet_alloc(); -if (!s->pkt) -return AVERROR(ENOMEM); +s->pkt = avctx->internal->in_pkt; return 0; } @@ -277,8 +275,6 @@ static av_cold int decode_end(AVCodecContext *avctx) else if (CONFIG_BINKAUDIO_DCT_DECODER) ff_dct_end(&s->trans.dct); -av_packet_free(&s->pkt); - return 0; } @@ -341,7 +337,8 @@ static void decode_flush(AVCodecContext *avctx) { BinkAudioContext *const s = avctx->priv_data; -av_packet_unref(s->pkt); +/* s->pkt coincides with avctx->internal->in_pkt + * and is unreferenced generically when flushing. */ s->first = 1; } -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 07/10] avcodec/libdav1d: Don't leak side-data-only packets
Signed-off-by: Andreas Rheinhardt --- libavcodec/libdav1d.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 2807210e50..2d5fccec71 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -328,6 +328,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) return res; } } +} else if (res >= 0) { +av_packet_unref(&pkt); +return AVERROR(EAGAIN); } } -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 08/10] avcodec/libdav1d: Use AVCodecInternal.in_pkt instead of stack packet
Signed-off-by: Andreas Rheinhardt --- libavcodec/libdav1d.c | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 2d5fccec71..507aaa1a96 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -40,6 +40,9 @@ typedef struct Libdav1dContext { AVClass *class; Dav1dContext *c; +/* This packet coincides with AVCodecInternal.in_pkt + * and is not owned by us. */ +AVPacket *pkt; AVBufferPool *pool; int pool_size; @@ -214,6 +217,8 @@ static av_cold int libdav1d_init(AVCodecContext *c) #endif int res; +dav1d->pkt = c->internal->in_pkt; + av_log(c, AV_LOG_INFO, "libdav1d %s\n", dav1d_version()); dav1d_default_settings(&s); @@ -292,25 +297,26 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) int res; if (!data->sz) { -AVPacket pkt = { 0 }; +AVPacket *const pkt = dav1d->pkt; -res = ff_decode_get_packet(c, &pkt); +res = ff_decode_get_packet(c, pkt); if (res < 0 && res != AVERROR_EOF) return res; -if (pkt.size) { -res = dav1d_data_wrap(data, pkt.data, pkt.size, libdav1d_data_free, pkt.buf); +if (pkt->size) { +res = dav1d_data_wrap(data, pkt->data, pkt->size, + libdav1d_data_free, pkt->buf); if (res < 0) { -av_packet_unref(&pkt); +av_packet_unref(pkt); return res; } -data->m.timestamp = pkt.pts; -data->m.offset = pkt.pos; -data->m.duration = pkt.duration; +data->m.timestamp = pkt->pts; +data->m.offset= pkt->pos; +data->m.duration = pkt->duration; -pkt.buf = NULL; -av_packet_unref(&pkt); +pkt->buf = NULL; +av_packet_unref(pkt); if (c->reordered_opaque != AV_NOPTS_VALUE) { uint8_t *reordered_opaque = av_malloc(sizeof(c->reordered_opaque)); @@ -329,7 +335,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) } } } else if (res >= 0) { -av_packet_unref(&pkt); +av_packet_unref(pkt); return AVERROR(EAGAIN); } } -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 09/10] avcodec/libdav1d: Use av_memdup() where appropriate
Signed-off-by: Andreas Rheinhardt --- libavcodec/libdav1d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index 507aaa1a96..bbc81a9dc9 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -319,13 +319,13 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) av_packet_unref(pkt); if (c->reordered_opaque != AV_NOPTS_VALUE) { -uint8_t *reordered_opaque = av_malloc(sizeof(c->reordered_opaque)); +uint8_t *reordered_opaque = av_memdup(&c->reordered_opaque, + sizeof(c->reordered_opaque)); if (!reordered_opaque) { dav1d_data_unref(data); return AVERROR(ENOMEM); } -memcpy(reordered_opaque, &c->reordered_opaque, sizeof(c->reordered_opaque)); res = dav1d_data_wrap_user_data(data, reordered_opaque, libdav1d_user_data_free, reordered_opaque); if (res < 0) { -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 10/10] avcodec/mjpegdec: Use AVCodecInternal.in_pkt for buffer packet
Signed-off-by: Andreas Rheinhardt --- libavcodec/mjpegdec.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 7f89641660..8b154ce0ab 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -127,9 +127,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) s->picture_ptr = s->picture; } -s->pkt = av_packet_alloc(); -if (!s->pkt) -return AVERROR(ENOMEM); +s->pkt = avctx->internal->in_pkt; s->avctx = avctx; ff_blockdsp_init(&s->bdsp, avctx); @@ -2960,8 +2958,6 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) } else if (s->picture_ptr) av_frame_unref(s->picture_ptr); -av_packet_free(&s->pkt); - av_frame_free(&s->smv_frame); av_freep(&s->buffer); -- 2.30.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 02/10] avcodec/binkaudio: Properly flush the decoder
lgtm ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/4] avformat/rtpdec_rfc4175: add support for exactframerate
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 712c683..060f725 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -25,9 +25,11 @@ #include "rtpdec_formats.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" +#include "libavutil/parseutils.h" struct PayloadContext { char *sampling; +AVRational framerate; int depth; int width; int height; @@ -69,6 +71,11 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; +if (data->framerate.den > 0) { +stream->avg_frame_rate = data->framerate; +stream->codecpar->bit_rate = data->frame_size * av_q2d(data->framerate) * 8; +} + return 0; } @@ -84,6 +91,10 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->sampling = av_strdup(value); else if (!strncmp(attr, "depth", 5)) data->depth = atoi(value); +else if (!strncmp(attr, "exactframerate", 14)) { +if (av_parse_video_rate(&data->framerate, value) < 0) +return AVERROR(EINVAL); +} return 0; } -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/4] avformat/rtpdec_rfc4175: add support for TCS
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 13 + 1 file changed, 13 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 060f725..d45530e 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -94,6 +94,19 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, else if (!strncmp(attr, "exactframerate", 14)) { if (av_parse_video_rate(&data->framerate, value) < 0) return AVERROR(EINVAL); +} else if (!strncmp(attr, "TCS", 3)) { +if (!strncmp(value, "SDR", 3)) +stream->codecpar->color_trc = AVCOL_TRC_BT709; +else if (!strncmp(value, "PQ", 2)) +stream->codecpar->color_trc = AVCOL_TRC_SMPTE2084; +else if (!strncmp(value, "HLG", 3)) +stream->codecpar->color_trc = AVCOL_TRC_ARIB_STD_B67; +else if (!strncmp(value, "LINEAR", 6)) +stream->codecpar->color_trc = AVCOL_TRC_LINEAR; +else if (!strncmp(value, "ST428-1", 7)) +stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; +else +stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; } return 0; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/4] avformat/rtpdec_rfc4175: add support for colorimetry
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index d45530e..93607d7 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -107,6 +107,17 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, stream->codecpar->color_trc = AVCOL_TRC_SMPTEST428_1; else stream->codecpar->color_trc = AVCOL_TRC_UNSPECIFIED; +} else if (!strncmp(attr, "colorimetry", 11)) { +if (!strncmp(value, "BT601", 5)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT470BG; +stream->codecpar->color_space = AVCOL_SPC_BT470BG; +} else if (!strncmp(value, "BT709", 5)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT709; +stream->codecpar->color_space = AVCOL_SPC_BT709; +} else if (!strncmp(value, "BT2020", 6)) { +stream->codecpar->color_primaries = AVCOL_PRI_BT2020; +stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; +} } return 0; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 4/4] avformat/rtpdec_rfc4175: add support for RANGE
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/rtpdec_rfc4175.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index 93607d7..f50cad7 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -118,6 +118,11 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, stream->codecpar->color_primaries = AVCOL_PRI_BT2020; stream->codecpar->color_space = AVCOL_SPC_BT2020_NCL; } +} else if (!strncmp(attr, "RANGE", 5)) { +if (!strncmp(value, "NARROW", 6)) +stream->codecpar->color_range = AVCOL_RANGE_MPEG; +else if (!strncmp(value, "FULL", 4)) +stream->codecpar->color_range = AVCOL_RANGE_JPEG; } return 0; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/mxf: support MCA audio information
--- libavformat/mxf.h| 1 + libavformat/mxfdec.c | 276 ++- 2 files changed, 271 insertions(+), 6 deletions(-) diff --git a/libavformat/mxf.h b/libavformat/mxf.h index fe9c52732c..cddbcb13c9 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -50,6 +50,7 @@ enum MXFMetadataSetType { TaggedValue, TapeDescriptor, AVCSubDescriptor, +MCASubDescriptor, }; enum MXFFrameLayout { diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c28549f6a9..1bd7642416 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -45,17 +45,21 @@ */ #include +#include #include "libavutil/aes.h" #include "libavutil/avstring.h" #include "libavutil/mastering_display_metadata.h" #include "libavutil/mathematics.h" #include "libavcodec/bytestream.h" +#include "libavcodec/internal.h" +#include "libavutil/channel_layout.h" #include "libavutil/intreadwrite.h" #include "libavutil/parseutils.h" #include "libavutil/timecode.h" #include "libavutil/opt.h" #include "avformat.h" +#include "avlanguage.h" #include "internal.h" #include "mxf.h" @@ -177,6 +181,8 @@ typedef struct { int body_sid; MXFWrappingScheme wrapping; int edit_units_per_packet; /* how many edit units to read at a time (PCM, ClipWrapped) */ +bool require_reordering; +int channel_ordering[FF_SANE_NB_CHANNELS]; } MXFTrack; typedef struct MXFDescriptor { @@ -205,6 +211,8 @@ typedef struct MXFDescriptor { unsigned int vert_subsampling; UID *file_descriptors_refs; int file_descriptors_count; +UID *sub_descriptors_refs; +int sub_descriptors_count; int linked_track_id; uint8_t *extradata; int extradata_size; @@ -217,6 +225,15 @@ typedef struct MXFDescriptor { size_t coll_size; } MXFDescriptor; +typedef struct MXFMCASubDescriptor { +MXFMetadataSet meta; +UID uid; +UID mca_link_id; +UID mca_group_link_id; +UID mca_label_dictionnary_id; +char *language; +} MXFMCASubDescriptor; + typedef struct MXFIndexTableSegment { MXFMetadataSet meta; int edit_unit_byte_count; @@ -311,6 +328,9 @@ static const uint8_t mxf_system_item_key_cp[] = { 0x06,0x0e,0x2b,0x static const uint8_t mxf_system_item_key_gc[] = { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 }; static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 }; static const uint8_t mxf_apple_coll_prefix[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 }; +static const uint8_t mxf_audio_channel[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x01 }; +static const uint8_t mxf_soundfield_group[]= { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x0d,0x03,0x02,0x02 }; + /* complete keys to match */ static const uint8_t mxf_crypto_source_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 }; static const uint8_t mxf_encrypted_triplet_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 }; @@ -323,6 +343,15 @@ static const uint8_t mxf_indirect_value_utf16be[] = { 0x42,0x01,0x10,0x static const uint8_t mxf_apple_coll_max_cll[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 }; static const uint8_t mxf_apple_coll_max_fall[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 }; +static const uint8_t mxf_mca_label_dictionnary_id[]= { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_tag_symbol[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_tag_name[]= { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_link_id[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 }; +static const uint8_t mxf_soundfield_group_link_id[]= { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 }; + +static const uint8_t mxf_sub_descriptor[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 }; + static const uint8_t mxf_mastering_display_prefix[13] = { FF_MXF_MasteringDisplay_PREFIX }; static const uint8_t mxf_mastering_display_uls[4][16] = { FF_MXF_MasteringDisplayPrimaries, @@ -343,6 +372,11 @@ static void mxf_free_metadataset(MXFMetadataSet **ctx, int freectx) av_freep(&((MXFDescriptor *)*ctx)->mastering); av_freep(&((MXFDescr
Re: [FFmpeg-devel] [PATCH 1/1] avutil/frame: Document the possibility of negative line sizes
lgtm ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/gemdec: Use ff_set_dimensions()
On Mon, Oct 11, 2021 at 08:18:25PM +1100, Peter Ross wrote: > On Sun, Oct 10, 2021 at 11:39:54PM +0200, Michael Niedermayer wrote: > > Fixes: OOM > > Fixes: > > 39798/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GEM_fuzzer-5611636853964800 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/gemdec.c | 8 ++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/libavcodec/gemdec.c b/libavcodec/gemdec.c > > index bf0927b7638..2464dda8a7e 100644 > > --- a/libavcodec/gemdec.c > > +++ b/libavcodec/gemdec.c > > @@ -101,6 +101,7 @@ static int gem_decode_frame(AVCodecContext *avctx, > > int row_width, pixel_size; > > State state = {.y = 0, .pl = 0, .x = 0, .vdup = 1}; > > void (*put_lines)(AVCodecContext *avctx, int planes, int row_width, > > int pixel_size, State * state, uint8_t * row, AVFrame *p); > > +int width, height; > > > > if (buf_size <= 16) > > return AVERROR_INVALIDDATA; > > @@ -114,8 +115,11 @@ static int gem_decode_frame(AVCodecContext *avctx, > > pattern_size = bytestream2_get_be16(&gb); > > avctx->sample_aspect_ratio.num = bytestream2_get_be16(&gb); > > avctx->sample_aspect_ratio.den = bytestream2_get_be16(&gb); > > -avctx->width = bytestream2_get_be16(&gb); > > -avctx->height = bytestream2_get_be16(&gb); > > +width = bytestream2_get_be16(&gb); > > +height = bytestream2_get_be16(&gb); > > +ret = ff_set_dimensions(avctx, width, height); > > +if (ret < 0) > > +return ret; > > > > row_width = (avctx->width + 7) / 8; > > put_lines = put_lines_bits; > > looks good. please apply. will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/utils: Ensure 8x8 alignment for ARGO in avcodec_align_dimensions2()
On Sun, Oct 10, 2021 at 11:39:53PM +0200, Michael Niedermayer wrote: > Fixes: out of array access > Fixes: > 39736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARGO_fuzzer-4820016722214912 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/utils.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The smallest minority on earth is the individual. Those who deny individual rights cannot claim to be defenders of minorities. - Ayn Rand signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/avpacket: add av_packet_remove_side_data
On Mon, 11 Oct 2021, Zhao Zhili wrote: --- doc/APIchanges | 3 +++ libavcodec/avpacket.c | 15 +++ libavcodec/packet.h | 5 + libavcodec/tests/avpacket.c | 9 + libavcodec/version.h| 2 +- 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 7b267a79ac..2c6b369ea9 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-10-11 - xx - lavc 59.13.100 - packet.h + Add av_packet_remove_side_data() + 2021-09-21 - xx - lavu 57.7.100 - pixfmt.h Add AV_PIX_FMT_X2BGR10. diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index d8d8fef3b9..2a9123e5fa 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -179,6 +179,21 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size) return 0; } +void av_packet_remove_side_data(AVPacket *pkt, enum AVPacketSideDataType type) +{ +for (int i = 0; i < pkt->side_data_elems; i++) { +if (pkt->side_data[i].type == type) { +av_freep(&pkt->side_data[i].data); +pkt->side_data[i] = pkt->side_data[pkt->side_data_elems - 1]; +pkt->side_data_elems--; +/* Better keep side_data sync to side_data_elems */ +if (!pkt->side_data_elems) +av_freep(&pkt->side_data); +break; +} +} +} I suggest you use the same algorigthm which is used for avframe side data removal, because as far as I know it is still not explicitly documented that multiple types of the same side data is not allowed... So IMHO it is better if this works in all cases. Thanks, Marton + void av_packet_free_side_data(AVPacket *pkt) { int i; diff --git a/libavcodec/packet.h b/libavcodec/packet.h index 9baff24635..85edf87211 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -571,6 +571,11 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size); +/** + * Remove and free side data instances of the given type. + */ +void av_packet_remove_side_data(AVPacket *pkt, enum AVPacketSideDataType type); + /** * Shrink the already allocated side data buffer * diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c index 7a70ade4c3..710a964915 100644 --- a/libavcodec/tests/avpacket.c +++ b/libavcodec/tests/avpacket.c @@ -124,6 +124,15 @@ int main(void) "when \"size\" parameter is too large.\n" ); ret = 1; } +/* test remove side data */ +av_packet_remove_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA); +for (int i = 0; i < avpkt->side_data_elems; i++) { +if (avpkt->side_data[i].type == AV_PKT_DATA_NEW_EXTRADATA) { +printf("av_packet_remove_side_data failed to remove side data"); +ret = 1; +} +} + /*clean up*/ av_packet_free(&avpkt_clone); av_packet_free(&avpkt); diff --git a/libavcodec/version.h b/libavcodec/version.h index 74b8baa5f3..76af066d32 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 59 -#define LIBAVCODEC_VERSION_MINOR 12 +#define LIBAVCODEC_VERSION_MINOR 13 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/avio{, buf}: introduce public AVIOContext::bytes_read
On Mon, Oct 4, 2021 at 12:12 PM Jan Ekström wrote: > > On Mon, Oct 4, 2021 at 1:06 AM Michael Niedermayer > wrote: > > > > On Mon, Oct 04, 2021 at 12:25:26AM +0300, Jan Ekström wrote: > > > On Sat, Oct 2, 2021 at 2:51 PM Michael Niedermayer > > > wrote: > > > > > > > > On Sat, Oct 02, 2021 at 02:42:52PM +0300, Jan Ekström wrote: > > > > > On Sat, Oct 2, 2021 at 1:32 PM Michael Niedermayer > > > > > wrote: > > > > > > > > > > > > On Sun, Sep 26, 2021 at 06:48:18PM +0300, Jan Ekström wrote: > > > > > > > Such a field can be seen as generally useful in cases where the > > > > > > > API user is not implementing custom AVIO callbacks, but still > > > > > > > would > > > > > > > like to know if data is being read even if AVPackets are not being > > > > > > > returned. > > > > > > > --- > > > > > > > Originally I thought about making an accessor for the private > > > > > > > field, to > > > > > > > not grow the public struct's size (and have a duplicate field, as > > > > > > > well > > > > > > > as making sure the value was read-only). But an objection was > > > > > > > raised > > > > > > > that such accessors should be refrained from as they unnecessarily > > > > > > > filled the function symbol space or so. Together with the > > > > > > > objection, a > > > > > > > proposal of making it a field on the public struct that was only > > > > > > > written > > > > > > > to was proposed. > > > > > > > > > > > > > > This patch follows that proposal. > > > > > > > > > > > > > > doc/APIchanges| 3 +++ > > > > > > > libavformat/avio.h| 5 + > > > > > > > libavformat/aviobuf.c | 2 ++ > > > > > > > libavformat/version.h | 2 +- > > > > > > > 4 files changed, 11 insertions(+), 1 deletion(-) > > > > > > > > > > > > There are 3 statistics, read, write and seek > > > > > > shouldnt all 3 be provided to the user? > > > > > > > > > > > > thx > > > > > > > > > > > > > > > > I added one which I have seen actually utilized by at least one API > > > > > client, and then others could be added as per responses. > > > > > > > > > > That is why I pinged, as I had not received any responses - either > > > > > positive or negative. > > > > > > > > > > > > > > Writing I can see a use for, seek I am not as sure of. But if you > > > > > believe all of them should be exposed I am fine with that. > > > > > > > > seek is timeconsuming especially if its over a network due to > > > > latency. > > > > So for example if suddenly the number of seeks changes that > > > > could be interresting. > > > > > > > > thx > > > > > > I would prefer to add fields which were noted as specifically private > > > and then cleaned up when there are actual API client users that would > > > see them as useful, or if there are clear use cases where they'd be > > > useful. I have seen the read bytes statistic actually being utilized > > > by an API client with a comment: > > > > Assume a network protocol, TCP, UDP, HTTP, RT*P whatever > > how do you tune the buffer sizes ? > > Can the number of seeks be used ? > > or from a different point of view, if there are alot of seeks should > > a user app try to increase the buffer sizes ? > > > > maybe iam missing something but when playing a not perfectly interleaved > > file > > over the network the buffer size should be what makes the difference between > > that working or not working > > ideally a user app shouldnt need to mess with this, of course and these > > values > > should all be automagically adjusted > > > > If a user app fails to get packets in realtime over the network, it would > > fail to play that stream. Some user apps could display a warning message to > > the user about it. > > If now the user app has access to the number of seeks it could be more > > specific in the warning to the user. > > "Unable to play network is maybe too slow" > > "Unable to play buffer is maybe too small or file is poorly interleaved" > > ... > > > > Maybe iam just seeing all this from the wrong side i dunno but to me it > > seems > > usefull to a user app to have access to the number of seeks and these seem > > non contrived use cases to me ... Ive gotten random point to nowhere > > warnings about playback issues and restarting the computer obviously that > > never was the issue. > > > > thx > > > > OK, I think this is now focusing on the wrong point, sorry. > > I think it's just better for me to note that I am not the best person > to post (and thus be the one to argue for the usefulness in reviews if > someone asks why I am bringing those private entries that were once > removed back to the public struct) of those other entries. Ping? Is this now in a purgatory state due to me not wanting to be the one to argue for the other options in review? Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/1] mov: read track title
On Mon, Oct 11, 2021 at 6:23 AM Dong Nguyen wrote: > > this change fix issue [9438](https://trac.ffmpeg.org/ticket/9438) > > after commit da9cc22d5bd5f59756c2037b02966376da2cf323 > ffmpeg is able to write track title metadata to mov/mp4 format file > but it is not able to read back the metadata > Huh, so I seem to have incorrectly read things previously :) .I started implementing reading of the 3GPP titl box due to the QTFF spec saying that `name` is not supposed to be an end user facing name, but an internal/debug reference [1]. Of course, then checking the actual contents of the 'name' box within the udta box, it seems like I was incorrect, as the box's structure doesn't match. The udta side of the spec has a one-liner that doesn't say much about how it should be utilized [2]. So I guess this udta `name` is in this case not something internal, after all? ┐(´д`)┌ [1] https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html [2] https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP4939-CH204-25538 > Signed-off-by: Dong Nguyen > --- > libavformat/mov.c | 15 +-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index a811bc7677..644e746d02 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -303,6 +303,7 @@ static int mov_read_udta_string(MOVContext *c, > AVIOContext *pb, MOVAtom atom) > int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL; > int raw = 0; > int num = 0; > +int track_title = 0; > > switch (atom.type) { > case MKTAG( '@','P','R','M'): key = "premiere_version"; raw = 1; break; > @@ -380,6 +381,12 @@ static int mov_read_udta_string(MOVContext *c, > AVIOContext *pb, MOVAtom atom) > case MKTAG(0xa9,'l','y','r'): key = "lyrics";break; > case MKTAG(0xa9,'m','a','k'): key = "make"; break; > case MKTAG(0xa9,'m','o','d'): key = "model"; break; > +case MKTAG('n','a','m','e') : > +if (c->trak_index >= 0) { // meta inside track > +key = "title"; > +track_title = 1; > +} > +break; Since this seems to be a barebones string-only box, if you set `key = "title"; raw = 1;` the string parsing should work. No need to add the track_title variable to skip other types of string parsing (data_type is zero so it shouldn't hit any of those pieces of custom data parsing logic, either). > case MKTAG(0xa9,'n','a','m'): key = "title"; break; > case MKTAG(0xa9,'o','p','e'): key = "original_artist"; break; > case MKTAG(0xa9,'p','r','d'): key = "producer"; break; > @@ -428,7 +435,7 @@ retry: > return ret; > } > } else return 0; > -} else if (atom.size > 4 && key && !c->itunes_metadata && !raw) { > +} else if (atom.size > 4 && key && !c->itunes_metadata && !raw && > !track_title) { > str_size = avio_rb16(pb); // string length > if (str_size > atom.size) { > raw = 1; > @@ -521,7 +528,11 @@ retry: > str[str_size] = 0; > } > c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED; > -av_dict_set(&c->fc->metadata, key, str, 0); > +if (track_title) { > +av_dict_set(&c->fc->streams[c->trak_index]->metadata, key, str, > 0); > +} else { > +av_dict_set(&c->fc->metadata, key, str, 0); > +} Since QTFF, ISOBMFF, 3GPP and such all seem to utilize udta in both movie and track boxes, I think the correct thing to do would be to first to poke in something a la https://github.com/jeeb/ffmpeg/commits/enable_writing_udta_metadata_for_tracks . Unfortunately currently movenc's track udta box writing seems to be *very* limited, which thus leads to things which were read from track udta boxes to not be propagated through (and thus you get a lot of FATE test diffs where information is only seemingly removed and not propagated from another location). Welcome to the mess that is mov(enc) :) . Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter: add varblur video filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 15 ++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_varblur.c | 362 +++ 4 files changed, 379 insertions(+) create mode 100644 libavfilter/vf_varblur.c diff --git a/doc/filters.texi b/doc/filters.texi index 5e7326d2f2..4a28c1f828 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -21731,6 +21731,21 @@ Threshold used depends also on each decomposition coefficients. Default is universal. @end table +@section varblur +Apply variable blur filter by using 2nd video stream to set blur radius. + +This filter accepts the following options: + +@table @option +@item min_r +Set min allowed radius. By default is 0. Allowed range is from 0 to 254. +@item max_r +Set max allowed radius. By default is 8. Allowed range is from 1 to 255. +@item planes +@item planes +Set which planes to process. By default all are used. +@end table + @section vectorscope Display 2 color component values in the two dimensional graph (which is called diff --git a/libavfilter/Makefile b/libavfilter/Makefile index da2c8b7a5e..358f121cb4 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -486,6 +486,7 @@ OBJS-$(CONFIG_UNTILE_FILTER) += vf_untile.o OBJS-$(CONFIG_USPP_FILTER) += vf_uspp.o qp_table.o OBJS-$(CONFIG_V360_FILTER) += vf_v360.o OBJS-$(CONFIG_VAGUEDENOISER_FILTER) += vf_vaguedenoiser.o +OBJS-$(CONFIG_VARBLUR_FILTER)+= vf_varblur.o framesync.o OBJS-$(CONFIG_VECTORSCOPE_FILTER)+= vf_vectorscope.o OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o OBJS-$(CONFIG_VFRDET_FILTER) += vf_vfrdet.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 81e1b0965b..409ab5d3c4 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -463,6 +463,7 @@ extern const AVFilter ff_vf_untile; extern const AVFilter ff_vf_uspp; extern const AVFilter ff_vf_v360; extern const AVFilter ff_vf_vaguedenoiser; +extern const AVFilter ff_vf_varblur; extern const AVFilter ff_vf_vectorscope; extern const AVFilter ff_vf_vflip; extern const AVFilter ff_vf_vfrdet; diff --git a/libavfilter/vf_varblur.c b/libavfilter/vf_varblur.c new file mode 100644 index 00..8ac568f55e --- /dev/null +++ b/libavfilter/vf_varblur.c @@ -0,0 +1,362 @@ +/* + * Copyright (c) 2021 Paul B Mahol + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "avfilter.h" +#include "formats.h" +#include "framesync.h" +#include "internal.h" +#include "video.h" + +typedef struct VarBlurContext { +const AVClass *class; +FFFrameSync fs; + +int min_radius; +int max_radius; +int planes; + +int depth; +int planewidth[4]; +int planeheight[4]; + +AVFrame *sat; +int nb_planes; + +int (*blur_plane)(AVFilterContext *s, void *arg, + int jobnr, int nb_jobs); +} VarBlurContext; + +#define OFFSET(x) offsetof(VarBlurContext, x) +#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM + +static const AVOption varblur_options[] = { +{ "min_r", "set min blur radius", OFFSET(min_radius), AV_OPT_TYPE_INT, {.i64=0}, 0, 254, FLAGS }, +{ "max_r", "set max blur radius", OFFSET(max_radius), AV_OPT_TYPE_INT, {.i64=8}, 1, 255, FLAGS }, +{ "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS }, +{ NULL } +}; + +FRAMESYNC_DEFINE_CLASS(varblur, VarBlurContext, fs); + +static const enum AVPixelFormat pix_fmts[] = { +AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P, +AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, +AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV420P, +AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, +AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, +AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, +AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, +AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444
Re: [FFmpeg-devel] [PATCH 1/1] mov: read track title
> On Tue, Oct 12, 2021 at 3:54 AM Jan Ekström wrote: > Huh, so I seem to have incorrectly read things previously :) .I > started implementing reading of the 3GPP titl box due to the QTFF spec > saying that `name` is not supposed to be an end user facing name, but > an internal/debug reference [1]. > > Of course, then checking the actual contents of the 'name' box within > the udta box, it seems like I was incorrect, as the box's structure > doesn't match. The udta side of the spec has a one-liner that doesn't > say much about how it should be utilized [2]. > > So I guess this udta `name` is in this case not something internal, > after all? ┐(´д`)┌ > > [1] https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html > [2] https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP4939-CH204-25538 :) all I did is just trying to implement reverse path of [3] [3] https://github.com/FFmpeg/FFmpeg/commit/da9cc22d5bd5f59756c2037b02966376da2cf323#diff-e40972d5f339c353a7fef633294e1f13fbb2a972ec34f484e4a9fd6a516a11f4R1723-R1724 > Since this seems to be a barebones string-only box, if you set `key = > "title"; raw = 1;` the string parsing should work. No need to add the > track_title variable to skip other types of string parsing (data_type > is zero so it shouldn't hit any of those pieces of custom data parsing > logic, either). nice, will update the patch, thanks btw, `track_title` is also used to reduce checking that the `udta` is inside track boxes but I guess it is a minor point and more clearer if explicitly check it before setting metadata. > Since QTFF, ISOBMFF, 3GPP and such all seem to utilize udta in both > movie and track boxes, I think the correct thing to do would be to > first to poke in something a la > https://github.com/jeeb/ffmpeg/commits/enable_writing_udta_metadata_for_tracks > . > > Unfortunately currently movenc's track udta box writing seems to be > *very* limited, which thus leads to things which were read from track > udta boxes to not be propagated through (and thus you get a lot of > FATE test diffs where information is only seemingly removed and not > propagated from another location). Welcome to the mess that is > mov(enc) :) . > So should I update the patch as suggested and/or wait for properly movenc's udta patch? Thanks Dong ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavcodec/avpacket: add av_packet_remove_side_data
> On Oct 12, 2021, at 2:20 AM, Marton Balint wrote: > > On Mon, 11 Oct 2021, Zhao Zhili wrote: > >> --- >> doc/APIchanges | 3 +++ >> libavcodec/avpacket.c | 15 +++ >> libavcodec/packet.h | 5 + >> libavcodec/tests/avpacket.c | 9 + >> libavcodec/version.h| 2 +- >> 5 files changed, 33 insertions(+), 1 deletion(-) >> >> diff --git a/doc/APIchanges b/doc/APIchanges >> index 7b267a79ac..2c6b369ea9 100644 >> --- a/doc/APIchanges >> +++ b/doc/APIchanges >> @@ -14,6 +14,9 @@ libavutil: 2021-04-27 >> >> API changes, most recent first: >> >> +2021-10-11 - xx - lavc 59.13.100 - packet.h >> + Add av_packet_remove_side_data() >> + >> 2021-09-21 - xx - lavu 57.7.100 - pixfmt.h >> Add AV_PIX_FMT_X2BGR10. >> >> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c >> index d8d8fef3b9..2a9123e5fa 100644 >> --- a/libavcodec/avpacket.c >> +++ b/libavcodec/avpacket.c >> @@ -179,6 +179,21 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, >> int size) >>return 0; >> } >> >> +void av_packet_remove_side_data(AVPacket *pkt, enum AVPacketSideDataType >> type) >> +{ >> +for (int i = 0; i < pkt->side_data_elems; i++) { >> +if (pkt->side_data[i].type == type) { >> +av_freep(&pkt->side_data[i].data); >> +pkt->side_data[i] = pkt->side_data[pkt->side_data_elems - 1]; >> +pkt->side_data_elems--; >> +/* Better keep side_data sync to side_data_elems */ >> +if (!pkt->side_data_elems) >> +av_freep(&pkt->side_data); >> +break; >> +} >> +} >> +} > > I suggest you use the same algorigthm which is used for avframe side data > removal, because as far as I know it is still not explicitly documented that > multiple types of the same side data is not allowed... So IMHO it is better > if this works in all cases. > I have noticed the difference, av_packet_add_side_data() doesn’t allow multiple instance side data of the same type, while av_frame_new_side_data_from_buf() allows that for history reasons and too late to be fixed. As you said in https://patchwork.ffmpeg.org/project/ffmpeg/patch/20191101120314.88956-1-quinkbl...@foxmail.com/ > all our API around side data (get/remove) is based on the > assumption that a single entry of a type exists. Also for packet/stream > side data it is already assumed as far as I see. I think the behavior of avpacket is unlikely to change. So for the sake of consistent to av_packet_add_side_data() and av_packet_shrink_side_data(), and a little performance reason, I prefer return early. But I’m fine to continue the loop if you thought safety and forward compatibility is more important. > Thanks, > Marton > >> + >> void av_packet_free_side_data(AVPacket *pkt) >> { >>int i; >> diff --git a/libavcodec/packet.h b/libavcodec/packet.h >> index 9baff24635..85edf87211 100644 >> --- a/libavcodec/packet.h >> +++ b/libavcodec/packet.h >> @@ -571,6 +571,11 @@ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum >> AVPacketSideDataType type, >> int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, >>uint8_t *data, size_t size); >> >> +/** >> + * Remove and free side data instances of the given type. >> + */ >> +void av_packet_remove_side_data(AVPacket *pkt, enum AVPacketSideDataType >> type); >> + >> /** >> * Shrink the already allocated side data buffer >> * >> diff --git a/libavcodec/tests/avpacket.c b/libavcodec/tests/avpacket.c >> index 7a70ade4c3..710a964915 100644 >> --- a/libavcodec/tests/avpacket.c >> +++ b/libavcodec/tests/avpacket.c >> @@ -124,6 +124,15 @@ int main(void) >>"when \"size\" parameter is too large.\n" ); >>ret = 1; >>} >> +/* test remove side data */ >> +av_packet_remove_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA); >> +for (int i = 0; i < avpkt->side_data_elems; i++) { >> +if (avpkt->side_data[i].type == AV_PKT_DATA_NEW_EXTRADATA) { >> +printf("av_packet_remove_side_data failed to remove side data"); >> +ret = 1; >> +} >> +} >> + >>/*clean up*/ >>av_packet_free(&avpkt_clone); >>av_packet_free(&avpkt); >> diff --git a/libavcodec/version.h b/libavcodec/version.h >> index 74b8baa5f3..76af066d32 100644 >> --- a/libavcodec/version.h >> +++ b/libavcodec/version.h >> @@ -28,7 +28,7 @@ >> #include "libavutil/version.h" >> >> #define LIBAVCODEC_VERSION_MAJOR 59 >> -#define LIBAVCODEC_VERSION_MINOR 12 >> +#define LIBAVCODEC_VERSION_MINOR 13 >> #define LIBAVCODEC_VERSION_MICRO 100 >> >> #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ >> -- >> 2.31.1 >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> To unsubscribe, visit link above, or email >> ffmpeg-devel-requ...@ffmpeg.org with subject "