Re: [FFmpeg-devel] [PATCH v3 1/3] tests/fate/flvenc: add hevc in enhanced flv test case
Steven Liu: > Andreas Rheinhardt 于2023年7月19日周三 18:32写道: >> >> Steven Liu: >>> Signed-off-by: Steven Liu >>> --- >>> tests/fate/flvenc.mak| 7 ++- >>> tests/ref/fate/enhanced-flv-hevc | 8 >>> 2 files changed, 14 insertions(+), 1 deletion(-) >>> create mode 100644 tests/ref/fate/enhanced-flv-hevc >>> >>> diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak >>> index 5032fface3..6b2fbe8c89 100644 >>> --- a/tests/fate/flvenc.mak >>> +++ b/tests/fate/flvenc.mak >>> @@ -1,5 +1,10 @@ >>> FATE_FLVENC_FFMPEG_FFPROBE-$(call TRANSCODE, FLV, FLV, RAWVIDEO_DECODER >>> SCALE_FILTER TESTSRC_FILTER LAVFI_INDEV) += fate-flv-add_keyframe_index >>> fate-flv-add_keyframe_index: CMD = transcode "lavfi -graph >>> testsrc=r=7:n=2:d=20" "foo" flv "-vf scale -c:v flv1 -dct int -g 7 >>> -flvflags add_keyframe_index" "-c copy -t 0.1" "-show_entries format_tags" >>> >>> +FATE_ENHANCED_FLVENC_FFMPEG-$(call REMUX, MOV, FLV_MUXER) += >>> fate-enhanced-flv-hevc >>> +fate-enhanced-flv-hevc: CMD = transcode mov >>> $(TARGET_SAMPLES)/hevc/dv84.mov\ >>> + flv "-vcodec copy -map 0:v -frames 1" >>> + >>> FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) >>> -fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) >>> +FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) >>> +fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) >>> $(FATE_ENHANCED_FLVENC_FFMPEG-yes) >>> diff --git a/tests/ref/fate/enhanced-flv-hevc >>> b/tests/ref/fate/enhanced-flv-hevc >>> new file mode 100644 >>> index 00..41eaefaf6e >>> --- /dev/null >>> +++ b/tests/ref/fate/enhanced-flv-hevc >>> @@ -0,0 +1,8 @@ >>> +afed0105d121688bad7dc94218256571 *tests/data/fate/enhanced-flv-hevc.flv >>> +64396 tests/data/fate/enhanced-flv-hevc.flv >>> +#tb 0: 1/30 >>> +#media_type 0: video >>> +#codec_id 0: rawvideo >>> +#dimensions 0: 1920x1080 >>> +#sar 0: 0/1 >>> +0, 0, 0,1, 6220800, 0x1f259c93 >> >> Why are you restricting this to one frame? And why are you not copying >> the audio, too (this would test multiplexing)? After all, FLV supports AAC. >> Furthermore, you are copying the video when creating the intermediate >> FLV file, yet then you are decoding it at the next stage. This decoding >> would necessitate a dependency on the HEVC decoder (and maybe the parser >> as well as the extract_extradata bsf?). Alternatively, one can just use >> codec copy when reading the intermediate file as well (the latter is my >> preferred approach). >> The same remarks also apply to the other patches. > Hi Andreas, > > > What about do it like this: > > FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO HEVC, FLV MOV, > HEVCPARSE) += fate-enhanced-flv-hevc > fate-enhanced-flv-hevc: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov\ > flv "-c copy" "-af aresample" > You would not need to resample when you simply copied the stuff instead of decoding. - 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 v3 1/3] tests/fate/flvenc: add hevc in enhanced flv test case
Andreas Rheinhardt 于2023年7月20日周四 16:41写道: > > Steven Liu: > > Andreas Rheinhardt 于2023年7月19日周三 18:32写道: > >> > >> Steven Liu: > >>> Signed-off-by: Steven Liu > >>> --- > >>> tests/fate/flvenc.mak| 7 ++- > >>> tests/ref/fate/enhanced-flv-hevc | 8 > >>> 2 files changed, 14 insertions(+), 1 deletion(-) > >>> create mode 100644 tests/ref/fate/enhanced-flv-hevc > >>> > >>> diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak > >>> index 5032fface3..6b2fbe8c89 100644 > >>> --- a/tests/fate/flvenc.mak > >>> +++ b/tests/fate/flvenc.mak > >>> @@ -1,5 +1,10 @@ > >>> FATE_FLVENC_FFMPEG_FFPROBE-$(call TRANSCODE, FLV, FLV, RAWVIDEO_DECODER > >>> SCALE_FILTER TESTSRC_FILTER LAVFI_INDEV) += fate-flv-add_keyframe_index > >>> fate-flv-add_keyframe_index: CMD = transcode "lavfi -graph > >>> testsrc=r=7:n=2:d=20" "foo" flv "-vf scale -c:v flv1 -dct int -g 7 > >>> -flvflags add_keyframe_index" "-c copy -t 0.1" "-show_entries format_tags" > >>> > >>> +FATE_ENHANCED_FLVENC_FFMPEG-$(call REMUX, MOV, FLV_MUXER) += > >>> fate-enhanced-flv-hevc > >>> +fate-enhanced-flv-hevc: CMD = transcode mov > >>> $(TARGET_SAMPLES)/hevc/dv84.mov\ > >>> + flv "-vcodec copy -map 0:v -frames 1" > >>> + > >>> FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > >>> -fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > >>> +FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) > >>> +fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > >>> $(FATE_ENHANCED_FLVENC_FFMPEG-yes) > >>> diff --git a/tests/ref/fate/enhanced-flv-hevc > >>> b/tests/ref/fate/enhanced-flv-hevc > >>> new file mode 100644 > >>> index 00..41eaefaf6e > >>> --- /dev/null > >>> +++ b/tests/ref/fate/enhanced-flv-hevc > >>> @@ -0,0 +1,8 @@ > >>> +afed0105d121688bad7dc94218256571 *tests/data/fate/enhanced-flv-hevc.flv > >>> +64396 tests/data/fate/enhanced-flv-hevc.flv > >>> +#tb 0: 1/30 > >>> +#media_type 0: video > >>> +#codec_id 0: rawvideo > >>> +#dimensions 0: 1920x1080 > >>> +#sar 0: 0/1 > >>> +0, 0, 0,1, 6220800, 0x1f259c93 > >> > >> Why are you restricting this to one frame? And why are you not copying > >> the audio, too (this would test multiplexing)? After all, FLV supports AAC. > >> Furthermore, you are copying the video when creating the intermediate > >> FLV file, yet then you are decoding it at the next stage. This decoding > >> would necessitate a dependency on the HEVC decoder (and maybe the parser > >> as well as the extract_extradata bsf?). Alternatively, one can just use > >> codec copy when reading the intermediate file as well (the latter is my > >> preferred approach). > >> The same remarks also apply to the other patches. > > Hi Andreas, > > > > > > What about do it like this: > > > > FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO HEVC, FLV MOV, > > HEVCPARSE) += fate-enhanced-flv-hevc > > fate-enhanced-flv-hevc: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov\ > > flv "-c copy" "-af aresample" > > > > You would not need to resample when you simply copied the stuff instead > of decoding. It will get error message if i don't use resample: ffmpeg version N-111514-g6efbbe7d25 Copyright (c) 2000-2023 the FFmpeg developers built with Apple clang version 14.0.3 (clang-1403.0.22.14.1) configuration: --prefix=/usr/local/ --libdir=/usr/local/lib/ --cc=clang --enable-htmlpages --enable-libx264 --enable-gpl --extra-cflags='-I/usr/local/include/GraphicsMagick/ -I/usr/local/opt/openssl/include/ -O0 -g3 -fsanitize=address -Wno-error -fPIC -I/usr/local/include -fno-omit-frame-pointer' --extra-ldflags='-O0 -g3 -fsanitize=address -fno-omit-frame-pointer -Wno-error -fPIC -L/usr/local/lib -L/usr/local/opt/openssl/lib -lpng' --enable-libfreetype --enable-fontconfig --enable-libspeex --enable-libopus --enable-libzmq --enable-libx265 --enable-libass --enable-videotoolbox --disable-optimizations --enable-audiotoolbox --enable-opengl --disable-stripping --samples=../../fate-suite/ --enable-encoder=hevc_videotoolbox --enable-hwaccel=hevc_videotoolbox --enable-hwaccel=h264_videotoolbox --enable-openssl --enable-nonfree --disable-shared --enable-libfdk_aac --enable-libxml2 --enable-libmp3lame --enable-libaom --enable-lcms2 --enable-libwebp --enable-libvpx libavutil 58. 14.100 / 58. 14.100 libavcodec 60. 22.100 / 60. 22.100 libavformat60. 10.100 / 60. 10.100 libavdevice60. 2.101 / 60. 2.101 libavfilter 9. 8.102 / 9. 8.102 libswscale 7. 3.100 / 7. 3.100 libswresample 4. 11.100 / 4. 11.100 libpostproc57. 2.100 / 57. 2.100 Input #0, flv, from '/Users/liuqi/multimedia/upstream_ffmpeg/ufbuild/tests/data/fate/enhanced-flv-hevc.flv': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt com.apple.quicktime.creationdate: 2021-05-29T15:14:19-0400 com.apple.quicktime.make: Apple com.apple.quicktime.model: iPhone 12 mini com.apple.quicktime.software: 14.4.1 Duration: 00:00:0
Re: [FFmpeg-devel] [PATCH v3 1/3] tests/fate/flvenc: add hevc in enhanced flv test case
Steven Liu: > Andreas Rheinhardt 于2023年7月20日周四 16:41写道: >> >> Steven Liu: >>> Andreas Rheinhardt 于2023年7月19日周三 18:32写道: Steven Liu: > Signed-off-by: Steven Liu > --- > tests/fate/flvenc.mak| 7 ++- > tests/ref/fate/enhanced-flv-hevc | 8 > 2 files changed, 14 insertions(+), 1 deletion(-) > create mode 100644 tests/ref/fate/enhanced-flv-hevc > > diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak > index 5032fface3..6b2fbe8c89 100644 > --- a/tests/fate/flvenc.mak > +++ b/tests/fate/flvenc.mak > @@ -1,5 +1,10 @@ > FATE_FLVENC_FFMPEG_FFPROBE-$(call TRANSCODE, FLV, FLV, RAWVIDEO_DECODER > SCALE_FILTER TESTSRC_FILTER LAVFI_INDEV) += fate-flv-add_keyframe_index > fate-flv-add_keyframe_index: CMD = transcode "lavfi -graph > testsrc=r=7:n=2:d=20" "foo" flv "-vf scale -c:v flv1 -dct int -g 7 > -flvflags add_keyframe_index" "-c copy -t 0.1" "-show_entries format_tags" > > +FATE_ENHANCED_FLVENC_FFMPEG-$(call REMUX, MOV, FLV_MUXER) += > fate-enhanced-flv-hevc > +fate-enhanced-flv-hevc: CMD = transcode mov > $(TARGET_SAMPLES)/hevc/dv84.mov\ > + flv "-vcodec copy -map 0:v -frames 1" > + > FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > -fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > +FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) > +fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > $(FATE_ENHANCED_FLVENC_FFMPEG-yes) > diff --git a/tests/ref/fate/enhanced-flv-hevc > b/tests/ref/fate/enhanced-flv-hevc > new file mode 100644 > index 00..41eaefaf6e > --- /dev/null > +++ b/tests/ref/fate/enhanced-flv-hevc > @@ -0,0 +1,8 @@ > +afed0105d121688bad7dc94218256571 *tests/data/fate/enhanced-flv-hevc.flv > +64396 tests/data/fate/enhanced-flv-hevc.flv > +#tb 0: 1/30 > +#media_type 0: video > +#codec_id 0: rawvideo > +#dimensions 0: 1920x1080 > +#sar 0: 0/1 > +0, 0, 0,1, 6220800, 0x1f259c93 Why are you restricting this to one frame? And why are you not copying the audio, too (this would test multiplexing)? After all, FLV supports AAC. Furthermore, you are copying the video when creating the intermediate FLV file, yet then you are decoding it at the next stage. This decoding would necessitate a dependency on the HEVC decoder (and maybe the parser as well as the extract_extradata bsf?). Alternatively, one can just use codec copy when reading the intermediate file as well (the latter is my preferred approach). The same remarks also apply to the other patches. >>> Hi Andreas, >>> >>> >>> What about do it like this: >>> >>> FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO HEVC, FLV MOV, >>> HEVCPARSE) += fate-enhanced-flv-hevc >>> fate-enhanced-flv-hevc: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov\ >>> flv "-c copy" "-af aresample" >>> >> >> You would not need to resample when you simply copied the stuff instead >> of decoding. > > It will get error message if i don't use resample: > > ffmpeg version N-111514-g6efbbe7d25 Copyright (c) 2000-2023 the FFmpeg > developers > built with Apple clang version 14.0.3 (clang-1403.0.22.14.1) > configuration: --prefix=/usr/local/ --libdir=/usr/local/lib/ > --cc=clang --enable-htmlpages --enable-libx264 --enable-gpl > --extra-cflags='-I/usr/local/include/GraphicsMagick/ > -I/usr/local/opt/openssl/include/ -O0 -g3 -fsanitize=address > -Wno-error -fPIC -I/usr/local/include -fno-omit-frame-pointer' > --extra-ldflags='-O0 -g3 -fsanitize=address -fno-omit-frame-pointer > -Wno-error -fPIC -L/usr/local/lib -L/usr/local/opt/openssl/lib -lpng' > --enable-libfreetype --enable-fontconfig --enable-libspeex > --enable-libopus --enable-libzmq --enable-libx265 --enable-libass > --enable-videotoolbox --disable-optimizations --enable-audiotoolbox > --enable-opengl --disable-stripping --samples=../../fate-suite/ > --enable-encoder=hevc_videotoolbox --enable-hwaccel=hevc_videotoolbox > --enable-hwaccel=h264_videotoolbox --enable-openssl --enable-nonfree > --disable-shared --enable-libfdk_aac --enable-libxml2 > --enable-libmp3lame --enable-libaom --enable-lcms2 --enable-libwebp > --enable-libvpx > libavutil 58. 14.100 / 58. 14.100 > libavcodec 60. 22.100 / 60. 22.100 > libavformat60. 10.100 / 60. 10.100 > libavdevice60. 2.101 / 60. 2.101 > libavfilter 9. 8.102 / 9. 8.102 > libswscale 7. 3.100 / 7. 3.100 > libswresample 4. 11.100 / 4. 11.100 > libpostproc57. 2.100 / 57. 2.100 > Input #0, flv, from > '/Users/liuqi/multimedia/upstream_ffmpeg/ufbuild/tests/data/fate/enhanced-flv-hevc.flv': > Metadata: > major_brand : qt > minor_version : 0 > compatible_brands: qt > com.apple.quicktime.creationdate: 2021-05-29T15:14:19-0400 > com.apple.quicktime.make: Apple > com.a
[FFmpeg-devel] [PATCH v4 0/3] Add test cases of hevc, vp9, av1 in enhanced flv
Steven Liu (3): tests/fate/flvenc: add hevc in enhanced flv test case tests/fate/flvenc: add vp9 in enhanced flv test case tests/fate/flvenc: add av1 in enhanced flv test case tests/fate/flvenc.mak| 15 +- tests/ref/fate/enhanced-flv-av1 | 32 tests/ref/fate/enhanced-flv-hevc | 258 +++ tests/ref/fate/enhanced-flv-vp9 | 18 +++ 4 files changed, 322 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/enhanced-flv-av1 create mode 100644 tests/ref/fate/enhanced-flv-hevc create mode 100644 tests/ref/fate/enhanced-flv-vp9 -- 2.40.0 ___ 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 v4 1/3] tests/fate/flvenc: add hevc in enhanced flv test case
Signed-off-by: Steven Liu --- tests/fate/flvenc.mak| 7 +- tests/ref/fate/enhanced-flv-hevc | 258 +++ 2 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 tests/ref/fate/enhanced-flv-hevc diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak index 5032fface3..b472dffe5b 100644 --- a/tests/fate/flvenc.mak +++ b/tests/fate/flvenc.mak @@ -1,5 +1,10 @@ FATE_FLVENC_FFMPEG_FFPROBE-$(call TRANSCODE, FLV, FLV, RAWVIDEO_DECODER SCALE_FILTER TESTSRC_FILTER LAVFI_INDEV) += fate-flv-add_keyframe_index fate-flv-add_keyframe_index: CMD = transcode "lavfi -graph testsrc=r=7:n=2:d=20" "foo" flv "-vf scale -c:v flv1 -dct int -g 7 -flvflags add_keyframe_index" "-c copy -t 0.1" "-show_entries format_tags" +FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO HEVC, FLV MOV, HEVC_PARSER) += fate-enhanced-flv-hevc +fate-enhanced-flv-hevc: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov\ + flv "-c copy" "-c copy" + FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) -fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) +FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) +fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) $(FATE_ENHANCED_FLVENC_FFMPEG-yes) diff --git a/tests/ref/fate/enhanced-flv-hevc b/tests/ref/fate/enhanced-flv-hevc new file mode 100644 index 00..3799f1f50b --- /dev/null +++ b/tests/ref/fate/enhanced-flv-hevc @@ -0,0 +1,258 @@ +e7030c9d4301afbbe0ec6f6899a80bdc *tests/data/fate/enhanced-flv-hevc.flv +3602600 tests/data/fate/enhanced-flv-hevc.flv +#extradata 0: 551, 0xa18acf66 +#extradata 1:2, 0x00340022 +#tb 0: 1/1000 +#media_type 0: video +#codec_id 0: hevc +#dimensions 0: 1920x1080 +#sar 0: 0/1 +#tb 1: 1/1000 +#media_type 1: audio +#codec_id 1: aac +#sample_rate 1: 44100 +#channel_layout_name 1: stereo +0, 0, 0, 33,63375, 0xc76606ab +0, 33, 33, 33,46706, 0x0e08a7e5, F=0x0 +0, 66, 66, 33,29766, 0x753c031a, F=0x0 +1, 68, 68, 23,6, 0x031e0108 +1, 91, 91, 23, 251, 0x6b4a7cbd +0,100,100, 33,19409, 0x4b948b6c, F=0x0 +1,114,114, 23, 389, 0x6673c205 +0,133,133, 33,21086, 0x1b9412ce, F=0x0 +1,138,138, 23, 356, 0x8c71a316 +1,161,161, 23, 339, 0x3018a45a +0,166,166, 33,62043, 0xc2356b56, F=0x0 +1,184,184, 23, 405, 0xc89ebe05 +0,200,200, 33,36175, 0x0a7df38c, F=0x0 +1,207,207, 23, 449, 0x42eadf96 +1,231,231, 23, 416, 0x28a7c9b9 +0,233,233, 33,16028, 0xa57fcbe9, F=0x0 +1,254,254, 23, 426, 0x9a74d4ec +0,266,266, 33,15428, 0x9a91f357, F=0x0 +1,277,277, 23, 419, 0xbe3dc54b +0,300,300, 33,66072, 0xa542b6d7, F=0x0 +1,300,300, 23, 424, 0x5102d50e +1,323,323, 23, 402, 0xb11cc14c +0,333,333, 33,34985, 0xbfd8ff45, F=0x0 +1,347,347, 23, 401, 0x3820b8f9 +0,366,366, 33,16036, 0xfc39c6ea, F=0x0 +1,370,370, 23, 400, 0xe5c4c168 +1,393,393, 23, 435, 0x6dbecc33 +0,400,400, 33,19893, 0x7e746f4e, F=0x0 +1,416,416, 23, 441, 0x0ad3d199 +0,433,433, 33,77576, 0xeba2e5c8, F=0x0 +1,440,440, 23, 479, 0x44dce967 +1,463,463, 23, 439, 0x7d85e4c9 +0,466,466, 33,35400, 0xbe179462, F=0x0 +1,486,486, 23, 461, 0xca18e36b +0,500,500, 33,15962, 0x7703dcd8, F=0x0 +1,509,509, 23, 498, 0xf73befd7 +1,532,532, 23, 469, 0x0119e958 +0,533,533, 33,16136, 0x78a74880, F=0x0 +1,556,556, 23, 472, 0x4980e108 +0,566,566, 33,74990, 0xb6fc1da7, F=0x0 +1,579,579, 23, 488, 0x42baeb77 +0,600,600, 33,36594, 0xc3c61c3e, F=0x0 +1,602,602, 23, 458, 0x2198dde8 +1,625,625, 23, 430, 0x0858cc8f +0,633,633, 33,16524, 0xb297a886, F=0x0 +1,648,648, 23, 464, 0x9590e068 +0,666,666, 33,17033, 0x31b3dd63, F=0x0 +1,672,672, 23, 415, 0xf926cf5f +1,695,695, 23, 429, 0xf4a4d6c3 +0,700,700, 33,66745, 0x5edee4b1, F=0x0 +1,718,718, 23, 420, 0xb6
[FFmpeg-devel] [PATCH v4 2/3] tests/fate/flvenc: add vp9 in enhanced flv test case
Signed-off-by: Steven Liu --- tests/fate/flvenc.mak | 4 tests/ref/fate/enhanced-flv-vp9 | 18 ++ 2 files changed, 22 insertions(+) create mode 100644 tests/ref/fate/enhanced-flv-vp9 diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak index b472dffe5b..87a1093136 100644 --- a/tests/fate/flvenc.mak +++ b/tests/fate/flvenc.mak @@ -5,6 +5,10 @@ FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO HEVC, FLV MOV, HEVC_PARSE fate-enhanced-flv-hevc: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov\ flv "-c copy" "-c copy" +FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO VP9, FLV IVF, VP9_PARSER) += fate-enhanced-flv-vp9 +fate-enhanced-flv-vp9: CMD = transcode ivf $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-05-resize.ivf\ + flv "-c copy" "-c copy" + FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) $(FATE_ENHANCED_FLVENC_FFMPEG-yes) diff --git a/tests/ref/fate/enhanced-flv-vp9 b/tests/ref/fate/enhanced-flv-vp9 new file mode 100644 index 00..149d9a6269 --- /dev/null +++ b/tests/ref/fate/enhanced-flv-vp9 @@ -0,0 +1,18 @@ +8e7403c6fb638202ac2b8b7d8c5df3f6 *tests/data/fate/enhanced-flv-vp9.flv +9384 tests/data/fate/enhanced-flv-vp9.flv +#extradata 0:8, 0x03b0009c +#tb 0: 1/1000 +#media_type 0: video +#codec_id 0: vp9 +#dimensions 0: 352x288 +#sar 0: 0/1 +0, 0, 0, 33, 3964, 0x8ff9b15f +0, 33, 33, 33, 373, 0x985fb479, F=0x0 +0, 67, 67, 33, 375, 0x2813bc1b, F=0x0 +0,100,100, 33, 261, 0x69557ae9, F=0x0 +0,133,133, 33, 527, 0xb4a7fe75, F=0x0 +0,167,167, 33, 608, 0x80a8212a, F=0x0 +0,200,200, 33, 1551, 0x28f2f1f9, F=0x0 +0,233,233, 33, 520, 0xbec201ee, F=0x0 +0,267,267, 33, 426, 0xf9e0d260, F=0x0 +0,300,300, 33, 384, 0xcbd8b904, F=0x0 -- 2.40.0 ___ 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 v4 3/3] tests/fate/flvenc: add av1 in enhanced flv test case
Signed-off-by: Steven Liu --- tests/fate/flvenc.mak | 4 tests/ref/fate/enhanced-flv-av1 | 32 2 files changed, 36 insertions(+) create mode 100644 tests/ref/fate/enhanced-flv-av1 diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak index 87a1093136..bfb7faf726 100644 --- a/tests/fate/flvenc.mak +++ b/tests/fate/flvenc.mak @@ -9,6 +9,10 @@ FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO VP9, FLV IVF, VP9_PARSER) fate-enhanced-flv-vp9: CMD = transcode ivf $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-05-resize.ivf\ flv "-c copy" "-c copy" +FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO AV1, FLV IVF, AV1_PARSER) += fate-enhanced-flv-av1 +fate-enhanced-flv-av1: CMD = transcode ivf $(TARGET_SAMPLES)/av1/decode_model.ivf\ + flv "-c copy" "-c copy" + FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) $(FATE_ENHANCED_FLVENC_FFMPEG-yes) diff --git a/tests/ref/fate/enhanced-flv-av1 b/tests/ref/fate/enhanced-flv-av1 new file mode 100644 index 00..120c880ddd --- /dev/null +++ b/tests/ref/fate/enhanced-flv-av1 @@ -0,0 +1,32 @@ +b40c54b7a26854fd3a4da13dcbba37a3 *tests/data/fate/enhanced-flv-av1.flv +22742 tests/data/fate/enhanced-flv-av1.flv +#extradata 0: 35, 0x527207cd +#tb 0: 1/1000 +#media_type 0: video +#codec_id 0: av1 +#dimensions 0: 240x100 +#sar 0: 1/1 +0, 0, 0, 41, 8170, 0x56e3ab74 +0, 42, 42, 41, 7042, 0x85b9890b, F=0x0 +0, 83, 83, 41,6, 0x026000f4, F=0x0 +0,125,125, 41, 50, 0x4d311090, F=0x0 +0,167,167, 41,6, 0x0288010c, F=0x0 +0,208,208, 41, 281, 0x7d34844b, F=0x0 +0,250,250, 41,6, 0x023000e4, F=0x0 +0,292,292, 41, 65, 0xa0511848, F=0x0 +0,333,333, 41,6, 0x02d8013c, F=0x0 +0,375,375, 41, 1067, 0x193503be, F=0x0 +0,417,417, 41,6, 0x02d4, F=0x0 +0,458,458, 41, 54, 0x7dcd1303, F=0x0 +0,500,500, 41,6, 0x0288011c, F=0x0 +0,542,542, 41, 691, 0x4f2149f9, F=0x0 +0,583,583, 41,6, 0x02500104, F=0x0 +0,625,625, 41, 211, 0x212267a2, F=0x0 +0,667,667, 41, 44, 0xed810e43, F=0x0 +0,708,708, 41, 3523, 0xcf33e296, F=0x0 +0,750,750, 41, 65, 0x4a0418a1, F=0x0 +0,792,792, 41, 388, 0xcbc0c26b, F=0x0 +0,833,833, 41, 180, 0x2b635133, F=0x0 +0,875,875, 41, 62, 0x76ef1809, F=0x0 +0,917,917, 41, 42, 0xb08b0a78, F=0x0 +0,958,958, 41, 63, 0xd07b1a32, F=0x0 -- 2.40.0 ___ 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 0/1] avfilter/buffersink: Add user video frame allocation
This patch adds the ability for the user to allocate frames rather than being forced to use avfilters default allocator. This useful for applications like Kodi that wish to be able to control how the final filter stage frame is allocated so that it is compatible with whatever it wishes to do next e.g. allocate a dmabuf backed frame for direct display via DRM. This is similar to the facility provided by get_buffer2 in avcodec. John Cox (1): avfilter/buffersink: Add video frame allocation callback libavfilter/buffersink.c | 21 + libavfilter/buffersink.h | 27 +++ libavfilter/version.h| 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) -- 2.39.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 1/1] avfilter/buffersink: Add video frame allocation callback
Add a callback to enable user allocation of video frames on the final stage of a filter chain. Signed-off-by: John Cox --- libavfilter/buffersink.c | 21 + libavfilter/buffersink.h | 27 +++ libavfilter/version.h| 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 306c283f77..070b743186 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -62,6 +62,11 @@ typedef struct BufferSinkContext { int sample_rates_size; AVFrame *peeked_frame; + +union { +av_buffersink_alloc_video_frame * video; +} alloc_cb; +void * alloc_v; } BufferSinkContext; #define NB_ITEMS(list) (list ## _size / sizeof(*list)) @@ -154,6 +159,21 @@ int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, return get_frame_internal(ctx, frame, 0, nb_samples); } +static AVFrame * alloc_video_buffer(AVFilterLink *link, int w, int h) +{ +AVFilterContext * const ctx = link->dst; +BufferSinkContext * const bs = ctx->priv; +return bs->alloc_cb.video ? bs->alloc_cb.video(ctx, bs->alloc_v, w, h) : +ff_default_get_video_buffer(link, w, h); +} + +void av_buffersink_set_alloc_video_frame(AVFilterContext *ctx, av_buffersink_alloc_video_frame * cb, void * v) +{ +BufferSinkContext * const bs = ctx->priv; +bs->alloc_cb.video = cb; +bs->alloc_v = v; +} + static av_cold int common_init(AVFilterContext *ctx) { BufferSinkContext *buf = ctx->priv; @@ -381,6 +401,7 @@ static const AVFilterPad avfilter_vsink_buffer_inputs[] = { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, +.get_buffer = {.video = alloc_video_buffer}, }, }; diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h index 64e08de53e..73f0ddc476 100644 --- a/libavfilter/buffersink.h +++ b/libavfilter/buffersink.h @@ -166,6 +166,33 @@ int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame); */ int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples); +/** + * Callback from av_buffersink_set_alloc_video_frame to allocate + * a frame + * + * @param ctx pointer to a context of the abuffersink AVFilter. + * @param v opaque pointer passed to + * av_buffersink_set_alloc_video_frame + * @param w width of frame to allocate + * @param height of frame to allocate + * + * @return + * - The newly allocated frame + * - NULL if error + */ +typedef AVFrame * av_buffersink_alloc_video_frame(AVFilterContext * ctx, void * v, int w, int h); + +/** + * Set a video frame allocation method for buffersink + * + * @param ctx pointer to a context of the abuffersink AVFilter. + * @param cb Callback to the allocation function. If set to NULL + * then the default avfilter allocation function will + * be used. + * @param v Opaque to pass to the allocation function + */ +void av_buffersink_set_alloc_video_frame(AVFilterContext *ctx, av_buffersink_alloc_video_frame * cb, void * v); + /** * @} */ diff --git a/libavfilter/version.h b/libavfilter/version.h index c001693e3c..54950497be 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFILTER_VERSION_MINOR 8 +#define LIBAVFILTER_VERSION_MINOR 9 #define LIBAVFILTER_VERSION_MICRO 102 -- 2.39.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 1/3] avfilter/vf_overlay: Add support for yuv444p10 pixel format
On 17/07/2023 08:47, Tobias Rapp wrote: On 07/07/2023 14:44, Tobias Rapp wrote: --- doc/filters.texi | 3 +++ libavfilter/vf_overlay.c | 36 +++- libavfilter/vf_overlay.h | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) [...] Would like to apply this patch-set in a few days from now if there are no objections. Applied. Regards, Tobias ___ 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/amfenc: add smart access video option
This commit adds option for enabling SmartAccess Video (SAV) in AMF encoders. SmartAccess video - AMD hardware-specific feature which enables the parallelization of encode and decode streams across multiple Video Codec Engine (VCN) hardware instances. Signed-off-by: Evgeny Pavlov --- libavcodec/amfenc.h | 1 + libavcodec/amfenc_av1.c | 4 libavcodec/amfenc_h264.c | 4 libavcodec/amfenc_hevc.c | 4 4 files changed, 13 insertions(+) diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h index 2dbd378ef8..e8d66164ed 100644 --- a/libavcodec/amfenc.h +++ b/libavcodec/amfenc.h @@ -89,6 +89,7 @@ typedef struct AmfContext { int quality; int b_frame_delta_qp; int ref_b_frame_delta_qp; +int smart_access_video; // Dynamic options, can be set after Init() call diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c index 30c0a9fad2..c2c6f75266 100644 --- a/libavcodec/amfenc_av1.c +++ b/libavcodec/amfenc_av1.c @@ -104,6 +104,8 @@ static const AVOption options[] = { { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{.i64 = 0 }, 0, 1, VE }, +{ "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE}, + //Pre Analysis options { "preanalysis","Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE }, @@ -241,6 +243,8 @@ FF_ENABLE_DEPRECATION_WARNINGS } } +AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video); + // Pre-Pass, Pre-Analysis, Two-Pass if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) { AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_PREENCODE, 0); diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c index 2380aa4e90..c0836b4ec2 100644 --- a/libavcodec/amfenc_h264.c +++ b/libavcodec/amfenc_h264.c @@ -136,6 +136,8 @@ static const AVOption options[] = { { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, +{ "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE}, + //Pre Analysis options { "preanalysis","Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE }, @@ -353,6 +355,8 @@ FF_ENABLE_DEPRECATION_WARNINGS av_log(ctx, AV_LOG_WARNING, "rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set\n"); } +AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video); + if (ctx->preanalysis != -1) { AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false : true)); } diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c index dd232cc8ac..5436583403 100644 --- a/libavcodec/amfenc_hevc.c +++ b/libavcodec/amfenc_hevc.c @@ -99,6 +99,8 @@ static const AVOption options[] = { { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, +{ "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE}, + //Pre Analysis options { "preanalysis","Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE }, @@ -241,6 +243,8 @@ FF_ENABLE_DEPRECATION_WARNINGS } } +AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video); + // Pre-Pass, Pre-Analysis, Two-Pass if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) { AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0); -- 2.41.0 ___ 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/amfenc: add smart access video option
This commit adds option for enabling SmartAccess Video (SAV) in AMF encoders. SAV is an AMD hardware-specific feature which enables the parallelization of encode and decode streams across multiple Video Codec Engine (VCN) hardware instances. Signed-off-by: Evgeny Pavlov --- libavcodec/amfenc.h | 1 + libavcodec/amfenc_av1.c | 4 libavcodec/amfenc_h264.c | 4 libavcodec/amfenc_hevc.c | 4 4 files changed, 13 insertions(+) diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h index 2dbd378ef8..e8d66164ed 100644 --- a/libavcodec/amfenc.h +++ b/libavcodec/amfenc.h @@ -89,6 +89,7 @@ typedef struct AmfContext { int quality; int b_frame_delta_qp; int ref_b_frame_delta_qp; +int smart_access_video; // Dynamic options, can be set after Init() call diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c index 30c0a9fad2..c2c6f75266 100644 --- a/libavcodec/amfenc_av1.c +++ b/libavcodec/amfenc_av1.c @@ -104,6 +104,8 @@ static const AVOption options[] = { { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{.i64 = 0 }, 0, 1, VE }, +{ "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE}, + //Pre Analysis options { "preanalysis","Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE }, @@ -241,6 +243,8 @@ FF_ENABLE_DEPRECATION_WARNINGS } } +AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video); + // Pre-Pass, Pre-Analysis, Two-Pass if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) { AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_PREENCODE, 0); diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c index 2380aa4e90..c0836b4ec2 100644 --- a/libavcodec/amfenc_h264.c +++ b/libavcodec/amfenc_h264.c @@ -136,6 +136,8 @@ static const AVOption options[] = { { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, +{ "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE}, + //Pre Analysis options { "preanalysis","Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE }, @@ -353,6 +355,8 @@ FF_ENABLE_DEPRECATION_WARNINGS av_log(ctx, AV_LOG_WARNING, "rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set\n"); } +AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video); + if (ctx->preanalysis != -1) { AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false : true)); } diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c index dd232cc8ac..5436583403 100644 --- a/libavcodec/amfenc_hevc.c +++ b/libavcodec/amfenc_hevc.c @@ -99,6 +99,8 @@ static const AVOption options[] = { { "log_to_dbg", "Enable AMF logging to debug output", OFFSET(log_to_dbg), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, +{ "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE}, + //Pre Analysis options { "preanalysis","Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE }, @@ -241,6 +243,8 @@ FF_ENABLE_DEPRECATION_WARNINGS } } +AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video); + // Pre-Pass, Pre-Analysis, Two-Pass if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) { AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0); -- 2.41.0 ___ 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/rtmpproto: forward rw_timeout to tcp proto
--- libavformat/rtmpproto.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index f0ef223f05..a18cc78eac 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -127,6 +127,7 @@ typedef struct RTMPContext { int nb_streamid;///< The next stream id to return on createStream calls doubleduration; ///< Duration of the stream in seconds as returned by the server (only valid if non-zero) int tcp_nodelay;///< Use TCP_NODELAY to disable Nagle's algorithm if set to 1 +int rw_timeout; ///< timeout of socket I/O operations char username[50]; char password[50]; char auth_params[500]; @@ -2656,10 +2657,12 @@ static int rtmp_open(URLContext *s, const char *uri, int flags, AVDictionary **o port = RTMP_DEFAULT_PORT; if (rt->listen) ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, -"?listen&listen_timeout=%d&tcp_nodelay=%d", -rt->listen_timeout * 1000, rt->tcp_nodelay); +"?listen&listen_timeout=%d&timeout=%d&tcp_nodelay=%d", +rt->listen_timeout * 1000, rt->rw_timeout, +rt->tcp_nodelay); else -ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, "?tcp_nodelay=%d", rt->tcp_nodelay); +ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, +"?tcp_nodelay=%d&timeout=%d", rt->tcp_nodelay, rt->rw_timeout); } reconnect: @@ -3120,6 +3123,7 @@ static const AVOption rtmp_options[] = { {"listen", "Listen for incoming rtmp connections", OFFSET(listen), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC, "rtmp_listen" }, {"tcp_nodelay", "Use TCP_NODELAY to disable Nagle's algorithm", OFFSET(tcp_nodelay), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC|ENC}, {"timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies -rtmp_listen 1", OFFSET(listen_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC, "rtmp_listen" }, +{"rw_timeout", "Maximum timeout (in microseconds) to wait for socket i/o. -1 is infinite.", OFFSET(rw_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC|ENC }, { NULL }, }; -- 2.34.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 01/47] fftools/ffmpeg_mux_init: handle pixel format endianness
Pushed the set except for deprecating the "smart" pixfmt selection, on which there is no consensus yet. -- Anton Khirnov ___ 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 0/3] avcodec: move HDR10 (MDCV/CLL) SEI handling to h2645_sei
Quoting Jan Ekström (2023-07-12 20:32:44) > This allows parsing code to be re-utilized from H.264, as well as probably > from VVC in the future. > > This additionally eases verification of the AVCodecContext side data patch > set, which includes libx264 integration for HDR10 side data. > > Notes: > * At least in ffprobe and FATE tests the code works even without the > additional > sync in "update_thread_context" in either HEVC or H.264 (as the viewing > environment SEI patch set showed earlier). As the current HEVC code had such > sync, I kept it and added a similar thing to the H.264 decoder. > ** If this is required for all things, the sync should possibly be added to >ff_h2645_sei_ctx_replace? As currently both the HEVC and H.264 decoders are >synchronizing various structs by themselves in addition to calling >ctx_replace. Is it supposed to apply to the current frame only or all the following ones as well. If the latter, you need to propagate it between thread contexts. > * I did not add a simlar decrementing logic to the H.264 decoder for now, > as not sure how it should be handled exactly. Not sure what you mean by decrementing - what is being decremented? -- Anton Khirnov ___ 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/5] fftools/ffmpeg: support applying container level cropping
Quoting James Almer (2023-07-20 00:20:43) > diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c > index 8b750de4e5..3cf29c8b2c 100644 > --- a/fftools/ffmpeg_enc.c > +++ b/fftools/ffmpeg_enc.c > @@ -441,14 +441,16 @@ int enc_open(OutputStream *ost, AVFrame *frame) > int i; > for (i = 0; i < ist->st->nb_side_data; i++) { > AVPacketSideData *sd = &ist->st->side_data[i]; > -if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) { > +if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) > +continue; > +if (ist->apply_cropping && sd->type == > AV_PKT_DATA_FRAME_CROPPING) > +continue; I'm very much not a fan of the encoder doing anything based on decoder options. I know the code below already does the same thing, but I'd like to get rid of it rather than add to it. -- Anton Khirnov ___ 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] configure: use just the pkg-config for sndio
On 7/7/2023 3:16 PM, Brad Smith wrote: On 2023-07-01 2:58 p.m., Brad Smith wrote: On 2023-06-23 7:36 p.m., Brad Smith wrote: On 2023-06-23 7:35 p.m., Michael Niedermayer wrote: On Fri, Jun 23, 2023 at 06:56:30PM -0400, Brad Smith wrote: On 2023-06-23 6:55 p.m., Michael Niedermayer wrote: On Fri, Jun 23, 2023 at 06:41:08PM -0400, Brad Smith wrote: ping. On 2023-06-17 6:48 p.m., Brad Smith wrote: On Sun, Jun 18, 2023 at 12:01:14AM +0200, Michael Niedermayer wrote: this breaks a plain configure here on ubuntu ./configure ERROR: sndio not found using pkg-config If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat. Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus This is what I had intended. You intended to break a plain ./configure on ubuntu ? If so i think we better dont apply that patch :) thx No, there was a second patch there. oops i missed that, the 2nd patch works fine on ubuntu no objections from me thx ping. ping. ping. ___ 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/5] fftools/ffmpeg: support applying container level cropping
On 7/20/2023 4:08 PM, Anton Khirnov wrote: Quoting James Almer (2023-07-20 00:20:43) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 8b750de4e5..3cf29c8b2c 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -441,14 +441,16 @@ int enc_open(OutputStream *ost, AVFrame *frame) int i; for (i = 0; i < ist->st->nb_side_data; i++) { AVPacketSideData *sd = &ist->st->side_data[i]; -if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) { +if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) +continue; +if (ist->apply_cropping && sd->type == AV_PKT_DATA_FRAME_CROPPING) +continue; I'm very much not a fan of the encoder doing anything based on decoder options. Right now, all input stream side data (save for CPB) is copied to the output stream. Without this chunk, the frame cropping side data will be copied regardless of it having been applied or not at the decoding level. I don't know how else to prevent that. Maybe removing the side data from the input stream? Although that's pretty ugly. I have a separate patchset adding packet side data to codecpar and avctx, and deprecating AVStream.side_data in favor of it. With that, i could maybe use and therefore remove the cropping side data from ist->par (which is internal to the CLI) if applied. I know the code below already does the same thing, but I'd like to get rid of it rather than add to it. ___ 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/5] fftools/ffmpeg: support applying container level cropping
Quoting James Almer (2023-07-20 21:25:02) > On 7/20/2023 4:08 PM, Anton Khirnov wrote: > > Quoting James Almer (2023-07-20 00:20:43) > >> diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c > >> index 8b750de4e5..3cf29c8b2c 100644 > >> --- a/fftools/ffmpeg_enc.c > >> +++ b/fftools/ffmpeg_enc.c > >> @@ -441,14 +441,16 @@ int enc_open(OutputStream *ost, AVFrame *frame) > >> int i; > >> for (i = 0; i < ist->st->nb_side_data; i++) { > >> AVPacketSideData *sd = &ist->st->side_data[i]; > >> -if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) { > >> +if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) > >> +continue; > >> +if (ist->apply_cropping && sd->type == > >> AV_PKT_DATA_FRAME_CROPPING) > >> +continue; > > > > I'm very much not a fan of the encoder doing anything based on decoder > > options. > > Right now, all input stream side data (save for CPB) is copied to the > output stream. I think it's wrong for transcoding. Side data should be propagated through the decoder and the filtergraph and then be processed by the encoder. Just blindly copying whatever is in the input is bound to produce inaccurate information. -- Anton Khirnov ___ 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/5] fftools/ffmpeg: support applying container level cropping
On 7/20/2023 4:31 PM, Anton Khirnov wrote: Quoting James Almer (2023-07-20 21:25:02) On 7/20/2023 4:08 PM, Anton Khirnov wrote: Quoting James Almer (2023-07-20 00:20:43) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 8b750de4e5..3cf29c8b2c 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -441,14 +441,16 @@ int enc_open(OutputStream *ost, AVFrame *frame) int i; for (i = 0; i < ist->st->nb_side_data; i++) { AVPacketSideData *sd = &ist->st->side_data[i]; -if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) { +if (sd->type == AV_PKT_DATA_CPB_PROPERTIES) +continue; +if (ist->apply_cropping && sd->type == AV_PKT_DATA_FRAME_CROPPING) +continue; I'm very much not a fan of the encoder doing anything based on decoder options. Right now, all input stream side data (save for CPB) is copied to the output stream. I think it's wrong for transcoding. Side data should be propagated through the decoder My other set will introduce this, so at least the first step towards this will be done. I'll send it in a few. and the filtergraph and then be processed by the encoder. It however doesn't touch lavfi. Just blindly copying whatever is in the input is bound to produce inaccurate information. Agree, but that's outside the scope of this set. I don't think lavfi can even take global side data right now. Only on a frame basis. ___ 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/13] avcodec/avcodec: add side data to AVCodecContext
Signed-off-by: James Almer --- libavcodec/avcodec.c | 2 ++ libavcodec/avcodec.h | 8 + libavcodec/avpacket.c | 84 +++ libavcodec/packet.h | 54 4 files changed, 148 insertions(+) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 340abe830e..16869e97f2 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -467,6 +467,8 @@ av_cold int avcodec_close(AVCodecContext *avctx) av_freep(&avctx->internal); } +av_packet_free_side_data_set(&avctx->side_data_set); + for (i = 0; i < avctx->nb_coded_side_data; i++) av_freep(&avctx->coded_side_data[i].data); av_freep(&avctx->coded_side_data); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index fe41ecc3c9..2902ecf6cb 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2102,6 +2102,14 @@ typedef struct AVCodecContext { * an error. */ int64_t frame_num; + +/** + * Additional data associated with the entire stream. + * + * - decoding: set by user + * - encoding: unused + */ +AVPacketSideDataSet side_data_set; } AVCodecContext; /** diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 5fef65e97a..f569731403 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -645,3 +645,87 @@ int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp) return 0; } + +AVPacketSideData *av_packet_get_side_data_from_set(const AVPacketSideDataSet *set, + enum AVPacketSideDataType type) +{ +for (int i = 0; i < set->nb_side_data; i++) +if (set->side_data[i].type == type) +return &set->side_data[i]; + +return NULL; +} + +static int add_side_data_to_set(AVPacketSideDataSet *set, +AVPacketSideData **psd, +enum AVPacketSideDataType type, +uint8_t *data, size_t size) +{ +AVPacketSideData *sd, *tmp; + +for (int i = 0; i < set->nb_side_data; i++) { +sd = &set->side_data[i]; + +if (sd->type == type) { +av_freep(&sd->data); +sd->data = data; +sd->size = size; +*psd = sd; +return 0; +} +} + +if (set->nb_side_data + 1U > FFMIN(INT_MAX, SIZE_MAX / sizeof(*tmp))) +return AVERROR(ERANGE); + +tmp = av_realloc_array(set->side_data, set->nb_side_data + 1, sizeof(*tmp)); +if (!tmp) +return AVERROR(ENOMEM); + +set->side_data = tmp; +set->nb_side_data++; + +sd = &set->side_data[set->nb_side_data - 1]; +sd->type = type; +sd->data = data; +sd->size = size; +*psd = sd; + +return 0; +} + +int av_packet_add_side_data_to_set(AVPacketSideDataSet *set, + enum AVPacketSideDataType type, + uint8_t *data, size_t size) +{ +AVPacketSideData *sd; + +return add_side_data_to_set(set, &sd, type, data, size); +} + +AVPacketSideData *av_packet_new_side_data_to_set(AVPacketSideDataSet *set, + enum AVPacketSideDataType type, + size_t size) +{ +AVPacketSideData *sd = NULL; +uint8_t *data = av_malloc(size); +int ret; + +if (!data) +return NULL; + +ret = add_side_data_to_set(set, &sd, type, data, size); +if (ret < 0) +av_freep(&data); + +return sd; +} + +void av_packet_free_side_data_set(AVPacketSideDataSet *set) +{ +int i; +for (i = 0; i < set->nb_side_data; i++) +av_freep(&set->side_data[i].data); +av_freep(&set->side_data); +set->nb_side_data = 0; +} diff --git a/libavcodec/packet.h b/libavcodec/packet.h index f28e7e7011..590c2bf15a 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -318,6 +318,14 @@ typedef struct AVPacketSideData { enum AVPacketSideDataType type; } AVPacketSideData; +/** + * Structure to hold a set of AVPacketSideDataSet + */ +typedef struct AVPacketSideDataSet { +AVPacketSideData *side_data; +intnb_side_data; +} AVPacketSideDataSet; + /** * This structure stores compressed data. It is typically exported by demuxers * and then passed as input to decoders, or received as output from encoders and @@ -724,6 +732,52 @@ int av_packet_make_writable(AVPacket *pkt); */ void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); +/** + * Allocate a new side data entry into to a set. + * + * @param set a set to which the side data should be added + * @param type side data type + * @param size side data size + * @return pointer to freshly allocated side data entry or NULL otherwise. + */ +AVPacketSideData *av_packet_new_side_data_to_set(AVPacketSideDataSet *set, + enum AVPacketSideDataType type, +
[FFmpeg-devel] [PATCH 02/13] avcodec/codec_par: add side data to AVCodecParameters
Signed-off-by: James Almer --- libavcodec/codec_par.c | 36 libavcodec/codec_par.h | 6 ++ 2 files changed, 42 insertions(+) diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c index 775c187073..c113cfcd80 100644 --- a/libavcodec/codec_par.c +++ b/libavcodec/codec_par.c @@ -27,11 +27,13 @@ #include "libavutil/mem.h" #include "avcodec.h" #include "codec_par.h" +#include "packet.h" static void codec_parameters_reset(AVCodecParameters *par) { av_freep(&par->extradata); av_channel_layout_uninit(&par->ch_layout); +av_packet_free_side_data_set(&par->side_data_set); memset(par, 0, sizeof(*par)); @@ -72,6 +74,29 @@ void avcodec_parameters_free(AVCodecParameters **ppar) av_freep(ppar); } +static int codec_parameters_copy_side_data(AVPacketSideDataSet *dst, + const AVPacketSideDataSet *src) +{ +if (!src->nb_side_data) +return 0; + +dst->side_data = av_calloc(src->nb_side_data, sizeof(*dst->side_data)); +if (!dst->side_data) +return AVERROR(ENOMEM); + +for (int i = 0; i < src->nb_side_data; i++) { +uint8_t *data = av_memdup(src->side_data[i].data, src->side_data[i].size); +if (!data) +return AVERROR(ENOMEM); +dst->side_data[i].type = src->side_data[i].type; +dst->side_data[i].size = src->side_data[i].size; +dst->side_data[i].data = data; +dst->nb_side_data++; +} + +return 0; +} + int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src) { int ret; @@ -89,6 +114,10 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src memcpy(dst->extradata, src->extradata, src->extradata_size); dst->extradata_size = src->extradata_size; } +memset(&dst->side_data_set, 0, sizeof(dst->side_data_set)); +ret = codec_parameters_copy_side_data(&dst->side_data_set, &src->side_data_set); +if (ret < 0) +return ret; ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout); if (ret < 0) @@ -177,6 +206,9 @@ FF_ENABLE_DEPRECATION_WARNINGS memcpy(par->extradata, codec->extradata, codec->extradata_size); par->extradata_size = codec->extradata_size; } +ret = codec_parameters_copy_side_data(&par->side_data_set, &codec->side_data_set); +if (ret < 0) +return ret; return 0; } @@ -261,6 +293,10 @@ FF_ENABLE_DEPRECATION_WARNINGS memcpy(codec->extradata, par->extradata, par->extradata_size); codec->extradata_size = par->extradata_size; } +av_packet_free_side_data_set(&codec->side_data_set); +ret = codec_parameters_copy_side_data(&codec->side_data_set, &par->side_data_set); +if (ret < 0) +return ret; return 0; } diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h index add90fdb1e..06e9d54615 100644 --- a/libavcodec/codec_par.h +++ b/libavcodec/codec_par.h @@ -29,6 +29,7 @@ #include "libavutil/pixfmt.h" #include "codec_id.h" +#include "packet.h" /** * @addtogroup lavc_core @@ -223,6 +224,11 @@ typedef struct AVCodecParameters { * when no higher-level timing information is available. */ AVRational framerate; + +/** + * Additional data associated with the entire stream. + */ +AVPacketSideDataSet side_data_set; } AVCodecParameters; /** -- 2.41.0 ___ 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/13] avformat/avformat: use the side data from AVStream.codecpar
Signed-off-by: James Almer --- libavdevice/android_camera.c | 6 +-- libavformat/avformat.c | 42 - libavformat/avformat.h | 28 ++ libavformat/concatdec.c | 1 - libavformat/dashdec.c| 11 -- libavformat/demux.c | 40 +--- libavformat/demux_utils.c| 4 ++ libavformat/dovi_isom.c | 2 +- libavformat/dump.c | 6 +-- libavformat/hls.c| 11 -- libavformat/hlsenc.c | 11 +++--- libavformat/internal.h | 4 ++ libavformat/matroska.c | 2 +- libavformat/matroskadec.c| 20 +- libavformat/matroskaenc.c| 35 - libavformat/mov.c| 41 +++- libavformat/movenc.c | 73 +--- libavformat/mp3enc.c | 8 ++-- libavformat/mpegenc.c| 15 +--- libavformat/mpegts.c | 2 +- libavformat/mux.c| 19 ++ libavformat/mxfdec.c | 9 +++-- libavformat/mxfenc.c | 8 ++-- libavformat/options.c| 2 + libavformat/replaygain.c | 6 ++- libavformat/seek.c | 2 + libavformat/version_major.h | 1 + 27 files changed, 230 insertions(+), 179 deletions(-) diff --git a/libavdevice/android_camera.c b/libavdevice/android_camera.c index 1934999c18..7ceb1e1fc2 100644 --- a/libavdevice/android_camera.c +++ b/libavdevice/android_camera.c @@ -638,7 +638,7 @@ static int wait_for_image_format(AVFormatContext *avctx) static int add_display_matrix(AVFormatContext *avctx, AVStream *st) { AndroidCameraCtx *ctx = avctx->priv_data; -uint8_t *side_data; +AVPacketSideData *side_data; int32_t display_matrix[9]; av_display_rotation_set(display_matrix, ctx->sensor_orientation); @@ -647,14 +647,14 @@ static int add_display_matrix(AVFormatContext *avctx, AVStream *st) av_display_matrix_flip(display_matrix, 1, 0); } -side_data = av_stream_new_side_data(st, +side_data = av_packet_new_side_data_to_set(&st->codecpar.side_data_set, AV_PKT_DATA_DISPLAYMATRIX, sizeof(display_matrix)); if (!side_data) { return AVERROR(ENOMEM); } -memcpy(side_data, display_matrix, sizeof(display_matrix)); +memcpy(side_data->data, display_matrix, sizeof(display_matrix)); return 0; } diff --git a/libavformat/avformat.c b/libavformat/avformat.c index 356b4de931..3afc5afd7f 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -46,9 +46,13 @@ void ff_free_stream(AVStream **pst) if (!st) return; +#if FF_API_AVSTREAM_SIDE_DATA +FF_DISABLE_DEPRECATION_WARNINGS for (int i = 0; i < st->nb_side_data; i++) av_freep(&st->side_data[i].data); av_freep(&st->side_data); +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (st->attached_pic.data) av_packet_unref(&st->attached_pic); @@ -138,6 +142,8 @@ void avformat_free_context(AVFormatContext *s) av_free(s); } +#if FF_API_AVSTREAM_SIDE_DATA +FF_DISABLE_DEPRECATION_WARNINGS uint8_t *av_stream_get_side_data(const AVStream *st, enum AVPacketSideDataType type, size_t *size) { @@ -205,36 +211,8 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } - -int ff_stream_side_data_copy(AVStream *dst, const AVStream *src) -{ -/* Free existing side data*/ -for (int i = 0; i < dst->nb_side_data; i++) -av_free(dst->side_data[i].data); -av_freep(&dst->side_data); -dst->nb_side_data = 0; - -/* Copy side data if present */ -if (src->nb_side_data) { -dst->side_data = av_calloc(src->nb_side_data, - sizeof(*dst->side_data)); -if (!dst->side_data) -return AVERROR(ENOMEM); -dst->nb_side_data = src->nb_side_data; - -for (int i = 0; i < src->nb_side_data; i++) { -uint8_t *data = av_memdup(src->side_data[i].data, - src->side_data[i].size); -if (!data) -return AVERROR(ENOMEM); -dst->side_data[i].type = src->side_data[i].type; -dst->side_data[i].size = src->side_data[i].size; -dst->side_data[i].data = data; -} -} - -return 0; -} +FF_ENABLE_DEPRECATION_WARNINGS +#endif /** * Copy all stream parameters from source to destination stream, with the @@ -270,10 +248,6 @@ static int stream_params_copy(AVStream *dst, const AVStream *src) if (ret < 0) return ret; -ret = ff_stream_side_data_copy(dst, src); -if (ret < 0) -return ret; - av_packet_unref(&dst->attached_pic); if (src->attached_pic.data) { ret = av_packet_ref(&dst->attached_pic, &src->attached_pic); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 1916aa2dc5..e67ed4205e 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -164,6 +1
[FFmpeg-devel] [PATCH 04/13] fftools/ffmpeg: stop using AVStream.side_data
Signed-off-by: James Almer --- fftools/ffmpeg_demux.c| 11 +++ fftools/ffmpeg_enc.c | 25 + fftools/ffmpeg_filter.c | 5 - fftools/ffmpeg_mux_init.c | 16 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 48edbd7f6b..f984df7c95 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -482,8 +482,8 @@ static int input_packet_process(Demuxer *d, DemuxMsg *msg, AVPacket *src) /* add the stream-global side data to the first packet */ if (ds->nb_packets == 1) { -for (int i = 0; i < ist->st->nb_side_data; i++) { -AVPacketSideData *src_sd = &ist->st->side_data[i]; +for (int i = 0; i < ist->st->codecpar->side_data_set.nb_side_data; i++) { +AVPacketSideData *src_sd = &ist->st->codecpar->side_data_set.side_data[i]; uint8_t *dst_data; if (src_sd->type == AV_PKT_DATA_DISPLAYMATRIX) @@ -979,6 +979,7 @@ static int add_display_matrix_to_stream(const OptionsContext *o, AVFormatContext *ctx, InputStream *ist) { AVStream *st = ist->st; +AVPacketSideData *sd; double rotation = DBL_MAX; int hflip = -1, vflip = -1; int hflip_set = 0, vflip_set = 0, rotation_set = 0; @@ -995,12 +996,14 @@ static int add_display_matrix_to_stream(const OptionsContext *o, if (!rotation_set && !hflip_set && !vflip_set) return 0; -buf = (int32_t *)av_stream_new_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9); -if (!buf) { +sd = av_packet_new_side_data_to_set(&st->codecpar->side_data_set, AV_PKT_DATA_DISPLAYMATRIX, +sizeof(int32_t) * 9); +if (!sd) { av_log(ist, AV_LOG_FATAL, "Failed to generate a display matrix!\n"); return AVERROR(ENOMEM); } +buf = (int32_t *)sd->data; av_display_rotation_set(buf, rotation_set ? -(rotation) : -0.0f); diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 96424272bf..f12024dff5 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -428,12 +428,12 @@ int enc_open(OutputStream *ost, AVFrame *frame) for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) { const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i]; -uint8_t *dst_data; +AVPacketSideData *sd_dst; -dst_data = av_stream_new_side_data(ost->st, sd_src->type, sd_src->size); -if (!dst_data) +sd_dst = av_packet_new_side_data_to_set(&ost->par_in->side_data_set, sd_src->type, sd_src->size); +if (!sd_dst) return AVERROR(ENOMEM); -memcpy(dst_data, sd_src->data, sd_src->size); +memcpy(sd_dst->data, sd_src->data, sd_src->size); } } @@ -446,15 +446,16 @@ int enc_open(OutputStream *ost, AVFrame *frame) */ if (ist) { int i; -for (i = 0; i < ist->st->nb_side_data; i++) { -AVPacketSideData *sd = &ist->st->side_data[i]; -if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) { -uint8_t *dst = av_stream_new_side_data(ost->st, sd->type, sd->size); -if (!dst) +for (i = 0; i < ist->st->codecpar->side_data_set.nb_side_data; i++) { +AVPacketSideData *sd_src = &ist->st->codecpar->side_data_set.side_data[i]; +if (sd_src->type != AV_PKT_DATA_CPB_PROPERTIES) { +AVPacketSideData *sd_dst = av_packet_new_side_data_to_set(&ost->par_in->side_data_set, + sd_src->type, sd_src->size); +if (!sd_dst) return AVERROR(ENOMEM); -memcpy(dst, sd->data, sd->size); -if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX) -av_display_rotation_set((int32_t *)dst, 0); +memcpy(sd_dst->data, sd_src->data, sd_src->size); +if (ist->autorotate && sd_src->type == AV_PKT_DATA_DISPLAYMATRIX) +av_display_rotation_set((int32_t *)sd_dst->data, 0); } } } diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 925b5116cc..33bc96c8dd 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1383,11 +1383,14 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, // TODO: insert hwaccel enabled filters like transpose_vaapi into the graph if (ist->autorotate && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { +AVPacketSideData *sd = NULL; int32_t *displaymatrix = ifp->displaymatrix; double theta; if (!ifp->displaymatrix_present) -displaymatrix = (int32_t *)av_stream_get_side_data(ist->st, AV_PKT_DATA_DISPLAYMATRIX, NULL); +
[FFmpeg-devel] [PATCH 05/13] fftools/ffplay: stop using AVStream.side_data
Signed-off-by: James Almer --- fftools/ffplay.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 5212ad053e..c123511027 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -1904,8 +1904,12 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX); if (sd) displaymatrix = (int32_t *)sd->data; -if (!displaymatrix) -displaymatrix = (int32_t *)av_stream_get_side_data(is->video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL); +if (!displaymatrix) { +AVPacketSideData *sd = av_packet_get_side_data_from_set(&is->video_st->codecpar->side_data_set, + AV_PKT_DATA_DISPLAYMATRIX); +if (sd) +displaymatrix = (int32_t *)sd->data; +} theta = get_rotation(displaymatrix); if (fabs(theta - 90) < 1.0) { -- 2.41.0 ___ 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/13] fftools/ffprobe: stop using AVStream.side_data
Signed-off-by: James Almer --- fftools/ffprobe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index a39185f6fe..b60fd8eb1f 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3186,8 +3186,9 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id if (do_show_stream_tags) ret = show_tags(w, stream->metadata, in_program ? SECTION_ID_PROGRAM_STREAM_TAGS : SECTION_ID_STREAM_TAGS); -if (stream->nb_side_data) { -print_pkt_side_data(w, stream->codecpar, stream->side_data, stream->nb_side_data, +if (stream->codecpar->side_data_set.nb_side_data) { +print_pkt_side_data(w, stream->codecpar, stream->codecpar->side_data_set.side_data, +stream->codecpar->side_data_set.nb_side_data, SECTION_ID_STREAM_SIDE_DATA_LIST, SECTION_ID_STREAM_SIDE_DATA); } -- 2.41.0 ___ 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 11/13] avcodec/avcodec: deprecate coded_side_data
In favor of AVCodecContext.side_data_set Signed-off-by: James Almer --- libavcodec/avcodec.c | 34 ++ libavcodec/avcodec.h | 7 ++- libavcodec/utils.c | 24 +--- libavcodec/version_major.h | 1 + 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 16869e97f2..2b9de43c78 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -334,6 +334,36 @@ FF_ENABLE_DEPRECATION_WARNINGS avci->needs_close = 1; } +#if FF_API_CODED_SIDE_DATA +FF_DISABLE_DEPRECATION_WARNINGS +if (av_codec_is_encoder(avctx->codec)) { +const AVPacketSideData *sd = +av_packet_get_side_data_from_set(&avctx->side_data_set, AV_PKT_DATA_CPB_PROPERTIES); +if (sd) { +uint8_t *data; +AVPacketSideData *tmp = av_realloc_array(avctx->coded_side_data, + avctx->nb_coded_side_data + 1U, + sizeof(*tmp)); +if (!tmp) { +ret = AVERROR(ENOMEM); +goto free_and_end; +} +avctx->coded_side_data = tmp; + +data = av_memdup(sd->data, sd->size); +if (!data) { +ret = AVERROR(ENOMEM); +goto free_and_end; +} + +avctx->coded_side_data[avctx->nb_coded_side_data].data = data; +avctx->coded_side_data[avctx->nb_coded_side_data].size = sd->size; +avctx->coded_side_data[avctx->nb_coded_side_data++].type = AV_PKT_DATA_CPB_PROPERTIES; +} +} +FF_ENABLE_DEPRECATION_WARNINGS +#endif + ret=0; if (av_codec_is_decoder(avctx->codec)) { @@ -469,10 +499,14 @@ av_cold int avcodec_close(AVCodecContext *avctx) av_packet_free_side_data_set(&avctx->side_data_set); +#if FF_API_CODED_SIDE_DATA +FF_DISABLE_DEPRECATION_WARNINGS for (i = 0; i < avctx->nb_coded_side_data; i++) av_freep(&avctx->coded_side_data[i].data); av_freep(&avctx->coded_side_data); avctx->nb_coded_side_data = 0; +FF_ENABLE_DEPRECATION_WARNINGS +#endif av_buffer_unref(&avctx->hw_frames_ctx); av_buffer_unref(&avctx->hw_device_ctx); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2902ecf6cb..ba6cfc09a0 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1892,14 +1892,19 @@ typedef struct AVCodecContext { #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x0002 #define FF_CODEC_PROPERTY_FILM_GRAIN 0x0004 +#if FF_API_CODED_SIDE_DATA /** * Additional data associated with the entire coded stream. * * - decoding: unused * - encoding: may be set by libavcodec after avcodec_open2(). + * @deprecated use side_data_set */ +attribute_deprecated AVPacketSideData *coded_side_data; +attribute_deprecated intnb_coded_side_data; +#endif /** * A reference to the AVHWFramesContext describing the input (for encoding) @@ -2107,7 +2112,7 @@ typedef struct AVCodecContext { * Additional data associated with the entire stream. * * - decoding: set by user - * - encoding: unused + * - encoding: may be set by libavcodec after avcodec_open2(). */ AVPacketSideDataSet side_data_set; } AVCodecContext; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 672eb15d98..01223de707 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1048,32 +1048,26 @@ AVCPBProperties *av_cpb_properties_alloc(size_t *size) AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx) { -AVPacketSideData *tmp; +AVPacketSideData *sd; AVCPBProperties *props; size_t size; -int i; +int ret; -for (i = 0; i < avctx->nb_coded_side_data; i++) -if (avctx->coded_side_data[i].type == AV_PKT_DATA_CPB_PROPERTIES) -return (AVCPBProperties *)avctx->coded_side_data[i].data; +sd = av_packet_get_side_data_from_set(&avctx->side_data_set, AV_PKT_DATA_CPB_PROPERTIES); +if (sd) +return (AVCPBProperties *)sd->data; props = av_cpb_properties_alloc(&size); if (!props) return NULL; -tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp)); -if (!tmp) { -av_freep(&props); +ret = av_packet_add_side_data_to_set(&avctx->side_data_set, AV_PKT_DATA_CPB_PROPERTIES, + (uint8_t *)props, size); +if (ret < 0) { +av_free(props); return NULL; } -avctx->coded_side_data = tmp; -avctx->nb_coded_side_data++; - -avctx->coded_side_data[avctx->nb_coded_side_data - 1].type = AV_PKT_DATA_CPB_PROPERTIES; -avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props; -avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size; - return
[FFmpeg-devel] [PATCH 07/13] avcodec/hevcdec: check for DOVI configuration record in AVCodecContext side data
Signed-off-by: James Almer --- libavcodec/hevcdec.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index fcf19b4eb6..0d659e4c55 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -3403,8 +3403,12 @@ static int hevc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, } sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_DOVI_CONF, &sd_size); -if (sd && sd_size > 0) +if (sd && sd_size > 0) { +av_log(avctx, AV_LOG_WARNING, + "passing a DOVI configuration record through packet side data is " + "deprecated and will stop working soon. Use AVCodecContext side data\n"); ff_dovi_update_cfg(&s->dovi_ctx, (AVDOVIDecoderConfigurationRecord *) sd); +} s->ref = NULL; ret= decode_nal_units(s, avpkt->data, avpkt->size); @@ -3707,12 +3711,18 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx) atomic_init(&s->wpp_err, 0); if (!avctx->internal->is_copy) { +AVPacketSideData *sd; + if (avctx->extradata_size > 0 && avctx->extradata) { ret = hevc_decode_extradata(s, avctx->extradata, avctx->extradata_size, 1); if (ret < 0) { return ret; } } + +sd = av_packet_get_side_data_from_set(&avctx->side_data_set, AV_PKT_DATA_DOVI_CONF); +if (sd && sd->size > 0) +ff_dovi_update_cfg(&s->dovi_ctx, (AVDOVIDecoderConfigurationRecord *) sd->data); } return 0; -- 2.41.0 ___ 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 12/13] avformat/demux: stop copying the internal AVCodecContext coded_side_data
It's no longer needed Signed-off-by: James Almer --- libavformat/demux.c | 16 1 file changed, 16 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index 7253196a82..24bc8fce2a 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2432,19 +2432,6 @@ static int extract_extradata(FFFormatContext *si, AVStream *st, const AVPacket * return 0; } -static int add_coded_side_data(AVStream *st, AVCodecContext *avctx) -{ -for (int i = 0; i < avctx->nb_coded_side_data; i++) { -const AVPacketSideData *const sd_src = &avctx->coded_side_data[i]; -AVPacketSideData *sd_dst = av_packet_new_side_data_to_set(&st->codecpar->side_data_set, - sd_src->type, sd_src->size); -if (!sd_dst) -return AVERROR(ENOMEM); -memcpy(sd_dst->data, sd_src->data, sd_src->size); -} -return 0; -} - int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) { FFFormatContext *const si = ffformatcontext(ic); @@ -2972,9 +2959,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) ret = avcodec_parameters_from_context(st->codecpar, sti->avctx); if (ret < 0) goto find_stream_info_err; -ret = add_coded_side_data(st, sti->avctx); -if (ret < 0) -goto find_stream_info_err; } #if FF_API_AVSTREAM_SIDE_DATA -- 2.41.0 ___ 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/13] avcodec/decode: check for global side data in AVCodecContext side data
Signed-off-by: James Almer --- libavcodec/decode.c | 56 + libavcodec/decode.h | 2 +- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index f0e6acc03e..66506b6dfb 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1396,25 +1396,30 @@ static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame) return av_packet_unpack_dictionary(side_metadata, size, frame_md); } -int ff_decode_frame_props_from_pkt(const AVCodecContext *avctx, +static const struct { +enum AVPacketSideDataType packet; +enum AVFrameSideDataType frame; +} sd_global_map[] = { +{ AV_PKT_DATA_REPLAYGAIN ,AV_FRAME_DATA_REPLAYGAIN }, +{ AV_PKT_DATA_SPHERICAL, AV_FRAME_DATA_SPHERICAL }, +{ AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D }, +{ AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE }, +{ AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA }, +{ AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, +{ AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE }, +{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, +}; + +int ff_decode_frame_props_from_pkt(AVCodecContext *avctx, AVFrame *frame, const AVPacket *pkt) { static const struct { enum AVPacketSideDataType packet; enum AVFrameSideDataType frame; } sd[] = { -{ AV_PKT_DATA_REPLAYGAIN ,AV_FRAME_DATA_REPLAYGAIN }, -{ AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX }, -{ AV_PKT_DATA_SPHERICAL, AV_FRAME_DATA_SPHERICAL }, -{ AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D }, -{ AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE }, -{ AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA }, -{ AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC }, { AV_PKT_DATA_AFD,AV_FRAME_DATA_AFD }, -{ AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE }, { AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE }, -{ AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS }, { AV_PKT_DATA_SKIP_SAMPLES, AV_FRAME_DATA_SKIP_SAMPLES }, }; @@ -1427,6 +1432,23 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif +for (int i = 0; i < FF_ARRAY_ELEMS(sd_global_map); i++) { +size_t size; +uint8_t *packet_sd = av_packet_get_side_data(pkt, sd_global_map[i].packet, &size); +if (packet_sd) { +AVFrameSideData *frame_sd; + +av_log(avctx, AV_LOG_WARNING, + "passing global side data through packet side data is " + "deprecated and will stop working soon. Use AVCodecContext side data\n"); + +av_frame_remove_side_data(frame, sd_global_map[i].frame); + frame_sd = av_frame_new_side_data(frame, sd_global_map[i].frame, size); +if (!frame_sd) +return AVERROR(ENOMEM); +memcpy(frame_sd->data, packet_sd, size); +} +} for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) { size_t size; uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size); @@ -1463,6 +1485,20 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) const AVPacket *pkt = avctx->internal->last_pkt_props; int ret; +for (int i = 0; i < FF_ARRAY_ELEMS(sd_global_map); i++) { +AVPacketSideData *packet_sd = av_packet_get_side_data_from_set(&avctx->side_data_set, + sd_global_map[i].packet); +if (packet_sd) { +AVFrameSideData *frame_sd = av_frame_new_side_data(frame, + sd_global_map[i].frame, + packet_sd->size); +if (!frame_sd) +return AVERROR(ENOMEM); + +memcpy(frame_sd->data, packet_sd->data, packet_sd->size); +} +} + if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) { ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt); if (ret < 0) diff --git a/libavcodec/decode.h b/libavcodec/decode.h index 2b9fe59907..0abbdf067c 100644 --- a/libavcodec/decode.h +++ b/libavcodec/decode.h @@ -67,7 +67,7 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt); /** * Set various frame properties from
[FFmpeg-devel] [PATCH 13/13] fftools: stop propagating the encoder's coded_side_data
It's no longer needed Signed-off-by: James Almer --- fftools/ffmpeg_enc.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index f12024dff5..7efbfdafb3 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -423,20 +423,6 @@ int enc_open(OutputStream *ost, AVFrame *frame) return ret; } -if (ost->enc_ctx->nb_coded_side_data) { -int i; - -for (i = 0; i < ost->enc_ctx->nb_coded_side_data; i++) { -const AVPacketSideData *sd_src = &ost->enc_ctx->coded_side_data[i]; -AVPacketSideData *sd_dst; - -sd_dst = av_packet_new_side_data_to_set(&ost->par_in->side_data_set, sd_src->type, sd_src->size); -if (!sd_dst) -return AVERROR(ENOMEM); -memcpy(sd_dst->data, sd_src->data, sd_src->size); -} -} - /* * Add global input side data. For now this is naive, and copies it * from the input stream's global side data. All side data should -- 2.41.0 ___ 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/13] fftools/ffmpeg: stop injecting stream side data in packets
This is no longer needed as the side data is available for decoders in the AVCodecContext. The tests affected reflect the removal of useless CPB and Stereo 3D side data in packets. Signed-off-by: James Almer --- fftools/ffmpeg_demux.c| 22 --- tests/ref/fate/autorotate | 4 ++-- tests/ref/fate/copy-trac3074 | 2 +- tests/ref/fate/matroska-avoid-negative-ts | 2 +- tests/ref/fate/matroska-dovi-write-config7| 2 +- tests/ref/fate/matroska-dovi-write-config8| 2 +- tests/ref/fate/matroska-encoding-delay| 2 +- .../fate/matroska-mastering-display-metadata | 4 ++-- tests/ref/fate/matroska-spherical-mono-remux | 4 ++-- tests/ref/fate/matroska-vp8-alpha-remux | 2 +- .../ref/fate/mov-mp4-disposition-mpegts-remux | 4 ++-- tests/ref/fate/mxf-d10-user-comments | 2 +- tests/ref/fate/mxf-remux-applehdr10 | 2 +- tests/ref/fate/vp9-superframe-bsf | 2 +- 14 files changed, 17 insertions(+), 39 deletions(-) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index f984df7c95..16519b4b2b 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -480,28 +480,6 @@ static int input_packet_process(Demuxer *d, DemuxMsg *msg, AVPacket *src) ds->data_size += pkt->size; ds->nb_packets++; -/* add the stream-global side data to the first packet */ -if (ds->nb_packets == 1) { -for (int i = 0; i < ist->st->codecpar->side_data_set.nb_side_data; i++) { -AVPacketSideData *src_sd = &ist->st->codecpar->side_data_set.side_data[i]; -uint8_t *dst_data; - -if (src_sd->type == AV_PKT_DATA_DISPLAYMATRIX) -continue; - -if (av_packet_get_side_data(pkt, src_sd->type, NULL)) -continue; - -dst_data = av_packet_new_side_data(pkt, src_sd->type, src_sd->size); -if (!dst_data) { -ret = AVERROR(ENOMEM); -goto fail; -} - -memcpy(dst_data, src_sd->data, src_sd->size); -} -} - if (debug_ts) { av_log(NULL, AV_LOG_INFO, "demuxer+ffmpeg -> ist_index:%d:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s duration:%s duration_time:%s off:%s off_time:%s\n", f->index, pkt->stream_index, diff --git a/tests/ref/fate/autorotate b/tests/ref/fate/autorotate index dff628bbff..2aa29fafa7 100644 --- a/tests/ref/fate/autorotate +++ b/tests/ref/fate/autorotate @@ -11,8 +11,8 @@ #codec_id 1: ac3 #sample_rate 1: 44100 #channel_layout_name 1: mono -0, -512, 0, 512, 6997, 0x55c700f6, S=1, 40 -1, -256, -256, 1536, 416, 0x92ddc529, S=2, 10, 4 +0, -512, 0, 512, 6997, 0x55c700f6 +1, -256, -256, 1536, 416, 0x92ddc529, S=1, 10 0, 0,512, 512, 4847, 0xe74f522e, F=0x0 1, 1280, 1280, 1536, 418, 0x0a7fcd2d 0,512, 1024, 512, 5281, 0xbd4a5dac, F=0x0 diff --git a/tests/ref/fate/copy-trac3074 b/tests/ref/fate/copy-trac3074 index b6d23f8c1c..53ba27e920 100644 --- a/tests/ref/fate/copy-trac3074 +++ b/tests/ref/fate/copy-trac3074 @@ -5,7 +5,7 @@ #codec_id 0: eac3 #sample_rate 0: 48000 #channel_layout_name 0: stereo -0, 0, 0, 1536, 512, 0x2beaf79f, S=1,4 +0, 0, 0, 1536, 512, 0x2beaf79f 0, 1536, 1536, 1536, 512, 0x29ddf9d6 0, 3072, 3072, 1536, 512, 0xba0afa79 0, 4608, 4608, 1536, 512, 0xe019f394 diff --git a/tests/ref/fate/matroska-avoid-negative-ts b/tests/ref/fate/matroska-avoid-negative-ts index dcde937d52..aabc741827 100644 --- a/tests/ref/fate/matroska-avoid-negative-ts +++ b/tests/ref/fate/matroska-avoid-negative-ts @@ -11,7 +11,7 @@ #codec_id 1: mp3 #sample_rate 1: 44100 #channel_layout_name 1: mono -0,-37, 43, 40, 9156, 0xe5bd034a, S=1, 40 +0,-37, 43, 40, 9156, 0xe5bd034a 1, 0, 0, 26, 417, 0x7198c15e 0, 3, 3, 40, 1740, 0x29ac4480, F=0x0 1, 26, 26, 26, 417, 0x3c67c32d diff --git a/tests/ref/fate/matroska-dovi-write-config7 b/tests/ref/fate/matroska-dovi-write-config7 index ef4c87d885..a2f106340d 100644 --- a/tests/ref/fate/matroska-dovi-write-config7 +++ b/tests/ref/fate/matroska-dovi-write-config7 @@ -13,7 +13,7 @@ #dimensions 1: 1920x1080 #sar 1: 0/1 0,-83, 0, 41, 699, 0x728548f1 -1,-83, 0, 41, 1085, 0xfb2dba82, S=1,8 +1,-83, 0, 41, 1085, 0xfb2dba82 0,-42,167, 41, 95, 0xc0312044, F=0x0 1,-42,167, 41, 481, 0xf23f91d5, F=0x0 0, 0, 83, 41,
[FFmpeg-devel] [PATCH 10/13] fftools/ffplay: stop injecting stream side data in packets
This is no longer needed as the side data is available for decoders in the AVCodecContext. Signed-off-by: James Almer --- fftools/ffplay.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fftools/ffplay.c b/fftools/ffplay.c index c123511027..e902ba0f6b 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -2781,8 +2781,6 @@ static int read_thread(void *arg) if (genpts) ic->flags |= AVFMT_FLAG_GENPTS; -av_format_inject_global_side_data(ic); - if (find_stream_info) { AVDictionary **opts; int orig_nb_streams = ic->nb_streams; -- 2.41.0 ___ 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 46/47] fftools/ffprobe: stop calling exit_program()
On Sat, 15 Jul 2023, Anton Khirnov wrote: Inline the relevant part of ffprobe_cleanup() into main() and drop the rest. --- fftools/ffprobe.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index e234c92904..a39185f6fe 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -381,17 +381,6 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl) #endif } [...] @@ -4124,8 +4112,10 @@ int main(int argc, char **argv) show_banner(argc, argv, options); ret = parse_options(NULL, argc, argv, options, opt_input_file); -if (ret < 0) -exit_program(ret == AVERROR_EXIT ? 0 : 1); +if (ret < 0) { +ret = AVERROR_EXIT ? 0 : ret; This looks unintended. Regards, Marton ___ 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/rtmpproto: forward rw_timeout to tcp proto
On Thu, 20 Jul 2023, Timo Rothenpieler wrote: --- libavformat/rtmpproto.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) Hmm, I would have somewhat expected that rw_timeout should be honored here already... Note that URLContext already has got a rw_timeout field and AVOption, so instead of adding a new option, it should be enough to just use the existing URLContext field. But also, have a look at fab8156b2f30666adabe227b3d7712fd193873b1. When opening a chained URLContext, we pass in the parent one, and propagate any options from that URLContext into the child. So as long as the URLContext rw_timeout is set for the rtmp protocol, the nested tcp protocol also should be getting it already implicitly. // Martin ___ 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/rtmpproto: forward rw_timeout to tcp proto
On 20.07.2023 22:47, Martin Storsjö wrote: On Thu, 20 Jul 2023, Timo Rothenpieler wrote: --- libavformat/rtmpproto.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) Hmm, I would have somewhat expected that rw_timeout should be honored here already... Note that URLContext already has got a rw_timeout field and AVOption, so instead of adding a new option, it should be enough to just use the existing URLContext field. But also, have a look at fab8156b2f30666adabe227b3d7712fd193873b1. When opening a chained URLContext, we pass in the parent one, and propagate any options from that URLContext into the child. So as long as the URLContext rw_timeout is set for the rtmp protocol, the nested tcp protocol also should be getting it already implicitly. I'm not entirely sure how that works with in regards to which options are getting forwarded where. But doesn't the "timeout" (in seconds, used as listen timeout) option from rtmpproto mask over the "timeout" option from tcp (in microseconds, used as rw/open timeout)? Hence the "renaming" here, to unshadow that tcp.c option. ___ 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/rtmpproto: forward rw_timeout to tcp proto
On Thu, 20 Jul 2023, Timo Rothenpieler wrote: On 20.07.2023 22:47, Martin Storsjö wrote: On Thu, 20 Jul 2023, Timo Rothenpieler wrote: --- libavformat/rtmpproto.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) Hmm, I would have somewhat expected that rw_timeout should be honored here already... Note that URLContext already has got a rw_timeout field and AVOption, so instead of adding a new option, it should be enough to just use the existing URLContext field. But also, have a look at fab8156b2f30666adabe227b3d7712fd193873b1. When opening a chained URLContext, we pass in the parent one, and propagate any options from that URLContext into the child. So as long as the URLContext rw_timeout is set for the rtmp protocol, the nested tcp protocol also should be getting it already implicitly. I'm not entirely sure how that works with in regards to which options are getting forwarded where. But doesn't the "timeout" (in seconds, used as listen timeout) option from rtmpproto mask over the "timeout" option from tcp (in microseconds, used as rw/open timeout)? Hence the "renaming" here, to unshadow that tcp.c option. Hmm, geez we have many similar-looking and randomly named timeout options here... The av_opt_copy() call in ffurl_open_whitelist() should only iterate over the options within the URLContext itself, not recurse into the protocol private options (as those probably don't match across protocols anyway). So I wouldn't think that the tcp "timeout" option ends up implicitly set from the rtmpproto "timeout" (listen_timeout) option. I didn't try running and observing it right now though. // Martin ___ 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/rtmpproto: forward rw_timeout to tcp proto
On 20.07.2023 23:09, Martin Storsjö wrote: Hmm, geez we have many similar-looking and randomly named timeout options here... The av_opt_copy() call in ffurl_open_whitelist() should only iterate over the options within the URLContext itself, not recurse into the protocol private options (as those probably don't match across protocols anyway). So I wouldn't think that the tcp "timeout" option ends up implicitly set from the rtmpproto "timeout" (listen_timeout) option. My goal here is to specifically be able to set the i/o timeout on the tcp side, since I just had an ffmpeg rtmp process wait for more data indefinitely after a network hickup, even though the connection was long dead. I just discovered that the URLContext has global options, and rw_timeout is one of them. So setting -rw_timeout should have already been possible, I'll try if that ends up in the right place. I didn't try running and observing it right now though. // Martin ___ 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 v4 3/3] tests/fate/flvenc: add av1 in enhanced flv test case
On Thu, Jul 20, 2023 at 07:00:02PM +0800, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > tests/fate/flvenc.mak | 4 > tests/ref/fate/enhanced-flv-av1 | 32 > 2 files changed, 36 insertions(+) > create mode 100644 tests/ref/fate/enhanced-flv-av1 > > diff --git a/tests/fate/flvenc.mak b/tests/fate/flvenc.mak > index 87a1093136..bfb7faf726 100644 > --- a/tests/fate/flvenc.mak > +++ b/tests/fate/flvenc.mak > @@ -9,6 +9,10 @@ FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO VP9, > FLV IVF, VP9_PARSER) > fate-enhanced-flv-vp9: CMD = transcode ivf > $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-05-resize.ivf\ > flv "-c copy" "-c copy" > > +FATE_ENHANCED_FLVENC_FFMPEG-$(call TRANSCODE, RAWVIDEO AV1, FLV IVF, > AV1_PARSER) += fate-enhanced-flv-av1 > +fate-enhanced-flv-av1: CMD = transcode ivf > $(TARGET_SAMPLES)/av1/decode_model.ivf\ > + flv "-c copy" "-c copy" > + > FATE_FFMPEG_FFPROBE += $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > FATE_SAMPLES_FFMPEG += $(FATE_ENHANCED_FLVENC_FFMPEG-yes) > fate-flvenc: $(FATE_FLVENC_FFMPEG_FFPROBE-yes) > $(FATE_ENHANCED_FLVENC_FFMPEG-yes) does this depend on any other patches ? if not it seems failing here: --- ./tests/ref/fate/enhanced-flv-av1 2023-07-20 23:27:26.197002114 +0200 +++ tests/data/fate/enhanced-flv-av12023-07-20 23:42:54.419017533 +0200 @@ -1,5 +1,5 @@ -b40c54b7a26854fd3a4da13dcbba37a3 *tests/data/fate/enhanced-flv-av1.flv -22742 tests/data/fate/enhanced-flv-av1.flv +a59158ac59815ab6c014383e23b2b792 *tests/data/fate/enhanced-flv-av1.flv +22762 tests/data/fate/enhanced-flv-av1.flv #extradata 0: 35, 0x527207cd #tb 0: 1/1000 #media_type 0: video Test enhanced-flv-av1 failed. Look at tests/data/fate/enhanced-flv-av1.err for details. tests/Makefile:307: recipe for target 'fate-enhanced-flv-av1' failed make: *** [fate-enhanced-flv-av1] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides 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 v2 3/5] libavcodec/webp: add support for animated WebP decoding
Am 12.07.23 um 02:20 schrieb James Zern: On Thu, Jul 6, 2023 at 4:28 AM Thilo Borgmann wrote: From: Josef Zlomek Fixes: 4907 Adds support for decoding of animated WebP. The WebP decoder adds the animation related features according to the specs: https://developers.google.com/speed/webp/docs/riff_container#animation The frames of the animation may be smaller than the image canvas. Therefore, the frame is decoded to a temporary frame, then it is blended into the canvas, the canvas is copied to the output frame, and finally the frame is disposed from the canvas. The output to AV_PIX_FMT_YUVA420P/AV_PIX_FMT_YUV420P is still supported. The background color is specified only as BGRA in the WebP file so it is converted to YUVA if YUV formats are output. Signed-off-by: Josef Zlomek --- Changelog | 1 + libavcodec/codec_desc.c | 3 +- libavcodec/version.h| 2 +- libavcodec/webp.c | 714 4 files changed, 658 insertions(+), 62 deletions(-) diff --git a/Changelog b/Changelog index 3876082844..271926ed8f 100644 --- a/Changelog +++ b/Changelog @@ -25,6 +25,7 @@ version : - Raw VVC bitstream parser, muxer and demuxer - Bitstream filter for editing metadata in VVC streams - Bitstream filter for converting VVC from MP4 to Annex B +- animated WebP parser/decoder version 6.0: - Radiance HDR image support diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 4406dd8318..47a38a4036 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1259,8 +1259,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_VIDEO, .name = "webp", .long_name = NULL_IF_CONFIG_SMALL("WebP"), -.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, +.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, The frames are all intra, though with animation they may be smaller than the canvas and combined with the previous frame. Well, which makes them in fact P-Frames. Also leaving _INTRA_ONLY induces rendering issues for animated images. Everything else in v3. Thanks, Thilo ___ 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 v2 5/5] libavformat/webp: add WebP demuxer
Am 12.07.23 um 03:22 schrieb James Zern: On Thu, Jul 6, 2023 at 4:28 AM Thilo Borgmann wrote: From: Josef Zlomek Adds the demuxer of animated WebP files. It supports non-animated, animated, truncated, and concatenated files. Reading from a pipe (and other non-seekable inputs) is also supported. The WebP demuxer splits the input stream into packets containing one frame. It also marks the key frames properly. The loop count is ignored by default (same behaviour as animated PNG and GIF), it may be enabled by the option '-ignore_loop 0'. The frame rate is set according to the frame delay in the ANMF chunk. If the delay is too low, or the image is not animated, the default frame rate is set to 10 fps, similarly to other WebP libraries and browsers. The fate suite was updated accordingly. Signed-off-by: Josef Zlomek --- Changelog | 1 + doc/demuxers.texi | 28 + libavformat/Makefile| 1 + libavformat/allformats.c| 1 + libavformat/version.h | 2 +- libavformat/webpdec.c | 733 tests/ref/fate/webp-rgb-lena-lossless | 2 +- tests/ref/fate/webp-rgb-lena-lossless-rgb24 | 2 +- tests/ref/fate/webp-rgb-lossless| 2 +- tests/ref/fate/webp-rgb-lossy-q80 | 2 +- tests/ref/fate/webp-rgba-lossless | 2 +- tests/ref/fate/webp-rgba-lossy-q80 | 2 +- 12 files changed, 771 insertions(+), 7 deletions(-) create mode 100644 libavformat/webpdec.c [...] +switch (chunk_type) { +case MKTAG('R', 'I', 'F', 'F'): +if (avio_tell(pb) != wdc->file_start + 8) { +// premature RIFF found, shorten the file size +WebPHeaders *tmp = webp_headers_lower_or_equal(wdc->webp_headers, + wdc->num_webp_headers, + avio_tell(pb)); +tmp->webp_size -= wdc->remaining_size; +wdc->remaining_size = 0; [...] + +if (wdc->remaining_size > 0 && avio_feof(pb)) { +// premature EOF, shorten the file size I'm not sure about this. If the file is truncated shouldn't this be treated as an error? Either it might be worth trying to decode what is left, or the size in the header might have even been damaged. Thanks, Thilo ___ 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 v3 0/6] webp: add support for animated WebP decoding
All issues of v2 fixed. Makes tsan happy now as well. Patch 5/6 is still there for making changes in lavc/webp reviewable but shall be stashed when pushing. -Thilo Josef Zlomek (2): libavcodec/webp: add support for animated WebP decoding libavformat/webp: add WebP demuxer Thilo Borgmann (4): avcodec/webp: move definitions into header avcodec/webp: remove unused definitions avcodec/webp_parser: parse each frame into one packet avcodec/webp: make init_canvas_frame static Changelog | 2 + doc/demuxers.texi | 28 + libavcodec/codec_desc.c | 3 +- libavcodec/version.h| 2 +- libavcodec/webp.c | 714 +-- libavcodec/webp.h | 38 + libavcodec/webp_parser.c| 130 ++-- libavformat/Makefile| 1 + libavformat/allformats.c| 1 + libavformat/version.h | 2 +- libavformat/webpdec.c | 733 tests/ref/fate/exif-image-webp | 12 +- tests/ref/fate/webp-rgb-lena-lossless | 2 +- tests/ref/fate/webp-rgb-lena-lossless-rgb24 | 2 +- tests/ref/fate/webp-rgb-lossless| 2 +- tests/ref/fate/webp-rgb-lossy-q80 | 2 +- tests/ref/fate/webp-rgba-lossless | 2 +- tests/ref/fate/webp-rgba-lossy-q80 | 2 +- 18 files changed, 1563 insertions(+), 115 deletions(-) create mode 100644 libavcodec/webp.h create mode 100644 libavformat/webpdec.c -- 2.37.1 (Apple Git-137.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 v3 1/6] avcodec/webp: move definitions into header
--- libavcodec/webp.c | 1 + libavcodec/webp.h | 38 ++ 2 files changed, 39 insertions(+) create mode 100644 libavcodec/webp.h diff --git a/libavcodec/webp.c b/libavcodec/webp.c index d35cb66f8d..b0475c344a 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -52,6 +52,7 @@ #include "thread.h" #include "tiff_common.h" #include "vp8.h" +#include "webp.h" #define VP8X_FLAG_ANIMATION 0x02 #define VP8X_FLAG_XMP_METADATA 0x04 diff --git a/libavcodec/webp.h b/libavcodec/webp.h new file mode 100644 index 00..53bf59e7cd --- /dev/null +++ b/libavcodec/webp.h @@ -0,0 +1,38 @@ +/* + * WebP image format definitions + * Copyright (c) 2020 Pexeso Inc. + * + * 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 + */ + +/** + * @file + * WebP image format definitions. + */ + +#ifndef AVCODEC_WEBP_H +#define AVCODEC_WEBP_H + +#define ANMF_DISPOSAL_METHOD0x01 +#define ANMF_DISPOSAL_METHOD_UNCHANGED 0x00 +#define ANMF_DISPOSAL_METHOD_BACKGROUND 0x01 + +#define ANMF_BLENDING_METHOD0x02 +#define ANMF_BLENDING_METHOD_ALPHA 0x00 +#define ANMF_BLENDING_METHOD_OVERWRITE 0x02 + +#endif /* AVCODEC_WEBP_H */ -- 2.37.1 (Apple Git-137.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 v3 2/6] avcodec/webp: remove unused definitions
--- libavcodec/webp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index b0475c344a..6ba81a6a99 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -60,8 +60,6 @@ #define VP8X_FLAG_ALPHA 0x10 #define VP8X_FLAG_ICC 0x20 -#define MAX_PALETTE_SIZE256 -#define MAX_CACHE_BITS 11 #define NUM_CODE_LENGTH_CODES 19 #define HUFFMAN_CODES_PER_META_CODE 5 #define NUM_LITERAL_CODES 256 -- 2.37.1 (Apple Git-137.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 v3 4/6] libavcodec/webp: add support for animated WebP decoding
From: Josef Zlomek Fixes: 4907 Adds support for decoding of animated WebP. The WebP decoder adds the animation related features according to the specs: https://developers.google.com/speed/webp/docs/riff_container#animation The frames of the animation may be smaller than the image canvas. Therefore, the frame is decoded to a temporary frame, then it is blended into the canvas, the canvas is copied to the output frame, and finally the frame is disposed from the canvas. The output to AV_PIX_FMT_YUVA420P/AV_PIX_FMT_YUV420P is still supported. The background color is specified only as BGRA in the WebP file so it is converted to YUVA if YUV formats are output. Signed-off-by: Josef Zlomek --- Changelog | 1 + libavcodec/codec_desc.c | 3 +- libavcodec/version.h| 2 +- libavcodec/webp.c | 718 4 files changed, 662 insertions(+), 62 deletions(-) diff --git a/Changelog b/Changelog index 3876082844..271926ed8f 100644 --- a/Changelog +++ b/Changelog @@ -25,6 +25,7 @@ version : - Raw VVC bitstream parser, muxer and demuxer - Bitstream filter for editing metadata in VVC streams - Bitstream filter for converting VVC from MP4 to Annex B +- animated WebP parser/decoder version 6.0: - Radiance HDR image support diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c index 4406dd8318..47a38a4036 100644 --- a/libavcodec/codec_desc.c +++ b/libavcodec/codec_desc.c @@ -1259,8 +1259,7 @@ static const AVCodecDescriptor codec_descriptors[] = { .type = AVMEDIA_TYPE_VIDEO, .name = "webp", .long_name = NULL_IF_CONFIG_SMALL("WebP"), -.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, +.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, .mime_types= MT("image/webp"), }, { diff --git a/libavcodec/version.h b/libavcodec/version.h index 9411511e04..9f55381cf1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #include "version_major.h" #define LIBAVCODEC_VERSION_MINOR 22 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 6ba81a6a99..8cc417af36 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -35,12 +35,16 @@ * Exif metadata * ICC profile * + * @author Josef Zlomek, Pexeso Inc. + * Animation + * * Unimplemented: - * - Animation * - XMP metadata */ +#include "libavcodec/packet.h" #include "libavutil/imgutils.h" +#include "libavutil/colorspace.h" #define BITSTREAM_READER_LE #include "avcodec.h" @@ -192,6 +196,8 @@ typedef struct ImageContext { typedef struct WebPContext { VP8Context v; /* VP8 Context used for lossy decoding */ GetBitContext gb; /* bitstream reader for main image chunk */ +ThreadFrame canvas_frame; /* ThreadFrame for canvas */ +AVFrame *frame; /* AVFrame for decoded frame */ AVFrame *alpha_frame; /* AVFrame for alpha data decompressed from VP8L */ AVPacket *pkt; /* AVPacket to be passed to the underlying VP8 decoder */ AVCodecContext *avctx; /* parent AVCodecContext */ @@ -203,9 +209,24 @@ typedef struct WebPContext { int alpha_data_size;/* alpha chunk data size */ int has_exif; /* set after an EXIF chunk has been processed */ int has_iccp; /* set after an ICCP chunk has been processed */ -int width; /* image width */ -int height; /* image height */ -int lossless; /* indicates lossless or lossy */ +int vp8x_flags; /* global flags from VP8X chunk */ +int canvas_width; /* canvas width */ +int canvas_height; /* canvas height */ +int anmf_flags; /* frame flags from ANMF chunk */ +int width; /* frame width */ +int height; /* frame height */ +int pos_x; /* frame position X */ +int pos_y; /* frame position Y */ +int prev_anmf_flags;/* previous frame flags from ANMF chunk */ +int prev_width; /* previous frame width */ +int prev_height;/* previous frame height */ +int prev_pos_x; /* previous frame position X */ +int prev_pos_y; /* previous frame position Y */ +int await_progress; /* value of progress to wait for */ +uint8_t background_argb[4]; /* backgroun
[FFmpeg-devel] [PATCH v3 3/6] avcodec/webp_parser: parse each frame into one packet
--- libavcodec/webp_parser.c | 130 +++ 1 file changed, 89 insertions(+), 41 deletions(-) diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c index bd5f94dac5..da853bb1f5 100644 --- a/libavcodec/webp_parser.c +++ b/libavcodec/webp_parser.c @@ -25,13 +25,17 @@ #include "libavutil/bswap.h" #include "libavutil/common.h" +#include "libavutil/intreadwrite.h" #include "parser.h" typedef struct WebPParseContext { ParseContext pc; +int frame; +int first_frame; uint32_t fsize; -uint32_t remaining_size; +uint32_t remaining_file_size; +uint32_t remaining_tag_size; } WebPParseContext; static int webp_parse(AVCodecParserContext *s, AVCodecContext *avctx, @@ -41,62 +45,106 @@ static int webp_parse(AVCodecParserContext *s, AVCodecContext *avctx, WebPParseContext *ctx = s->priv_data; uint64_t state = ctx->pc.state64; int next = END_NOT_FOUND; -int i = 0; +int i, len; -*poutbuf = NULL; -*poutbuf_size = 0; - -restart: -if (ctx->pc.frame_start_found <= 8) { -for (; i < buf_size; i++) { +for (i = 0; i < buf_size;) { +if (ctx->remaining_tag_size) { +/* consuming tag */ +len = FFMIN(ctx->remaining_tag_size, buf_size - i); +i += len; +ctx->remaining_tag_size -= len; +ctx->remaining_file_size -= len; +} else { +/* scan for the next tag or file */ state = (state << 8) | buf[i]; -if (ctx->pc.frame_start_found == 0) { -if ((state >> 32) == MKBETAG('R', 'I', 'F', 'F')) { -ctx->fsize = av_bswap32(state); -if (ctx->fsize > 15 && ctx->fsize <= UINT32_MAX - 10) { -ctx->pc.frame_start_found = 1; -ctx->fsize += 8; +i++; + +if (!ctx->remaining_file_size) { +/* scan for the next file */ +if (ctx->pc.frame_start_found == 4) { +ctx->pc.frame_start_found = 0; +if ((uint32_t) state == MKBETAG('W', 'E', 'B', 'P')) { +if (ctx->frame || i != 12) { +ctx->frame = 0; +next = i - 12; +state = 0; +ctx->pc.frame_start_found = 0; +break; +} +ctx->remaining_file_size = ctx->fsize - 4; +ctx->first_frame = 1; +continue; } } -} else if (ctx->pc.frame_start_found == 8) { -if ((state >> 32) != MKBETAG('W', 'E', 'B', 'P')) { +if (ctx->pc.frame_start_found == 0) { +if ((state >> 32) == MKBETAG('R', 'I', 'F', 'F')) { +ctx->fsize = av_bswap32(state); +if (ctx->fsize > 15 && ctx->fsize <= UINT32_MAX - 10) { +ctx->fsize += (ctx->fsize & 1); +ctx->pc.frame_start_found = 1; +} +} +} else +ctx->pc.frame_start_found++; +} else { +/* read the next tag */ +ctx->remaining_file_size--; +if (ctx->remaining_file_size == 0) { ctx->pc.frame_start_found = 0; continue; } ctx->pc.frame_start_found++; -ctx->remaining_size = ctx->fsize + i - 15; -if (ctx->pc.index + i > 15) { -next = i - 15; -state = 0; +if (ctx->pc.frame_start_found < 8) +continue; + +switch (state >> 32) { +case MKBETAG('A', 'N', 'M', 'F'): +case MKBETAG('V', 'P', '8', ' '): +case MKBETAG('V', 'P', '8', 'L'): +if (ctx->frame) { +ctx->frame = 0; +next = i - 8; +state = 0; +ctx->pc.frame_start_found = 0; +goto flush; +} +ctx->frame = 1; +break; +default: break; -} else { -ctx->pc.state64 = 0; -goto restart; } -} else if (ctx->pc.frame_start_found) -ctx->pc.frame_start_found++; -} -ctx->pc.state64 = state; -} else { -if (ctx->remaining_size) { -i = FFMIN(ctx->remaining_size, buf_size); -ctx->remaining_size -= i; -if (ctx->remaining_size) -goto flush; -ctx->pc.frame_start_found = 0; -goto res
[FFmpeg-devel] [PATCH v3 6/6] libavformat/webp: add WebP demuxer
From: Josef Zlomek Adds the demuxer of animated WebP files. It supports non-animated, animated, truncated, and concatenated files. Reading from a pipe (and other non-seekable inputs) is also supported. The WebP demuxer splits the input stream into packets containing one frame. It also marks the key frames properly. The loop count is ignored by default (same behaviour as animated PNG and GIF), it may be enabled by the option '-ignore_loop 0'. The frame rate is set according to the frame delay in the ANMF chunk. If the delay is too low, or the image is not animated, the default frame rate is set to 10 fps, similarly to other WebP libraries and browsers. The fate suite was updated accordingly. Signed-off-by: Josef Zlomek --- Changelog | 1 + doc/demuxers.texi | 28 + libavformat/Makefile| 1 + libavformat/allformats.c| 1 + libavformat/version.h | 2 +- libavformat/webpdec.c | 733 tests/ref/fate/exif-image-webp | 12 +- tests/ref/fate/webp-rgb-lena-lossless | 2 +- tests/ref/fate/webp-rgb-lena-lossless-rgb24 | 2 +- tests/ref/fate/webp-rgb-lossless| 2 +- tests/ref/fate/webp-rgb-lossy-q80 | 2 +- tests/ref/fate/webp-rgba-lossless | 2 +- tests/ref/fate/webp-rgba-lossy-q80 | 2 +- 13 files changed, 777 insertions(+), 13 deletions(-) create mode 100644 libavformat/webpdec.c diff --git a/Changelog b/Changelog index 271926ed8f..9d16537e2d 100644 --- a/Changelog +++ b/Changelog @@ -26,6 +26,7 @@ version : - Bitstream filter for editing metadata in VVC streams - Bitstream filter for converting VVC from MP4 to Annex B - animated WebP parser/decoder +- animated WebP demuxer version 6.0: - Radiance HDR image support diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 2d33b47a56..084a9c97bb 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -936,4 +936,32 @@ which in turn, acts as a ceiling for the size of scripts that can be read. Default is 1 MiB. @end table +@section webp + +Animated WebP demuxer. + +It accepts the following options: + +@table @option +@item -min_delay @var{int} +Set the minimum valid delay between frames in milliseconds. +Range is 0 to 6. Default value is 10. + +@item -max_webp_delay @var{int} +Set the maximum valid delay between frames in milliseconds. +Range is 0 to 16777215. Default value is 16777215 (over four hours), +the maximum value allowed by the specification. + +@item -default_delay @var{int} +Set the default delay between frames in milliseconds. +Range is 0 to 6. Default value is 100. + +@item -ignore_loop @var{bool} +WebP files can contain information to loop a certain number of times +(or infinitely). If @option{ignore_loop} is set to true, then the loop +setting from the input will be ignored and looping will not occur. +If set to false, then looping will occur and will cycle the number +of times according to the WebP. Default value is true. +@end table + @c man end DEMUXERS diff --git a/libavformat/Makefile b/libavformat/Makefile index 4cb00f8700..4293dad0c6 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -616,6 +616,7 @@ OBJS-$(CONFIG_WEBM_MUXER)+= matroskaenc.o matroska.o \ av1.o avlanguage.o OBJS-$(CONFIG_WEBM_DASH_MANIFEST_MUXER) += webmdashenc.o OBJS-$(CONFIG_WEBM_CHUNK_MUXER) += webm_chunk.o +OBJS-$(CONFIG_WEBP_DEMUXER) += webpdec.o OBJS-$(CONFIG_WEBP_MUXER)+= webpenc.o OBJS-$(CONFIG_WEBVTT_DEMUXER)+= webvttdec.o subtitles.o OBJS-$(CONFIG_WEBVTT_MUXER) += webvttenc.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 6324952bd2..98ed52bbde 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -500,6 +500,7 @@ extern const AVInputFormat ff_webm_dash_manifest_demuxer; extern const FFOutputFormat ff_webm_dash_manifest_muxer; extern const FFOutputFormat ff_webm_chunk_muxer; extern const FFOutputFormat ff_webp_muxer; +extern const AVInputFormat ff_webp_demuxer; extern const AVInputFormat ff_webvtt_demuxer; extern const FFOutputFormat ff_webvtt_muxer; extern const AVInputFormat ff_wsaud_demuxer; diff --git a/libavformat/version.h b/libavformat/version.h index 979952183c..787ee8c90b 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFORMAT_VERSION_MINOR 10 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ diff --git a/libavformat/webpdec.c b/libavformat/webpdec.c new file mode 100644 index 00..b4024809f7 --- /dev/null +++ b/libavformat/webpde
[FFmpeg-devel] [PATCH v3 5/6] avcodec/webp: make init_canvas_frame static
--- libavcodec/webp.c | 143 +++--- 1 file changed, 71 insertions(+), 72 deletions(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 8cc417af36..277f2c58bb 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -1351,7 +1351,77 @@ static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p, } return ret; } -int init_canvas_frame(WebPContext *s, int format, int key_frame); + +static int init_canvas_frame(WebPContext *s, int format, int key_frame) +{ +AVFrame *canvas = s->canvas_frame.f; +int height; +int ret; + +// canvas is needed only for animation +if (!(s->vp8x_flags & VP8X_FLAG_ANIMATION)) +return 0; + +// avoid init for non-key frames whose format and size did not change +if (!key_frame && +canvas->data[0] && +canvas->format == format && +canvas->width == s->canvas_width && +canvas->height == s->canvas_height) +return 0; + +// canvas changes within IPPP sequences will lose thread sync +// because of the ThreadFrame reallocation and will wait forever +// so if frame-threading is used, forbid canvas changes and unlock +// previous frames +if (!key_frame && canvas->data[0]) { +if (s->avctx->thread_count > 1) { +av_log(s->avctx, AV_LOG_WARNING, "Canvas change detected. The output will be damaged. Use -threads 1 to try decoding with best effort.\n"); +// unlock previous frames that have sent an _await() call +ff_thread_report_progress(&s->canvas_frame, INT_MAX, 0); +return AVERROR_PATCHWELCOME; +} else { +// warn for damaged frames +av_log(s->avctx, AV_LOG_WARNING, "Canvas change detected. The output will be damaged.\n"); +} +} + +s->avctx->pix_fmt = format; +canvas->format= format; +canvas->width = s->canvas_width; +canvas->height= s->canvas_height; + +// VP8 decoder changed the width and height in AVCodecContext. +// Change it back to the canvas size. +ret = ff_set_dimensions(s->avctx, s->canvas_width, s->canvas_height); +if (ret < 0) +return ret; + +ff_thread_release_ext_buffer(s->avctx, &s->canvas_frame); +ret = ff_thread_get_ext_buffer(s->avctx, &s->canvas_frame, AV_GET_BUFFER_FLAG_REF); +if (ret < 0) +return ret; + +if (canvas->format == AV_PIX_FMT_ARGB) { +height = canvas->height; +memset(canvas->data[0], 0, height * canvas->linesize[0]); +} else /* if (canvas->format == AV_PIX_FMT_YUVA420P) */ { +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(canvas->format); +for (int comp = 0; comp < desc->nb_components; comp++) { +int plane = desc->comp[comp].plane; + +if (comp == 1 || comp == 2) +height = AV_CEIL_RSHIFT(canvas->height, desc->log2_chroma_h); +else +height = FFALIGN(canvas->height, 1 << desc->log2_chroma_h); + +memset(canvas->data[plane], s->transparent_yuva[plane], + height * canvas->linesize[plane]); +} +} + +return 0; +} static int webp_decode_frame_common(AVCodecContext *avctx, uint8_t *data, int size, int *got_frame, int key_frame) @@ -1590,77 +1660,6 @@ exif_end: return size; } -int init_canvas_frame(WebPContext *s, int format, int key_frame) -{ -AVFrame *canvas = s->canvas_frame.f; -int height; -int ret; - -// canvas is needed only for animation -if (!(s->vp8x_flags & VP8X_FLAG_ANIMATION)) -return 0; - -// avoid init for non-key frames whose format and size did not change -if (!key_frame && -canvas->data[0] && -canvas->format == format && -canvas->width == s->canvas_width && -canvas->height == s->canvas_height) -return 0; - -// canvas changes within IPPP sequences will loose thread sync -// because of the ThreadFrame reallocation and will wait forever -// so if frame-threading is used, forbid canvas changes and unlock -// previous frames -if (!key_frame && canvas->data[0]) { -if (s->avctx->thread_count > 1) { -av_log(s->avctx, AV_LOG_WARNING, "Canvas change detected. The output will be damaged. Use -threads 1 to try decoding with best effort.\n"); -// unlock previous frames that have sent an _await() call -ff_thread_report_progress(&s->canvas_frame, INT_MAX, 0); -return AVERROR_PATCHWELCOME; -} else { -// warn for damaged frames -av_log(s->avctx, AV_LOG_WARNING, "Canvas change detected. The output will be damaged.\n"); -} -} - -s->avctx->pix_fmt = format; -canvas->format= format; -canvas->width = s->canvas_width; -canvas->height= s->canvas_height; - -// VP8 decoder changed the width and height in AVCodecContext. -
[FFmpeg-devel] [PATCH] avcodec/codec_par: always free side data in the destination AVCodecContext
Signed-off-by: James Almer --- libavcodec/codec_par.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c index 775c187073..a38a475dc7 100644 --- a/libavcodec/codec_par.c +++ b/libavcodec/codec_par.c @@ -253,8 +253,8 @@ FF_ENABLE_DEPRECATION_WARNINGS break; } +av_freep(&codec->extradata); if (par->extradata) { -av_freep(&codec->extradata); codec->extradata = av_mallocz(par->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return AVERROR(ENOMEM); -- 2.41.0 ___ 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".