From 1279098d7bea4440036fb50884773d620b00812c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 13 Oct 2011 08:21:45 +0200 Subject: [PATCH 01/12] presets: update libx264 ffpresets Use the native libx264 options and rename all the preset to use the avpreset extension. --- ffpresets/libx264-baseline.avpreset | 1 + ffpresets/libx264-baseline.ffpreset | 4 ---- ffpresets/libx264-fast.avpreset | 1 + ffpresets/libx264-fast.ffpreset | 23 ------------------ ffpresets/libx264-fast_firstpass.avpreset | 2 ++ ffpresets/libx264-fast_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-faster.avpreset | 1 + ffpresets/libx264-faster.ffpreset | 23 ------------------ ffpresets/libx264-faster_firstpass.avpreset | 2 ++ ffpresets/libx264-faster_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-ipod320.avpreset | 4 ++++ ffpresets/libx264-ipod320.ffpreset | 7 ------ ffpresets/libx264-ipod640.avpreset | 4 ++++ ffpresets/libx264-ipod640.ffpreset | 8 ------- ffpresets/libx264-lossless_fast.avpreset | 2 ++ ffpresets/libx264-lossless_fast.ffpreset | 20 ---------------- ffpresets/libx264-lossless_max.avpreset | 2 ++ ffpresets/libx264-lossless_max.ffpreset | 21 ---------------- ffpresets/libx264-lossless_medium.avpreset | 2 ++ ffpresets/libx264-lossless_medium.ffpreset | 20 ---------------- ffpresets/libx264-lossless_slow.avpreset | 2 ++ ffpresets/libx264-lossless_slow.ffpreset | 21 ---------------- ffpresets/libx264-lossless_slower.avpreset | 2 ++ ffpresets/libx264-lossless_slower.ffpreset | 21 ---------------- ffpresets/libx264-lossless_ultrafast.avpreset | 2 ++ ffpresets/libx264-lossless_ultrafast.ffpreset | 19 --------------- ffpresets/libx264-main.avpreset | 1 + ffpresets/libx264-main.ffpreset | 1 - ffpresets/libx264-medium.avpreset | 1 + ffpresets/libx264-medium.ffpreset | 22 ----------------- ffpresets/libx264-medium_firstpass.avpreset | 2 ++ ffpresets/libx264-medium_firstpass.ffpreset | 22 ----------------- ffpresets/libx264-placebo.avpreset | 1 + ffpresets/libx264-placebo.ffpreset | 23 ------------------ ffpresets/libx264-placebo_firstpass.avpreset | 2 ++ ffpresets/libx264-placebo_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-slow.avpreset | 1 + ffpresets/libx264-slow.ffpreset | 23 ------------------ ffpresets/libx264-slow_firstpass.avpreset | 2 ++ ffpresets/libx264-slow_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-slower.avpreset | 1 + ffpresets/libx264-slower.ffpreset | 23 ------------------ ffpresets/libx264-slower_firstpass.avpreset | 2 ++ ffpresets/libx264-slower_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-superfast.avpreset | 1 + ffpresets/libx264-superfast.ffpreset | 23 ------------------ .../libx264-superfast_firstpass.avpreset | 2 ++ .../libx264-superfast_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-ultrafast.avpreset | 1 + ffpresets/libx264-ultrafast.ffpreset | 24 ------------------- .../libx264-ultrafast_firstpass.avpreset | 2 ++ .../libx264-ultrafast_firstpass.ffpreset | 24 ------------------- ffpresets/libx264-veryfast.avpreset | 1 + ffpresets/libx264-veryfast.ffpreset | 23 ------------------ ffpresets/libx264-veryfast_firstpass.avpreset | 2 ++ ffpresets/libx264-veryfast_firstpass.ffpreset | 23 ------------------ ffpresets/libx264-veryslow.avpreset | 1 + ffpresets/libx264-veryslow.ffpreset | 23 ------------------ ffpresets/libx264-veryslow_firstpass.avpreset | 2 ++ ffpresets/libx264-veryslow_firstpass.ffpreset | 23 ------------------ 60 files changed, 52 insertions(+), 602 deletions(-) create mode 100644 ffpresets/libx264-baseline.avpreset delete mode 100644 ffpresets/libx264-baseline.ffpreset create mode 100644 ffpresets/libx264-fast.avpreset delete mode 100644 ffpresets/libx264-fast.ffpreset create mode 100644 ffpresets/libx264-fast_firstpass.avpreset delete mode 100644 ffpresets/libx264-fast_firstpass.ffpreset create mode 100644 ffpresets/libx264-faster.avpreset delete mode 100644 ffpresets/libx264-faster.ffpreset create mode 100644 ffpresets/libx264-faster_firstpass.avpreset delete mode 100644 ffpresets/libx264-faster_firstpass.ffpreset create mode 100644 ffpresets/libx264-ipod320.avpreset delete mode 100644 ffpresets/libx264-ipod320.ffpreset create mode 100644 ffpresets/libx264-ipod640.avpreset delete mode 100644 ffpresets/libx264-ipod640.ffpreset create mode 100644 ffpresets/libx264-lossless_fast.avpreset delete mode 100644 ffpresets/libx264-lossless_fast.ffpreset create mode 100644 ffpresets/libx264-lossless_max.avpreset delete mode 100644 ffpresets/libx264-lossless_max.ffpreset create mode 100644 ffpresets/libx264-lossless_medium.avpreset delete mode 100644 ffpresets/libx264-lossless_medium.ffpreset create mode 100644 ffpresets/libx264-lossless_slow.avpreset delete mode 100644 ffpresets/libx264-lossless_slow.ffpreset create mode 100644 ffpresets/libx264-lossless_slower.avpreset delete mode 100644 ffpresets/libx264-lossless_slower.ffpreset create mode 100644 ffpresets/libx264-lossless_ultrafast.avpreset delete mode 100644 ffpresets/libx264-lossless_ultrafast.ffpreset create mode 100644 ffpresets/libx264-main.avpreset delete mode 100644 ffpresets/libx264-main.ffpreset create mode 100644 ffpresets/libx264-medium.avpreset delete mode 100644 ffpresets/libx264-medium.ffpreset create mode 100644 ffpresets/libx264-medium_firstpass.avpreset delete mode 100644 ffpresets/libx264-medium_firstpass.ffpreset create mode 100644 ffpresets/libx264-placebo.avpreset delete mode 100644 ffpresets/libx264-placebo.ffpreset create mode 100644 ffpresets/libx264-placebo_firstpass.avpreset delete mode 100644 ffpresets/libx264-placebo_firstpass.ffpreset create mode 100644 ffpresets/libx264-slow.avpreset delete mode 100644 ffpresets/libx264-slow.ffpreset create mode 100644 ffpresets/libx264-slow_firstpass.avpreset delete mode 100644 ffpresets/libx264-slow_firstpass.ffpreset create mode 100644 ffpresets/libx264-slower.avpreset delete mode 100644 ffpresets/libx264-slower.ffpreset create mode 100644 ffpresets/libx264-slower_firstpass.avpreset delete mode 100644 ffpresets/libx264-slower_firstpass.ffpreset create mode 100644 ffpresets/libx264-superfast.avpreset delete mode 100644 ffpresets/libx264-superfast.ffpreset create mode 100644 ffpresets/libx264-superfast_firstpass.avpreset delete mode 100644 ffpresets/libx264-superfast_firstpass.ffpreset create mode 100644 ffpresets/libx264-ultrafast.avpreset delete mode 100644 ffpresets/libx264-ultrafast.ffpreset create mode 100644 ffpresets/libx264-ultrafast_firstpass.avpreset delete mode 100644 ffpresets/libx264-ultrafast_firstpass.ffpreset create mode 100644 ffpresets/libx264-veryfast.avpreset delete mode 100644 ffpresets/libx264-veryfast.ffpreset create mode 100644 ffpresets/libx264-veryfast_firstpass.avpreset delete mode 100644 ffpresets/libx264-veryfast_firstpass.ffpreset create mode 100644 ffpresets/libx264-veryslow.avpreset delete mode 100644 ffpresets/libx264-veryslow.ffpreset create mode 100644 ffpresets/libx264-veryslow_firstpass.avpreset delete mode 100644 ffpresets/libx264-veryslow_firstpass.ffpreset diff --git a/ffpresets/libx264-baseline.avpreset b/ffpresets/libx264-baseline.avpreset new file mode 100644 index 0000000000..0626e28440 --- /dev/null +++ b/ffpresets/libx264-baseline.avpreset @@ -0,0 +1 @@ +profile=baseline diff --git a/ffpresets/libx264-baseline.ffpreset b/ffpresets/libx264-baseline.ffpreset deleted file mode 100644 index ee7654bdec..0000000000 --- a/ffpresets/libx264-baseline.ffpreset +++ /dev/null @@ -1,4 +0,0 @@ -coder=0 -bf=0 -flags2=-wpred-dct8x8 -wpredp=0 diff --git a/ffpresets/libx264-fast.avpreset b/ffpresets/libx264-fast.avpreset new file mode 100644 index 0000000000..a8c526e8b4 --- /dev/null +++ b/ffpresets/libx264-fast.avpreset @@ -0,0 +1 @@ +preset=fast diff --git a/ffpresets/libx264-fast.ffpreset b/ffpresets/libx264-fast.ffpreset deleted file mode 100644 index 65201331bd..0000000000 --- a/ffpresets/libx264-fast.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partb8x8 -me_method=hex -subq=6 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=2 -directpred=1 -trellis=1 -flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp=2 -rc_lookahead=30 diff --git a/ffpresets/libx264-fast_firstpass.avpreset b/ffpresets/libx264-fast_firstpass.avpreset new file mode 100644 index 0000000000..d9cf5afe0e --- /dev/null +++ b/ffpresets/libx264-fast_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=fast +fastfirstpass=1 diff --git a/ffpresets/libx264-fast_firstpass.ffpreset b/ffpresets/libx264-fast_firstpass.ffpreset deleted file mode 100644 index 6fdb4b9e55..0000000000 --- a/ffpresets/libx264-fast_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=2 -rc_lookahead=30 diff --git a/ffpresets/libx264-faster.avpreset b/ffpresets/libx264-faster.avpreset new file mode 100644 index 0000000000..e311989bbb --- /dev/null +++ b/ffpresets/libx264-faster.avpreset @@ -0,0 +1 @@ +preset=faster diff --git a/ffpresets/libx264-faster.ffpreset b/ffpresets/libx264-faster.ffpreset deleted file mode 100644 index 52efc1a325..0000000000 --- a/ffpresets/libx264-faster.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partb8x8 -me_method=hex -subq=4 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=2 -directpred=1 -trellis=1 -flags2=+bpyramid-mixed_refs+wpred+dct8x8+fastpskip -wpredp=1 -rc_lookahead=20 diff --git a/ffpresets/libx264-faster_firstpass.avpreset b/ffpresets/libx264-faster_firstpass.avpreset new file mode 100644 index 0000000000..48a2d443bc --- /dev/null +++ b/ffpresets/libx264-faster_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=faster +fastfirstpass=1 diff --git a/ffpresets/libx264-faster_firstpass.ffpreset b/ffpresets/libx264-faster_firstpass.ffpreset deleted file mode 100644 index 41a87fb6b3..0000000000 --- a/ffpresets/libx264-faster_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=1 -rc_lookahead=20 diff --git a/ffpresets/libx264-ipod320.avpreset b/ffpresets/libx264-ipod320.avpreset new file mode 100644 index 0000000000..6323191740 --- /dev/null +++ b/ffpresets/libx264-ipod320.avpreset @@ -0,0 +1,4 @@ +profile=baseline +level=13 +maxrate=768000 +bufsize=3000000 diff --git a/ffpresets/libx264-ipod320.ffpreset b/ffpresets/libx264-ipod320.ffpreset deleted file mode 100644 index 943b521348..0000000000 --- a/ffpresets/libx264-ipod320.ffpreset +++ /dev/null @@ -1,7 +0,0 @@ -coder=0 -bf=0 -flags2=-wpred-dct8x8 -level=13 -maxrate=768000 -bufsize=3000000 -wpredp=0 diff --git a/ffpresets/libx264-ipod640.avpreset b/ffpresets/libx264-ipod640.avpreset new file mode 100644 index 0000000000..c2c3e1a88e --- /dev/null +++ b/ffpresets/libx264-ipod640.avpreset @@ -0,0 +1,4 @@ +profile=baseline +level=30 +maxrate=10000000 +bufsize=10000000 diff --git a/ffpresets/libx264-ipod640.ffpreset b/ffpresets/libx264-ipod640.ffpreset deleted file mode 100644 index 1ed3d9fb28..0000000000 --- a/ffpresets/libx264-ipod640.ffpreset +++ /dev/null @@ -1,8 +0,0 @@ -coder=0 -bf=0 -refs=1 -flags2=-wpred-dct8x8 -level=30 -maxrate=10000000 -bufsize=10000000 -wpredp=0 diff --git a/ffpresets/libx264-lossless_fast.avpreset b/ffpresets/libx264-lossless_fast.avpreset new file mode 100644 index 0000000000..1658d563aa --- /dev/null +++ b/ffpresets/libx264-lossless_fast.avpreset @@ -0,0 +1,2 @@ +preset=fast +qp=0 diff --git a/ffpresets/libx264-lossless_fast.ffpreset b/ffpresets/libx264-lossless_fast.ffpreset deleted file mode 100644 index 49b9ed1add..0000000000 --- a/ffpresets/libx264-lossless_fast.ffpreset +++ /dev/null @@ -1,20 +0,0 @@ -coder=0 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8+parti4x4+partp8x8-partp4x4-partb8x8 -me_method=hex -subq=3 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -directpred=1 -flags2=+fastpskip -cqp=0 -wpredp=0 diff --git a/ffpresets/libx264-lossless_max.avpreset b/ffpresets/libx264-lossless_max.avpreset new file mode 100644 index 0000000000..c25ff32d16 --- /dev/null +++ b/ffpresets/libx264-lossless_max.avpreset @@ -0,0 +1,2 @@ +preset=placebo +qp=0 diff --git a/ffpresets/libx264-lossless_max.ffpreset b/ffpresets/libx264-lossless_max.ffpreset deleted file mode 100644 index f32d7b40c6..0000000000 --- a/ffpresets/libx264-lossless_max.ffpreset +++ /dev/null @@ -1,21 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 -me_method=esa -subq=8 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -refs=16 -directpred=1 -flags2=+mixed_refs+dct8x8+fastpskip -cqp=0 -wpredp=2 diff --git a/ffpresets/libx264-lossless_medium.avpreset b/ffpresets/libx264-lossless_medium.avpreset new file mode 100644 index 0000000000..f7b1d81f39 --- /dev/null +++ b/ffpresets/libx264-lossless_medium.avpreset @@ -0,0 +1,2 @@ +preset=medium +qp=0 diff --git a/ffpresets/libx264-lossless_medium.ffpreset b/ffpresets/libx264-lossless_medium.ffpreset deleted file mode 100644 index 0b84612fcb..0000000000 --- a/ffpresets/libx264-lossless_medium.ffpreset +++ /dev/null @@ -1,20 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 -me_method=hex -subq=5 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -directpred=1 -flags2=+fastpskip -cqp=0 -wpredp=2 diff --git a/ffpresets/libx264-lossless_slow.avpreset b/ffpresets/libx264-lossless_slow.avpreset new file mode 100644 index 0000000000..a15ff4c426 --- /dev/null +++ b/ffpresets/libx264-lossless_slow.avpreset @@ -0,0 +1,2 @@ +preset=slow +qp=0 diff --git a/ffpresets/libx264-lossless_slow.ffpreset b/ffpresets/libx264-lossless_slow.ffpreset deleted file mode 100644 index 857d3d1986..0000000000 --- a/ffpresets/libx264-lossless_slow.ffpreset +++ /dev/null @@ -1,21 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 -me_method=umh -subq=6 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -refs=2 -directpred=1 -flags2=+dct8x8+fastpskip -cqp=0 -wpredp=2 diff --git a/ffpresets/libx264-lossless_slower.avpreset b/ffpresets/libx264-lossless_slower.avpreset new file mode 100644 index 0000000000..bd71f03291 --- /dev/null +++ b/ffpresets/libx264-lossless_slower.avpreset @@ -0,0 +1,2 @@ +preset=slower +qp=0 diff --git a/ffpresets/libx264-lossless_slower.ffpreset b/ffpresets/libx264-lossless_slower.ffpreset deleted file mode 100644 index ef0609f1b6..0000000000 --- a/ffpresets/libx264-lossless_slower.ffpreset +++ /dev/null @@ -1,21 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 -me_method=umh -subq=8 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -refs=4 -directpred=1 -flags2=+mixed_refs+dct8x8+fastpskip -cqp=0 -wpredp=2 diff --git a/ffpresets/libx264-lossless_ultrafast.avpreset b/ffpresets/libx264-lossless_ultrafast.avpreset new file mode 100644 index 0000000000..4d71eb72aa --- /dev/null +++ b/ffpresets/libx264-lossless_ultrafast.avpreset @@ -0,0 +1,2 @@ +preset=ultrafast +qp=0 diff --git a/ffpresets/libx264-lossless_ultrafast.ffpreset b/ffpresets/libx264-lossless_ultrafast.ffpreset deleted file mode 100644 index 4cc84f1b4f..0000000000 --- a/ffpresets/libx264-lossless_ultrafast.ffpreset +++ /dev/null @@ -1,19 +0,0 @@ -coder=0 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -me_method=dia -subq=0 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -directpred=1 -flags2=+fastpskip -cqp=0 diff --git a/ffpresets/libx264-main.avpreset b/ffpresets/libx264-main.avpreset new file mode 100644 index 0000000000..336c69b3af --- /dev/null +++ b/ffpresets/libx264-main.avpreset @@ -0,0 +1 @@ +profile=main diff --git a/ffpresets/libx264-main.ffpreset b/ffpresets/libx264-main.ffpreset deleted file mode 100644 index d1dc7ddae9..0000000000 --- a/ffpresets/libx264-main.ffpreset +++ /dev/null @@ -1 +0,0 @@ -flags2=-dct8x8 diff --git a/ffpresets/libx264-medium.avpreset b/ffpresets/libx264-medium.avpreset new file mode 100644 index 0000000000..261d584f95 --- /dev/null +++ b/ffpresets/libx264-medium.avpreset @@ -0,0 +1 @@ +preset=medium diff --git a/ffpresets/libx264-medium.ffpreset b/ffpresets/libx264-medium.ffpreset deleted file mode 100644 index 685995226d..0000000000 --- a/ffpresets/libx264-medium.ffpreset +++ /dev/null @@ -1,22 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partb8x8 -me_method=hex -subq=7 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=3 -directpred=1 -trellis=1 -flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp=2 diff --git a/ffpresets/libx264-medium_firstpass.avpreset b/ffpresets/libx264-medium_firstpass.avpreset new file mode 100644 index 0000000000..06c8f9f8fb --- /dev/null +++ b/ffpresets/libx264-medium_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=medium +fastfirstpass=1 diff --git a/ffpresets/libx264-medium_firstpass.ffpreset b/ffpresets/libx264-medium_firstpass.ffpreset deleted file mode 100644 index ca304ee24d..0000000000 --- a/ffpresets/libx264-medium_firstpass.ffpreset +++ /dev/null @@ -1,22 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=2 diff --git a/ffpresets/libx264-placebo.avpreset b/ffpresets/libx264-placebo.avpreset new file mode 100644 index 0000000000..93d721d004 --- /dev/null +++ b/ffpresets/libx264-placebo.avpreset @@ -0,0 +1 @@ +preset=placebo diff --git a/ffpresets/libx264-placebo.ffpreset b/ffpresets/libx264-placebo.ffpreset deleted file mode 100644 index 7923a76c74..0000000000 --- a/ffpresets/libx264-placebo.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -me_method=tesa -subq=10 -me_range=24 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=16 -refs=16 -directpred=3 -trellis=2 -flags2=+bpyramid+mixed_refs+wpred+dct8x8-fastpskip -wpredp=2 -rc_lookahead=60 diff --git a/ffpresets/libx264-placebo_firstpass.avpreset b/ffpresets/libx264-placebo_firstpass.avpreset new file mode 100644 index 0000000000..c8099e50c7 --- /dev/null +++ b/ffpresets/libx264-placebo_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=placebo +fastfirstpass=1 diff --git a/ffpresets/libx264-placebo_firstpass.ffpreset b/ffpresets/libx264-placebo_firstpass.ffpreset deleted file mode 100644 index 7923a76c74..0000000000 --- a/ffpresets/libx264-placebo_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -me_method=tesa -subq=10 -me_range=24 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=16 -refs=16 -directpred=3 -trellis=2 -flags2=+bpyramid+mixed_refs+wpred+dct8x8-fastpskip -wpredp=2 -rc_lookahead=60 diff --git a/ffpresets/libx264-slow.avpreset b/ffpresets/libx264-slow.avpreset new file mode 100644 index 0000000000..85778ec8ba --- /dev/null +++ b/ffpresets/libx264-slow.avpreset @@ -0,0 +1 @@ +preset=slow diff --git a/ffpresets/libx264-slow.ffpreset b/ffpresets/libx264-slow.ffpreset deleted file mode 100644 index fcbef4bcfc..0000000000 --- a/ffpresets/libx264-slow.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partb8x8 -me_method=umh -subq=8 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=5 -directpred=3 -trellis=1 -flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp=2 -rc_lookahead=50 diff --git a/ffpresets/libx264-slow_firstpass.avpreset b/ffpresets/libx264-slow_firstpass.avpreset new file mode 100644 index 0000000000..9998bc95a2 --- /dev/null +++ b/ffpresets/libx264-slow_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=slow +fastfirstpass=1 diff --git a/ffpresets/libx264-slow_firstpass.ffpreset b/ffpresets/libx264-slow_firstpass.ffpreset deleted file mode 100644 index 74f87b0c2d..0000000000 --- a/ffpresets/libx264-slow_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=3 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=2 -rc_lookahead=50 diff --git a/ffpresets/libx264-slower.avpreset b/ffpresets/libx264-slower.avpreset new file mode 100644 index 0000000000..87d69893f2 --- /dev/null +++ b/ffpresets/libx264-slower.avpreset @@ -0,0 +1 @@ +preset=slower diff --git a/ffpresets/libx264-slower.ffpreset b/ffpresets/libx264-slower.ffpreset deleted file mode 100644 index 741d21f920..0000000000 --- a/ffpresets/libx264-slower.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -me_method=umh -subq=9 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=8 -directpred=3 -trellis=2 -flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp=2 -rc_lookahead=60 diff --git a/ffpresets/libx264-slower_firstpass.avpreset b/ffpresets/libx264-slower_firstpass.avpreset new file mode 100644 index 0000000000..c798b82872 --- /dev/null +++ b/ffpresets/libx264-slower_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=slower +fastfirstpass=1 diff --git a/ffpresets/libx264-slower_firstpass.ffpreset b/ffpresets/libx264-slower_firstpass.ffpreset deleted file mode 100644 index 0be886a156..0000000000 --- a/ffpresets/libx264-slower_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=3 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=2 -rc_lookahead=60 diff --git a/ffpresets/libx264-superfast.avpreset b/ffpresets/libx264-superfast.avpreset new file mode 100644 index 0000000000..1c117ecf60 --- /dev/null +++ b/ffpresets/libx264-superfast.avpreset @@ -0,0 +1 @@ +preset=superfast diff --git a/ffpresets/libx264-superfast.ffpreset b/ffpresets/libx264-superfast.ffpreset deleted file mode 100644 index 7f0f50b782..0000000000 --- a/ffpresets/libx264-superfast.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4-partp8x8-partb8x8 -me_method=dia -subq=1 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred+dct8x8+fastpskip-mbtree -wpredp=0 -rc_lookahead=0 diff --git a/ffpresets/libx264-superfast_firstpass.avpreset b/ffpresets/libx264-superfast_firstpass.avpreset new file mode 100644 index 0000000000..fc70e0970b --- /dev/null +++ b/ffpresets/libx264-superfast_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=superfast +fastfirstpass=1 diff --git a/ffpresets/libx264-superfast_firstpass.ffpreset b/ffpresets/libx264-superfast_firstpass.ffpreset deleted file mode 100644 index 87b4f29012..0000000000 --- a/ffpresets/libx264-superfast_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=1 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip-mbtree -wpredp=0 -rc_lookahead=0 diff --git a/ffpresets/libx264-ultrafast.avpreset b/ffpresets/libx264-ultrafast.avpreset new file mode 100644 index 0000000000..910330188f --- /dev/null +++ b/ffpresets/libx264-ultrafast.avpreset @@ -0,0 +1 @@ +preset=ultrafast diff --git a/ffpresets/libx264-ultrafast.ffpreset b/ffpresets/libx264-ultrafast.ffpreset deleted file mode 100644 index 561191e399..0000000000 --- a/ffpresets/libx264-ultrafast.ffpreset +++ /dev/null @@ -1,24 +0,0 @@ -coder=0 -flags=-loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=0 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=0 -i_qfactor=0.71 -b_strategy=0 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=0 -refs=1 -directpred=1 -trellis=0 -flags2=-bpyramid-mixed_refs-wpred-dct8x8+fastpskip-mbtree -wpredp=0 -aq_mode=0 -rc_lookahead=0 diff --git a/ffpresets/libx264-ultrafast_firstpass.avpreset b/ffpresets/libx264-ultrafast_firstpass.avpreset new file mode 100644 index 0000000000..e3aaa17a2e --- /dev/null +++ b/ffpresets/libx264-ultrafast_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=ultrafast +fastfirstpass=1 diff --git a/ffpresets/libx264-ultrafast_firstpass.ffpreset b/ffpresets/libx264-ultrafast_firstpass.ffpreset deleted file mode 100644 index 561191e399..0000000000 --- a/ffpresets/libx264-ultrafast_firstpass.ffpreset +++ /dev/null @@ -1,24 +0,0 @@ -coder=0 -flags=-loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=0 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=0 -i_qfactor=0.71 -b_strategy=0 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=0 -refs=1 -directpred=1 -trellis=0 -flags2=-bpyramid-mixed_refs-wpred-dct8x8+fastpskip-mbtree -wpredp=0 -aq_mode=0 -rc_lookahead=0 diff --git a/ffpresets/libx264-veryfast.avpreset b/ffpresets/libx264-veryfast.avpreset new file mode 100644 index 0000000000..fa49629b35 --- /dev/null +++ b/ffpresets/libx264-veryfast.avpreset @@ -0,0 +1 @@ +preset=veryfast diff --git a/ffpresets/libx264-veryfast.ffpreset b/ffpresets/libx264-veryfast.ffpreset deleted file mode 100644 index d8c7f7a371..0000000000 --- a/ffpresets/libx264-veryfast.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partb8x8 -me_method=hex -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred+dct8x8+fastpskip -wpredp=0 -rc_lookahead=10 diff --git a/ffpresets/libx264-veryfast_firstpass.avpreset b/ffpresets/libx264-veryfast_firstpass.avpreset new file mode 100644 index 0000000000..4909030551 --- /dev/null +++ b/ffpresets/libx264-veryfast_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=veryfast +fastfirstpass=1 diff --git a/ffpresets/libx264-veryfast_firstpass.ffpreset b/ffpresets/libx264-veryfast_firstpass.ffpreset deleted file mode 100644 index 7b2a1e93d2..0000000000 --- a/ffpresets/libx264-veryfast_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=16 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=1 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=3 -refs=1 -directpred=1 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=0 -rc_lookahead=10 diff --git a/ffpresets/libx264-veryslow.avpreset b/ffpresets/libx264-veryslow.avpreset new file mode 100644 index 0000000000..7e01c8f5c1 --- /dev/null +++ b/ffpresets/libx264-veryslow.avpreset @@ -0,0 +1 @@ +preset=veryslow diff --git a/ffpresets/libx264-veryslow.ffpreset b/ffpresets/libx264-veryslow.ffpreset deleted file mode 100644 index 82333655f9..0000000000 --- a/ffpresets/libx264-veryslow.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -me_method=umh -subq=10 -me_range=24 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=8 -refs=16 -directpred=3 -trellis=2 -flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp=2 -rc_lookahead=60 diff --git a/ffpresets/libx264-veryslow_firstpass.avpreset b/ffpresets/libx264-veryslow_firstpass.avpreset new file mode 100644 index 0000000000..daf5a8f4d5 --- /dev/null +++ b/ffpresets/libx264-veryslow_firstpass.avpreset @@ -0,0 +1,2 @@ +preset=veryslow +fastfirstpass=1 diff --git a/ffpresets/libx264-veryslow_firstpass.ffpreset b/ffpresets/libx264-veryslow_firstpass.ffpreset deleted file mode 100644 index 2bbf4731f4..0000000000 --- a/ffpresets/libx264-veryslow_firstpass.ffpreset +++ /dev/null @@ -1,23 +0,0 @@ -coder=1 -flags=+loop+cgop -cmp=+chroma -partitions=-parti8x8-parti4x4-partp8x8-partb8x8 -me_method=dia -subq=2 -me_range=24 -g=250 -keyint_min=25 -sc_threshold=40 -i_qfactor=0.71 -b_strategy=2 -qcomp=0.6 -qmin=0 -qmax=69 -qdiff=4 -bf=8 -refs=1 -directpred=3 -trellis=0 -flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip -wpredp=2 -rc_lookahead=60 From 4e64c4d51a04503dc1e856bce8d3fbbe09ede9e6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 5 Sep 2011 18:16:13 +0200 Subject: [PATCH 02/12] AVOptions: add documentation. --- libavutil/opt.h | 183 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) diff --git a/libavutil/opt.h b/libavutil/opt.h index 6d189b876d..6182326af2 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -32,6 +32,189 @@ #include "dict.h" #include "log.h" +/** + * @defgroup avoptions AVOptions + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct must be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() must be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_malloc(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in Libav are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This allows to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + * @} + */ + enum AVOptionType{ AV_OPT_TYPE_FLAGS, AV_OPT_TYPE_INT, From 0244879f30b81db7b7a001ce2ac21fe81b849ba4 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 18 Jun 2011 03:11:16 +0200 Subject: [PATCH 03/12] lavfi: add testsrc source Signed-off-by: Anton Khirnov --- doc/filters.texi | 46 +++++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/avfilter.h | 2 +- libavfilter/vsrc_testsrc.c | 359 +++++++++++++++++++++++++++++++++++++ 5 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 libavfilter/vsrc_testsrc.c diff --git a/doc/filters.texi b/doc/filters.texi index 56f00ff4e1..a50a0fa269 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1974,6 +1974,52 @@ Some examples follow: frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay @end example +@section testsrc + +Generate a test video pattern, showing a color pattern, a scrolling +gradient and a timestamp. This is mainly intended for testing +purposes. + +It accepts an optional sequence of @var{key}=@var{value} pairs, +separated by ":". The description of the accepted options follows. + +@table @option + +@item size, s +Specify the size of the sourced video, it may be a string of the form +@var{width}x@var{heigth}, or the name of a size abbreviation. The +default value is "320x240". + +@item rate, r +Specify the frame rate of the sourced video, as the number of frames +generated per second. It has to be a string in the format +@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float +number or a valid video frame rate abbreviation. The default value is +"25". + +@item sar +Set the sample aspect ratio of the sourced video. + +@item duration +Set the video duration of the sourced video. The accepted syntax is: +@example +[-]HH[:MM[:SS[.m...]]] +[-]S+[.m...] +@end example +See also the function @code{av_parse_time()}. + +If not specified, or the expressed duration is negative, the video is +supposed to be generated forever. +@end table + +For example the following: +@example +testsrc=duration=5.3:size=qcif:rate=10 +@end example + +will generate a video with a duration of 5.3 seconds, with size +176x144 and a framerate of 10 frames per second. + @c man end VIDEO SOURCES @chapter Video Sinks diff --git a/libavfilter/Makefile b/libavfilter/Makefile index c5f146e949..e91cfeaa63 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -64,6 +64,7 @@ OBJS-$(CONFIG_COLOR_FILTER) += vsrc_color.o OBJS-$(CONFIG_FREI0R_SRC_FILTER) += vf_frei0r.o OBJS-$(CONFIG_MOVIE_FILTER) += vsrc_movie.o OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o +OBJS-$(CONFIG_TESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index f6c60a1eea..cf7db8886a 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -85,6 +85,7 @@ void avfilter_register_all(void) REGISTER_FILTER (FREI0R, frei0r_src, vsrc); REGISTER_FILTER (MOVIE, movie, vsrc); REGISTER_FILTER (NULLSRC, nullsrc, vsrc); + REGISTER_FILTER (TESTSRC, testsrc, vsrc); REGISTER_FILTER (NULLSINK, nullsink, vsink); } diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 72b5dfa12b..8de0f2b5ca 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -29,7 +29,7 @@ #include "libavutil/rational.h" #define LIBAVFILTER_VERSION_MAJOR 2 -#define LIBAVFILTER_VERSION_MINOR 11 +#define LIBAVFILTER_VERSION_MINOR 12 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c new file mode 100644 index 0000000000..557f4b0edc --- /dev/null +++ b/libavfilter/vsrc_testsrc.c @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2007 Nicolas George + * Copyright (c) 2011 Stefano Sabatini + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Based on the test pattern generator demuxer by Nicolas George: + * http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-October/037845.html + */ + +#include + +#include "libavutil/mathematics.h" +#include "libavutil/opt.h" +#include "libavutil/parseutils.h" +#include "avfilter.h" + +typedef struct { + const AVClass *class; + int h, w; + unsigned int nb_frame; + AVRational time_base; + int64_t pts, max_pts; + char *size; ///< video frame size + char *rate; ///< video frame rate + char *duration; ///< total duration of the generated video + AVRational sar; ///< sample aspect ratio + + void (* fill_picture_fn)(AVFilterContext *ctx, AVFilterBufferRef *picref); +} TestSourceContext; + +#define OFFSET(x) offsetof(TestSourceContext, x) + +static const AVOption testsrc_options[] = { + { "size", "set video size", OFFSET(size), FF_OPT_TYPE_STRING, {.str = "320x240"}}, + { "s", "set video size", OFFSET(size), FF_OPT_TYPE_STRING, {.str = "320x240"}}, + { "rate", "set video rate", OFFSET(rate), FF_OPT_TYPE_STRING, {.str = "25"}, }, + { "r", "set video rate", OFFSET(rate), FF_OPT_TYPE_STRING, {.str = "25"}, }, + { "duration", "set video duration", OFFSET(duration), FF_OPT_TYPE_STRING, {.str = NULL}, }, + { "sar", "set video sample aspect ratio", OFFSET(sar), FF_OPT_TYPE_RATIONAL, {1}, 0, INT_MAX }, + { NULL }, +}; + +static av_cold int init_common(AVFilterContext *ctx, const char *args, void *opaque) +{ + TestSourceContext *test = ctx->priv; + AVRational frame_rate_q; + int64_t duration = -1; + int ret = 0; + + av_opt_set_defaults(test); + + if ((ret = (av_set_options_string(test, args, "=", ":"))) < 0) { + av_log(ctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args); + return ret; + } + + if ((ret = av_parse_video_size(&test->w, &test->h, test->size)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid frame size: '%s'\n", test->size); + return ret; + } + + if ((ret = av_parse_video_rate(&frame_rate_q, test->rate)) < 0 || + frame_rate_q.den <= 0 || frame_rate_q.num <= 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid frame rate: '%s'\n", test->rate); + return ret; + } + + if ((test->duration) && (ret = av_parse_time(&duration, test->duration, 1)) < 0) { + av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", test->duration); + return ret; + } + + test->time_base.num = frame_rate_q.den; + test->time_base.den = frame_rate_q.num; + test->max_pts = duration >= 0 ? + av_rescale_q(duration, AV_TIME_BASE_Q, test->time_base) : -1; + test->nb_frame = 0; + test->pts = 0; + + av_log(ctx, AV_LOG_DEBUG, "size:%dx%d rate:%d/%d duration:%f sar:%d/%d\n", + test->w, test->h, frame_rate_q.num, frame_rate_q.den, + duration < 0 ? -1 : test->max_pts * av_q2d(test->time_base), + test->sar.num, test->sar.den); + return 0; +} + +static int config_props(AVFilterLink *outlink) +{ + TestSourceContext *test = outlink->src->priv; + + outlink->w = test->w; + outlink->h = test->h; + outlink->sample_aspect_ratio = test->sar; + outlink->time_base = test->time_base; + + return 0; +} + +static int request_frame(AVFilterLink *outlink) +{ + TestSourceContext *test = outlink->src->priv; + AVFilterBufferRef *picref; + + if (test->max_pts >= 0 && test->pts > test->max_pts) + return AVERROR_EOF; + picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, + test->w, test->h); + picref->pts = test->pts++; + picref->pos = -1; + picref->video->key_frame = 1; + picref->video->interlaced = 0; + picref->video->pict_type = AV_PICTURE_TYPE_I; + picref->video->pixel_aspect = test->sar; + test->nb_frame++; + test->fill_picture_fn(outlink->src, picref); + + avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0)); + avfilter_draw_slice(outlink, 0, picref->video->h, 1); + avfilter_end_frame(outlink); + avfilter_unref_buffer(picref); + + return 0; +} + +static const char *testsrc_get_name(void *ctx) +{ + return "testsrc"; +} + +static const AVClass testsrc_class = { + .class_name = "TestSourceContext", + .item_name = testsrc_get_name, + .option = testsrc_options, +}; + +/** + * Fill a rectangle with value val. + * + * @param val the RGB value to set + * @param dst pointer to the destination buffer to fill + * @param dst_linesize linesize of destination + * @param segment_width width of the segment + * @param x horizontal coordinate where to draw the rectangle in the destination buffer + * @param y horizontal coordinate where to draw the rectangle in the destination buffer + * @param w width of the rectangle to draw, expressed as a number of segment_width units + * @param h height of the rectangle to draw, expressed as a number of segment_width units + */ +static void draw_rectangle(unsigned val, uint8_t *dst, int dst_linesize, unsigned segment_width, + unsigned x, unsigned y, unsigned w, unsigned h) +{ + int i; + int step = 3; + + dst += segment_width * (step * x + y * dst_linesize); + w *= segment_width * step; + h *= segment_width; + for (i = 0; i < h; i++) { + memset(dst, val, w); + dst += dst_linesize; + } +} + +static void draw_digit(int digit, uint8_t *dst, unsigned dst_linesize, + unsigned segment_width) +{ +#define TOP_HBAR 1 +#define MID_HBAR 2 +#define BOT_HBAR 4 +#define LEFT_TOP_VBAR 8 +#define LEFT_BOT_VBAR 16 +#define RIGHT_TOP_VBAR 32 +#define RIGHT_BOT_VBAR 64 + struct { + int x, y, w, h; + } segments[] = { + { 1, 0, 5, 1 }, /* TOP_HBAR */ + { 1, 6, 5, 1 }, /* MID_HBAR */ + { 1, 12, 5, 1 }, /* BOT_HBAR */ + { 0, 1, 1, 5 }, /* LEFT_TOP_VBAR */ + { 0, 7, 1, 5 }, /* LEFT_BOT_VBAR */ + { 6, 1, 1, 5 }, /* RIGHT_TOP_VBAR */ + { 6, 7, 1, 5 } /* RIGHT_BOT_VBAR */ + }; + static const unsigned char masks[10] = { + /* 0 */ TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + /* 1 */ RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + /* 2 */ TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR, + /* 3 */ TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + /* 4 */ MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + /* 5 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR, + /* 6 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR, + /* 7 */ TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + /* 8 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + /* 9 */ TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR, + }; + unsigned mask = masks[digit]; + int i; + + draw_rectangle(0, dst, dst_linesize, segment_width, 0, 0, 8, 13); + for (i = 0; i < FF_ARRAY_ELEMS(segments); i++) + if (mask & (1<priv; + uint8_t *p, *p0; + int x, y; + int color, color_rest; + int icolor; + int radius; + int quad0, quad; + int dquad_x, dquad_y; + int grad, dgrad, rgrad, drgrad; + int seg_size; + int second; + int i; + uint8_t *data = picref->data[0]; + int width = picref->video->w; + int height = picref->video->h; + + /* draw colored bars and circle */ + radius = (width + height) / 4; + quad0 = width * width / 4 + height * height / 4 - radius * radius; + dquad_y = 1 - height; + p0 = data; + for (y = 0; y < height; y++) { + p = p0; + color = 0; + color_rest = 0; + quad = quad0; + dquad_x = 1 - width; + for (x = 0; x < width; x++) { + icolor = color; + if (quad < 0) + icolor ^= 7; + quad += dquad_x; + dquad_x += 2; + *(p++) = icolor & 1 ? 255 : 0; + *(p++) = icolor & 2 ? 255 : 0; + *(p++) = icolor & 4 ? 255 : 0; + color_rest += 8; + if (color_rest >= width) { + color_rest -= width; + color++; + } + } + quad0 += dquad_y; + dquad_y += 2; + p0 += picref->linesize[0]; + } + + /* draw sliding color line */ + p = data + picref->linesize[0] * height * 3/4; + grad = (256 * test->nb_frame * test->time_base.num / test->time_base.den) % + GRADIENT_SIZE; + rgrad = 0; + dgrad = GRADIENT_SIZE / width; + drgrad = GRADIENT_SIZE % width; + for (x = 0; x < width; x++) { + *(p++) = + grad < 256 || grad >= 5 * 256 ? 255 : + grad >= 2 * 256 && grad < 4 * 256 ? 0 : + grad < 2 * 256 ? 2 * 256 - 1 - grad : grad - 4 * 256; + *(p++) = + grad >= 4 * 256 ? 0 : + grad >= 1 * 256 && grad < 3 * 256 ? 255 : + grad < 1 * 256 ? grad : 4 * 256 - 1 - grad; + *(p++) = + grad < 2 * 256 ? 0 : + grad >= 3 * 256 && grad < 5 * 256 ? 255 : + grad < 3 * 256 ? grad - 2 * 256 : 6 * 256 - 1 - grad; + grad += dgrad; + rgrad += drgrad; + if (rgrad >= GRADIENT_SIZE) { + grad++; + rgrad -= GRADIENT_SIZE; + } + if (grad >= GRADIENT_SIZE) + grad -= GRADIENT_SIZE; + } + for (y = height / 8; y > 0; y--) { + memcpy(p, p - picref->linesize[0], 3 * width); + p += picref->linesize[0]; + } + + /* draw digits */ + seg_size = width / 80; + if (seg_size >= 1 && height >= 13 * seg_size) { + second = test->nb_frame * test->time_base.num / test->time_base.den; + x = width - (width - seg_size * 64) / 2; + y = (height - seg_size * 13) / 2; + p = data + (x*3 + y * picref->linesize[0]); + for (i = 0; i < 8; i++) { + p -= 3 * 8 * seg_size; + draw_digit(second % 10, p, picref->linesize[0], seg_size); + second /= 10; + if (second == 0) + break; + } + } +} + +static av_cold int test_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + TestSourceContext *test = ctx->priv; + + test->class = &testsrc_class; + test->fill_picture_fn = test_fill_picture; + return init_common(ctx, args, opaque); +} + +static int test_query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_RGB24, PIX_FMT_NONE + }; + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +AVFilter avfilter_vsrc_testsrc = { + .name = "testsrc", + .description = NULL_IF_CONFIG_SMALL("Generate test pattern."), + .priv_size = sizeof(TestSourceContext), + .init = test_init, + + .query_formats = test_query_formats, + + .inputs = (AVFilterPad[]) {{ .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, + .config_props = config_props, }, + { .name = NULL }}, +}; From ec2ac9271c91633e5d88551867a7f03bb81852f1 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 11 Jul 2011 16:27:09 +0200 Subject: [PATCH 04/12] lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs The licence was changed from GPL to LGPL with explicit approval from the original author. See thread: Subject: [FFmpeg-devel] [PATCH] lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs Date: Mon, 11 Jul 2011 16:32:41 +0200 Signed-off-by: Anton Khirnov --- doc/filters.texi | 14 ++-- libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/avfilter.h | 2 +- libavfilter/vsrc_testsrc.c | 142 ++++++++++++++++++++++++++++++++++++- 5 files changed, 153 insertions(+), 7 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index a50a0fa269..520a6cb31f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1974,13 +1974,17 @@ Some examples follow: frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay @end example -@section testsrc +@section rgbtestsrc, testsrc -Generate a test video pattern, showing a color pattern, a scrolling -gradient and a timestamp. This is mainly intended for testing -purposes. +The @code{rgbtestsrc} source generates an RGB test pattern useful for +detecting RGB vs BGR issues. You should see a red, green and blue +stripe from top to bottom. -It accepts an optional sequence of @var{key}=@var{value} pairs, +The @code{testsrc} source generates a test video pattern, showing a +color pattern, a scrolling gradient and a timestamp. This is mainly +intended for testing purposes. + +Both sources accept an optional sequence of @var{key}=@var{value} pairs, separated by ":". The description of the accepted options follows. @table @option diff --git a/libavfilter/Makefile b/libavfilter/Makefile index e91cfeaa63..e9eaf9550d 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -64,6 +64,7 @@ OBJS-$(CONFIG_COLOR_FILTER) += vsrc_color.o OBJS-$(CONFIG_FREI0R_SRC_FILTER) += vf_frei0r.o OBJS-$(CONFIG_MOVIE_FILTER) += vsrc_movie.o OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_nullsrc.o +OBJS-$(CONFIG_RGBTESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_TESTSRC_FILTER) += vsrc_testsrc.o OBJS-$(CONFIG_NULLSINK_FILTER) += vsink_nullsink.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index cf7db8886a..d72987402c 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -85,6 +85,7 @@ void avfilter_register_all(void) REGISTER_FILTER (FREI0R, frei0r_src, vsrc); REGISTER_FILTER (MOVIE, movie, vsrc); REGISTER_FILTER (NULLSRC, nullsrc, vsrc); + REGISTER_FILTER (RGBTESTSRC, rgbtestsrc, vsrc); REGISTER_FILTER (TESTSRC, testsrc, vsrc); REGISTER_FILTER (NULLSINK, nullsink, vsink); diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 8de0f2b5ca..f83c861f4b 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -29,7 +29,7 @@ #include "libavutil/rational.h" #define LIBAVFILTER_VERSION_MAJOR 2 -#define LIBAVFILTER_VERSION_MINOR 12 +#define LIBAVFILTER_VERSION_MINOR 13 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 557f4b0edc..be3bea1e0f 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -21,14 +21,20 @@ /** * @file - * Based on the test pattern generator demuxer by Nicolas George: + * Misc test sources. + * + * testsrc is based on the test pattern generator demuxer by Nicolas George: * http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-October/037845.html + * + * rgbtestsrc is ported from MPlayer libmpcodecs/vf_rgbtest.c by + * Michael Niedermayer. */ #include #include "libavutil/mathematics.h" #include "libavutil/opt.h" +#include "libavutil/intreadwrite.h" #include "libavutil/parseutils.h" #include "avfilter.h" @@ -44,6 +50,9 @@ typedef struct { AVRational sar; ///< sample aspect ratio void (* fill_picture_fn)(AVFilterContext *ctx, AVFilterBufferRef *picref); + + /* only used by rgbtest */ + int rgba_map[4]; } TestSourceContext; #define OFFSET(x) offsetof(TestSourceContext, x) @@ -140,6 +149,8 @@ static int request_frame(AVFilterLink *outlink) return 0; } +#if CONFIG_TESTSRC_FILTER + static const char *testsrc_get_name(void *ctx) { return "testsrc"; @@ -357,3 +368,132 @@ AVFilter avfilter_vsrc_testsrc = { .config_props = config_props, }, { .name = NULL }}, }; + +#endif /* CONFIG_TESTSRC_FILTER */ + +#if CONFIG_RGBTESTSRC_FILTER + +static const char *rgbtestsrc_get_name(void *ctx) +{ + return "rgbtestsrc"; +} + +static const AVClass rgbtestsrc_class = { + .class_name = "RGBTestSourceContext", + .item_name = rgbtestsrc_get_name, + .option = testsrc_options, +}; + +#define R 0 +#define G 1 +#define B 2 +#define A 3 + +static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize, + int x, int y, int r, int g, int b, enum PixelFormat fmt, + int rgba_map[4]) +{ + int32_t v; + uint8_t *p; + + switch (fmt) { + case PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break; + case PIX_FMT_RGB444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b >> 4) << 8) | ((g >> 4) << 4) | (r >> 4); break; + case PIX_FMT_BGR555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<10) | ((g>>3)<<5) | (b>>3); break; + case PIX_FMT_RGB555: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<10) | ((g>>3)<<5) | (r>>3); break; + case PIX_FMT_BGR565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); break; + case PIX_FMT_RGB565: ((uint16_t*)(dst + y*dst_linesize))[x] = ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); break; + case PIX_FMT_RGB24: + case PIX_FMT_BGR24: + v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)); + p = dst + 3*x + y*dst_linesize; + AV_WL24(p, v); + break; + case PIX_FMT_RGBA: + case PIX_FMT_BGRA: + case PIX_FMT_ARGB: + case PIX_FMT_ABGR: + v = (r << (rgba_map[R]*8)) + (g << (rgba_map[G]*8)) + (b << (rgba_map[B]*8)); + p = dst + 4*x + y*dst_linesize; + AV_WL32(p, v); + break; + } +} + +static void rgbtest_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref) +{ + TestSourceContext *test = ctx->priv; + int x, y, w = picref->video->w, h = picref->video->h; + + for (y = 0; y < h; y++) { + for (x = 0; x < picref->video->w; x++) { + int c = 256*x/w; + int r = 0, g = 0, b = 0; + + if (3*y < h ) r = c; + else if (3*y < 2*h) g = c; + else b = c; + + rgbtest_put_pixel(picref->data[0], picref->linesize[0], x, y, r, g, b, + ctx->outputs[0]->format, test->rgba_map); + } + } +} + +static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + TestSourceContext *test = ctx->priv; + + test->class = &rgbtestsrc_class; + test->fill_picture_fn = rgbtest_fill_picture; + return init_common(ctx, args, opaque); +} + +static int rgbtest_query_formats(AVFilterContext *ctx) +{ + static const enum PixelFormat pix_fmts[] = { + PIX_FMT_RGBA, PIX_FMT_ARGB, PIX_FMT_BGRA, PIX_FMT_ABGR, + PIX_FMT_BGR24, PIX_FMT_RGB24, + PIX_FMT_RGB444, PIX_FMT_BGR444, + PIX_FMT_RGB565, PIX_FMT_BGR565, + PIX_FMT_RGB555, PIX_FMT_BGR555, + PIX_FMT_NONE + }; + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +static int rgbtest_config_props(AVFilterLink *outlink) +{ + TestSourceContext *test = outlink->src->priv; + + switch (outlink->format) { + case PIX_FMT_ARGB: test->rgba_map[A] = 0; test->rgba_map[R] = 1; test->rgba_map[G] = 2; test->rgba_map[B] = 3; break; + case PIX_FMT_ABGR: test->rgba_map[A] = 0; test->rgba_map[B] = 1; test->rgba_map[G] = 2; test->rgba_map[R] = 3; break; + case PIX_FMT_RGBA: + case PIX_FMT_RGB24: test->rgba_map[R] = 0; test->rgba_map[G] = 1; test->rgba_map[B] = 2; test->rgba_map[A] = 3; break; + case PIX_FMT_BGRA: + case PIX_FMT_BGR24: test->rgba_map[B] = 0; test->rgba_map[G] = 1; test->rgba_map[R] = 2; test->rgba_map[A] = 3; break; + } + + return config_props(outlink); +} + +AVFilter avfilter_vsrc_rgbtestsrc = { + .name = "rgbtestsrc", + .description = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."), + .priv_size = sizeof(TestSourceContext), + .init = rgbtest_init, + + .query_formats = rgbtest_query_formats, + + .inputs = (AVFilterPad[]) {{ .name = NULL}}, + + .outputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .request_frame = request_frame, + .config_props = rgbtest_config_props, }, + { .name = NULL }}, +}; + +#endif /* CONFIG_RGBTESTSRC_FILTER */ From df3ca34a567c320fa5ccb0203d66d473acb7207e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 19 Oct 2011 07:50:12 +0200 Subject: [PATCH 05/12] Makefile: change presets extension to .avpreset Fixes make install. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 28ca055aad..feb57cbea0 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale FFLIBS := avutil -DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset) +DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.avpreset) SKIPHEADERS = cmdutils_common_opts.h From 0d8506b8c52659c5bfff9535391d5e95ddcd45f1 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 16 Oct 2011 17:20:17 +0200 Subject: [PATCH 06/12] Ut Video decoder Signed-off-by: Anton Khirnov --- Changelog | 1 + doc/general.texi | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 1 + libavcodec/utvideo.c | 460 +++++++++++++++++++++++++++++++++++++++++ libavcodec/version.h | 4 +- libavformat/riff.c | 4 + 8 files changed, 471 insertions(+), 2 deletions(-) create mode 100644 libavcodec/utvideo.c diff --git a/Changelog b/Changelog index a70a3db252..f61d3e2b13 100644 --- a/Changelog +++ b/Changelog @@ -52,6 +52,7 @@ easier to use. The changes are: - VC-1 interlaced decoding - lut, lutrgb, and lutyuv filters - boxblur filter +- Ut Video decoder version 0.7: diff --git a/doc/general.texi b/doc/general.texi index 2c463cb53e..c4c4414c4f 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -516,6 +516,7 @@ following image formats are supported: @tab encoding supported through external library libtheora @item Tiertex Limited SEQ video @tab @tab X @tab Codec used in DOS CD-ROM FlashBack game. +@item Ut Video @tab @tab X @item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X @item VMware Screen Codec / VMware Video @tab @tab X @tab Codec used in videos captured by VMware. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 4c3eca379b..a566df27e1 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -378,6 +378,7 @@ OBJS-$(CONFIG_TTA_DECODER) += tta.o OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o OBJS-$(CONFIG_ULTI_DECODER) += ulti.o +OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o OBJS-$(CONFIG_V210_DECODER) += v210dec.o OBJS-$(CONFIG_V210_ENCODER) += v210enc.o OBJS-$(CONFIG_V210X_DECODER) += v210x.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index fdb0a9cba8..f85f06d6cc 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -199,6 +199,7 @@ void avcodec_register_all(void) REGISTER_DECODER (TSCC, tscc); REGISTER_DECODER (TXD, txd); REGISTER_DECODER (ULTI, ulti); + REGISTER_DECODER (UTVIDEO, utvideo); REGISTER_ENCDEC (V210, v210); REGISTER_DECODER (V210X, v210x); REGISTER_DECODER (VB, vb); diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 440ba9b487..a8086c6574 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -212,6 +212,7 @@ enum CodecID { CODEC_ID_VC1IMAGE, CODEC_ID_G723_1, CODEC_ID_G729, + CODEC_ID_UTVIDEO, /* various PCM "codecs" */ CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs diff --git a/libavcodec/utvideo.c b/libavcodec/utvideo.c new file mode 100644 index 0000000000..aac3969b15 --- /dev/null +++ b/libavcodec/utvideo.c @@ -0,0 +1,460 @@ +/* + * Ut Video decoder + * Copyright (c) 2011 Konstantin Shishkov + * + * This file is part of Libav. + * + * Libav 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. + * + * Libav 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 Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Ut Video decoder + */ + +#include + +#include "libavutil/intreadwrite.h" +#include "avcodec.h" +#include "bytestream.h" +#include "get_bits.h" +#include "dsputil.h" + +enum { + PRED_NONE = 0, + PRED_LEFT, + PRED_GRADIENT, + PRED_MEDIAN, +}; + +typedef struct UtvideoContext { + AVCodecContext *avctx; + AVFrame pic; + DSPContext dsp; + + uint32_t frame_info_size, flags, frame_info; + int planes; + int slices; + int compression; + int interlaced; + int frame_pred; + + uint8_t *slice_bits; + int slice_bits_size; +} UtvideoContext; + +typedef struct HuffEntry { + uint8_t sym; + uint8_t len; +} HuffEntry; + +static int huff_cmp(const void *a, const void *b) +{ + const HuffEntry *aa = a, *bb = b; + return (aa->len - bb->len)*256 + aa->sym - bb->sym; +} + +static int build_huff(const uint8_t *src, VLC *vlc) +{ + int i; + HuffEntry he[256]; + int last; + uint32_t codes[256]; + uint8_t bits[256]; + uint8_t syms[256]; + uint32_t code; + + for (i = 0; i < 256; i++) { + he[i].sym = i; + he[i].len = *src++; + } + qsort(he, 256, sizeof(*he), huff_cmp); + + if (!he[0].len || he[0].len > 32) + return -1; + + last = 255; + while (he[last].len == 255 && last) + last--; + + code = 1; + for (i = last; i >= 0; i--) { + codes[i] = code >> (32 - he[i].len); + bits[i] = he[i].len; + syms[i] = he[i].sym; + code += 0x80000000u >> (he[i].len - 1); + } + + return init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1, + bits, sizeof(*bits), sizeof(*bits), + codes, sizeof(*codes), sizeof(*codes), + syms, sizeof(*syms), sizeof(*syms), 0); +} + +static int decode_plane(UtvideoContext *c, int plane_no, + uint8_t *dst, int step, int stride, + int width, int height, + const uint8_t *src, int src_size, int use_pred) +{ + int i, j, slice, pix; + int sstart, send; + VLC vlc; + GetBitContext gb; + int prev; + + if (build_huff(src, &vlc)) { + av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n"); + return AVERROR_INVALIDDATA; + } + + src += 256; + src_size -= 256; + + send = 0; + for (slice = 0; slice < c->slices; slice++) { + uint8_t *dest; + int slice_data_start, slice_data_end, slice_size; + + sstart = send; + send = height * (slice + 1) / c->slices; + dest = dst + sstart * stride; + + // slice offset and size validation was done earlier + slice_data_start = slice ? AV_RL32(src + slice * 4 - 4) : 0; + slice_data_end = AV_RL32(src + slice * 4); + slice_size = slice_data_end - slice_data_start; + + if (!slice_size) { + for (j = sstart; j < send; j++) { + for (i = 0; i < width * step; i += step) + dest[i] = 0x80; + dest += stride; + } + continue; + } + + memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, slice_size); + memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); + c->dsp.bswap_buf((uint32_t*)c->slice_bits, (uint32_t*)c->slice_bits, + (slice_data_end - slice_data_start + 3) >> 2); + init_get_bits(&gb, c->slice_bits, slice_size * 8); + + prev = 0x80; + for (j = sstart; j < send; j++) { + for (i = 0; i < width * step; i += step) { + if (get_bits_left(&gb) <= 0) { + av_log(c->avctx, AV_LOG_ERROR, "Slice decoding ran out of bits\n"); + goto fail; + } + pix = get_vlc2(&gb, vlc.table, vlc.bits, 4); + if (pix < 0) { + av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n"); + goto fail; + } + if (use_pred) { + prev += pix; + pix = prev; + } + dest[i] = pix; + } + dest += stride; + } + if (get_bits_left(&gb) > 32) + av_log(c->avctx, AV_LOG_WARNING, "%d bits left after decoding slice\n", + get_bits_left(&gb)); + } + + free_vlc(&vlc); + + return 0; +fail: + free_vlc(&vlc); + return AVERROR_INVALIDDATA; +} + +static const int rgb_order[4] = { 1, 2, 0, 3 }; + +static void restore_rgb_planes(uint8_t *src, int step, int stride, int width, int height) +{ + int i, j; + uint8_t r, g, b; + + for (j = 0; j < height; j++) { + for (i = 0; i < width * step; i += step) { + r = src[i]; + g = src[i + 1]; + b = src[i + 2]; + src[i] = r + g - 0x80; + src[i + 2] = b + g - 0x80; + } + src += stride; + } +} + +static void restore_median(uint8_t *src, int step, int stride, + int width, int height, int slices) +{ + int i, j, slice; + int A, B, C; + uint8_t *bsrc; + int slice_start, slice_height; + + for (slice = 0; slice < slices; slice++) { + slice_start = (slice * height) / slices; + slice_height = ((slice + 1) * height) / slices - slice_start; + + bsrc = src + slice_start * stride; + + // first line - left neighbour prediction + bsrc[0] += 0x80; + A = bsrc[0]; + for (i = step; i < width * step; i += step) { + bsrc[i] += A; + A = bsrc[i]; + } + bsrc += stride; + if (slice_height == 1) + continue; + // second line - first element has top predition, the rest uses median + C = bsrc[-stride]; + bsrc[0] += C; + A = bsrc[0]; + for (i = step; i < width * step; i += step) { + B = bsrc[i - stride]; + bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); + C = B; + A = bsrc[i]; + } + bsrc += stride; + // the rest of lines use continuous median prediction + for (j = 2; j < slice_height; j++) { + for (i = 0; i < width * step; i += step) { + B = bsrc[i - stride]; + bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); + C = B; + A = bsrc[i]; + } + bsrc += stride; + } + } +} + +static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) +{ + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; + const uint8_t *buf_end = buf + buf_size; + UtvideoContext *c = avctx->priv_data; + const uint8_t *ptr; + int i, j; + const uint8_t *plane_start[5]; + int plane_size, max_slice_size = 0, slice_start, slice_end, slice_size; + int ret; + + if (c->pic.data[0]) + avctx->release_buffer(avctx, &c->pic); + + c->pic.reference = 1; + c->pic.buffer_hints = FF_BUFFER_HINTS_VALID; + if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; + } + + /* parse plane structure to retrieve frame flags and validate slice offsets */ + ptr = buf; + for (i = 0; i < c->planes; i++) { + plane_start[i] = ptr; + if (buf_end - ptr < 256 + 4 * c->slices) { + av_log(avctx, AV_LOG_ERROR, "Insufficient data for a plane\n"); + return AVERROR_INVALIDDATA; + } + ptr += 256; + slice_start = 0; + slice_end = 0; + for (j = 0; j < c->slices; j++) { + slice_end = bytestream_get_le32(&ptr); + slice_size = slice_end - slice_start; + if (slice_size < 0) { + av_log(avctx, AV_LOG_ERROR, "Incorrect slice size\n"); + return AVERROR_INVALIDDATA; + } + slice_start = slice_end; + max_slice_size = FFMAX(max_slice_size, slice_size); + } + plane_size = slice_end; + if (buf_end - ptr < plane_size) { + av_log(avctx, AV_LOG_ERROR, "Plane size is bigger than available data\n"); + return AVERROR_INVALIDDATA; + } + ptr += plane_size; + } + plane_start[c->planes] = ptr; + if (buf_end - ptr < c->frame_info_size) { + av_log(avctx, AV_LOG_ERROR, "Not enough data for frame information\n"); + return AVERROR_INVALIDDATA; + } + c->frame_info = AV_RL32(ptr); + av_log(avctx, AV_LOG_DEBUG, "frame information flags %X\n", c->frame_info); + + c->frame_pred = (c->frame_info >> 8) & 3; + + if (c->frame_pred == PRED_GRADIENT) { + av_log_ask_for_sample(avctx, "Frame uses gradient prediction\n"); + return AVERROR_PATCHWELCOME; + } + + av_fast_malloc(&c->slice_bits, &c->slice_bits_size, + max_slice_size + FF_INPUT_BUFFER_PADDING_SIZE); + + if (!c->slice_bits) { + av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); + return AVERROR(ENOMEM); + } + + switch (c->avctx->pix_fmt) { + case PIX_FMT_RGB24: + case PIX_FMT_RGBA: + for (i = 0; i < c->planes; i++) { + ret = decode_plane(c, i, c->pic.data[0] + rgb_order[i], c->planes, + c->pic.linesize[0], avctx->width, avctx->height, + plane_start[i], plane_start[i + 1] - plane_start[i], + c->frame_pred == PRED_LEFT); + if (ret) + return ret; + if (c->frame_pred == PRED_MEDIAN) + restore_median(c->pic.data[0] + rgb_order[i], c->planes, + c->pic.linesize[0], avctx->width, avctx->height, + c->slices); + } + restore_rgb_planes(c->pic.data[0], c->planes, c->pic.linesize[0], + avctx->width, avctx->height); + break; + case PIX_FMT_YUV420P: + for (i = 0; i < 3; i++) { + ret = decode_plane(c, i, c->pic.data[i], 1, + c->pic.linesize[i], avctx->width >> !!i, avctx->height >> !!i, + plane_start[i], plane_start[i + 1] - plane_start[i], + c->frame_pred == PRED_LEFT); + if (ret) + return ret; + if (c->frame_pred == PRED_MEDIAN) + restore_median(c->pic.data[i], 1, c->pic.linesize[i], + avctx->width >> !!i, avctx->height >> !!i, + c->slices); + } + break; + case PIX_FMT_YUV422P: + for (i = 0; i < 3; i++) { + ret = decode_plane(c, i, c->pic.data[i], 1, + c->pic.linesize[i], avctx->width >> !!i, avctx->height, + plane_start[i], plane_start[i + 1] - plane_start[i], + c->frame_pred == PRED_LEFT); + if (ret) + return ret; + if (c->frame_pred == PRED_MEDIAN) + restore_median(c->pic.data[i], 1, c->pic.linesize[i], + avctx->width >> !!i, avctx->height, c->slices); + } + break; + } + + *data_size = sizeof(AVFrame); + *(AVFrame*)data = c->pic; + + /* always report that the buffer was completely consumed */ + return buf_size; +} + +static av_cold int decode_init(AVCodecContext *avctx) +{ + UtvideoContext * const c = avctx->priv_data; + + c->avctx = avctx; + + dsputil_init(&c->dsp, avctx); + + if (avctx->extradata_size < 16) { + av_log(avctx, AV_LOG_ERROR, "Insufficient extradata size %d, should be at least 16\n", + avctx->extradata_size); + return AVERROR_INVALIDDATA; + } + + av_log(avctx, AV_LOG_DEBUG, "Encoder version %d.%d.%d.%d\n", + avctx->extradata[3], avctx->extradata[2], + avctx->extradata[1], avctx->extradata[0]); + av_log(avctx, AV_LOG_DEBUG, "Original format %X\n", AV_RB32(avctx->extradata + 4)); + c->frame_info_size = AV_RL32(avctx->extradata + 8); + c->flags = AV_RL32(avctx->extradata + 12); + + if (c->frame_info_size != 4) + av_log_ask_for_sample(avctx, "Frame info is not 4 bytes\n"); + av_log(avctx, AV_LOG_DEBUG, "Encoding parameters %08X\n", c->flags); + c->slices = (c->flags >> 24) + 1; + c->compression = c->flags & 1; + c->interlaced = c->flags & 0x800; + + c->slice_bits_size = 0; + + switch (avctx->codec_tag) { + case MKTAG('U', 'L', 'R', 'G'): + c->planes = 3; + avctx->pix_fmt = PIX_FMT_RGB24; + break; + case MKTAG('U', 'L', 'R', 'A'): + c->planes = 4; + avctx->pix_fmt = PIX_FMT_RGBA; + break; + case MKTAG('U', 'L', 'Y', '0'): + c->planes = 3; + avctx->pix_fmt = PIX_FMT_YUV420P; + break; + case MKTAG('U', 'L', 'Y', '2'): + c->planes = 3; + avctx->pix_fmt = PIX_FMT_YUV422P; + break; + default: + av_log(avctx, AV_LOG_ERROR, "Unknown Ut Video FOURCC provided (%08X)\n", + avctx->codec_tag); + return AVERROR_INVALIDDATA; + } + + return 0; +} + +static av_cold int decode_end(AVCodecContext *avctx) +{ + UtvideoContext * const c = avctx->priv_data; + + if (c->pic.data[0]) + avctx->release_buffer(avctx, &c->pic); + + av_freep(&c->slice_bits); + + return 0; +} + +AVCodec ff_utvideo_decoder = { + .name = "utvideo", + .type = AVMEDIA_TYPE_VIDEO, + .id = CODEC_ID_UTVIDEO, + .priv_data_size = sizeof(UtvideoContext), + .init = decode_init, + .close = decode_end, + .decode = decode_frame, + .capabilities = CODEC_CAP_DR1, + .long_name = NULL_IF_CONFIG_SMALL("Ut Video"), +}; + diff --git a/libavcodec/version.h b/libavcodec/version.h index ee647bed56..b89e6f17cc 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,8 +21,8 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 12 -#define LIBAVCODEC_VERSION_MICRO 2 +#define LIBAVCODEC_VERSION_MINOR 13 +#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/riff.c b/libavformat/riff.c index 8587806647..0f4c079b35 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -275,6 +275,10 @@ const AVCodecTag ff_codec_bmp_tags[] = { { CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') }, { CODEC_ID_KGV1, MKTAG('K', 'G', 'V', '1') }, { CODEC_ID_LAGARITH, MKTAG('L', 'A', 'G', 'S') }, + { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') }, + { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') }, + { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') }, + { CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') }, { CODEC_ID_NONE, 0 } }; From 73447eb4bdba11bf23367f115f1a0ce46ce6f1df Mon Sep 17 00:00:00 2001 From: Mashiat Sarker Shakkhar Date: Wed, 19 Oct 2011 18:51:20 +0500 Subject: [PATCH 07/12] Use correct scaling table for bwd-pred MVs in second B-field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When scaling backward predicted MVs in second B-field, the scaling table is opposite of that for P field pictures; i.e. first field P table will be used as second field B table and second field P table will be used as first field B table. This is not documented in the spec, but exists in the ref. decoder. This fixes SA10139. Signed-off-by: Martin Storsjö --- libavcodec/vc1dec.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 6ca75852c9..708ad81e7b 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1291,6 +1291,7 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di int scaledvalue, refdist; int scalesame1, scalesame2; int scalezone1_x, zone1offset_x; + int table_index = dir ^ v->second_field; if (v->s.pict_type != AV_PICTURE_TYPE_B) refdist = v->refdist; @@ -1298,10 +1299,10 @@ static av_always_inline int scaleforsame_x(VC1Context *v, int n /* MV */, int di refdist = dir ? v->brfd : v->frfd; if (refdist > 3) refdist = 3; - scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; - scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; - scalezone1_x = vc1_field_mvpred_scales[v->second_field][3][refdist]; - zone1offset_x = vc1_field_mvpred_scales[v->second_field][5][refdist]; + scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist]; + scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist]; + scalezone1_x = vc1_field_mvpred_scales[table_index][3][refdist]; + zone1offset_x = vc1_field_mvpred_scales[table_index][5][refdist]; if (FFABS(n) > 255) scaledvalue = n; @@ -1323,6 +1324,7 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, int scaledvalue, refdist; int scalesame1, scalesame2; int scalezone1_y, zone1offset_y; + int table_index = dir ^ v->second_field; if (v->s.pict_type != AV_PICTURE_TYPE_B) refdist = v->refdist; @@ -1330,10 +1332,10 @@ static av_always_inline int scaleforsame_y(VC1Context *v, int i, int n /* MV */, refdist = dir ? v->brfd : v->frfd; if (refdist > 3) refdist = 3; - scalesame1 = vc1_field_mvpred_scales[v->second_field][1][refdist]; - scalesame2 = vc1_field_mvpred_scales[v->second_field][2][refdist]; - scalezone1_y = vc1_field_mvpred_scales[v->second_field][4][refdist]; - zone1offset_y = vc1_field_mvpred_scales[v->second_field][6][refdist]; + scalesame1 = vc1_field_mvpred_scales[table_index][1][refdist]; + scalesame2 = vc1_field_mvpred_scales[table_index][2][refdist]; + scalezone1_y = vc1_field_mvpred_scales[table_index][4][refdist]; + zone1offset_y = vc1_field_mvpred_scales[table_index][6][refdist]; if (FFABS(n) > 63) scaledvalue = n; @@ -1444,7 +1446,7 @@ static av_always_inline int scaleforopp(VC1Context *v, int n /* MV */, refdist = FFMIN(v->refdist, 3); else refdist = dir ? v->brfd : v->frfd; - scaleopp = vc1_field_mvpred_scales[v->second_field][0][refdist]; + scaleopp = vc1_field_mvpred_scales[dir ^ v->second_field][0][refdist]; return n * scaleopp >> 8; } From 569129a6dc503379c0486008224dfaff8f0ee81f Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 18 Jun 2011 11:19:27 +0200 Subject: [PATCH 08/12] lavf: add avformat_new_stream as a replacement for av_new_stream. It takes a codec parameter, thus enabling codec-specific defaults. --- doc/APIchanges | 3 +++ libavformat/avformat.h | 21 +++++++++++++++++++++ libavformat/utils.c | 13 +++++++++++-- libavformat/version.h | 7 +++++-- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index c4557f06a0..bd55cb0172 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2011-10-xx - xxxxxxx - lavf 53.10.0 + Add avformat_new_stream(). Deprecate av_new_stream(). + 2011-xx-xx - xxxxxxx - lavf 53.9.0 Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4e7e883eb5..65f66d84d3 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1311,6 +1311,7 @@ void av_close_input_file(AVFormatContext *s); */ void avformat_free_context(AVFormatContext *s); +#if FF_API_NEW_STREAM /** * Add a new stream to a media file. * @@ -1321,7 +1322,27 @@ void avformat_free_context(AVFormatContext *s); * @param s media file handle * @param id file-format-dependent stream ID */ +attribute_deprecated AVStream *av_new_stream(AVFormatContext *s, int id); +#endif + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); + AVProgram *av_new_program(AVFormatContext *s, int id); /** diff --git a/libavformat/utils.c b/libavformat/utils.c index 6393b62615..9735d455d9 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2657,7 +2657,17 @@ void av_close_input_file(AVFormatContext *s) avio_close(pb); } +#if FF_API_NEW_STREAM AVStream *av_new_stream(AVFormatContext *s, int id) +{ + AVStream *st = avformat_new_stream(s, NULL); + if (st) + st->id = id; + return st; +} +#endif + +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) { AVStream *st; int i; @@ -2678,13 +2688,12 @@ AVStream *av_new_stream(AVFormatContext *s, int id) return NULL; } - st->codec = avcodec_alloc_context3(NULL); + st->codec = avcodec_alloc_context3(c); if (s->iformat) { /* no default bitrate if decoding */ st->codec->bit_rate = 0; } st->index = s->nb_streams; - st->id = id; st->start_time = AV_NOPTS_VALUE; st->duration = AV_NOPTS_VALUE; /* we set the current DTS to 0 so that formats without any timestamps diff --git a/libavformat/version.h b/libavformat/version.h index db20bd6658..9de30ea55b 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -24,8 +24,8 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 53 -#define LIBAVFORMAT_VERSION_MINOR 9 -#define LIBAVFORMAT_VERSION_MICRO 1 +#define LIBAVFORMAT_VERSION_MINOR 10 +#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ @@ -95,5 +95,8 @@ #ifndef FF_API_RTSP_URL_OPTIONS #define FF_API_RTSP_URL_OPTIONS (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_NEW_STREAM +#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif /* AVFORMAT_VERSION_H */ From 3b3bbdd3e63a3a1eaf69b861f72cf74f1669afe1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 18 Jun 2011 11:43:24 +0200 Subject: [PATCH 09/12] lavf,lavd: replace av_new_stream->avformat_new_stream part I. Trivial replacements with sed are done in this commit: sed 's/av_new_stream(\([^)]*\), 0)/avformat_new_stream(\1, NULL)/' --- libavdevice/alsa-audio-dec.c | 2 +- libavdevice/bktr.c | 2 +- libavdevice/fbdev.c | 2 +- libavdevice/jack_audio.c | 2 +- libavdevice/libcdio.c | 2 +- libavdevice/libdc1394.c | 2 +- libavdevice/oss_audio.c | 2 +- libavdevice/sndio_dec.c | 2 +- libavdevice/v4l.c | 2 +- libavdevice/v4l2.c | 2 +- libavdevice/vfwcap.c | 2 +- libavdevice/x11grab.c | 2 +- libavformat/4xm.c | 2 +- libavformat/aacdec.c | 2 +- libavformat/aea.c | 2 +- libavformat/aiffdec.c | 2 +- libavformat/amr.c | 2 +- libavformat/anm.c | 2 +- libavformat/apc.c | 2 +- libavformat/ape.c | 2 +- libavformat/asfdec.c | 2 +- libavformat/assdec.c | 2 +- libavformat/au.c | 2 +- libavformat/bethsoftvid.c | 4 ++-- libavformat/bfi.c | 4 ++-- libavformat/bink.c | 2 +- libavformat/c93.c | 2 +- libavformat/cafdec.c | 2 +- libavformat/cdg.c | 2 +- libavformat/daud.c | 2 +- libavformat/dfa.c | 2 +- libavformat/dsicin.c | 4 ++-- libavformat/dv.c | 4 ++-- libavformat/dxa.c | 4 ++-- libavformat/eacdata.c | 2 +- libavformat/electronicarts.c | 4 ++-- libavformat/ffmdec.c | 2 +- libavformat/ffmetadec.c | 2 +- libavformat/filmstripdec.c | 2 +- libavformat/flacdec.c | 2 +- libavformat/flic.c | 2 +- libavformat/idcin.c | 4 ++-- libavformat/idroqdec.c | 2 +- libavformat/iff.c | 2 +- libavformat/img2.c | 2 +- libavformat/ipmovie.c | 4 ++-- libavformat/iss.c | 2 +- libavformat/iv8.c | 2 +- libavformat/ivfdec.c | 2 +- libavformat/jvdec.c | 2 +- libavformat/lmlm4.c | 2 +- libavformat/lxfdec.c | 2 +- libavformat/matroskadec.c | 4 ++-- libavformat/mm.c | 4 ++-- libavformat/mmf.c | 2 +- libavformat/mp3dec.c | 2 +- libavformat/mpc.c | 2 +- libavformat/mpc8.c | 2 +- libavformat/mpegts.c | 2 +- libavformat/msnwc_tcp.c | 2 +- libavformat/mvi.c | 4 ++-- libavformat/ncdec.c | 2 +- libavformat/oma.c | 2 +- libavformat/output-example.c | 2 +- libavformat/psxstr.c | 4 ++-- libavformat/pva.c | 2 +- libavformat/qcp.c | 2 +- libavformat/r3d.c | 2 +- libavformat/rawdec.c | 6 +++--- libavformat/rl2.c | 4 ++-- libavformat/rmdec.c | 4 ++-- libavformat/rpl.c | 4 ++-- libavformat/rsodec.c | 2 +- libavformat/rtpenc_chain.c | 2 +- libavformat/segafilm.c | 4 ++-- libavformat/sierravmd.c | 4 ++-- libavformat/siff.c | 4 ++-- libavformat/smacker.c | 4 ++-- libavformat/sol.c | 2 +- libavformat/soxdec.c | 2 +- libavformat/spdifdec.c | 2 +- libavformat/srtdec.c | 2 +- libavformat/thp.c | 4 ++-- libavformat/tiertexseq.c | 4 ++-- libavformat/tmv.c | 4 ++-- libavformat/tta.c | 2 +- libavformat/tty.c | 2 +- libavformat/txd.c | 2 +- libavformat/vc1test.c | 2 +- libavformat/vocdec.c | 2 +- libavformat/vqf.c | 2 +- libavformat/wav.c | 4 ++-- libavformat/wc3movie.c | 4 ++-- libavformat/westwood.c | 6 +++--- libavformat/wtv.c | 2 +- libavformat/wv.c | 2 +- libavformat/xa.c | 2 +- libavformat/xmv.c | 2 +- libavformat/xwma.c | 2 +- libavformat/yop.c | 2 +- libavformat/yuv4mpeg.c | 2 +- 101 files changed, 129 insertions(+), 129 deletions(-) diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 0ee6b0196e..1346016254 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -60,7 +60,7 @@ static av_cold int audio_read_header(AVFormatContext *s1, enum CodecID codec_id; snd_pcm_sw_params_t *sw_params; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { av_log(s1, AV_LOG_ERROR, "Cannot add stream\n"); diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index a2513a729d..8dd4e3ae0a 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -271,7 +271,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) goto out; } - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { ret = AVERROR(ENOMEM); goto out; diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c index 099a486b9b..ddace67392 100644 --- a/libavdevice/fbdev.c +++ b/libavdevice/fbdev.c @@ -108,7 +108,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx, return ret; } - if (!(st = av_new_stream(avctx, 0))) + if (!(st = avformat_new_stream(avctx, NULL))) return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */ diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c index 7b39b41b96..4907e82395 100644 --- a/libavdevice/jack_audio.c +++ b/libavdevice/jack_audio.c @@ -229,7 +229,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param if ((test = start_jack(context))) return test; - stream = av_new_stream(context, 0); + stream = avformat_new_stream(context, NULL); if (!stream) { stop_jack(self); return AVERROR(ENOMEM); diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c index 9ea7780ef3..bade74e5f0 100644 --- a/libavdevice/libcdio.c +++ b/libavdevice/libcdio.c @@ -53,7 +53,7 @@ static av_cold int read_header(AVFormatContext *ctx, AVFormatParameters *ap) int ret, i; char *err = NULL; - if (!(st = av_new_stream(ctx, 0))) + if (!(st = avformat_new_stream(ctx, NULL))) return AVERROR(ENOMEM); s->drive = cdio_cddap_identify(ctx->filename, CDDA_MESSAGE_LOGIT, &err); if (!s->drive) { diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 5ccf816fed..bca014fe3c 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -160,7 +160,7 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap, } /* create a video stream */ - vst = av_new_stream(c, 0); + vst = avformat_new_stream(c, NULL); if (!vst) { ret = AVERROR(ENOMEM); goto out; diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index 167dd6c185..01d944a163 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -209,7 +209,7 @@ static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap) AVStream *st; int ret; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { return AVERROR(ENOMEM); } diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c index 629a88dfd4..ca11661f09 100644 --- a/libavdevice/sndio_dec.c +++ b/libavdevice/sndio_dec.c @@ -34,7 +34,7 @@ static av_cold int audio_read_header(AVFormatContext *s1, AVStream *st; int ret; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index 71771d6e4d..5fc91d37be 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -98,7 +98,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) s->video_win.width = ap->width; s->video_win.height = ap->height; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 735d803fdd..59b1e55bd8 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -580,7 +580,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) enum CodecID codec_id; enum PixelFormat pix_fmt = PIX_FMT_NONE; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { res = AVERROR(ENOMEM); goto out; diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index 61b038323c..6f11914935 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -295,7 +295,7 @@ static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap) SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if(!st) { vfw_read_close(s); return AVERROR(ENOMEM); diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index 14232ed0b7..7874b81908 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -193,7 +193,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) goto out; } - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { ret = AVERROR(ENOMEM); goto out; diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 1557c5b5a4..21771348a9 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -141,7 +141,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->height = AV_RL32(&header[i + 40]); /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st){ ret= AVERROR(ENOMEM); goto fail; diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index 0c96fa49c4..4aa2d32754 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -65,7 +65,7 @@ static int adts_aac_read_header(AVFormatContext *s, { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/aea.c b/libavformat/aea.c index e2d853b17a..b33b45f927 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -57,7 +57,7 @@ static int aea_read_probe(AVProbeData *p) static int aea_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 54972de5e0..5d25a742a1 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -196,7 +196,7 @@ static int aiff_read_header(AVFormatContext *s, filesize -= 4; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/amr.c b/libavformat/amr.c index e9c74caf27..b26afa71b7 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -84,7 +84,7 @@ static int amr_read_header(AVFormatContext *s, avio_read(pb, header, 6); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) { return AVERROR(ENOMEM); diff --git a/libavformat/anm.c b/libavformat/anm.c index f24caf16b2..a89bf3e719 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -97,7 +97,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; /* video stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/apc.c b/libavformat/apc.c index 109851632e..238395087c 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -39,7 +39,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl32(pb); /* _APC */ avio_rl32(pb); /* 1.20 */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/ape.c b/libavformat/ape.c index 088515c58a..b29e57bcce 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -313,7 +313,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ape->compressiontype); /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index a35290b041..48ecec78b4 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -227,7 +227,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) pos1 = avio_tell(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ diff --git a/libavformat/assdec.c b/libavformat/assdec.c index 08b520e656..6b9c3dea95 100644 --- a/libavformat/assdec.c +++ b/libavformat/assdec.c @@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) uint8_t *p, **dst[2]={0}; int pos[2]={0}; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; av_set_pts_info(st, 64, 1, 100); diff --git a/libavformat/au.c b/libavformat/au.c index d8765e3e47..5121574c3c 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -151,7 +151,7 @@ static int au_read_header(AVFormatContext *s, } /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 05243cc510..d30f873e9a 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -70,7 +70,7 @@ static int vid_read_header(AVFormatContext *s, avio_skip(pb, 5); vid->nframes = avio_rl16(pb); - stream = av_new_stream(s, 0); + stream = avformat_new_stream(s, NULL); if (!stream) return AVERROR(ENOMEM); av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps @@ -83,7 +83,7 @@ static int vid_read_header(AVFormatContext *s, avio_rl16(pb); // done with video codec, set up audio codec - stream = av_new_stream(s, 0); + stream = avformat_new_stream(s, NULL); if (!stream) return AVERROR(ENOMEM); stream->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 7a02c23daf..647dd54894 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -55,12 +55,12 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) int fps, chunk_header; /* Initialize the video codec... */ - vstream = av_new_stream(s, 0); + vstream = avformat_new_stream(s, NULL); if (!vstream) return AVERROR(ENOMEM); /* Initialize the audio codec... */ - astream = av_new_stream(s, 0); + astream = avformat_new_stream(s, NULL); if (!astream) return AVERROR(ENOMEM); diff --git a/libavformat/bink.c b/libavformat/bink.c index b576555deb..19c4571e00 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -78,7 +78,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) uint16_t flags; int keyframe; - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); diff --git a/libavformat/c93.c b/libavformat/c93.c index 6cf448f6b5..9a0eb52234 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -79,7 +79,7 @@ static int read_header(AVFormatContext *s, /* Audio streams are added if audio packets are found */ s->ctx_flags |= AVFMTCTX_NOHEADER; - video = av_new_stream(s, 0); + video = avformat_new_stream(s, NULL); if (!video) return AVERROR(ENOMEM); diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 02d1e3ccaa..b8c378a48e 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -61,7 +61,7 @@ static int read_desc_chunk(AVFormatContext *s) int flags; /* new audio stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/cdg.c b/libavformat/cdg.c index 150496762b..b60ea3710a 100644 --- a/libavformat/cdg.c +++ b/libavformat/cdg.c @@ -28,7 +28,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *vst; int ret; - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); diff --git a/libavformat/daud.c b/libavformat/daud.c index 6a48818c84..9deca33bde 100644 --- a/libavformat/daud.c +++ b/libavformat/daud.c @@ -21,7 +21,7 @@ #include "avformat.h" static int daud_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/dfa.c b/libavformat/dfa.c index cd925e05fc..7b90ba7805 100644 --- a/libavformat/dfa.c +++ b/libavformat/dfa.c @@ -45,7 +45,7 @@ static int dfa_read_header(AVFormatContext *s, avio_skip(pb, 2); // unused frames = avio_rl16(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index a82ac4cb54..3c7589b556 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -107,7 +107,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) cin->audio_buffer_size = 0; /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -120,7 +120,7 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height = hdr->video_frame_height; /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/dv.c b/libavformat/dv.c index 384e4dc3da..5b229e9f07 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -211,7 +211,7 @@ static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) /* Dynamic handling of the audio streams in DV */ for (i = 0; i < ach; i++) { if (!c->ast[i]) { - c->ast[i] = av_new_stream(c->fctx, 0); + c->ast[i] = avformat_new_stream(c->fctx, NULL); if (!c->ast[i]) break; av_set_pts_info(c->ast[i], 64, 1, 30000); @@ -278,7 +278,7 @@ DVDemuxContext* dv_init_demux(AVFormatContext *s) if (!c) return NULL; - c->vst = av_new_stream(s, 0); + c->vst = avformat_new_stream(s, NULL); if (!c->vst) { av_free(c); return NULL; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 375b039df4..e35740eff9 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -87,7 +87,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) h = avio_rb16(pb); c->has_sound = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; @@ -100,7 +100,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_skip(pb, 16); fsize = avio_rl32(pb); - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return -1; ret = ff_get_wav_header(pb, ast->codec, fsize); diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 56f4e271dd..7d6da93efc 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -64,7 +64,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) sample_rate = avio_rb16(pb); avio_skip(pb, 12); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index b6d6a84144..c236d2fbbf 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -410,7 +410,7 @@ static int ea_read_header(AVFormatContext *s, if (ea->video_codec) { /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); ea->video_stream_index = st->index; @@ -435,7 +435,7 @@ static int ea_read_header(AVFormatContext *s, } /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, ea->sample_rate); diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index b9516d5b8b..61b6a2dafe 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -290,7 +290,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) for(i=0;ipb, line, sizeof(line)); if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return -1; diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index e672ba0048..8028d0404f 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -49,7 +49,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index 1cae9f090e..e6098adf4a 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -31,7 +31,7 @@ static int flac_read_header(AVFormatContext *s, int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0; uint8_t header[4]; uint8_t *buffer=NULL; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/flic.c b/libavformat/flic.c index 3cea79e8a9..c231777963 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -105,7 +105,7 @@ static int flic_read_header(AVFormatContext *s, speed = FLIC_DEFAULT_SPEED; /* initialize the decoder streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); flic->video_stream_index = st->index; diff --git a/libavformat/idcin.c b/libavformat/idcin.c index ca67e69101..64bc5350a3 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -153,7 +153,7 @@ static int idcin_read_header(AVFormatContext *s, bytes_per_sample = avio_rl32(pb); channels = avio_rl32(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, IDCIN_FPS); @@ -174,7 +174,7 @@ static int idcin_read_header(AVFormatContext *s, /* if sample rate is 0, assume no audio */ if (sample_rate) { idcin->audio_present = 1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, IDCIN_FPS); diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 1175c22e48..88770345ae 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -84,7 +84,7 @@ static int roq_read_header(AVFormatContext *s, roq->audio_frame_count = 0; roq->audio_stream_index = -1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 63, 1, framerate); diff --git a/libavformat/iff.c b/libavformat/iff.c index 8f309b95dd..5e8f1689c4 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -115,7 +115,7 @@ static int iff_read_header(AVFormatContext *s, uint32_t chunk_id, data_size; int compression = -1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/img2.c b/libavformat/img2.c index c5bc978ae8..34ab79f6cc 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -216,7 +216,7 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) s1->ctx_flags |= AVFMTCTX_NOHEADER; - st = av_new_stream(s1, 0); + st = avformat_new_stream(s1, NULL); if (!st) { return AVERROR(ENOMEM); } diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 067ab15e66..396742d908 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -559,7 +559,7 @@ static int ipmovie_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; /* initialize the stream decoders */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 63, 1, 1000000); @@ -572,7 +572,7 @@ static int ipmovie_read_header(AVFormatContext *s, st->codec->bits_per_coded_sample = ipmovie->video_bpp; if (ipmovie->audio_type) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate); diff --git a/libavformat/iss.c b/libavformat/iss.c index c1dd478623..845e07ba0c 100644 --- a/libavformat/iss.c +++ b/libavformat/iss.c @@ -88,7 +88,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap) iss->sample_start_pos = avio_tell(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/iv8.c b/libavformat/iv8.c index bca31dcdd5..c1ddd0fdb7 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c index 9211881e53..52a370e652 100644 --- a/libavformat/ivfdec.c +++ b/libavformat/ivfdec.c @@ -40,7 +40,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rl16(s->pb); // version avio_rl16(s->pb); // header size - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index d4008f7148..908a9261d9 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -69,7 +69,7 @@ static int read_header(AVFormatContext *s, avio_skip(pb, 80); - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); vst = av_new_stream(s, 1); if (!ast || !vst) return AVERROR(ENOMEM); diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 0d905e4fed..7945cb1a4c 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -60,7 +60,7 @@ static int lmlm4_probe(AVProbeData * pd) { static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_MPEG4; diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 0f7e4268d2..1ab345e79f 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -217,7 +217,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE) return ret < 0 ? ret : AVERROR_EOF; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->duration = AV_RL32(&header_data[32]); diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 237e9295e0..78b27b6bd3 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1396,7 +1396,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) } } - st = track->stream = av_new_stream(s, 0); + st = track->stream = avformat_new_stream(s, NULL); if (st == NULL) return AVERROR(ENOMEM); @@ -1570,7 +1570,7 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) attachements[j].bin.data && attachements[j].bin.size > 0)) { av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n"); } else { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (st == NULL) break; av_dict_set(&st->metadata, "filename",attachements[j].filename, 0); diff --git a/libavformat/mm.c b/libavformat/mm.c index 20118a9de4..dc4ea71eb3 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -105,7 +105,7 @@ static int read_header(AVFormatContext *s, avio_skip(pb, length - 10); /* unknown data */ /* video stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -117,7 +117,7 @@ static int read_header(AVFormatContext *s, /* audio stream */ if (length == MM_HEADER_LEN_AV) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index ffa6916d97..4028a61545 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -241,7 +241,7 @@ static int mmf_read_header(AVFormatContext *s, } mmf->data_size = size; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index dbd1c1ef65..09494de136 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -137,7 +137,7 @@ static int mp3_read_header(AVFormatContext *s, AVStream *st; int64_t off; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 8faa0f7320..a8f526a627 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -84,7 +84,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) c->curbits = 8; c->frames_noted = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 2634ee33b9..cd89f1c2f2 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -222,7 +222,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) c->samples = ffio_read_varlen(pb); ffio_read_varlen(pb); //silence samples at the beginning - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index b232b2c147..5d1b296ca5 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1550,7 +1550,7 @@ static int mpegts_read_header(AVFormatContext *s, /* only read packets */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 9ac724e2f2..0c12ea60ef 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -75,7 +75,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) AVCodecContext *codec; AVStream *st; - st = av_new_stream(ctx, 0); + st = avformat_new_stream(ctx, NULL); if(!st) return AVERROR(ENOMEM); diff --git a/libavformat/mvi.c b/libavformat/mvi.c index 532c0c4f49..60a5bc893b 100644 --- a/libavformat/mvi.c +++ b/libavformat/mvi.c @@ -42,11 +42,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *ast, *vst; unsigned int version, frames_count, msecs_per_frame, player_version; - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 8feda75214..5c2506e5c7 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -45,7 +45,7 @@ static int nc_probe(AVProbeData *probe_packet) static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/oma.c b/libavformat/oma.c index 5ffe8fa9f0..da014689d0 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -307,7 +307,7 @@ static int oma_read_header(AVFormatContext *s, codec_params = AV_RB24(&buf[33]); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/output-example.c b/libavformat/output-example.c index 3b28b7c7c6..95690f75de 100644 --- a/libavformat/output-example.c +++ b/libavformat/output-example.c @@ -200,7 +200,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) AVCodecContext *c; AVStream *st; - st = av_new_stream(oc, 0); + st = avformat_new_stream(oc, NULL); if (!st) { fprintf(stderr, "Could not alloc stream\n"); exit(1); diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index ac6104fced..90385df0cb 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -162,7 +162,7 @@ static int str_read_packet(AVFormatContext *s, if(str->channels[channel].video_stream_index < 0){ /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, 15); @@ -210,7 +210,7 @@ static int str_read_packet(AVFormatContext *s, if(str->channels[channel].audio_stream_index < 0){ int fmt = sector[0x13]; /* allocate a new AVStream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/pva.c b/libavformat/pva.c index 22fea40db9..d045c29c4d 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -43,7 +43,7 @@ static int pva_probe(AVProbeData * pd) { static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - if (!(st = av_new_stream(s, 0))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_MPEG2VIDEO; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index 291eb182ed..191e9dd85b 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -84,7 +84,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIOContext *pb = s->pb; QCPContext *c = s->priv_data; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); uint8_t buf[16]; int i, nb_rates; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 890b3b93c6..8e632c99f1 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -52,7 +52,7 @@ static int read_atom(AVFormatContext *s, Atom *atom) static int r3d_read_red1(AVFormatContext *s) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); char filename[258]; int tmp; int av_unused tmp2; diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index c4c027ab06..fb3336d37c 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -33,7 +33,7 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; enum CodecID id; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -122,7 +122,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) int ff_raw_audio_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -143,7 +143,7 @@ int ff_raw_video_read_header(AVFormatContext *s, int ret = 0; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 42b46a8e36..e7b9fd9f98 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -110,7 +110,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, def_sound_size = avio_rl16(pb); /** setup video stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); @@ -140,7 +140,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, pts_num = def_sound_size; pts_den = rate; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 56ad3313cf..7eaecf0469 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -396,7 +396,7 @@ static int rm_read_header_old(AVFormatContext *s) AVStream *st; rm->old_format = 1; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->priv_data = ff_rm_alloc_rmstream(); @@ -462,7 +462,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) rm_read_metadata(s, 1); break; case MKTAG('M', 'D', 'P', 'R'): - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->id = avio_rb16(pb); diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 1e2f65f770..b2651f1860 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -139,7 +139,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) av_dict_set(&s->metadata, "author" , line, 0); // video headers - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -181,7 +181,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) // samples, though. This code will ignore additional tracks. audio_format = read_line_and_int(pb, &error); // audio format ID if (audio_format) { - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c index 98de8fe669..0f7588bd8a 100644 --- a/libavformat/rsodec.c +++ b/libavformat/rsodec.c @@ -54,7 +54,7 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index dc8ed30c77..f0e4dae8eb 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -43,7 +43,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st, return NULL; rtpctx->oformat = rtp_format; - if (!av_new_stream(rtpctx, 0)) { + if (!avformat_new_stream(rtpctx, NULL)) { av_free(rtpctx); return NULL; } diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 4bbacc5fa6..d4e496582b 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -134,7 +134,7 @@ static int film_read_header(AVFormatContext *s, /* initialize the decoder streams */ if (film->video_type) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); film->video_stream_index = st->index; @@ -146,7 +146,7 @@ static int film_read_header(AVFormatContext *s, } if (film->audio_type) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); film->audio_stream_index = st->index; diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 4539cfb20f..cf66895586 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -104,7 +104,7 @@ static int vmd_read_header(AVFormatContext *s, else vmd->is_indeo3 = 0; /* start up the decoders */ - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); av_set_pts_info(vst, 33, 1, 10); @@ -125,7 +125,7 @@ static int vmd_read_header(AVFormatContext *s, /* if sample rate is 0, assume no audio */ vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]); if (vmd->sample_rate) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); vmd->audio_stream_index = st->index; diff --git a/libavformat/siff.c b/libavformat/siff.c index cdb64528e5..9c24c51f15 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -71,7 +71,7 @@ static int siff_probe(AVProbeData *p) static int create_audio_stream(AVFormatContext *s, SIFFContext *c) { AVStream *ast; - ast = av_new_stream(s, 0); + ast = avformat_new_stream(s, NULL); if (!ast) return -1; ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -115,7 +115,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) avio_skip(pb, 16); //zeroes - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 447e6e67c4..279d58626d 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -154,7 +154,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) } /* init video codec */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; smk->videoindex = st->index; @@ -177,7 +177,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) for(i = 0; i < 7; i++) { smk->indexes[i] = -1; if (smk->rates[i]) { - ast[i] = av_new_stream(s, 0); + ast[i] = avformat_new_stream(s, NULL); smk->indexes[i] = ast[i]->index; ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; if (smk->aflags[i] & SMK_AUD_BINKAUD) { diff --git a/libavformat/sol.c b/libavformat/sol.c index 920582f3d1..55accc2473 100644 --- a/libavformat/sol.c +++ b/libavformat/sol.c @@ -110,7 +110,7 @@ static int sol_read_header(AVFormatContext *s, else id = 0; /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 504c8371ce..a9ee817f30 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -51,7 +51,7 @@ static int sox_read_header(AVFormatContext *s, double sample_rate, sample_rate_frac; AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index fa2ddeb5e8..0cbbc54e0f 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -205,7 +205,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) if (!s->nb_streams) { /* first packet, create a stream */ - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { av_free_packet(pkt); return AVERROR(ENOMEM); diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 72c5c80f6b..8927164ff5 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -42,7 +42,7 @@ static int srt_probe(AVProbeData *p) static int srt_read_header(AVFormatContext *s, AVFormatParameters *ap) { - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return -1; av_set_pts_info(st, 64, 1, 1000); diff --git a/libavformat/thp.c b/libavformat/thp.c index 3941977688..29312b4f78 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -94,7 +94,7 @@ static int thp_read_header(AVFormatContext *s, break; /* Video component. */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -117,7 +117,7 @@ static int thp_read_header(AVFormatContext *s, break; /* Audio component. */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index 41ee3c61cb..03d69db7ac 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -206,7 +206,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) seq->audio_buffer_full = 0; /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -219,7 +219,7 @@ static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->height = SEQ_FRAME_H; /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 10d78e18d8..b0b6a1b224 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -73,10 +73,10 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(pb) != TMV_TAG) return -1; - if (!(vst = av_new_stream(s, 0))) + if (!(vst = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); - if (!(ast = av_new_stream(s, 0))) + if (!(ast = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); ast->codec->sample_rate = avio_rl16(pb); diff --git a/libavformat/tta.c b/libavformat/tta.c index d049d5e9c7..87174c1abd 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -77,7 +77,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/tty.c b/libavformat/tty.c index 50514e8b08..8f2311dd1c 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -76,7 +76,7 @@ static int read_header(AVFormatContext *avctx, { TtyDemuxContext *s = avctx->priv_data; int width = 0, height = 0, ret = 0; - AVStream *st = av_new_stream(avctx, 0); + AVStream *st = avformat_new_stream(avctx, NULL); AVRational framerate; if (!st) { diff --git a/libavformat/txd.c b/libavformat/txd.c index e6fae08aa0..a601ea0853 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -40,7 +40,7 @@ static int txd_probe(AVProbeData * pd) { static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *st; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 564b5eb03d..172a64c30b 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -54,7 +54,7 @@ static int vc1t_read_header(AVFormatContext *s, return -1; /* init video codec */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index 23f1b0d579..638c15ae4b 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -52,7 +52,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR(ENOSYS); } avio_skip(pb, header_size); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 590d465c2a..71dc1ae73d 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -64,7 +64,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) { VqfContext *c = s->priv_data; - AVStream *st = av_new_stream(s, 0); + AVStream *st = avformat_new_stream(s, NULL); int chunk_tag; int rate_flag = -1; int header_size; diff --git a/libavformat/wav.c b/libavformat/wav.c index d80945157c..298880d590 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -273,7 +273,7 @@ static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st) int ret; /* parse fmt header */ - *st = av_new_stream(s, 0); + *st = avformat_new_stream(s, NULL); if (!*st) return AVERROR(ENOMEM); @@ -636,7 +636,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 0df9881887..b4d277239f 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -163,7 +163,7 @@ static int wc3_read_header(AVFormatContext *s, } while (fourcc_tag != BRCH_TAG); /* initialize the decoder streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); @@ -174,7 +174,7 @@ static int wc3_read_header(AVFormatContext *s, st->codec->width = wc3->width; st->codec->height = wc3->height; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, WC3_FRAME_FPS); diff --git a/libavformat/westwood.c b/libavformat/westwood.c index cd05b5deb8..be0140b596 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -144,7 +144,7 @@ static int wsaud_read_header(AVFormatContext *s, wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8; /* initialize the audio decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, wsaud->audio_samplerate); @@ -221,7 +221,7 @@ static int wsvqa_read_header(AVFormatContext *s, unsigned int chunk_size; /* initialize the video decoder stream */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, VQA_FRAMERATE); @@ -247,7 +247,7 @@ static int wsvqa_read_header(AVFormatContext *s, /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */ if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) { - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 33, 1, VQA_FRAMERATE); diff --git a/libavformat/wtv.c b/libavformat/wtv.c index cc6fc8be48..c3cd5ebcda 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -481,7 +481,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (!filesize) goto done; - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) goto done; av_dict_set(&st->metadata, "title", description, 0); diff --git a/libavformat/wv.c b/libavformat/wv.c index d057262029..4816ed670e 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -220,7 +220,7 @@ static int wv_read_header(AVFormatContext *s, } /* now we are ready: build format streams */ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/xa.c b/libavformat/xa.c index 7dd19585c2..cdff35de7d 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -70,7 +70,7 @@ static int xa_read_header(AVFormatContext *s, AVStream *st; /*Set up the XA Audio Decoder*/ - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/xmv.c b/libavformat/xmv.c index 4c2400bd85..9c47193beb 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -150,7 +150,7 @@ static int xmv_read_header(AVFormatContext *s, /* Video track */ - vst = av_new_stream(s, 0); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); diff --git a/libavformat/xwma.c b/libavformat/xwma.c index f383fd2077..9a1a6b62b9 100644 --- a/libavformat/xwma.c +++ b/libavformat/xwma.c @@ -69,7 +69,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) if (tag != MKTAG('f', 'm', 't', ' ')) return -1; size = avio_rl32(pb); - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); diff --git a/libavformat/yop.c b/libavformat/yop.c index 76116fb6b6..72004bf8fe 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -56,7 +56,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) int frame_rate, ret; - audio_stream = av_new_stream(s, 0); + audio_stream = avformat_new_stream(s, NULL); video_stream = av_new_stream(s, 1); // Extra data that will be passed to the decoder diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index 37d8d8a028..e1db1a377b 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -327,7 +327,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) aspectd = 1; } - st = av_new_stream(s, 0); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); st->codec->width = width; From 84ad31ff180fa089cd6bfd93c246336a16036455 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 18 Jun 2011 11:43:24 +0200 Subject: [PATCH 10/12] lavf: replace av_new_stream->avformat_new_stream part II. Manual replacements are done in this commit. In many cases, the id is some constant made up number (e.g. 0 for video and 1 for audio), which is then not used in the demuxer for anything. Those ids are removed. --- avconv.c | 5 ++++- libavformat/4xm.c | 3 ++- libavformat/applehttp.c | 3 ++- libavformat/avidec.c | 3 ++- libavformat/avisynth.c | 6 ++++-- libavformat/avs.c | 4 ++-- libavformat/bink.c | 2 +- libavformat/c93.c | 2 +- libavformat/flic.c | 2 +- libavformat/flvdec.c | 3 ++- libavformat/gxf.c | 3 ++- libavformat/idroqdec.c | 2 +- libavformat/jvdec.c | 2 +- libavformat/libnut.c | 2 +- libavformat/lmlm4.c | 2 +- libavformat/lxfdec.c | 2 +- libavformat/mov.c | 3 ++- libavformat/mpeg.c | 3 ++- libavformat/mpegts.c | 18 ++++++++++++------ libavformat/mtv.c | 10 ++++------ libavformat/mxfdec.c | 3 ++- libavformat/mxg.c | 10 ++++------ libavformat/nsvdec.c | 6 ++++-- libavformat/nutdec.c | 2 +- libavformat/nuv.c | 4 ++-- libavformat/oggdec.c | 3 ++- libavformat/pva.c | 2 +- libavformat/r3d.c | 2 +- libavformat/rdt.c | 3 ++- libavformat/rtsp.c | 3 ++- libavformat/sapdec.c | 6 ++++-- libavformat/swfdec.c | 9 ++++++--- libavformat/wtv.c | 3 ++- libavformat/xmv.c | 2 +- libavformat/yop.c | 2 +- 35 files changed, 83 insertions(+), 57 deletions(-) diff --git a/avconv.c b/avconv.c index 3c68ffc10b..8fc6fd1425 100644 --- a/avconv.c +++ b/avconv.c @@ -3016,7 +3016,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; - AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0); + AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; int64_t max_frames = INT64_MAX; char *bsf = NULL, *next, *codec_tag = NULL; @@ -3030,6 +3030,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e exit_program(1); } + if (oc->nb_streams - 1 < o->nb_streamid_map) + st->id = o->streamid_map[oc->nb_streams - 1]; + output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 21771348a9..ba4eda351d 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -198,12 +198,13 @@ static int fourxm_read_header(AVFormatContext *s, i += 8 + size; /* allocate a new AVStream */ - st = av_new_stream(s, current_track); + st = avformat_new_stream(s, NULL); if (!st){ ret= AVERROR(ENOMEM); goto fail; } + st->id = current_track; av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate); fourxm->tracks[current_track].stream_index = st->index; diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index 567baeb8ee..eadb230045 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -505,11 +505,12 @@ static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap) snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth); /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { - AVStream *st = av_new_stream(s, i); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; } + st->id = i; avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); if (v->bandwidth) av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, diff --git a/libavformat/avidec.c b/libavformat/avidec.c index da92353b00..71aa0365d3 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -426,10 +426,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) break; }else{ stream_index++; - st = av_new_stream(s, stream_index); + st = avformat_new_stream(s, NULL); if (!st) goto fail; + st->id = stream_index; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index b615796116..78eb5e6025 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -84,7 +84,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK) continue; - st = av_new_stream(s, id); + st = avformat_new_stream(s, NULL); + st->id = id; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->block_align = wvfmt.nBlockAlign; @@ -110,7 +111,8 @@ static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap) if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK) continue; - st = av_new_stream(s, id); + st = avformat_new_stream(s, NULL); + st->id = id; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->r_frame_rate.num = stream->info.dwRate; st->r_frame_rate.den = stream->info.dwScale; diff --git a/libavformat/avs.c b/libavformat/avs.c index cc0e849bc2..c6ccbb2cd2 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -179,7 +179,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_VIDEO: if (!avs->st_video) { - avs->st_video = av_new_stream(s, AVS_VIDEO); + avs->st_video = avformat_new_stream(s, NULL); if (avs->st_video == NULL) return AVERROR(ENOMEM); avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -196,7 +196,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) case AVS_AUDIO: if (!avs->st_audio) { - avs->st_audio = av_new_stream(s, AVS_AUDIO); + avs->st_audio = avformat_new_stream(s, NULL); if (avs->st_audio == NULL) return AVERROR(ENOMEM); avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/bink.c b/libavformat/bink.c index 19c4571e00..ea04afdf92 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -130,7 +130,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) avio_skip(pb, 4 * bink->num_audio_tracks); for (i = 0; i < bink->num_audio_tracks; i++) { - ast = av_new_stream(s, 1); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/c93.c b/libavformat/c93.c index 9a0eb52234..a47c301a36 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -117,7 +117,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) datasize = avio_rl16(pb); if (datasize > 42) { if (!c93->audio) { - c93->audio = av_new_stream(s, 1); + c93->audio = avformat_new_stream(s, NULL); if (!c93->audio) return AVERROR(ENOMEM); c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/flic.c b/libavformat/flic.c index c231777963..39c7444964 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -145,7 +145,7 @@ static int flic_read_header(AVFormatContext *s, */ if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) { /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */ - ast = av_new_stream(s, 1); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index d2f3f51d28..5e354b11be 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -354,9 +354,10 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { } static AVStream *create_stream(AVFormatContext *s, int is_audio){ - AVStream *st = av_new_stream(s, is_audio); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return NULL; + st->id = is_audio; st->codec->codec_type = is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO; av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ return st; diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 8077d809b3..283e3a6246 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -81,9 +81,10 @@ static int get_sindex(AVFormatContext *s, int id, int format) { i = ff_find_stream_index(s, id); if (i >= 0) return i; - st = av_new_stream(s, id); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); + st->id = id; switch (format) { case 3: case 4: diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 88770345ae..f1c1acca8b 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -166,7 +166,7 @@ static int roq_read_packet(AVFormatContext *s, case RoQ_SOUND_MONO: case RoQ_SOUND_STEREO: if (roq->audio_stream_index == -1) { - AVStream *st = av_new_stream(s, 1); + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE); diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c index 908a9261d9..42a4dbf4cc 100644 --- a/libavformat/jvdec.c +++ b/libavformat/jvdec.c @@ -70,7 +70,7 @@ static int read_header(AVFormatContext *s, avio_skip(pb, 80); ast = avformat_new_stream(s, NULL); - vst = av_new_stream(s, 1); + vst = avformat_new_stream(s, NULL); if (!ast || !vst) return AVERROR(ENOMEM); diff --git a/libavformat/libnut.c b/libavformat/libnut.c index a618c53903..fbf9f2ac67 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -213,7 +213,7 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { priv->s = s; for (i = 0; s[i].type != -1 && i < 2; i++) { - AVStream * st = av_new_stream(avf, i); + AVStream * st = avformat_new_stream(avf, NULL); int j; for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8); diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 7945cb1a4c..db3bf2875f 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -67,7 +67,7 @@ static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) { st->need_parsing = AVSTREAM_PARSE_HEADERS; av_set_pts_info(st, 64, 1001, 30000); - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MP2; diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 1ab345e79f..cfa4f970ad 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -243,7 +243,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_WARNING, "VBI data not yet supported\n"); if ((lxf->channels = (disk_params >> 2) & 0xF)) { - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/mov.c b/libavformat/mov.c index 144fdb9a15..d93969ce2a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1793,8 +1793,9 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVStreamContext *sc; int ret; - st = av_new_stream(c->fc, c->fc->nb_streams); + st = avformat_new_stream(c->fc, NULL); if (!st) return AVERROR(ENOMEM); + st->id = c->fc->nb_streams; sc = av_mallocz(sizeof(MOVStreamContext)); if (!sc) return AVERROR(ENOMEM); diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 52bf40faa5..982903829f 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -532,9 +532,10 @@ static int mpegps_read_packet(AVFormatContext *s, goto redo; } /* no stream found: add a new stream */ - st = av_new_stream(s, startcode); + st = avformat_new_stream(s, NULL); if (!st) goto skip; + st->id = startcode; st->codec->codec_type = type; st->codec->codec_id = codec_id; if (codec_id != CODEC_ID_PCM_S16BE) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 5d1b296ca5..b7814e59c9 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -598,12 +598,13 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, return AVERROR(ENOMEM); memcpy(sub_pes, pes, sizeof(*sub_pes)); - sub_st = av_new_stream(pes->stream, pes->pid); + sub_st = avformat_new_stream(pes->stream, NULL); if (!sub_st) { av_free(sub_pes); return AVERROR(ENOMEM); } + sub_st->id = pes->pid; av_set_pts_info(sub_st, 33, 1, 90000); sub_st->priv_data = sub_pes; sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -700,9 +701,10 @@ static int mpegts_push_data(MpegTSFilter *filter, /* stream not present in PMT */ if (!pes->st) { - pes->st = av_new_stream(ts->stream, pes->pid); + pes->st = avformat_new_stream(ts->stream, NULL); if (!pes->st) return AVERROR(ENOMEM); + pes->st->id = pes->pid; mpegts_set_stream_info(pes->st, pes, 0, 0); } @@ -1090,14 +1092,18 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len /* now create ffmpeg stream */ if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { pes = ts->pids[pid]->u.pes_filter.opaque; - if (!pes->st) - pes->st = av_new_stream(pes->stream, pes->pid); + if (!pes->st) { + pes->st = avformat_new_stream(pes->stream, NULL); + st->id = pes->pid; + } st = pes->st; } else { if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably pes = add_pes_stream(ts, pid, pcr_pid); - if (pes) - st = av_new_stream(pes->stream, pes->pid); + if (pes) { + st = avformat_new_stream(pes->stream, NULL); + st->id = pes->pid; + } } if (!st) diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 59f13fe704..16e4c90eeb 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -32,8 +32,6 @@ #define MTV_HEADER_SIZE 512 #define MTV_AUDIO_PADDING_SIZE 12 #define AUDIO_SAMPLING_RATE 44100 -#define VIDEO_SID 0 -#define AUDIO_SID 1 typedef struct MTVDemuxContext { @@ -118,7 +116,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // video - raw rgb565 - st = av_new_stream(s, VIDEO_SID); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); @@ -134,7 +132,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // audio - mp3 - st = av_new_stream(s, AUDIO_SID); + st = avformat_new_stream(s, NULL); if(!st) return AVERROR(ENOMEM); @@ -171,7 +169,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->pos -= MTV_AUDIO_PADDING_SIZE; - pkt->stream_index = AUDIO_SID; + pkt->stream_index = 1; }else { @@ -190,7 +188,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) for(i=0;iimg_segment_size/2;i++) *((uint16_t *)pkt->data+i) = av_bswap16(*((uint16_t *)pkt->data+i)); #endif - pkt->stream_index = VIDEO_SID; + pkt->stream_index = 0; } return ret; diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index d0a8a3afe2..76a8329766 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -746,11 +746,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) if (!source_track) continue; - st = av_new_stream(mxf->fc, source_track->track_id); + st = avformat_new_stream(mxf->fc, NULL); if (!st) { av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n"); return -1; } + st->id = source_track->track_id; st->priv_data = source_track; st->duration = component->duration; if (st->duration == -1) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 5caa68a667..2b69f7204f 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -24,8 +24,6 @@ #include "avformat.h" #include "avio.h" -#define VIDEO_STREAM_INDEX 0 -#define AUDIO_STREAM_INDEX 1 #define DEFAULT_PACKET_SIZE 1024 #define OVERREAD_SIZE 3 @@ -44,14 +42,14 @@ static int mxg_read_header(AVFormatContext *s, AVFormatParameters *ap) MXGContext *mxg = s->priv_data; /* video parameters will be extracted from the compressed bitstream */ - video_st = av_new_stream(s, VIDEO_STREAM_INDEX); + video_st = avformat_new_stream(s, NULL); if (!video_st) return AVERROR(ENOMEM); video_st->codec->codec_type = AVMEDIA_TYPE_VIDEO; video_st->codec->codec_id = CODEC_ID_MXPEG; av_set_pts_info(video_st, 64, 1, 1000000); - audio_st = av_new_stream(s, AUDIO_STREAM_INDEX); + audio_st = avformat_new_stream(s, NULL); if (!audio_st) return AVERROR(ENOMEM); audio_st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -166,7 +164,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) } pkt->pts = pkt->dts = mxg->dts; - pkt->stream_index = VIDEO_STREAM_INDEX; + pkt->stream_index = 0; pkt->destruct = NULL; pkt->size = mxg->buffer_ptr - mxg->soi_ptr; pkt->data = mxg->soi_ptr; @@ -204,7 +202,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) if (marker == APP13 && size >= 16) { /* audio data */ /* time (GMT) of first sample in usec since 1970, little-endian */ pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); - pkt->stream_index = AUDIO_STREAM_INDEX; + pkt->stream_index = 1; pkt->destruct = NULL; pkt->size = size - 14; pkt->data = startmarker_ptr + 16; diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 08c4b10362..84957c6a7a 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -437,10 +437,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) nsv->vheight = vwidth; if (vtag != T_NONE) { int i; - st = av_new_stream(s, NSV_ST_VIDEO); + st = avformat_new_stream(s, NULL); if (!st) goto fail; + st->id = NSV_ST_VIDEO; nst = av_mallocz(sizeof(NSVStream)); if (!nst) goto fail; @@ -468,10 +469,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) } if (atag != T_NONE) { #ifndef DISABLE_AUDIO - st = av_new_stream(s, NSV_ST_AUDIO); + st = avformat_new_stream(s, NULL); if (!st) goto fail; + st->id = NSV_ST_AUDIO; nst = av_mallocz(sizeof(NSVStream)); if (!nst) goto fail; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 493ca7efc0..730d6884cf 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -288,7 +288,7 @@ static int decode_main_header(NUTContext *nut){ nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); for(i=0; iv_id = stream_nr++; - vst = av_new_stream(s, ctx->v_id); + vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; @@ -169,7 +169,7 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { if (a_packs) { ctx->a_id = stream_nr++; - ast = av_new_stream(s, ctx->a_id); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 1fa8b09d13..7fd50a5590 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -172,10 +172,11 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream) os->header = -1; if (new_avstream) { - st = av_new_stream(s, idx); + st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); + st->id = idx; av_set_pts_info(st, 64, 1, 1000000); } diff --git a/libavformat/pva.c b/libavformat/pva.c index d045c29c4d..55883d7e9d 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -51,7 +51,7 @@ static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) { av_set_pts_info(st, 32, 1, 90000); av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME); - if (!(st = av_new_stream(s, 1))) + if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_MP2; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 8e632c99f1..11d450544a 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -89,7 +89,7 @@ static int r3d_read_red1(AVFormatContext *s) tmp = avio_r8(s->pb); // audio channels av_dlog(s, "audio channels %d\n", tmp); if (tmp > 0) { - AVStream *ast = av_new_stream(s, 1); + AVStream *ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 9155cfc480..3f161f618c 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -459,8 +459,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st) { AVStream *st; - if (!(st = av_new_stream(s, orig_st->id))) + if (!(st = avformat_new_stream(s, NULL))) return NULL; + st->id = orig_st->id; st->codec->codec_type = orig_st->codec->codec_type; st->first_dts = orig_st->first_dts; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 678594714f..5aadc4430a 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -357,9 +357,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) { /* no corresponding stream */ } else { - st = av_new_stream(s, rt->nb_rtsp_streams - 1); + st = avformat_new_stream(s, NULL); if (!st) return; + st->id = rt->nb_rtsp_streams - 1; rtsp_st->stream_index = st->index; st->codec->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c index c317821772..84a9eb17b3 100644 --- a/libavformat/sapdec.c +++ b/libavformat/sapdec.c @@ -163,11 +163,12 @@ static int sap_read_header(AVFormatContext *s, if (sap->sdp_ctx->ctx_flags & AVFMTCTX_NOHEADER) s->ctx_flags |= AVFMTCTX_NOHEADER; for (i = 0; i < sap->sdp_ctx->nb_streams; i++) { - AVStream *st = av_new_stream(s, i); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto fail; } + st->id = i; avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); st->time_base = sap->sdp_ctx->streams[i]->time_base; } @@ -211,11 +212,12 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt) if (s->ctx_flags & AVFMTCTX_NOHEADER) { while (sap->sdp_ctx->nb_streams > s->nb_streams) { int i = s->nb_streams; - AVStream *st = av_new_stream(s, i); + AVStream *st = avformat_new_stream(s, NULL); if (!st) { av_free_packet(pkt); return AVERROR(ENOMEM); } + st->id = i; avcodec_copy_context(st->codec, sap->sdp_ctx->streams[i]->codec); st->time_base = sap->sdp_ctx->streams[i]->time_base; } diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 502647f9a2..ac3d86c51c 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -106,9 +106,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) avio_rl16(pb); avio_r8(pb); /* Check for FLV1 */ - vst = av_new_stream(s, ch_id); + vst = avformat_new_stream(s, NULL); if (!vst) return -1; + vst->id = ch_id; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb)); av_set_pts_info(vst, 16, 256, swf->frame_rate); @@ -127,9 +128,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) avio_r8(pb); v = avio_r8(pb); swf->samples_per_frame = avio_rl16(pb); - ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ + ast = avformat_new_stream(s, NULL); if (!ast) return -1; + ast->id = -1; /* -1 to avoid clash with video stream ch_id */ ast->codec->channels = 1 + (v&1); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15); @@ -177,9 +179,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) break; } if (i == s->nb_streams) { - vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */ + vst = avformat_new_stream(s, NULL); if (!vst) return -1; + vst->id = -2; /* -2 to avoid clash with video stream and audio stream */ vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_MJPEG; av_set_pts_info(vst, 64, 256, swf->frame_rate); diff --git a/libavformat/wtv.c b/libavformat/wtv.c index c3cd5ebcda..4defc14e3c 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -626,9 +626,10 @@ static AVStream * new_stream(AVFormatContext *s, AVStream *st, int sid, int code WtvStream *wst = av_mallocz(sizeof(WtvStream)); if (!wst) return NULL; - st = av_new_stream(s, sid); + st = avformat_new_stream(s, NULL); if (!st) return NULL; + st->id = sid; st->priv_data = wst; } st->codec->codec_type = codec_type; diff --git a/libavformat/xmv.c b/libavformat/xmv.c index 9c47193beb..30e3b5ade9 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -211,7 +211,7 @@ static int xmv_read_header(AVFormatContext *s, av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream " "(0x%04X)\n", track->flags); - ast = av_new_stream(s, audio_track); + ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); diff --git a/libavformat/yop.c b/libavformat/yop.c index 72004bf8fe..c9bf9f8c4a 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -57,7 +57,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) int frame_rate, ret; audio_stream = avformat_new_stream(s, NULL); - video_stream = av_new_stream(s, 1); + video_stream = avformat_new_stream(s, NULL); // Extra data that will be passed to the decoder video_stream->codec->extradata_size = 8; From f0eeff708ab5add2d4e8aec9b10683d71b4802be Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 8 Oct 2011 08:47:47 +0200 Subject: [PATCH 11/12] lavc: make avcodec_get_context_defaults3 "officially" public Deprecate avcodec_get_context_defaults/avcodec_get_context_defaults2 --- avserver.c | 4 ++-- libavcodec/avcodec.h | 16 ++++++++++++++-- libavcodec/options.c | 44 ++++++++++++++++++++++---------------------- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/avserver.c b/avserver.c index 72b775447e..cb8f41f509 100644 --- a/avserver.c +++ b/avserver.c @@ -4234,8 +4234,8 @@ static int parse_ffconfig(const char *filename) } stream->fmt = avserver_guess_format(NULL, stream->filename, NULL); - avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO); - avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO); + avcodec_get_context_defaults3(&video_enc, NULL); + avcodec_get_context_defaults3(&audio_enc, NULL); audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; if (stream->fmt) { diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index a8086c6574..c2a3098eeb 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3592,19 +3592,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); */ const char *av_get_profile_name(const AVCodec *codec, int profile); +#if FF_API_ALLOC_CONTEXT /** * Set the fields of the given AVCodecContext to default values. * * @param s The AVCodecContext of which the fields should be set to default values. + * @deprecated use avcodec_get_context_defaults3 */ +attribute_deprecated void avcodec_get_context_defaults(AVCodecContext *s); /** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! * we WILL change its arguments and name a few times! */ +attribute_deprecated void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); +#endif -/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! - * we WILL change its arguments and name a few times! */ +/** + * Set the fields of the given AVCodecContext to default values corresponding + * to the given codec (defaults may be codec-dependent). + * + * Do not call this function if a non-NULL codec has been passed + * to avcodec_alloc_context3() that allocated this AVCodecContext. + * If codec is non-NULL, it is illegal to call avcodec_open2() with a + * different codec on this AVCodecContext. + */ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); #if FF_API_ALLOC_CONTEXT diff --git a/libavcodec/options.c b/libavcodec/options.c index 75a116450e..65d57d3d23 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -531,30 +531,32 @@ static const AVClass av_codec_context_class = { .child_class_next = codec_child_class_next, }; +#if FF_API_ALLOC_CONTEXT void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){ - memset(s, 0, sizeof(AVCodecContext)); - - s->av_class= &av_codec_context_class; - - s->codec_type = codec_type; - av_opt_set_defaults(s); - - s->time_base= (AVRational){0,1}; - s->get_buffer= avcodec_default_get_buffer; - s->release_buffer= avcodec_default_release_buffer; - s->get_format= avcodec_default_get_format; - s->execute= avcodec_default_execute; - s->execute2= avcodec_default_execute2; - s->sample_aspect_ratio= (AVRational){0,1}; - s->pix_fmt= PIX_FMT_NONE; - s->sample_fmt= AV_SAMPLE_FMT_NONE; - - s->reget_buffer= avcodec_default_reget_buffer; - s->reordered_opaque= AV_NOPTS_VALUE; + avcodec_get_context_defaults3(s, NULL); } +#endif int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){ - avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN); + memset(s, 0, sizeof(AVCodecContext)); + + s->av_class = &av_codec_context_class; + + s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN; + av_opt_set_defaults(s); + + s->time_base = (AVRational){0,1}; + s->get_buffer = avcodec_default_get_buffer; + s->release_buffer = avcodec_default_release_buffer; + s->get_format = avcodec_default_get_format; + s->execute = avcodec_default_execute; + s->execute2 = avcodec_default_execute2; + s->sample_aspect_ratio = (AVRational){0,1}; + s->pix_fmt = PIX_FMT_NONE; + s->sample_fmt = AV_SAMPLE_FMT_NONE; + + s->reget_buffer = avcodec_default_reget_buffer; + s->reordered_opaque = AV_NOPTS_VALUE; if(codec && codec->priv_data_size){ if(!s->priv_data){ s->priv_data= av_mallocz(codec->priv_data_size); @@ -602,13 +604,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ return avctx; } -#endif void avcodec_get_context_defaults(AVCodecContext *s){ avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN); } -#if FF_API_ALLOC_CONTEXT AVCodecContext *avcodec_alloc_context(void){ return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); } From 8096fdf0b6886305ea1a8cb2c869ab2732cd8e11 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 19 Oct 2011 08:22:23 +0200 Subject: [PATCH 12/12] presets: rename presets directory --- Makefile | 2 +- doc/avconv.texi | 2 +- doc/ffmpeg.texi | 2 +- {ffpresets => presets}/libvpx-1080p.avpreset | 0 {ffpresets => presets}/libvpx-1080p50_60.avpreset | 0 {ffpresets => presets}/libvpx-360p.avpreset | 0 {ffpresets => presets}/libvpx-720p.avpreset | 0 {ffpresets => presets}/libvpx-720p50_60.avpreset | 0 {ffpresets => presets}/libx264-baseline.avpreset | 0 {ffpresets => presets}/libx264-fast.avpreset | 0 {ffpresets => presets}/libx264-fast_firstpass.avpreset | 0 {ffpresets => presets}/libx264-faster.avpreset | 0 {ffpresets => presets}/libx264-faster_firstpass.avpreset | 0 {ffpresets => presets}/libx264-ipod320.avpreset | 0 {ffpresets => presets}/libx264-ipod640.avpreset | 0 {ffpresets => presets}/libx264-lossless_fast.avpreset | 0 {ffpresets => presets}/libx264-lossless_max.avpreset | 0 {ffpresets => presets}/libx264-lossless_medium.avpreset | 0 {ffpresets => presets}/libx264-lossless_slow.avpreset | 0 {ffpresets => presets}/libx264-lossless_slower.avpreset | 0 {ffpresets => presets}/libx264-lossless_ultrafast.avpreset | 0 {ffpresets => presets}/libx264-main.avpreset | 0 {ffpresets => presets}/libx264-medium.avpreset | 0 {ffpresets => presets}/libx264-medium_firstpass.avpreset | 0 {ffpresets => presets}/libx264-placebo.avpreset | 0 {ffpresets => presets}/libx264-placebo_firstpass.avpreset | 0 {ffpresets => presets}/libx264-slow.avpreset | 0 {ffpresets => presets}/libx264-slow_firstpass.avpreset | 0 {ffpresets => presets}/libx264-slower.avpreset | 0 {ffpresets => presets}/libx264-slower_firstpass.avpreset | 0 {ffpresets => presets}/libx264-superfast.avpreset | 0 {ffpresets => presets}/libx264-superfast_firstpass.avpreset | 0 {ffpresets => presets}/libx264-ultrafast.avpreset | 0 {ffpresets => presets}/libx264-ultrafast_firstpass.avpreset | 0 {ffpresets => presets}/libx264-veryfast.avpreset | 0 {ffpresets => presets}/libx264-veryfast_firstpass.avpreset | 0 {ffpresets => presets}/libx264-veryslow.avpreset | 0 {ffpresets => presets}/libx264-veryslow_firstpass.avpreset | 0 38 files changed, 3 insertions(+), 3 deletions(-) rename {ffpresets => presets}/libvpx-1080p.avpreset (100%) rename {ffpresets => presets}/libvpx-1080p50_60.avpreset (100%) rename {ffpresets => presets}/libvpx-360p.avpreset (100%) rename {ffpresets => presets}/libvpx-720p.avpreset (100%) rename {ffpresets => presets}/libvpx-720p50_60.avpreset (100%) rename {ffpresets => presets}/libx264-baseline.avpreset (100%) rename {ffpresets => presets}/libx264-fast.avpreset (100%) rename {ffpresets => presets}/libx264-fast_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-faster.avpreset (100%) rename {ffpresets => presets}/libx264-faster_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-ipod320.avpreset (100%) rename {ffpresets => presets}/libx264-ipod640.avpreset (100%) rename {ffpresets => presets}/libx264-lossless_fast.avpreset (100%) rename {ffpresets => presets}/libx264-lossless_max.avpreset (100%) rename {ffpresets => presets}/libx264-lossless_medium.avpreset (100%) rename {ffpresets => presets}/libx264-lossless_slow.avpreset (100%) rename {ffpresets => presets}/libx264-lossless_slower.avpreset (100%) rename {ffpresets => presets}/libx264-lossless_ultrafast.avpreset (100%) rename {ffpresets => presets}/libx264-main.avpreset (100%) rename {ffpresets => presets}/libx264-medium.avpreset (100%) rename {ffpresets => presets}/libx264-medium_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-placebo.avpreset (100%) rename {ffpresets => presets}/libx264-placebo_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-slow.avpreset (100%) rename {ffpresets => presets}/libx264-slow_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-slower.avpreset (100%) rename {ffpresets => presets}/libx264-slower_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-superfast.avpreset (100%) rename {ffpresets => presets}/libx264-superfast_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-ultrafast.avpreset (100%) rename {ffpresets => presets}/libx264-ultrafast_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-veryfast.avpreset (100%) rename {ffpresets => presets}/libx264-veryfast_firstpass.avpreset (100%) rename {ffpresets => presets}/libx264-veryslow.avpreset (100%) rename {ffpresets => presets}/libx264-veryslow_firstpass.avpreset (100%) diff --git a/Makefile b/Makefile index feb57cbea0..04af278b93 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale FFLIBS := avutil -DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.avpreset) +DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset) SKIPHEADERS = cmdutils_common_opts.h diff --git a/doc/avconv.texi b/doc/avconv.texi index 6e38a47b78..c298dc5710 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -778,7 +778,7 @@ A preset file contains a sequence of @var{option=value} pairs, one for each line, specifying a sequence of options which can be specified also on the command line. Lines starting with the hash ('#') character are ignored and are used to provide comments. Empty lines are also ignored. Check the -@file{ffpresets} directory in the Libav source tree for examples. +@file{presets} directory in the Libav source tree for examples. Preset files are specified with the @code{pre} option, this option takes a preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 22989c0723..968d4f68b7 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -791,7 +791,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs, one for each line, specifying a sequence of options which would be awkward to specify on the command line. Lines starting with the hash ('#') character are ignored and are used to provide comments. Check -the @file{ffpresets} directory in the Libav source tree for examples. +the @file{presets} directory in the Libav source tree for examples. Preset files are specified with the @code{vpre}, @code{apre}, @code{spre}, and @code{fpre} options. The @code{fpre} option takes the diff --git a/ffpresets/libvpx-1080p.avpreset b/presets/libvpx-1080p.avpreset similarity index 100% rename from ffpresets/libvpx-1080p.avpreset rename to presets/libvpx-1080p.avpreset diff --git a/ffpresets/libvpx-1080p50_60.avpreset b/presets/libvpx-1080p50_60.avpreset similarity index 100% rename from ffpresets/libvpx-1080p50_60.avpreset rename to presets/libvpx-1080p50_60.avpreset diff --git a/ffpresets/libvpx-360p.avpreset b/presets/libvpx-360p.avpreset similarity index 100% rename from ffpresets/libvpx-360p.avpreset rename to presets/libvpx-360p.avpreset diff --git a/ffpresets/libvpx-720p.avpreset b/presets/libvpx-720p.avpreset similarity index 100% rename from ffpresets/libvpx-720p.avpreset rename to presets/libvpx-720p.avpreset diff --git a/ffpresets/libvpx-720p50_60.avpreset b/presets/libvpx-720p50_60.avpreset similarity index 100% rename from ffpresets/libvpx-720p50_60.avpreset rename to presets/libvpx-720p50_60.avpreset diff --git a/ffpresets/libx264-baseline.avpreset b/presets/libx264-baseline.avpreset similarity index 100% rename from ffpresets/libx264-baseline.avpreset rename to presets/libx264-baseline.avpreset diff --git a/ffpresets/libx264-fast.avpreset b/presets/libx264-fast.avpreset similarity index 100% rename from ffpresets/libx264-fast.avpreset rename to presets/libx264-fast.avpreset diff --git a/ffpresets/libx264-fast_firstpass.avpreset b/presets/libx264-fast_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-fast_firstpass.avpreset rename to presets/libx264-fast_firstpass.avpreset diff --git a/ffpresets/libx264-faster.avpreset b/presets/libx264-faster.avpreset similarity index 100% rename from ffpresets/libx264-faster.avpreset rename to presets/libx264-faster.avpreset diff --git a/ffpresets/libx264-faster_firstpass.avpreset b/presets/libx264-faster_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-faster_firstpass.avpreset rename to presets/libx264-faster_firstpass.avpreset diff --git a/ffpresets/libx264-ipod320.avpreset b/presets/libx264-ipod320.avpreset similarity index 100% rename from ffpresets/libx264-ipod320.avpreset rename to presets/libx264-ipod320.avpreset diff --git a/ffpresets/libx264-ipod640.avpreset b/presets/libx264-ipod640.avpreset similarity index 100% rename from ffpresets/libx264-ipod640.avpreset rename to presets/libx264-ipod640.avpreset diff --git a/ffpresets/libx264-lossless_fast.avpreset b/presets/libx264-lossless_fast.avpreset similarity index 100% rename from ffpresets/libx264-lossless_fast.avpreset rename to presets/libx264-lossless_fast.avpreset diff --git a/ffpresets/libx264-lossless_max.avpreset b/presets/libx264-lossless_max.avpreset similarity index 100% rename from ffpresets/libx264-lossless_max.avpreset rename to presets/libx264-lossless_max.avpreset diff --git a/ffpresets/libx264-lossless_medium.avpreset b/presets/libx264-lossless_medium.avpreset similarity index 100% rename from ffpresets/libx264-lossless_medium.avpreset rename to presets/libx264-lossless_medium.avpreset diff --git a/ffpresets/libx264-lossless_slow.avpreset b/presets/libx264-lossless_slow.avpreset similarity index 100% rename from ffpresets/libx264-lossless_slow.avpreset rename to presets/libx264-lossless_slow.avpreset diff --git a/ffpresets/libx264-lossless_slower.avpreset b/presets/libx264-lossless_slower.avpreset similarity index 100% rename from ffpresets/libx264-lossless_slower.avpreset rename to presets/libx264-lossless_slower.avpreset diff --git a/ffpresets/libx264-lossless_ultrafast.avpreset b/presets/libx264-lossless_ultrafast.avpreset similarity index 100% rename from ffpresets/libx264-lossless_ultrafast.avpreset rename to presets/libx264-lossless_ultrafast.avpreset diff --git a/ffpresets/libx264-main.avpreset b/presets/libx264-main.avpreset similarity index 100% rename from ffpresets/libx264-main.avpreset rename to presets/libx264-main.avpreset diff --git a/ffpresets/libx264-medium.avpreset b/presets/libx264-medium.avpreset similarity index 100% rename from ffpresets/libx264-medium.avpreset rename to presets/libx264-medium.avpreset diff --git a/ffpresets/libx264-medium_firstpass.avpreset b/presets/libx264-medium_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-medium_firstpass.avpreset rename to presets/libx264-medium_firstpass.avpreset diff --git a/ffpresets/libx264-placebo.avpreset b/presets/libx264-placebo.avpreset similarity index 100% rename from ffpresets/libx264-placebo.avpreset rename to presets/libx264-placebo.avpreset diff --git a/ffpresets/libx264-placebo_firstpass.avpreset b/presets/libx264-placebo_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-placebo_firstpass.avpreset rename to presets/libx264-placebo_firstpass.avpreset diff --git a/ffpresets/libx264-slow.avpreset b/presets/libx264-slow.avpreset similarity index 100% rename from ffpresets/libx264-slow.avpreset rename to presets/libx264-slow.avpreset diff --git a/ffpresets/libx264-slow_firstpass.avpreset b/presets/libx264-slow_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-slow_firstpass.avpreset rename to presets/libx264-slow_firstpass.avpreset diff --git a/ffpresets/libx264-slower.avpreset b/presets/libx264-slower.avpreset similarity index 100% rename from ffpresets/libx264-slower.avpreset rename to presets/libx264-slower.avpreset diff --git a/ffpresets/libx264-slower_firstpass.avpreset b/presets/libx264-slower_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-slower_firstpass.avpreset rename to presets/libx264-slower_firstpass.avpreset diff --git a/ffpresets/libx264-superfast.avpreset b/presets/libx264-superfast.avpreset similarity index 100% rename from ffpresets/libx264-superfast.avpreset rename to presets/libx264-superfast.avpreset diff --git a/ffpresets/libx264-superfast_firstpass.avpreset b/presets/libx264-superfast_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-superfast_firstpass.avpreset rename to presets/libx264-superfast_firstpass.avpreset diff --git a/ffpresets/libx264-ultrafast.avpreset b/presets/libx264-ultrafast.avpreset similarity index 100% rename from ffpresets/libx264-ultrafast.avpreset rename to presets/libx264-ultrafast.avpreset diff --git a/ffpresets/libx264-ultrafast_firstpass.avpreset b/presets/libx264-ultrafast_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-ultrafast_firstpass.avpreset rename to presets/libx264-ultrafast_firstpass.avpreset diff --git a/ffpresets/libx264-veryfast.avpreset b/presets/libx264-veryfast.avpreset similarity index 100% rename from ffpresets/libx264-veryfast.avpreset rename to presets/libx264-veryfast.avpreset diff --git a/ffpresets/libx264-veryfast_firstpass.avpreset b/presets/libx264-veryfast_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-veryfast_firstpass.avpreset rename to presets/libx264-veryfast_firstpass.avpreset diff --git a/ffpresets/libx264-veryslow.avpreset b/presets/libx264-veryslow.avpreset similarity index 100% rename from ffpresets/libx264-veryslow.avpreset rename to presets/libx264-veryslow.avpreset diff --git a/ffpresets/libx264-veryslow_firstpass.avpreset b/presets/libx264-veryslow_firstpass.avpreset similarity index 100% rename from ffpresets/libx264-veryslow_firstpass.avpreset rename to presets/libx264-veryslow_firstpass.avpreset