[FFmpeg-devel] [PATCH] Update configure file to fix a build failure with gcc-11 on Ubuntu 21.10

2021-09-18 Thread Gianfranco Costamagna
New gcc changed the way it exposes armhf build flags.
"the architecture now has to include the cpu features, see the man page, arM 
options"

example of build failure:
https://launchpad.net/ubuntu/+source/ffmpeg/7:4.4-6ubuntu1/+build/22070856

Note: this syntax was introduced in GCC 8 https://gcc.gnu.org/gcc-8/changes.html
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 7ac23123c7..571b70208c 100755
--- a/configure
+++ b/configure
@@ -5000,7 +5000,7 @@ elif enabled arm; then
 elif check_arm_arch 6ZK;  then echo armv6zk
 elif check_arm_arch 6T2;  then echo armv6t2
 elif check_arm_arch 7;then echo armv7
-elif check_arm_arch 7A  7_A;  then echo armv7-a
+elif check_arm_arch 7A  7_A;  then echo armv7-a+fp
 elif check_arm_arch 7S;   then echo armv7-a
 elif check_arm_arch 7R  7_R;  then echo armv7-r
 elif check_arm_arch 7M  7_M;  then echo armv7-m
-- 
2.25.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/4] avcodec/siren: Check index for catergory5

2021-09-18 Thread Peter Ross
On Fri, Sep 17, 2021 at 09:56:16PM +0200, Michael Niedermayer wrote:
> Fixes: out of array access
> Fixes: 
> 38603/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSNSIREN_fuzzer-5741847809490944.fuzz
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/siren.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/siren.c b/libavcodec/siren.c
> index 2161b29a2cc..7f2b4678608 100644
> --- a/libavcodec/siren.c
> +++ b/libavcodec/siren.c
> @@ -648,6 +648,10 @@ static int decode_vector(SirenContext *s, int 
> number_of_regions,
>  }
>  coefs_ptr++;
>  }
> +if (i >= FF_ARRAY_ELEMS(noise_category5)) {
> +error = 1;
> +break;
> +}
>  
>  noise = decoder_standard_deviation[region] * noise_category5[i];
>  } else

this fixes the recent msnsiren commit.
please apply

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/3] avcodec/siren: prevent getbitcontext overread

2021-09-18 Thread Peter Ross
---
 libavcodec/siren.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/siren.c b/libavcodec/siren.c
index 2161b29a2c..3b0ad7b642 100644
--- a/libavcodec/siren.c
+++ b/libavcodec/siren.c
@@ -608,12 +608,16 @@ static int decode_vector(SirenContext *s, int 
number_of_regions,
 
 index >>= 1;
 
-if (error == 0 && get_bits_left(gb) >= 0) {
+if (error == 0) {
 for (j = 0; j < vector_dimension[category]; j++) {
 decoded_value = mlt_quant[category][index & ((1 << 
index_table[category]) - 1)];
 index >>= index_table[category];
 
 if (decoded_value) {
+if (get_bits_left(gb) <= 0) {
+error = 1;
+break;
+}
 if (!get_bits1(gb))
 decoded_value *= 
-decoder_standard_deviation[region];
 else
-- 
2.33.0

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/3] avcodec/siren: don't reduce getbitcontext size by checksum_bits at initialisation

2021-09-18 Thread Peter Ross
this allows the checksum calculation routine to also use getbitcontext
---
at the expense of having to offset get_bits_left(gb) everywhere

 libavcodec/siren.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/siren.c b/libavcodec/siren.c
index 3b0ad7b642..92fd3632f5 100644
--- a/libavcodec/siren.c
+++ b/libavcodec/siren.c
@@ -594,7 +594,7 @@ static int decode_vector(SirenContext *s, int 
number_of_regions,
 for (i = 0; i < number_of_vectors[category]; i++) {
 index = 0;
 do {
-if (get_bits_left(gb) <= 0) {
+if (get_bits_left(gb) - s->checksum_bits <= 0) {
 error = 1;
 break;
 }
@@ -614,7 +614,7 @@ static int decode_vector(SirenContext *s, int 
number_of_regions,
 index >>= index_table[category];
 
 if (decoded_value) {
-if (get_bits_left(gb) <= 0) {
+if (get_bits_left(gb) - s->checksum_bits <= 0) {
 error = 1;
 break;
 }
@@ -693,7 +693,7 @@ static int decode_vector(SirenContext *s, int 
number_of_regions,
 }
 }
 
-return error == 1 ? AVERROR_INVALIDDATA : get_bits_left(gb);
+return error == 1 ? AVERROR_INVALIDDATA : (get_bits_left(gb) - 
s->checksum_bits);
 }
 
 static int siren_decode(AVCodecContext *avctx, void *data,
@@ -712,7 +712,7 @@ static int siren_decode(AVCodecContext *avctx, void *data,
 if (avpkt->size < bits_per_frame / 8)
 return AVERROR_INVALIDDATA;
 
-if ((ret = init_get_bits(gb, avpkt->data, bits_per_frame - 
s->checksum_bits)) < 0)
+if ((ret = init_get_bits(gb, avpkt->data, bits_per_frame)) < 0)
 return ret;
 } else
 if ((ret = init_get_bits8(gb, avpkt->data, avpkt->size)) < 0)
@@ -726,7 +726,7 @@ static int siren_decode(AVCodecContext *avctx, void *data,
 
 rate_control = get_bits(gb, 4);
 
-ret = categorize_regions(s->number_of_regions, get_bits_left(gb),
+ret = categorize_regions(s->number_of_regions, get_bits_left(gb) - 
s->checksum_bits,
  s->absolute_region_power_index, 
s->power_categories,
  s->category_balance);
 if (ret < 0)
@@ -741,11 +741,11 @@ static int siren_decode(AVCodecContext *avctx, void *data,
 if (ret < 0 && !s->microsoft)
 return ret;
 
-if (get_bits_left(gb) > 0) {
+if (get_bits_left(gb) - s->checksum_bits > 0) {
 do {
 frame_error |= !get_bits1(gb);
-} while (get_bits_left(gb) > 0);
-} else if (get_bits_left(gb) < 0 &&
+} while (get_bits_left(gb) - s->checksum_bits > 0);
+} else if (get_bits_left(gb) - s->checksum_bits < 0 &&
rate_control + 1 < s->rate_control_possibilities) {
 frame_error = 1;
 }
-- 
2.33.0

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/3] avcodec/siren: add checksum calculation

2021-09-18 Thread Peter Ross
---
 libavcodec/siren.c | 32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/libavcodec/siren.c b/libavcodec/siren.c
index 92fd3632f5..2d3969f24c 100644
--- a/libavcodec/siren.c
+++ b/libavcodec/siren.c
@@ -756,7 +756,37 @@ static int siren_decode(AVCodecContext *avctx, void *data,
 frame_error = 1;
 }
 
-skip_bits(gb, s->checksum_bits);
+if ((avctx->err_recognition & AV_EF_CRCCHECK) && s->checksum_bits) {
+static const uint16_t ChecksumTable[4] = {0x7F80, 0x7878, 0x, 
0x};
+int wpf, checksum, sum, calculated_checksum, temp1;
+
+checksum = get_bits(gb, s->checksum_bits);
+
+wpf = bits_per_frame / 16;
+sum = 0;
+for (int i = 0; i < wpf - 1; i++)
+sum ^= AV_RB16(avpkt->data + i * 2) << (i % 15);
+sum ^= (AV_RB16(avpkt->data + (wpf - 1) * 2) & ~checksum) << ((wpf - 
1) % 15);
+sum = (sum >> 15) ^ (sum & 0x7FFF);
+
+calculated_checksum = 0;
+for (int i = 0; i < 4; i++) {
+temp1 = ChecksumTable[i] & sum;
+
+for (int j = 8; j > 0; j >>= 1)
+temp1 ^= temp1 >> j;
+
+calculated_checksum <<= 1;
+calculated_checksum |= temp1 & 1;
+}
+
+if (checksum != calculated_checksum) {
+av_log(avctx, AV_LOG_WARNING, "Invalid checksum\n");
+if (avctx->err_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
+frame_error = 1;
+}
+}
 
 if (frame_error) {
 memcpy(s->imdct_in, s->backup_frame, number_of_valid_coefs * 
sizeof(float));
-- 
2.33.0

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/3] libswscale/options: Add parent_log_context_offset to AVClass

2021-09-18 Thread Paul B Mahol
probably fine
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/demux: Use av_opt_set_int() where appropriate

2021-09-18 Thread Paul B Mahol
probably fine
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 03/13] avcodec/elbg: Merge avpriv_init_elbg() into avpriv_do_elbg()

2021-09-18 Thread Paul B Mahol
lgtm
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avfilter/vf_zscale: Don't make assumptions about zimg's range enums

2021-09-18 Thread Paul B Mahol
lgtm
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 12/39] avfilter/f_perms: Deduplicate AVClasses

2021-09-18 Thread Paul B Mahol
lgtm
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Update configure file to fix a build failure with gcc-11 on Ubuntu 21.10

2021-09-18 Thread Timo Rothenpieler

On 18.09.2021 11:06, Gianfranco Costamagna wrote:

New gcc changed the way it exposes armhf build flags.
"the architecture now has to include the cpu features, see the man page, arM 
options"

example of build failure:
https://launchpad.net/ubuntu/+source/ffmpeg/7:4.4-6ubuntu1/+build/22070856

Note: this syntax was introduced in GCC 8 https://gcc.gnu.org/gcc-8/changes.html
---
  configure | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 7ac23123c7..571b70208c 100755
--- a/configure
+++ b/configure
@@ -5000,7 +5000,7 @@ elif enabled arm; then
  elif check_arm_arch 6ZK;  then echo armv6zk
  elif check_arm_arch 6T2;  then echo armv6t2
  elif check_arm_arch 7;then echo armv7
-elif check_arm_arch 7A  7_A;  then echo armv7-a
+elif check_arm_arch 7A  7_A;  then echo armv7-a+fp
  elif check_arm_arch 7S;   then echo armv7-a
  elif check_arm_arch 7R  7_R;  then echo armv7-r
  elif check_arm_arch 7M  7_M;  then echo armv7-m



Does this still work with older gccs, or will those be broken after this?


smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v1 1/1] avformat/amr: Return PATCHWELCOME on stereo files

2021-09-18 Thread Sun Zhenliang
Ping.
在 2021年9月17日 +0800 15:28,Sun Zhenliang ,写道:
> 在 2021年9月17日 +0800 14:49,Paul B Mahol ,写道:
> > Are stereo files available somewhere? Known way to encode?
> Here is the stereo file,
> https://github.com/HiSunzhenliang/patch/blob/main/ffmpeg/avformat-amr-Return-PATCHWELCOME-on-stereo-files/stereo.amr-nb
>
> It’s made by our internal amr codec tool which followed 3GPP specifications.
>
> FFmpeg did not recognize this audio before. With this patch, it will detect 
> correctly and
> show patches welcome.
> >
> > On Fri, Sep 17, 2021 at 4:14 AM Sun Zhenliang 
> > wrote:
> >
> > > Ping.
> > >
> > > Anyone could review this patch?
> > >
> > > Thx.
> > > 在 2021年9月16日 +0800 11:24,sunzhenliang ,写道:
> > > > Signed-off-by: sunzhenliang 
> > > > ---
> > > > libavformat/amr.c | 22 ++
> > > > 1 file changed, 18 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/libavformat/amr.c b/libavformat/amr.c
> > > > index 836b276fd5..2762010ebe 100644
> > > > --- a/libavformat/amr.c
> > > > +++ b/libavformat/amr.c
> > > > @@ -36,8 +36,10 @@ typedef struct {
> > > > uint64_t block_count;
> > > > } AMRContext;
> > > >
> > > > -static const char AMR_header[] = "#!AMR\n";
> > > > -static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > +static const char AMR_header[] = "#!AMR\n";
> > > > +static const char AMR_MC_header[] = "#!AMR_MC1.0\n";
> > > > +static const char AMRWB_header[] = "#!AMR-WB\n";
> > > > +static const char AMRWB_MC_header[] = "#!AMR-WB_MC1.0\n";
> > > >
> > > > static const uint8_t amrnb_packed_size[16] = {
> > > > 13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
> > > > @@ -82,7 +84,7 @@ static int amr_read_header(AVFormatContext *s)
> > > > {
> > > > AVIOContext *pb = s->pb;
> > > > AVStream *st;
> > > > - uint8_t header[9];
> > > > + uint8_t header[15];
> > > >
> > > > if (avio_read(pb, header, 6) != 6)
> > > > return AVERROR_INVALIDDATA;
> > > > @@ -94,7 +96,19 @@ static int amr_read_header(AVFormatContext *s)
> > > > if (avio_read(pb, header + 6, 3) != 3)
> > > > return AVERROR_INVALIDDATA;
> > > > if (memcmp(header, AMRWB_header, 9)) {
> > > > - return -1;
> > > > + if (avio_read(pb, header + 6 + 3, 3) != 3)
> > > > + return AVERROR_INVALIDDATA;
> > > > + if (memcmp(header, AMR_MC_header, 12)) {
> > > > + if (avio_read(pb, header + 6 + 3 + 3, 3) != 3)
> > > > + return AVERROR_INVALIDDATA;
> > > > + if (memcmp(header, AMRWB_MC_header, 15)) {
> > > > + return -1;
> > > > + }
> > > > + avpriv_report_missing_feature(s, "multi-channel AMRWB");
> > > > + return AVERROR_PATCHWELCOME;
> > > > + }
> > > > + avpriv_report_missing_feature(s, "multi-channel AMR");
> > > > + return AVERROR_PATCHWELCOME;
> > > > }
> > > >
> > > > st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b');
> > > > --
> > > > 2.25.1
> > > >
> > > ___
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > >
> > > To unsubscribe, visit link above, or email
> > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> > >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [[PATCH] configure: fix armv7 build failure with gcc-11 and Ubuntu 21.10

2021-09-18 Thread Gianfranco Costamagna
New gcc changed the way it exposes armhf build flags.
"the architecture now has to include the cpu features, see the man page, arM 
options"

example of build failure:
https://launchpad.net/ubuntu/+source/ffmpeg/7:4.4-6ubuntu1/+build/22070856

Note: this syntax was introduced in GCC 8 https://gcc.gnu.org/gcc-8/changes.html
Signed-off-by: Gianfranco Costamagna 
Signed-off-by: Gianfranco Costamagna 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 7ac23123c7..571b70208c 100755
--- a/configure
+++ b/configure
@@ -5000,7 +5000,7 @@ elif enabled arm; then
 elif check_arm_arch 6ZK;  then echo armv6zk
 elif check_arm_arch 6T2;  then echo armv6t2
 elif check_arm_arch 7;then echo armv7
-elif check_arm_arch 7A  7_A;  then echo armv7-a
+elif check_arm_arch 7A  7_A;  then echo armv7-a+fp
 elif check_arm_arch 7S;   then echo armv7-a
 elif check_arm_arch 7R  7_R;  then echo armv7-r
 elif check_arm_arch 7M  7_M;  then echo armv7-m
-- 
2.25.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Update configure file to fix a build failure with gcc-11 on Ubuntu 21.10

2021-09-18 Thread Gianfranco Costamagna
Hello Timo

Il giorno sab 18 set 2021 alle ore 13:15 Timo Rothenpieler <
t...@rothenpieler.org> ha scritto:

> On 18.09.2021 11:06, Gianfranco Costamagna wrote:
> > New gcc changed the way it exposes armhf build flags.
> > "the architecture now has to include the cpu features, see the man page,
> arM options"
> >
> > example of build failure:
> >
> https://launchpad.net/ubuntu/+source/ffmpeg/7:4.4-6ubuntu1/+build/22070856
> >
> > Note: this syntax was introduced in GCC 8
> https://gcc.gnu.org/gcc-8/changes.html
> > ---
> >   configure | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/configure b/configure
> > index 7ac23123c7..571b70208c 100755
> > --- a/configure
> > +++ b/configure
> > @@ -5000,7 +5000,7 @@ elif enabled arm; then
> >   elif check_arm_arch 6ZK;  then echo armv6zk
> >   elif check_arm_arch 6T2;  then echo armv6t2
> >   elif check_arm_arch 7;then echo armv7
> > -elif check_arm_arch 7A  7_A;  then echo armv7-a
> > +elif check_arm_arch 7A  7_A;  then echo armv7-a+fp
> >   elif check_arm_arch 7S;   then echo armv7-a
> >   elif check_arm_arch 7R  7_R;  then echo armv7-r
> >   elif check_arm_arch 7M  7_M;  then echo armv7-m
> >
>
> Does this still work with older gccs, or will those be broken after this?
>

I checked gcc-10 and it works too.
The new naming has been introduced in gcc-8, so there should be no issues
even for backporting the package to old systems.

What is the oldest supported compiler for ffmpeg?

BTW this is just an idea of a patch, other people might want to patch all
the arms for the new gcc-11, but I don't know how to change them because I
don't have the hardware
so I just patched the Debian/Ubuntu used one.

Feel free to change it if you like, or just take it as reference for people
experiencing build failures with gcc-11. Hopefully somebody with the
required hw will patch it in a better way once the gcc-11 becomes default
on more systems.

I sent a new patch version with different commit message.
Gianfranco


> 
>
___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Update configure file to fix a build failure with gcc-11 on Ubuntu 21.10

2021-09-18 Thread Timo Rothenpieler

On 18.09.2021 15:48, Gianfranco Costamagna wrote:

Hello Timo

Il giorno sab 18 set 2021 alle ore 13:15 Timo Rothenpieler <
t...@rothenpieler.org> ha scritto:


On 18.09.2021 11:06, Gianfranco Costamagna wrote:

New gcc changed the way it exposes armhf build flags.
"the architecture now has to include the cpu features, see the man page,

arM options"


example of build failure:


https://launchpad.net/ubuntu/+source/ffmpeg/7:4.4-6ubuntu1/+build/22070856


Note: this syntax was introduced in GCC 8

https://gcc.gnu.org/gcc-8/changes.html

---
   configure | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 7ac23123c7..571b70208c 100755
--- a/configure
+++ b/configure
@@ -5000,7 +5000,7 @@ elif enabled arm; then
   elif check_arm_arch 6ZK;  then echo armv6zk
   elif check_arm_arch 6T2;  then echo armv6t2
   elif check_arm_arch 7;then echo armv7
-elif check_arm_arch 7A  7_A;  then echo armv7-a
+elif check_arm_arch 7A  7_A;  then echo armv7-a+fp
   elif check_arm_arch 7S;   then echo armv7-a
   elif check_arm_arch 7R  7_R;  then echo armv7-r
   elif check_arm_arch 7M  7_M;  then echo armv7-m



Does this still work with older gccs, or will those be broken after this?



I checked gcc-10 and it works too.
The new naming has been introduced in gcc-8, so there should be no issues
even for backporting the package to old systems.

What is the oldest supported compiler for ffmpeg?


At least all the way back to gcc-4, and some other exotic non-gcc compilers.
Though I'm not sure what the minimum with armv7 support is, or when gcc 
introduced it.


If it break some older compiler that's used on some stable branch of 
some distro, that'd be an issue.



BTW this is just an idea of a patch, other people might want to patch all
the arms for the new gcc-11, but I don't know how to change them because I
don't have the hardware
so I just patched the Debian/Ubuntu used one.

Feel free to change it if you like, or just take it as reference for people
experiencing build failures with gcc-11. Hopefully somebody with the
required hw will patch it in a better way once the gcc-11 becomes default
on more systems.

I sent a new patch version with different commit message.
Gianfranco




smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/10] configure: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread Paul B Mahol
Is this complete code to have fully functional SVC decoding?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/4] avformat/dhav: do not use zero fps

2021-09-18 Thread Michael Niedermayer
On Fri, Sep 17, 2021 at 10:02:25PM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/4] avcodec/siren: Check index for catergory5

2021-09-18 Thread Michael Niedermayer
On Sat, Sep 18, 2021 at 07:47:52PM +1000, Peter Ross wrote:
> On Fri, Sep 17, 2021 at 09:56:16PM +0200, Michael Niedermayer wrote:
> > Fixes: out of array access
> > Fixes: 
> > 38603/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MSNSIREN_fuzzer-5741847809490944.fuzz
> > 
> > Found-by: continuous fuzzing process 
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/siren.c | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/libavcodec/siren.c b/libavcodec/siren.c
> > index 2161b29a2cc..7f2b4678608 100644
> > --- a/libavcodec/siren.c
> > +++ b/libavcodec/siren.c
> > @@ -648,6 +648,10 @@ static int decode_vector(SirenContext *s, int 
> > number_of_regions,
> >  }
> >  coefs_ptr++;
> >  }
> > +if (i >= FF_ARRAY_ELEMS(noise_category5)) {
> > +error = 1;
> > +break;
> > +}
> >  
> >  noise = decoder_standard_deviation[region] * 
> > noise_category5[i];
> >  } else
> 
> this fixes the recent msnsiren commit.
> please apply

will apply

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 4/4] avcodec/targa: Do not return images when there is no image in the tga

2021-09-18 Thread Michael Niedermayer
On Fri, Sep 17, 2021 at 08:06:48PM +0200, Paul B Mahol wrote:
> On Fri, Sep 17, 2021 at 8:00 PM Michael Niedermayer 
> wrote:
> 
> > On Fri, Sep 17, 2021 at 07:35:32PM +0200, Paul B Mahol wrote:
> > > Please do not apply, This actually changes output to nothing.
> >
> > Do you have such a TGA file without an image in it?
> >
> > Why would that be relevant, comply with TGA specifications please.
> 
> thx

It is relevant as it would allow to check how such a file is handled
by various implementations
The specification does not specify that. It just says 
"No image Data included"
and our decoder returns a black image, the specification doesnt say that
means "black image" or i missed it when reading 
after the patch the decoder returns nothing instead of a black image
The other type this might reach is type 8, the specification i have doesnt
say anything about type 8 except that its reserved

Truevision TGAa
FILE FORMAT SPECIFICATION
Version 2.0
...
Image Type - Field 3 (1 byte):
The TGA File Format can be used to store Pseudo-Color, True-Color and 
Direct-Color images of various
pixel depths. Truevision has currently defined seven image types:
image   Description
Type0   No image Data included




[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/siren: add checksum calculation

2021-09-18 Thread Lynne
18 Sept 2021, 12:03 by pr...@xvid.org:

> ---
>  libavcodec/siren.c | 32 +++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/siren.c b/libavcodec/siren.c
> index 92fd3632f5..2d3969f24c 100644
> --- a/libavcodec/siren.c
> +++ b/libavcodec/siren.c
> @@ -756,7 +756,37 @@ static int siren_decode(AVCodecContext *avctx, void 
> *data,
>  frame_error = 1;
>  }
>  
> -skip_bits(gb, s->checksum_bits);
> +if ((avctx->err_recognition & AV_EF_CRCCHECK) && s->checksum_bits) {
> +static const uint16_t ChecksumTable[4] = {0x7F80, 0x7878, 0x, 
> 0x};
> +int wpf, checksum, sum, calculated_checksum, temp1;
> +
> +checksum = get_bits(gb, s->checksum_bits);
> +
> +wpf = bits_per_frame / 16;
> +sum = 0;
> +for (int i = 0; i < wpf - 1; i++)
> +sum ^= AV_RB16(avpkt->data + i * 2) << (i % 15);
> +sum ^= (AV_RB16(avpkt->data + (wpf - 1) * 2) & ~checksum) << ((wpf - 
> 1) % 15);
> +sum = (sum >> 15) ^ (sum & 0x7FFF);
> +
> +calculated_checksum = 0;
> +for (int i = 0; i < 4; i++) {
> +temp1 = ChecksumTable[i] & sum;
> +
> +for (int j = 8; j > 0; j >>= 1)
> +temp1 ^= temp1 >> j;
> +
> +calculated_checksum <<= 1;
> +calculated_checksum |= temp1 & 1;
> +}
> +
> +if (checksum != calculated_checksum) {
> +av_log(avctx, AV_LOG_WARNING, "Invalid checksum\n");
> +if (avctx->err_recognition & AV_EF_EXPLODE)
> +return AVERROR_INVALIDDATA;
> +frame_error = 1;
> +}
> +} 
>

Looks good to me.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avcodec/mlpdec: fix decoding single stereo stream in TrueHD

2021-09-18 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/mlpdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index bee47b6cc6..68c270ef52 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -408,6 +408,8 @@ static int read_major_sync(MLPDecodeContext *m, 
GetBitContext *gb)
 mh.stream_type);
 return AVERROR_PATCHWELCOME;
 }
+if (mh.channel_modifier_thd_stream0 == THD_CH_MODIFIER_STEREO)
+m->substream[0].mask = AV_CH_LAYOUT_STEREO;
 if ((substr = (mh.num_substreams > 1)))
 m->substream[0].mask = AV_CH_LAYOUT_STEREO;
 if (mh.num_substreams > 2)
@@ -415,7 +417,7 @@ static int read_major_sync(MLPDecodeContext *m, 
GetBitContext *gb)
 m->substream[2].mask = mh.channel_layout_thd_stream2;
 else
 m->substream[2].mask = mh.channel_layout_thd_stream1;
-m->substream[substr].mask = mh.channel_layout_thd_stream1;
+m->substream[1].mask = mh.channel_layout_thd_stream1;
 
 if (m->avctx->channels<=2 && m->substream[substr].mask == 
AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
 av_log(m->avctx, AV_LOG_DEBUG, "Mono stream with 2 substreams, 
ignoring 2nd\n");
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] avcodec/mlpenc: fix encoding stereo single stream in TrueHD

2021-09-18 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/mlpenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index ef01c1d282..b2b3297669 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -626,7 +626,7 @@ static av_cold int mlp_encode_init(AVCodecContext *avctx)
 ctx->ch_modifier_thd0= 0;
 ctx->ch_modifier_thd1= 0;
 ctx->ch_modifier_thd2= 0;
-ctx->channel_arrangement = 1;
+ctx->channel_arrangement = 0;
 break;
 case AV_CH_LAYOUT_5POINT0_BACK:
 ctx->ch_modifier_thd0= 1;
-- 
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/10] configure: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch includes a macro named "SVC_DEC_H264" has been added to the 
configure file that controls switching on and off SVC decoding capabilities 
based on temporal scalability.
  Thank you for you review!

configure.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/10] libavcodec/h264_ps.h: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264_ps.h.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/10] libavcodec/h264_ps.c: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264_ps.c.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 5/10] libavcodec/h264_refs.c: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264_refs.c.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/10] libavcodec/h264_parser.c: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264_parser.c.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 7/10] libavcodec/h264dec.c: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264dec.c.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 6/10] libavcodec/h264_slice.c: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264_slice.c.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 8/10] libavcodec/h264dec.h: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h264dec.h.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 9/10] libavcodec/h2645_parse.c: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h2645_parse.c.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 10/10] libavcodec/h2645_parse.h: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Dear,
  This patch contains the necessary implementations of the code.
  Thank you for your review!

h2645_parse.h.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] swscale: add input/output support for X2BGR10LE

2021-09-18 Thread Manuel Stoeckl
Signed-off-by: Manuel Stoeckl 
---
 libswscale/input.c   | 15 +--
 libswscale/output.c  |  9 -
 libswscale/utils.c   |  1 +
 libswscale/yuv2rgb.c |  9 ++---
 tests/ref/fate/filter-pixdesc-x2bgr10le  |  1 +
 tests/ref/fate/filter-pixfmts-copy   |  1 +
 tests/ref/fate/filter-pixfmts-crop   |  1 +
 tests/ref/fate/filter-pixfmts-field  |  1 +
 tests/ref/fate/filter-pixfmts-fieldorder |  1 +
 tests/ref/fate/filter-pixfmts-hflip  |  1 +
 tests/ref/fate/filter-pixfmts-il |  1 +
 tests/ref/fate/filter-pixfmts-null   |  1 +
 tests/ref/fate/filter-pixfmts-pad|  1 +
 tests/ref/fate/filter-pixfmts-scale  |  1 +
 tests/ref/fate/filter-pixfmts-transpose  |  1 +
 tests/ref/fate/filter-pixfmts-vflip  |  1 +
 16 files changed, 40 insertions(+), 6 deletions(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-x2bgr10le

diff --git a/libswscale/input.c b/libswscale/input.c
index b65aaf7c06..477dc3d6b2 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -245,7 +245,8 @@ rgb48funcs(bgr, BE, AV_PIX_FMT_BGR48BE)
  origin == AV_PIX_FMT_ARGB ||  \
  origin == AV_PIX_FMT_ABGR)\
 ? AV_RN32A(&src[(i) * 4])  \
-: ((origin == AV_PIX_FMT_X2RGB10LE)\
+: ((origin == AV_PIX_FMT_X2RGB10LE ||  \
+origin == AV_PIX_FMT_X2BGR10LE)\
? AV_RL32(&src[(i) * 4])\
: (isBE(origin) ? AV_RB16(&src[(i) * 2])\
   : AV_RL16(&src[(i) * 2]
@@ -393,6 +394,7 @@ rgb16_32_wrapper(AV_PIX_FMT_RGB565BE, rgb16be, 0, 0,  0, 0, 
  0xF800, 0x07E0,
 rgb16_32_wrapper(AV_PIX_FMT_RGB555BE, rgb15be, 0, 0,  0, 0,   0x7C00, 0x03E0,  
 0x001F,  0, 5, 10, RGB2YUV_SHIFT + 7)
 rgb16_32_wrapper(AV_PIX_FMT_RGB444BE, rgb12be, 0, 0,  0, 0,   0x0F00, 0x00F0,  
 0x000F,  0, 4,  8, RGB2YUV_SHIFT + 4)
 rgb16_32_wrapper(AV_PIX_FMT_X2RGB10LE, rgb30le, 16, 6, 0, 0, 0x3FF0, 
0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
+rgb16_32_wrapper(AV_PIX_FMT_X2BGR10LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 
0x3FF0, 4, 0, 0, RGB2YUV_SHIFT + 6)
 
 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
  const uint8_t *gsrc, const uint8_t *bsrc, const 
uint8_t *rsrc,
@@ -1344,6 +1346,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_X2RGB10LE:
 c->chrToYV12 = rgb30leToUV_half_c;
 break;
+case AV_PIX_FMT_X2BGR10LE:
+c->chrToYV12 = bgr30leToUV_half_c;
+break;
 }
 } else {
 switch (srcFormat) {
@@ -1428,6 +1433,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_X2RGB10LE:
 c->chrToYV12 = rgb30leToUV_c;
 break;
+case AV_PIX_FMT_X2BGR10LE:
+c->chrToYV12 = bgr30leToUV_c;
+break;
 }
 }
 
@@ -1708,7 +1716,10 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->lumToYV12 = y210le_Y_c;
 break;
 case AV_PIX_FMT_X2RGB10LE:
-c->lumToYV12 =rgb30leToY_c;
+c->lumToYV12 = rgb30leToY_c;
+break;
+case AV_PIX_FMT_X2BGR10LE:
+c->lumToYV12 = bgr30leToY_c;
 break;
 }
 if (c->needAlpha) {
diff --git a/libswscale/output.c b/libswscale/output.c
index f1d9a61d53..58b10f85a5 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1603,7 +1603,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
 
 dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
 dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2];
-} else if (target == AV_PIX_FMT_X2RGB10) {
+} else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) {
 uint32_t *dest = (uint32_t *) _dest;
 const uint32_t *r = (const uint32_t *) _r;
 const uint32_t *g = (const uint32_t *) _g;
@@ -1848,6 +1848,7 @@ YUV2RGBWRAPPER(yuv2rgb,,   8,AV_PIX_FMT_RGB8,  0)
 YUV2RGBWRAPPER(yuv2rgb,,   4,AV_PIX_FMT_RGB4,  0)
 YUV2RGBWRAPPER(yuv2rgb,,   4b,   AV_PIX_FMT_RGB4_BYTE, 0)
 YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0)
+YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0)
 
 static av_always_inline void yuv2rgb_write_full(SwsContext *c,
 uint8_t *dest, int i, int Y, int A, int U, int V,
@@ -3000,6 +3001,12 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 *yuv2packed2 = yuv2x2rgb10_2_c;
 *yuv2packedX = yuv2x2rgb10_X_c;
 break;
+case AV_PIX_FMT_X2BGR10LE:
+case AV_PIX_FMT_X2BGR10BE:
+*yuv2packed1 = yuv2x2bgr10_1_c;
+*yuv2packed2 = yuv2x2bgr10_2_c;
+  

[FFmpeg-devel] [PATCH 1/2] lavu/pix_fmt: add pixel format for x2bgr10

2021-09-18 Thread Manuel Stoeckl
The new format (given in big/little endian forms) matches the
existing X2RGB10 format, except with B and R channels switched.

AV_PIX_FMT_X2BGR10 data often is created by OpenGL programs
whose buffers use the GL_RGB10 internal format.

Signed-off-by: Manuel Stoeckl 
---
 doc/APIchanges   |  3 +++
 libavutil/pixdesc.c  | 24 
 libavutil/pixfmt.h   |  3 +++
 libavutil/version.h  |  4 ++--
 tests/ref/fate/imgutils  |  2 ++
 tests/ref/fate/sws-pixdesc-query | 11 +++
 6 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cf6105c99e..0ae6495b4d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-09-18 - xx - lavu 57.6.100 - pixfmt.h
+  Add AV_PIX_FMT_X2BGR10.
+
 2021-09-17 - xx - lavu 57.5.101 - buffer.h
   Constified the input parameters in av_buffer_replace(), av_buffer_ref(),
   and av_buffer_pool_buffer_get_opaque().
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 2346138d04..69cb198646 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -272,6 +272,30 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
 },
+[AV_PIX_FMT_X2BGR10LE] = {
+.name = "x2bgr10le",
+.nb_components= 3,
+.log2_chroma_w= 0,
+.log2_chroma_h= 0,
+.comp = {
+{ 0, 4, 0, 0, 10 },   /* R */
+{ 0, 4, 1, 2, 10 },   /* G */
+{ 0, 4, 2, 4, 10 },   /* B */
+},
+.flags = AV_PIX_FMT_FLAG_RGB,
+},
+[AV_PIX_FMT_X2BGR10BE] = {
+.name = "x2bgr10be",
+.nb_components= 3,
+.log2_chroma_w= 0,
+.log2_chroma_h= 0,
+.comp = {
+{ 0, 4, 2, 0, 10 },   /* R */
+{ 0, 4, 1, 2, 10 },   /* G */
+{ 0, 4, 0, 4, 10 },   /* B */
+},
+.flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE,
+},
 [AV_PIX_FMT_YUV422P] = {
 .name = "yuv422p",
 .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 5814f3f3da..53bdecfcb7 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -350,6 +350,8 @@ enum AVPixelFormat {
 
 AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 
10B(lsb), little-endian, X=unused/undefined
 AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 
10B(lsb), big-endian, X=unused/undefined
+AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 
10R(lsb), little-endian, X=unused/undefined
+AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 
10R(lsb), big-endian, X=unused/undefined
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
@@ -440,6 +442,7 @@ enum AVPixelFormat {
 
 #define AV_PIX_FMT_Y210   AV_PIX_FMT_NE(Y210BE,  Y210LE)
 #define AV_PIX_FMT_X2RGB10AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
+#define AV_PIX_FMT_X2BGR10AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
 
 /**
   * Chromaticity coordinates of the source primaries.
diff --git a/libavutil/version.h b/libavutil/version.h
index 1e6a80f86e..2b5ac540a4 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR   5
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR   6
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index f510150ea1..495bbd46f0 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -236,3 +236,5 @@ y210be  planes: 1, linesizes: 256   0   0   0, 
plane_sizes: 12288 0
 y210le  planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 x2rgb10le   planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 x2rgb10be   planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
+x2bgr10le   planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
+x2bgr10be   planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index c3cccfa492..a74109c3d7 100644
--- a/tests/ref/fa

Re: [FFmpeg-devel] [PATCH 1/2] avformat/mpegts: use actually read packet size in mpegts_resync special case

2021-09-18 Thread Marton Balint




On Fri, 17 Sep 2021, Michael Niedermayer wrote:


Fixes: infinite loop
Fixes: 
37986/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-5292311517462528
 -


LGTM, thanks.

Marton



Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
libavformat/mpegts.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index fe89d4fb9f3..bd13118f7f7 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2865,8 +2865,8 @@ static int mpegts_resync(AVFormatContext *s, int 
seekback, const uint8_t *curren
int64_t back = FFMIN(seekback, pos);

//Special case for files like 01c56b0dc1.ts
-if (current_packet[0] == 0x80 && current_packet[12] == 0x47) {
-avio_seek(pb, 12 - back, SEEK_CUR);
+if (current_packet[0] == 0x80 && current_packet[12] == 0x47 && pos >= 
TS_PACKET_SIZE) {
+avio_seek(pb, 12 - TS_PACKET_SIZE, SEEK_CUR);
return 0;
}

--
2.17.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3] avformat/mpegts: fixes overflow when parsing the PMT

2021-09-18 Thread Marton Balint




On Wed, 15 Sep 2021, Nicolas Jorge Dato wrote:


When a possible overflow was detected, there was a break
to exit the while loop.
However, it should have already substracted 2 bytes from
program_info_length (descriptor ID + length).
Ticket #9422


Thanks, applied.

Regards,
Marton


---
libavformat/mpegts.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index fe89d4fb9f..f4e95d21fd 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2346,10 +2346,11 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len

av_log(ts->stream, AV_LOG_TRACE, "program tag: 0x%02x len=%d\n", tag, 
len);

-if (len > program_info_length - 2)
+program_info_length -= 2;
+if (len > program_info_length)
// something else is broken, exit the program_descriptors_loop
break;
-program_info_length -= len + 2;
+program_info_length -= len;
if (tag == IOD_DESCRIPTOR) {
get8(&p, p_end); // scope
get8(&p, p_end); // label
--
2.33.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v3] avformat/libsrt: log streamid in listener mode

2021-09-18 Thread Marton Balint



On Fri, 18 Jun 2021, "zhilizhao(赵志立)" wrote:


Ping for review, thanks!


Thanks, applied.

Regards,
Marton




On Jun 10, 2021, at 11:58 AM, Zhao Zhili  wrote:

It's useful for test client which pass streamid to ffmpeg/ffplay.
For example, use ffmpeg to test streamid support in VLC:
./ffmpeg -v info -re -i foo.mp4 -c copy -f mpegts -mode listener 
srt://127.0.0.1:9000
./vlc srt://127.0.0.1:9000?streamid=foobar
---
v3:
Don't zero out streamid.
Fix streamid array size (512 -> 513).

v2:
Avoid forward declaration.
Use AV_LOG_VERBOSE.

libavformat/libsrt.c | 24 +++-
1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 8dee6aa3f3..a4285ca294 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -156,6 +156,15 @@ static int libsrt_neterrno(URLContext *h)
return os_errno ? AVERROR(os_errno) : AVERROR_UNKNOWN;
}

+static int libsrt_getsockopt(URLContext *h, int fd, SRT_SOCKOPT optname, const 
char * optnamestr, void * optval, int * optlen)
+{
+if (srt_getsockopt(fd, 0, optname, optval, optlen) < 0) {
+av_log(h, AV_LOG_ERROR, "failed to get option %s on socket: %s\n", 
optnamestr, srt_getlasterror_str());
+return AVERROR(EIO);
+}
+return 0;
+}
+
static int libsrt_socket_nonblock(int socket, int enable)
{
int ret, blocking = enable ? 0 : 1;
@@ -227,6 +236,9 @@ static int libsrt_listen(int eid, int fd, const struct 
sockaddr *addr, socklen_t
{
int ret;
int reuse = 1;
+/* Max streamid length plus an extra space for the terminating null 
character */
+char streamid[513];
+int streamid_len = sizeof(streamid);
if (srt_setsockopt(fd, SOL_SOCKET, SRTO_REUSEADDR, &reuse, sizeof(reuse))) {
av_log(h, AV_LOG_WARNING, "setsockopt(SRTO_REUSEADDR) failed\n");
}
@@ -245,6 +257,9 @@ static int libsrt_listen(int eid, int fd, const struct 
sockaddr *addr, socklen_t
return libsrt_neterrno(h);
if (libsrt_socket_nonblock(ret, 1) < 0)
av_log(h, AV_LOG_DEBUG, "libsrt_socket_nonblock failed\n");
+if (!libsrt_getsockopt(h, ret, SRTO_STREAMID, "SRTO_STREAMID", streamid, 
&streamid_len))
+/* Note: returned streamid_len doesn't count the terminating null 
character */
+av_log(h, AV_LOG_VERBOSE, "accept streamid [%s], length %d\n", 
streamid, streamid_len);

return ret;
}
@@ -279,15 +294,6 @@ static int libsrt_setsockopt(URLContext *h, int fd, 
SRT_SOCKOPT optname, const c
return 0;
}

-static int libsrt_getsockopt(URLContext *h, int fd, SRT_SOCKOPT optname, const 
char * optnamestr, void * optval, int * optlen)
-{
-if (srt_getsockopt(fd, 0, optname, optval, optlen) < 0) {
-av_log(h, AV_LOG_ERROR, "failed to get option %s on socket: %s\n", 
optnamestr, srt_getlasterror_str());
-return AVERROR(EIO);
-}
-return 0;
-}
-
/* - The "POST" options can be altered any time on a connected socket.
 They MAY have also some meaning when set prior to connecting; such
 option is SRTO_RCVSYN, which makes connect/accept call asynchronous.
--
2.31.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 1/10] configure: add SVC decode function base on temporal scalability for H.264

2021-09-18 Thread ??????
Thank you for your reply, this code just support the SVC decoding for the 
temporal scalability of H.264 at present, so it doesn't have the fully function 
of SVC decoding.



-- Original --
From:   
 "FFmpeg development discussions 
and patches"
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] avformat/libsrt: remove url_get_file_handle implementation

2021-09-18 Thread Marton Balint




On Mon, 9 Aug 2021, Zhao Zhili wrote:


SRTSOCKET is an abstraction designed by libsrt, it's not guaranteed
to be a real file descriptor. Even if it is, it should not be
operated directly outside of libsrt.
---
libavformat/libsrt.c | 7 ---
1 file changed, 7 deletions(-)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index e5701625b8..9aeaa8eb40 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -706,12 +706,6 @@ static int libsrt_close(URLContext *h)
return 0;
}

-static int libsrt_get_file_handle(URLContext *h)
-{
-SRTContext *s = h->priv_data;
-return s->fd;
-}
-
static const AVClass libsrt_class = {
.class_name = "libsrt",
.item_name  = av_default_item_name,
@@ -725,7 +719,6 @@ const URLProtocol ff_libsrt_protocol = {
.url_read= libsrt_read,
.url_write   = libsrt_write,
.url_close   = libsrt_close,
-.url_get_file_handle = libsrt_get_file_handle,
.priv_data_size  = sizeof(SRTContext),
.flags   = URL_PROTOCOL_FLAG_NETWORK,
.priv_data_class = &libsrt_class,


Thanks, applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] Update configure file to fix a build failure with gcc-11 on Ubuntu 21.10

2021-09-18 Thread Martin Storsjö

On Sat, 18 Sep 2021, Timo Rothenpieler wrote:


On 18.09.2021 15:48, Gianfranco Costamagna wrote:

Hello Timo

Il giorno sab 18 set 2021 alle ore 13:15 Timo Rothenpieler <
t...@rothenpieler.org> ha scritto:


On 18.09.2021 11:06, Gianfranco Costamagna wrote:

New gcc changed the way it exposes armhf build flags.
"the architecture now has to include the cpu features, see the man page,

arM options"


example of build failure:


https://launchpad.net/ubuntu/+source/ffmpeg/7:4.4-6ubuntu1/+build/22070856


Note: this syntax was introduced in GCC 8

https://gcc.gnu.org/gcc-8/changes.html

---
   configure | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 7ac23123c7..571b70208c 100755
--- a/configure
+++ b/configure
@@ -5000,7 +5000,7 @@ elif enabled arm; then
   elif check_arm_arch 6ZK;  then echo armv6zk
   elif check_arm_arch 6T2;  then echo armv6t2
   elif check_arm_arch 7;then echo armv7
-elif check_arm_arch 7A  7_A;  then echo armv7-a
+elif check_arm_arch 7A  7_A;  then echo armv7-a+fp
   elif check_arm_arch 7S;   then echo armv7-a
   elif check_arm_arch 7R  7_R;  then echo armv7-r
   elif check_arm_arch 7M  7_M;  then echo armv7-m



Does this still work with older gccs, or will those be broken after this?



I checked gcc-10 and it works too.
The new naming has been introduced in gcc-8, so there should be no issues
even for backporting the package to old systems.

What is the oldest supported compiler for ffmpeg?


At least all the way back to gcc-4, and some other exotic non-gcc compilers.
Though I'm not sure what the minimum with armv7 support is, or when gcc 
introduced it.


If it break some older compiler that's used on some stable branch of some 
distro, that'd be an issue.


+1, if this new syntax was introduced with GCC 8, I guess this would break 
building with GCC 7, and that's a rather new version to break IMO.


I'll try to reproduce this and look into it.

// Martin

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/2] avformat/utils: Add av_stream_get_codec_properties()

2021-09-18 Thread Soft Works
Signed-off-by: softworkz 
---
 doc/APIchanges | 3 +++
 libavformat/avformat.h | 9 +
 libavformat/utils.c| 5 +
 libavformat/version.h  | 2 +-
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cf6105c99e..fee94ccadd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-04-27 - xx - lavf 59.6.100 - avformat.h
+  Add av_stream_get_codec_properties()
+
 2021-09-17 - xx - lavu 57.5.101 - buffer.h
   Constified the input parameters in av_buffer_replace(), av_buffer_ref(),
   and av_buffer_pool_buffer_get_opaque().
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3a5bc8a06d..89ed984d1d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2763,6 +2763,15 @@ int avformat_transfer_internal_stream_timing_info(const 
AVOutputFormat *ofmt,
  */
 AVRational av_stream_get_codec_timebase(const AVStream *st);
 
+/**
+ * Get the internal codec properties from a stream.
+ *
+ * See @ref AVCodecContext.properties.
+ *
+ * @param st  input stream to extract the timebase from
+ */
+unsigned av_stream_get_codec_properties(const AVStream *st);
+
 /**
  * @}
  */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2b6208e8dc..76d3b0c85e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1945,6 +1945,11 @@ AVRational av_stream_get_codec_timebase(const AVStream 
*st)
 return cffstream(st)->avctx->time_base;
 }
 
+unsigned av_stream_get_codec_properties(const AVStream *st)
+{
+return cffstream(st)->avctx->properties;
+}
+
 void ff_format_set_url(AVFormatContext *s, char *url)
 {
 av_assert0(url);
diff --git a/libavformat/version.h b/libavformat/version.h
index 13df244d97..d5dd22059b 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   5
+#define LIBAVFORMAT_VERSION_MINOR   6
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.30.2.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works
Repro Example:
ffprobe -show_entries stream=closed_captions:disposition=:side_data=  
"http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";

While the codec string includes "Closed Captions",
the stream data is showing: closed_captions=0

Signed-off-by: softworkz 
---
 fftools/ffprobe.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 880f05a6c2..9425c1a2e3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w, 
AVFormatContext *fmt_ctx, int stream_id
 print_int("width",par->width);
 print_int("height",   par->height);
 if (dec_ctx) {
+unsigned codec_properties = 
av_stream_get_codec_properties(ist->st);
 print_int("coded_width",  dec_ctx->coded_width);
 print_int("coded_height", dec_ctx->coded_height);
-print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
-print_int("film_grain", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_FILM_GRAIN));
+print_int("closed_captions", !!(codec_properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
+print_int("film_grain", !!(codec_properties & 
FF_CODEC_PROPERTY_FILM_GRAIN));
 }
 print_int("has_b_frames", par->video_delay);
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
-- 
2.30.2.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 1/2] avformat/utils: Add av_stream_get_codec_properties()

2021-09-18 Thread Soft Works
Signed-off-by: softworkz 
---
 doc/APIchanges | 3 +++
 libavformat/avformat.h | 9 +
 libavformat/utils.c| 5 +
 libavformat/version.h  | 2 +-
 4 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index cf6105c99e..fee94ccadd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-04-27 - xx - lavf 59.6.100 - avformat.h
+  Add av_stream_get_codec_properties()
+
 2021-09-17 - xx - lavu 57.5.101 - buffer.h
   Constified the input parameters in av_buffer_replace(), av_buffer_ref(),
   and av_buffer_pool_buffer_get_opaque().
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3a5bc8a06d..89ed984d1d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2763,6 +2763,15 @@ int avformat_transfer_internal_stream_timing_info(const 
AVOutputFormat *ofmt,
  */
 AVRational av_stream_get_codec_timebase(const AVStream *st);
 
+/**
+ * Get the internal codec properties from a stream.
+ *
+ * See @ref AVCodecContext.properties.
+ *
+ * @param st  input stream to extract the timebase from
+ */
+unsigned av_stream_get_codec_properties(const AVStream *st);
+
 /**
  * @}
  */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2b6208e8dc..76d3b0c85e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1945,6 +1945,11 @@ AVRational av_stream_get_codec_timebase(const AVStream 
*st)
 return cffstream(st)->avctx->time_base;
 }
 
+unsigned av_stream_get_codec_properties(const AVStream *st)
+{
+return cffstream(st)->avctx->properties;
+}
+
 void ff_format_set_url(AVFormatContext *s, char *url)
 {
 av_assert0(url);
diff --git a/libavformat/version.h b/libavformat/version.h
index 13df244d97..d5dd22059b 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  59
-#define LIBAVFORMAT_VERSION_MINOR   5
+#define LIBAVFORMAT_VERSION_MINOR   6
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
2.30.2.windows.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works
Repro Example:
ffprobe -show_entries stream=closed_captions:disposition=:side_data=  
"http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";

While the codec string includes "Closed Captions",
the stream data is showing: closed_captions=0

The test ref was incorrect as the test media file
actually does have cc.

Signed-off-by: softworkz 
---
v2: Fix test result. It was undiscovered locally as make fate 
does not seem to properly rebuild ffprobe.

 fftools/ffprobe.c   | 5 +++--
 tests/ref/fate/ts-demux | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 880f05a6c2..9425c1a2e3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w, 
AVFormatContext *fmt_ctx, int stream_id
 print_int("width",par->width);
 print_int("height",   par->height);
 if (dec_ctx) {
+unsigned codec_properties = 
av_stream_get_codec_properties(ist->st);
 print_int("coded_width",  dec_ctx->coded_width);
 print_int("coded_height", dec_ctx->coded_height);
-print_int("closed_captions", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
-print_int("film_grain", !!(dec_ctx->properties & 
FF_CODEC_PROPERTY_FILM_GRAIN));
+print_int("closed_captions", !!(codec_properties & 
FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
+print_int("film_grain", !!(codec_properties & 
FF_CODEC_PROPERTY_FILM_GRAIN));
 }
 print_int("has_b_frames", par->video_delay);
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index 8e7a81da41..1d1382cf37 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -41,7 +41,7 @@ 
packet|codec_type=audio|stream_index=2|pts=3912642700|pts_time=43473.807778|dts=
 
packet|codec_type=video|stream_index=0|pts=3912686363|pts_time=43474.292922|dts=3912686363|dts_time=43474.292922|duration=1501|duration_time=0.016678|size=4944|pos=506660|flags=__|data_hash=CRC32:54a86cbb
 
packet|codec_type=audio|stream_index=1|pts=3912644825|pts_time=43473.831389|dts=3912644825|dts_time=43473.831389|duration=2880|duration_time=0.032000|size=906|pos=474888|flags=K_|data_hash=CRC32:0893d398
 
packet|codec_type=audio|stream_index=2|pts=3912645580|pts_time=43473.839778|dts=3912645580|dts_time=43473.839778|duration=2880|duration_time=0.032000|size=354|pos=491808|flags=K_|data_hash=CRC32:f5963fa6
-stream|index=0|codec_name=mpeg2video|profile=4|codec_type=video|codec_tag_string=[2][0][0][0]|codec_tag=0x0002|width=1280|height=720|coded_width=0|coded_height=0|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=4|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|id=0x31|r_frame_rate=6/1001|avg_frame_rate=6/1001|time_base=1/9|start_pts=3912669846|start_time=43474.109400|duration_ts=19519|duration=0.216878|bit_rate=1500|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=15|extradata_hash=CRC32:53134fa8|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_
 
thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
+stream|index=0|codec_name=mpeg2video|profile=4|codec_type=video|codec_tag_string=[2][0][0][0]|codec_tag=0x0002|width=1280|height=720|coded_width=0|coded_height=0|closed_captions=1|film_grain=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=4|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|id=0x31|r_frame_rate=6/1001|avg_frame_rate=6/1001|time_base=1/9|start_pts=3912669846|start_time=43474.109400|duration_ts=19519|duration=0.216878|bit_rate=1500|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=15|extradata_hash=CRC32:53134fa8|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_
 
thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
 side_data|side_data_type=CPB 
properties|max_bitrate=1500|min_bitrate=0|avg_bitrate=0|buffer_size=9781248|vbv_delay=-1
 
stream|index=1|codec_name=ac3|profile=u

Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Andreas Rheinhardt
Soft Works:
> Repro Example:
> ffprobe -show_entries stream=closed_captions:disposition=:side_data=  
> "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";
> 
> While the codec string includes "Closed Captions",
> the stream data is showing: closed_captions=0
> 
> The test ref was incorrect as the test media file
> actually does have cc.
> 
> Signed-off-by: softworkz 
> ---
> v2: Fix test result. It was undiscovered locally as make fate 
> does not seem to properly rebuild ffprobe.
> 

This test and several others in demux.mak are indeed missing an ffprobe
dependency. Will fix it. (A full fate-run should have nevertheless
rebuilt ffprobe, but maybe it only rebuilt it after having run these tests?)

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Andreas
> Rheinhardt
> Sent: Sunday, 19 September 2021 00:16
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of
> closed_captions property
> 
> Soft Works:
> > Repro Example:
> > ffprobe -show_entries stream=closed_captions:disposition=:side_data=
> "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";
> >
> > While the codec string includes "Closed Captions",
> > the stream data is showing: closed_captions=0
> >
> > The test ref was incorrect as the test media file
> > actually does have cc.
> >
> > Signed-off-by: softworkz 
> > ---
> > v2: Fix test result. It was undiscovered locally as make fate
> > does not seem to properly rebuild ffprobe.
> >
> 
> This test and several others in demux.mak are indeed missing an ffprobe
> dependency. Will fix it. (A full fate-run should have nevertheless
> rebuilt ffprobe, but maybe it only rebuilt it after having run these tests?)

I have a clean setup on a Uubuntu VM where I do nothing but running
FATE.

I did 'git pull' and then ran FATE which passed.


I had recently seen a similar issue which still reproduces for me:

make distclean
./configure
make -j8 fate SAMPLES=...

It errors at some point, but it doesn't error when I either
make ffprobe before or when I do not use the "-j8" parameter.

softworkz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Soft Works
> Sent: Sunday, 19 September 2021 00:38
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of
> closed_captions property
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of Andreas
> > Rheinhardt
> > Sent: Sunday, 19 September 2021 00:16
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display
> of
> > closed_captions property
> >
> > Soft Works:
> > > Repro Example:
> > > ffprobe -show_entries stream=closed_captions:disposition=:side_data=
> > "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";
> > >
> > > While the codec string includes "Closed Captions",
> > > the stream data is showing: closed_captions=0
> > >
> > > The test ref was incorrect as the test media file
> > > actually does have cc.
> > >
> > > Signed-off-by: softworkz 
> > > ---
> > > v2: Fix test result. It was undiscovered locally as make fate
> > > does not seem to properly rebuild ffprobe.
> > >
> >
> > This test and several others in demux.mak are indeed missing an ffprobe
> > dependency. Will fix it. (A full fate-run should have nevertheless
> > rebuilt ffprobe, but maybe it only rebuilt it after having run these
> tests?)
> 
> I have a clean setup on a Uubuntu VM where I do nothing but running
> FATE.
> 
> I did 'git pull' and then ran FATE which passed.
> 
> 
> I had recently seen a similar issue which still reproduces for me:
> 
> make distclean
> ./configure
> make -j8 fate SAMPLES=...
> 
> It errors at some point, but it doesn't error when I either
> make ffprobe before or when I do not use the "-j8" parameter.
> 

That essentially aligns with what you said:

> > rebuilt ffprobe, but maybe it only rebuilt it after having run these
> tests?)

ffprobe might get re-built at some point but when not building 
sequentially it might be built too late.

Maybe just some but not all depending tests are marked to depend
on ffprobe?

softworkz





___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/1] Implements RTMP reconnect feature

2021-09-18 Thread Jordi Cenzano
Nowadays when you are streaming to a live platform if the RTMP(s)
server needs to restarted for any reason (ex: deploy new version)
the RTMP connection is interrupted (probably after some draining time).
Facebook will publish a proposal to avoid that by sending a
GoAway message in the RTMP protocol.
This code is the reference client implementation of that proposal.
AFAIK other big live platforms showed their interest in implementing
this mechanism.
This can be already tested against Facebook live production using
the querystring parameter ?ccr_sec=120 (that indicates the backend
to send a disconnect signal after those seconds)
---
 libavformat/rtmppkt.c   |  19 +++
 libavformat/rtmppkt.h   |  10 ++
 libavformat/rtmpproto.c | 356 +---
 3 files changed, 359 insertions(+), 26 deletions(-)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 4b97c0833f..84ec72740d 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -405,6 +405,25 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
 return written;
 }
 
+int ff_rtmp_packet_clone(RTMPPacket *pkt_dst, const RTMPPacket *pkt_src)
+{
+if (pkt_src->size) {
+pkt_dst->data = av_realloc(NULL, pkt_src->size);
+if (!pkt_dst->data)
+return AVERROR(ENOMEM);
+else
+memcpy(pkt_dst->data, pkt_src->data, pkt_src->size);
+}
+pkt_dst->size   = pkt_src->size;
+pkt_dst->channel_id = pkt_src->channel_id;
+pkt_dst->type   = pkt_src->type;
+pkt_dst->timestamp  = pkt_src->timestamp;
+pkt_dst->extra  = pkt_src->extra;
+pkt_dst->ts_field   = pkt_src->ts_field;
+
+return 0;
+}
+
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
   int timestamp, int size)
 {
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index a15d2a5773..cdb901df89 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -59,6 +59,7 @@ typedef enum RTMPPacketType {
 RTMP_PT_SHARED_OBJ, ///< shared object
 RTMP_PT_INVOKE, ///< invoke some stream action
 RTMP_PT_METADATA = 22,  ///< FLV metadata
+RTMP_PT_GO_AWAY  = 32,  ///< Indicates please reconnect ASAP, server 
is about to go down
 } RTMPPacketType;
 
 /**
@@ -99,6 +100,15 @@ typedef struct RTMPPacket {
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
   int timestamp, int size);
 
+/**
+ * Clone RTMP packet
+ *
+ * @param pkt_dst packet destination
+ * @param pkt_src packet source
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmp_packet_clone(RTMPPacket *pkt_dst, const RTMPPacket *pkt_src);
+
 /**
  * Free RTMP packet.
  *
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b14d23b919..5b52c23f20 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -124,11 +124,21 @@ typedef struct RTMPContext {
 int   nb_streamid;///< The next stream id to 
return on createStream calls
 doubleduration;   ///< Duration of the stream in 
seconds as returned by the server (only valid if non-zero)
 int   tcp_nodelay;///< Use TCP_NODELAY to disable 
Nagle's algorithm if set to 1
+int   reconnect_interval; ///< Forces a reconnected every 
Xs (in media time)
 char  username[50];
 char  password[50];
 char  auth_params[500];
 int   do_reconnect;
+uint32_t  last_reconnect_timestamp;
 int   auth_tried;
+int   force_reconnection_now;
+int   go_away_received;
+AVDictionary* original_opts;
+char  original_uri[TCURL_MAX_LENGTH];
+int   original_flags;
+RTMPPacketlast_avc_seq_header_pkt;///< rtmp packet, used to save 
last AVC video header, used on reconnection
+RTMPPacketlast_aac_seq_header_pkt;///< rtmp packet, used to save 
last AAC audio header, used on reconnection
+RTMPPacketlast_metadata_pkt;///< rtmp packet, used to save 
last onMetadata info, used on reconnection
 } RTMPContext;
 
 #define PLAYER_KEY_OPEN_PART_LEN 30   ///< length of partial key used for 
first client digest signing
@@ -224,7 +234,7 @@ static void free_tracked_methods(RTMPContext *rt)
 rt->nb_tracked_methods   = 0;
 }
 
-static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track)
+static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track, int 
destroy)
 {
 int ret;
 
@@ -248,7 +258,9 @@ static int rtmp_send_packet(RTMPContext *rt, RTMPPacket 
*pkt, int track)
 ret = ff_rtmp_packet_write(rt->stream, pkt, rt->out_chunk_size,
&rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
 fail:
-ff_rtmp_packet_destroy(pkt);
+if (destroy)
+ff_rtmp_packet_destroy(pkt);
+
 return ret;
 }
 
@@ -336,6 +348,9 @

[FFmpeg-devel] [PATCH 1/1] Implements RTMP reconnect feature

2021-09-18 Thread Jordi Cenzano
Nowadays when you are streaming to a live platform if the RTMP(s)
server needs to restarted for any reason (ex: deploy new version)
the RTMP connection is interrupted (probably after some draining time).
Facebook will publish a proposal to avoid that by sending a
GoAway message in the RTMP protocol.
This code is the reference client implementation of that proposal.
AFAIK other big live platforms showed their interest in implementing
this mechanism.
This can be already tested against Facebook live production using
the querystring parameter ?ccr_sec=120 (that indicates the backend
to send a disconnect signal after those seconds)
---
 libavformat/rtmppkt.c   |  19 +++
 libavformat/rtmppkt.h   |  10 ++
 libavformat/rtmpproto.c | 356 +---
 3 files changed, 359 insertions(+), 26 deletions(-)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 4b97c0833f..84ec72740d 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -405,6 +405,25 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
 return written;
 }
 
+int ff_rtmp_packet_clone(RTMPPacket *pkt_dst, const RTMPPacket *pkt_src)
+{
+if (pkt_src->size) {
+pkt_dst->data = av_realloc(NULL, pkt_src->size);
+if (!pkt_dst->data)
+return AVERROR(ENOMEM);
+else
+memcpy(pkt_dst->data, pkt_src->data, pkt_src->size);
+}
+pkt_dst->size   = pkt_src->size;
+pkt_dst->channel_id = pkt_src->channel_id;
+pkt_dst->type   = pkt_src->type;
+pkt_dst->timestamp  = pkt_src->timestamp;
+pkt_dst->extra  = pkt_src->extra;
+pkt_dst->ts_field   = pkt_src->ts_field;
+
+return 0;
+}
+
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
   int timestamp, int size)
 {
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index a15d2a5773..cdb901df89 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -59,6 +59,7 @@ typedef enum RTMPPacketType {
 RTMP_PT_SHARED_OBJ, ///< shared object
 RTMP_PT_INVOKE, ///< invoke some stream action
 RTMP_PT_METADATA = 22,  ///< FLV metadata
+RTMP_PT_GO_AWAY  = 32,  ///< Indicates please reconnect ASAP, server 
is about to go down
 } RTMPPacketType;
 
 /**
@@ -99,6 +100,15 @@ typedef struct RTMPPacket {
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
   int timestamp, int size);
 
+/**
+ * Clone RTMP packet
+ *
+ * @param pkt_dst packet destination
+ * @param pkt_src packet source
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmp_packet_clone(RTMPPacket *pkt_dst, const RTMPPacket *pkt_src);
+
 /**
  * Free RTMP packet.
  *
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b14d23b919..5b52c23f20 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -124,11 +124,21 @@ typedef struct RTMPContext {
 int   nb_streamid;///< The next stream id to 
return on createStream calls
 doubleduration;   ///< Duration of the stream in 
seconds as returned by the server (only valid if non-zero)
 int   tcp_nodelay;///< Use TCP_NODELAY to disable 
Nagle's algorithm if set to 1
+int   reconnect_interval; ///< Forces a reconnected every 
Xs (in media time)
 char  username[50];
 char  password[50];
 char  auth_params[500];
 int   do_reconnect;
+uint32_t  last_reconnect_timestamp;
 int   auth_tried;
+int   force_reconnection_now;
+int   go_away_received;
+AVDictionary* original_opts;
+char  original_uri[TCURL_MAX_LENGTH];
+int   original_flags;
+RTMPPacketlast_avc_seq_header_pkt;///< rtmp packet, used to save 
last AVC video header, used on reconnection
+RTMPPacketlast_aac_seq_header_pkt;///< rtmp packet, used to save 
last AAC audio header, used on reconnection
+RTMPPacketlast_metadata_pkt;///< rtmp packet, used to save 
last onMetadata info, used on reconnection
 } RTMPContext;
 
 #define PLAYER_KEY_OPEN_PART_LEN 30   ///< length of partial key used for 
first client digest signing
@@ -224,7 +234,7 @@ static void free_tracked_methods(RTMPContext *rt)
 rt->nb_tracked_methods   = 0;
 }
 
-static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track)
+static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track, int 
destroy)
 {
 int ret;
 
@@ -248,7 +258,9 @@ static int rtmp_send_packet(RTMPContext *rt, RTMPPacket 
*pkt, int track)
 ret = ff_rtmp_packet_write(rt->stream, pkt, rt->out_chunk_size,
&rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
 fail:
-ff_rtmp_packet_destroy(pkt);
+if (destroy)
+ff_rtmp_packet_destroy(pkt);
+
 return ret;
 }
 
@@ -336,6 +348,9 @

[FFmpeg-devel] [PATCH 1/1] libavformat/rtmp: Implements RTMP reconnect feature

2021-09-18 Thread Jordi Cenzano
Nowadays when you are streaming to a live platform if the RTMP(s)
server needs to restarted for any reason (ex: deploy new version)
the RTMP connection is interrupted (probably after some draining time).
Facebook will publish a proposal to avoid that by sending a
GoAway message in the RTMP protocol.
This code is the reference client implementation of that proposal.
AFAIK other big live platforms showed their interest in implementing
this mechanism.
This can be already tested against Facebook live production using
the querystring parameter ?ccr_sec=120 (that indicates the backend
to send a disconnect signal after those seconds)
---
 libavformat/rtmppkt.c   |  19 +++
 libavformat/rtmppkt.h   |  10 ++
 libavformat/rtmpproto.c | 356 +---
 3 files changed, 359 insertions(+), 26 deletions(-)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 4b97c0833f..84ec72740d 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -405,6 +405,25 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
 return written;
 }
 
+int ff_rtmp_packet_clone(RTMPPacket *pkt_dst, const RTMPPacket *pkt_src)
+{
+if (pkt_src->size) {
+pkt_dst->data = av_realloc(NULL, pkt_src->size);
+if (!pkt_dst->data)
+return AVERROR(ENOMEM);
+else
+memcpy(pkt_dst->data, pkt_src->data, pkt_src->size);
+}
+pkt_dst->size   = pkt_src->size;
+pkt_dst->channel_id = pkt_src->channel_id;
+pkt_dst->type   = pkt_src->type;
+pkt_dst->timestamp  = pkt_src->timestamp;
+pkt_dst->extra  = pkt_src->extra;
+pkt_dst->ts_field   = pkt_src->ts_field;
+
+return 0;
+}
+
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
   int timestamp, int size)
 {
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index a15d2a5773..cdb901df89 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -59,6 +59,7 @@ typedef enum RTMPPacketType {
 RTMP_PT_SHARED_OBJ, ///< shared object
 RTMP_PT_INVOKE, ///< invoke some stream action
 RTMP_PT_METADATA = 22,  ///< FLV metadata
+RTMP_PT_GO_AWAY  = 32,  ///< Indicates please reconnect ASAP, server 
is about to go down
 } RTMPPacketType;
 
 /**
@@ -99,6 +100,15 @@ typedef struct RTMPPacket {
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
   int timestamp, int size);
 
+/**
+ * Clone RTMP packet
+ *
+ * @param pkt_dst packet destination
+ * @param pkt_src packet source
+ * @return zero on success, negative value otherwise
+ */
+int ff_rtmp_packet_clone(RTMPPacket *pkt_dst, const RTMPPacket *pkt_src);
+
 /**
  * Free RTMP packet.
  *
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b14d23b919..5b52c23f20 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -124,11 +124,21 @@ typedef struct RTMPContext {
 int   nb_streamid;///< The next stream id to 
return on createStream calls
 doubleduration;   ///< Duration of the stream in 
seconds as returned by the server (only valid if non-zero)
 int   tcp_nodelay;///< Use TCP_NODELAY to disable 
Nagle's algorithm if set to 1
+int   reconnect_interval; ///< Forces a reconnected every 
Xs (in media time)
 char  username[50];
 char  password[50];
 char  auth_params[500];
 int   do_reconnect;
+uint32_t  last_reconnect_timestamp;
 int   auth_tried;
+int   force_reconnection_now;
+int   go_away_received;
+AVDictionary* original_opts;
+char  original_uri[TCURL_MAX_LENGTH];
+int   original_flags;
+RTMPPacketlast_avc_seq_header_pkt;///< rtmp packet, used to save 
last AVC video header, used on reconnection
+RTMPPacketlast_aac_seq_header_pkt;///< rtmp packet, used to save 
last AAC audio header, used on reconnection
+RTMPPacketlast_metadata_pkt;///< rtmp packet, used to save 
last onMetadata info, used on reconnection
 } RTMPContext;
 
 #define PLAYER_KEY_OPEN_PART_LEN 30   ///< length of partial key used for 
first client digest signing
@@ -224,7 +234,7 @@ static void free_tracked_methods(RTMPContext *rt)
 rt->nb_tracked_methods   = 0;
 }
 
-static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track)
+static int rtmp_send_packet(RTMPContext *rt, RTMPPacket *pkt, int track, int 
destroy)
 {
 int ret;
 
@@ -248,7 +258,9 @@ static int rtmp_send_packet(RTMPContext *rt, RTMPPacket 
*pkt, int track)
 ret = ff_rtmp_packet_write(rt->stream, pkt, rt->out_chunk_size,
&rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
 fail:
-ff_rtmp_packet_destroy(pkt);
+if (destroy)
+ff_rtmp_packet_destroy(pkt);
+
 return ret;
 }
 
@@ -336,6 +348,9 @

Re: [FFmpeg-devel] [PATCH 1/1] libavformat/rtmp: Implements RTMP reconnect feature

2021-09-18 Thread Andreas Rheinhardt
Jordi Cenzano:
> Nowadays when you are streaming to a live platform if the RTMP(s)
> server needs to restarted for any reason (ex: deploy new version)
> the RTMP connection is interrupted (probably after some draining time).
> Facebook will publish a proposal to avoid that by sending a
> GoAway message in the RTMP protocol.
> This code is the reference client implementation of that proposal.
> AFAIK other big live platforms showed their interest in implementing
> this mechanism.
> This can be already tested against Facebook live production using
> the querystring parameter ?ccr_sec=120 (that indicates the backend
> to send a disconnect signal after those seconds)
> ---
>  libavformat/rtmppkt.c   |  19 +++
>  libavformat/rtmppkt.h   |  10 ++
>  libavformat/rtmpproto.c | 356 +---
>  3 files changed, 359 insertions(+), 26 deletions(-)
> 

This is the third time that you sent this; apparently without changes.
Stop resending it; we already got it.

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] doc/general_contents: Fix dead links

2021-09-18 Thread ffmpegandmahanstreamer
August 24, 2021 9:49 AM, "Mapul Bhola"  wrote:

> The x265 configuration and installation guide has moved to Bitbucket so the 
> updated link reflects
> that one.
> 
> As the openCV site currently only has docs for opencv3 and the filter in 
> libavfilter is an opencv2
> an alternative link is provided.
> ---
> doc/filters.texi | 2 +-
> doc/general_contents.texi | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index eaf23e3736..4db7e4f25b 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -15484,7 +15484,7 @@ values are assumed.
> 
> Refer to the official libopencv documentation for more precise
> information:
> -@url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
> +@url{http://www.opencv.org.cn/opencvdoc/2.3.2/html/modules/imgproc/doc/filtering.html}
> 
> Several libopencv filters are supported; see the following subsections.
> 
> diff --git a/doc/general_contents.texi b/doc/general_contents.texi
> index 354899ad17..ca39a9d718 100644
> --- a/doc/general_contents.texi
> +++ b/doc/general_contents.texi
> @@ -304,7 +304,7 @@ details), you must upgrade FFmpeg's license to GPL in 
> order to use it.
> 
> FFmpeg can make use of the x265 library for HEVC encoding.
> 
> -Go to @url{http://x265.org/developers.html} and follow the instructions
> +Go to 
> @url{https://bitbucket.org/multicoreware/x265_git/src/master/build/README.txt}
>  and follow
> the instructions
> for installing the library. Then pass @code{--enable-libx265} to configure
> to enable it.
> 
> -- 
> 2.24.3

ping
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works
Previous message got long lines wrapped. Resending as attachment.


v2-0002-ffprobe-Fix-incorrect-display-of-closed_captions-pr.patch
Description: v2-0002-ffprobe-Fix-incorrect-display-of-closed_captions-pr.patch
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] fate/demux, gapless, image: Add missing ffprobe dependencies

2021-09-18 Thread Andreas Rheinhardt
And remove the unnecessary ffmpeg dependencies while at it.

Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/demux.mak   | 14 --
 tests/fate/gapless.mak |  6 +++---
 tests/fate/image.mak   |  8 +---
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
index ab49be94cd..6ddbbcbd4d 100644
--- a/tests/fate/demux.mak
+++ b/tests/fate/demux.mak
@@ -48,7 +48,7 @@ FATE_SAMPLES_DEMUX-$(call ALLYES, GIF_DEMUXER FITS_DEMUXER 
GIF_DECODER FITS_ENCO
 fate-fits-demux: tests/data/fits-multi.fits
 fate-fits-demux: CMD = framecrc -i $(TARGET_PATH)/tests/data/fits-multi.fits 
-c:v copy
 
-FATE_SAMPLES_DEMUX-$(CONFIG_FLV_DEMUXER) += fate-flv-demux
+FATE_FFPROBE_DEMUX-$(CONFIG_FLV_DEMUXER) += fate-flv-demux
 fate-flv-demux: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/flv/Enigma_Principles_of_Lust-part.flv
 
 FATE_SAMPLES_DEMUX-$(CONFIG_GIF_DEMUXER) += fate-gif-demux
@@ -79,10 +79,10 @@ fate-mlv-demux: CMD = crc -i 
$(TARGET_SAMPLES)/mlv/M19-0333-cut.MLV -c copy
 FATE_SAMPLES_DEMUX-$(CONFIG_MOV_DEMUXER) += fate-mov-mp3-demux
 fate-mov-mp3-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/mpegaudio/packed_maindata.mp3.mp4 -c copy
 
-FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-opus-demux
+FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-opus-demux
 fate-ts-opus-demux: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/opus/test-8-7.1.opus-small.ts
 
-FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-small-demux
+FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-small-demux
 fate-ts-small-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/mpegts/h264small.ts
 
 FATE_SAMPLES_DEMUX-$(CONFIG_MTV_DEMUXER) += fate-mtv
@@ -100,7 +100,7 @@ fate-nistsphere-demux: CMD = crc -i 
$(TARGET_SAMPLES)/nistsphere/nist-ulaw.nist
 FATE_SAMPLES_DEMUX-$(CONFIG_NSV_DEMUXER) += fate-nsv-demux
 fate-nsv-demux: CMD = framecrc -i $(TARGET_SAMPLES)/nsv/witchblade-51kbps.nsv 
-t 6 -c:v copy -c:a copy
 
-FATE_SAMPLES_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggopus-demux
+FATE_FFPROBE_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggopus-demux
 fate-oggopus-demux: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/ogg/intro-partial.opus
 
 FATE_SAMPLES_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggvp8-demux
@@ -157,9 +157,11 @@ fate-xmv-demux: CMD = framecrc -i 
$(TARGET_SAMPLES)/xmv/logos1p.fmv -c:v copy -c
 FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
 fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a copy
 
-FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
+FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
 fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-small.ts
 
 FATE_SAMPLES_DEMUX += $(FATE_SAMPLES_DEMUX-yes)
 FATE_SAMPLES_FFMPEG += $(FATE_SAMPLES_DEMUX)
-fate-demux: $(FATE_SAMPLES_DEMUX)
+FATE_FFPROBE_DEMUX   += $(FATE_FFPROBE_DEMUX-yes)
+FATE_SAMPLES_FFPROBE += $(FATE_FFPROBE_DEMUX)
+fate-demux: $(FATE_SAMPLES_DEMUX) $(FATE_FFPROBE_DEMUX)
diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
index b035e18d03..68a396e187 100644
--- a/tests/fate/gapless.mak
+++ b/tests/fate/gapless.mak
@@ -1,7 +1,7 @@
 FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3
 fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-c:a 
mp3"
 
-FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3-side-data
+FATE_GAPLESSINFO_PROBE-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3-side-data
 fate-gapless-mp3-side-data: CMD = ffprobe_demux 
$(TARGET_SAMPLES)/gapless/gapless.mp3
 
 FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-audiomatch-square-mp3
@@ -122,7 +122,7 @@ FATE_GAPLESSENC-$(CONFIG_FFPROBE) = 
$(FATE_GAPLESSENC_PROBE-yes)
 FATE_GAPLESSENC = $(FATE_GAPLESSENC-yes)
 
 FATE_SAMPLES_AVCONV += $(FATE_GAPLESS)
-FATE_SAMPLES_AVCONV += $(FATE_GAPLESSINFO)
-FATE_SAMPLES_AVCONV += $(FATE_GAPLESSENC)
+FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_GAPLESSENC)
+FATE_SAMPLES_FFPROBE += $(FATE_GAPLESSINFO)
 
 fate-gapless: $(FATE_GAPLESS) $(FATE_GAPLESSINFO) $(FATE_GAPLESSENC)
diff --git a/tests/fate/image.mak b/tests/fate/image.mak
index 3b58972a53..e99fa0e1ce 100644
--- a/tests/fate/image.mak
+++ b/tests/fate/image.mak
@@ -374,17 +374,19 @@ $(foreach CLSP,$(PNG_COLORSPACES),$(eval $(call 
FATE_IMGSUITE_PNG,$(CLSP
 FATE_PNG += fate-png-int-rgb24
 fate-png-int-rgb24: CMD = framecrc -i 
$(TARGET_SAMPLES)/png1/lena-int_rgb24.png -sws_flags +accurate_rnd+bitexact
 
-FATE_PNG += fate-png-frame-metadata
+FATE_PNG_PROBE += fate-png-frame-metadata
 fate-png-frame-metadata: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries 
frame_tags \
 -i $(TARGET_SAMPLES)/filter/pixelart0.png
 
-FATE_PNG += fate-png-side-data
+FATE_PNG_PROBE += fate-png-side-data
 fate-png-side-data: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_frames \
 -i $(TARGET_SAMPLES)/png1/lena-int_rgb24.png
 
 FATE_PNG-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG)
+FATE_PNG_PROBE-$(call DEMDEC, IMAGE2, PNG) += $(FATE_PNG_PROBE)
 FATE_IMAGE += $(FATE_PNG-yes)
-fate-png: $(FATE_PNG-yes)
+FAT

Re: [FFmpeg-devel] [PATCH 01/10] avcodec/mpegvideo: Move startcodes to mpeg12.h

2021-09-18 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> And remove the MPEG-4-specific SLICE_START_CODE, which duplicates
> SLICE_STARTCODE.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
> I can add a commit giving these startcodes a proper MPEG12_ prefix later
> if desired.
> (Some of these startcodes are btw duplicated in lavf/mpegvideodec.c.)
> 
>  libavcodec/ituh263dec.c|  4 ++--
>  libavcodec/mpeg12.h| 10 ++
>  libavcodec/mpeg4videodec.c |  2 +-
>  libavcodec/mpegvideo.h | 12 
>  4 files changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
> index 565a6a1ac8..3f982f414f 100644
> --- a/libavcodec/ituh263dec.c
> +++ b/libavcodec/ituh263dec.c
> @@ -217,11 +217,11 @@ int ff_h263_resync(MpegEncContext *s){
>  if(s->codec_id==AV_CODEC_ID_MPEG4 && s->studio_profile) {
>  align_get_bits(&s->gb);
>  
> -while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != 
> SLICE_START_CODE) {
> +while (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) != 
> SLICE_STARTCODE) {
>  get_bits(&s->gb, 8);
>  }
>  
> -if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == 
> SLICE_START_CODE)
> +if (get_bits_left(&s->gb) >= 32 && show_bits_long(&s->gb, 32) == 
> SLICE_STARTCODE)
>  return get_bits_count(&s->gb);
>  else
>  return -1;
> diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
> index 4cd48b5d20..a7b94c132a 100644
> --- a/libavcodec/mpeg12.h
> +++ b/libavcodec/mpeg12.h
> @@ -25,6 +25,16 @@
>  #include "mpeg12vlc.h"
>  #include "mpegvideo.h"
>  
> +/* Start codes. */
> +#define SEQ_END_CODE0x01b7
> +#define SEQ_START_CODE  0x01b3
> +#define GOP_START_CODE  0x01b8
> +#define PICTURE_START_CODE  0x0100
> +#define SLICE_MIN_START_CODE0x0101
> +#define SLICE_MAX_START_CODE0x01af
> +#define EXT_START_CODE  0x01b5
> +#define USER_START_CODE 0x01b2
> +
>  void ff_mpeg12_common_init(MpegEncContext *s);
>  
>  #define INIT_2D_VLC_RL(rl, static_size, flags)\
> diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
> index a6ed842ea2..fcab975a9c 100644
> --- a/libavcodec/mpeg4videodec.c
> +++ b/libavcodec/mpeg4videodec.c
> @@ -550,7 +550,7 @@ int ff_mpeg4_decode_studio_slice_header(Mpeg4DecContext 
> *ctx)
>  unsigned vlc_len;
>  uint16_t mb_num;
>  
> -if (get_bits_left(gb) >= 32 && get_bits_long(gb, 32) == 
> SLICE_START_CODE) {
> +if (get_bits_left(gb) >= 32 && get_bits_long(gb, 32) == SLICE_STARTCODE) 
> {
>  vlc_len = av_log2(s->mb_width * s->mb_height) + 1;
>  mb_num = get_bits(gb, vlc_len);
>  
> diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
> index 76b32ea547..9f8d80df3d 100644
> --- a/libavcodec/mpegvideo.h
> +++ b/libavcodec/mpegvideo.h
> @@ -63,18 +63,6 @@
>  
>  #define MAX_B_FRAMES 16
>  
> -/* Start codes. */
> -#define SEQ_END_CODE0x01b7
> -#define SEQ_START_CODE  0x01b3
> -#define GOP_START_CODE  0x01b8
> -#define PICTURE_START_CODE  0x0100
> -#define SLICE_MIN_START_CODE0x0101
> -#define SLICE_MAX_START_CODE0x01af
> -#define EXT_START_CODE  0x01b5
> -#define USER_START_CODE 0x01b2
> -#define SLICE_START_CODE0x01b7
> -
> -
>  /**
>   * MpegEncContext.
>   */
> 

Will apply this patchset tomorrow unless there are objections.

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] fate/demux, gapless, image: Add missing ffprobe dependencies

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Andreas
> Rheinhardt
> Sent: Sunday, 19 September 2021 03:49
> To: ffmpeg-devel@ffmpeg.org
> Cc: Andreas Rheinhardt 
> Subject: [FFmpeg-devel] [PATCH] fate/demux, gapless, image: Add missing
> ffprobe dependencies
> 
> And remove the unnecessary ffmpeg dependencies while at it.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  tests/fate/demux.mak   | 14 --
>  tests/fate/gapless.mak |  6 +++---
>  tests/fate/image.mak   |  8 +---
>  3 files changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/fate/demux.mak b/tests/fate/demux.mak
> index ab49be94cd..6ddbbcbd4d 100644
> --- a/tests/fate/demux.mak
> +++ b/tests/fate/demux.mak
> @@ -48,7 +48,7 @@ FATE_SAMPLES_DEMUX-$(call ALLYES, GIF_DEMUXER FITS_DEMUXER
> GIF_DECODER FITS_ENCO
>  fate-fits-demux: tests/data/fits-multi.fits
>  fate-fits-demux: CMD = framecrc -i $(TARGET_PATH)/tests/data/fits-multi.fits
> -c:v copy
> 
> -FATE_SAMPLES_DEMUX-$(CONFIG_FLV_DEMUXER) += fate-flv-demux
> +FATE_FFPROBE_DEMUX-$(CONFIG_FLV_DEMUXER) += fate-flv-demux
>  fate-flv-demux: CMD = ffprobe_demux
> $(TARGET_SAMPLES)/flv/Enigma_Principles_of_Lust-part.flv
> 
>  FATE_SAMPLES_DEMUX-$(CONFIG_GIF_DEMUXER) += fate-gif-demux
> @@ -79,10 +79,10 @@ fate-mlv-demux: CMD = crc -i $(TARGET_SAMPLES)/mlv/M19-
> 0333-cut.MLV -c copy
>  FATE_SAMPLES_DEMUX-$(CONFIG_MOV_DEMUXER) += fate-mov-mp3-demux
>  fate-mov-mp3-demux: CMD = framecrc -i
> $(TARGET_SAMPLES)/mpegaudio/packed_maindata.mp3.mp4 -c copy
> 
> -FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-opus-demux
> +FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-opus-demux
>  fate-ts-opus-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/opus/test-8-
> 7.1.opus-small.ts
> 
> -FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-small-demux
> +FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-small-demux
>  fate-ts-small-demux: CMD = ffprobe_demux
> $(TARGET_SAMPLES)/mpegts/h264small.ts
> 
>  FATE_SAMPLES_DEMUX-$(CONFIG_MTV_DEMUXER) += fate-mtv
> @@ -100,7 +100,7 @@ fate-nistsphere-demux: CMD = crc -i
> $(TARGET_SAMPLES)/nistsphere/nist-ulaw.nist
>  FATE_SAMPLES_DEMUX-$(CONFIG_NSV_DEMUXER) += fate-nsv-demux
>  fate-nsv-demux: CMD = framecrc -i $(TARGET_SAMPLES)/nsv/witchblade-
> 51kbps.nsv -t 6 -c:v copy -c:a copy
> 
> -FATE_SAMPLES_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggopus-demux
> +FATE_FFPROBE_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggopus-demux
>  fate-oggopus-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ogg/intro-
> partial.opus
> 
>  FATE_SAMPLES_DEMUX-$(CONFIG_OGG_DEMUXER) += fate-oggvp8-demux
> @@ -157,9 +157,11 @@ fate-xmv-demux: CMD = framecrc -i
> $(TARGET_SAMPLES)/xmv/logos1p.fmv -c:v copy -c
>  FATE_SAMPLES_DEMUX-$(CONFIG_XWMA_DEMUXER) += fate-xwma-demux
>  fate-xwma-demux: CMD = crc -i $(TARGET_SAMPLES)/xwma/ergon.xwma -c:a copy
> 
> -FATE_SAMPLES_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
> +FATE_FFPROBE_DEMUX-$(CONFIG_MPEGTS_DEMUXER) += fate-ts-demux
>  fate-ts-demux: CMD = ffprobe_demux $(TARGET_SAMPLES)/ac3/mp3ac325-4864-
> small.ts
> 
>  FATE_SAMPLES_DEMUX += $(FATE_SAMPLES_DEMUX-yes)
>  FATE_SAMPLES_FFMPEG += $(FATE_SAMPLES_DEMUX)
> -fate-demux: $(FATE_SAMPLES_DEMUX)
> +FATE_FFPROBE_DEMUX   += $(FATE_FFPROBE_DEMUX-yes)
> +FATE_SAMPLES_FFPROBE += $(FATE_FFPROBE_DEMUX)
> +fate-demux: $(FATE_SAMPLES_DEMUX) $(FATE_FFPROBE_DEMUX)
> diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak
> index b035e18d03..68a396e187 100644
> --- a/tests/fate/gapless.mak
> +++ b/tests/fate/gapless.mak
> @@ -1,7 +1,7 @@
>  FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3
>  fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-c:a
> mp3"
> 
> -FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3-side-data
> +FATE_GAPLESSINFO_PROBE-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3-side-data
>  fate-gapless-mp3-side-data: CMD = ffprobe_demux
> $(TARGET_SAMPLES)/gapless/gapless.mp3
> 
>  FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-audiomatch-square-mp3
> @@ -122,7 +122,7 @@ FATE_GAPLESSENC-$(CONFIG_FFPROBE) =
> $(FATE_GAPLESSENC_PROBE-yes)
>  FATE_GAPLESSENC = $(FATE_GAPLESSENC-yes)
> 
>  FATE_SAMPLES_AVCONV += $(FATE_GAPLESS)
> -FATE_SAMPLES_AVCONV += $(FATE_GAPLESSINFO)
> -FATE_SAMPLES_AVCONV += $(FATE_GAPLESSENC)
> +FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_GAPLESSENC)
> +FATE_SAMPLES_FFPROBE += $(FATE_GAPLESSINFO)
> 
>  fate-gapless: $(FATE_GAPLESS) $(FATE_GAPLESSINFO) $(FATE_GAPLESSENC)
> diff --git a/tests/fate/image.mak b/tests/fate/image.mak
> index 3b58972a53..e99fa0e1ce 100644
> --- a/tests/fate/image.mak
> +++ b/tests/fate/image.mak
> @@ -374,17 +374,19 @@ $(foreach CLSP,$(PNG_COLORSPACES),$(eval $(call
> FATE_IMGSUITE_PNG,$(CLSP
>  FATE_PNG += fate-png-int-rgb24
>  fate-png-int-rgb24: CMD = framecrc -i $(TARGET_SAMPLES)/png1/lena-
> int_rgb24.png -sws_flags +accurate_rnd+bitexact
> 
> -FATE_PNG += fate-png-frame-metadata
> +FATE_PNG_PROBE += fate-png-frame-metadata
>  fate-png-frame-metadata: CMD = run ff

Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread James Almer

On 9/18/2021 7:10 PM, Soft Works wrote:

Repro Example:
ffprobe -show_entries stream=closed_captions:disposition=:side_data=  
"http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";

While the codec string includes "Closed Captions",
the stream data is showing: closed_captions=0

The test ref was incorrect as the test media file
actually does have cc.

Signed-off-by: softworkz 
---
v2: Fix test result. It was undiscovered locally as make fate
 does not seem to properly rebuild ffprobe.

  fftools/ffprobe.c   | 5 +++--
  tests/ref/fate/ts-demux | 2 +-
  2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 880f05a6c2..9425c1a2e3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w, 
AVFormatContext *fmt_ctx, int stream_id
  print_int("width",par->width);
  print_int("height",   par->height);
  if (dec_ctx) {
+unsigned codec_properties = 
av_stream_get_codec_properties(ist->st);


Library users are meant to use their own decoder contexts if they want 
this kind of information. AVStream->internal->avctx is internal to lavf. 
Accessors like this should be avoided.


ffprobe is already decoding frames for the purpose of show_frames, and 
in fact if you add -show_frames to the above command line example you 
gave, the output of show_streams will report closed_captions=1.
So the correct approach here is to make ffprobe decode a few frames when 
you request show_streams, even if you don't request show_frames.


I'll send a patch for this later.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of James Almer
> Sent: Sunday, 19 September 2021 05:05
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of
> closed_captions property
> 
> On 9/18/2021 7:10 PM, Soft Works wrote:
> > Repro Example:
> > ffprobe -show_entries stream=closed_captions:disposition=:side_data=
> "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";
> >
> > While the codec string includes "Closed Captions",
> > the stream data is showing: closed_captions=0
> >
> > The test ref was incorrect as the test media file
> > actually does have cc.
> >
> > Signed-off-by: softworkz 
> > ---
> > v2: Fix test result. It was undiscovered locally as make fate
> >  does not seem to properly rebuild ffprobe.
> >
> >   fftools/ffprobe.c   | 5 +++--
> >   tests/ref/fate/ts-demux | 2 +-
> >   2 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index 880f05a6c2..9425c1a2e3 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w,
> AVFormatContext *fmt_ctx, int stream_id
> >   print_int("width",par->width);
> >   print_int("height",   par->height);
> >   if (dec_ctx) {
> > +unsigned codec_properties =
> av_stream_get_codec_properties(ist->st);
> 
> Library users are meant to use their own decoder contexts if they want
> this kind of information. AVStream->internal->avctx is internal to lavf.
> Accessors like this should be avoided.

If you look further up in util 
> 
> ffprobe is already decoding frames for the purpose of show_frames, and
> in fact if you add -show_frames to the above command line example you
> gave, the output of show_streams will report closed_captions=1.

Yes, I know that, but if you don't - the output is wrong.

> So the correct approach here is to make ffprobe decode a few frames when
> you request show_streams, even if you don't request show_frames.

This is something that I would want to avoid. It has already happened
and the result is available already. The "Closed Captions" part in
the video codec string is coming from that result. 

It doesn't make sense IMO, to perform another decoding run to replicate
that result, because:

- It can't be taken for granted that this will lead to the same result
  that already exists
  How many frames do you think would be the right amount to process?
  What if the file start with a bunch of audio frames?
- It takes additional processing time, which could have a huge impact
  depending on how the input is being processed or a rather small 
  impact. 
  But even when the impact would be small - it could matter a lot
  when you are probing a library of like 10k or 100k files.

Kind regards,
softworkz



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread James Almer

On 9/19/2021 12:28 AM, Soft Works wrote:




-Original Message-
From: ffmpeg-devel  On Behalf Of James Almer
Sent: Sunday, 19 September 2021 05:05
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of
closed_captions property

On 9/18/2021 7:10 PM, Soft Works wrote:

Repro Example:
ffprobe -show_entries stream=closed_captions:disposition=:side_data=

"http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";


While the codec string includes "Closed Captions",
the stream data is showing: closed_captions=0

The test ref was incorrect as the test media file
actually does have cc.

Signed-off-by: softworkz 
---
v2: Fix test result. It was undiscovered locally as make fate
  does not seem to properly rebuild ffprobe.

   fftools/ffprobe.c   | 5 +++--
   tests/ref/fate/ts-demux | 2 +-
   2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 880f05a6c2..9425c1a2e3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w,

AVFormatContext *fmt_ctx, int stream_id

   print_int("width",par->width);
   print_int("height",   par->height);
   if (dec_ctx) {
+unsigned codec_properties =

av_stream_get_codec_properties(ist->st);

Library users are meant to use their own decoder contexts if they want
this kind of information. AVStream->internal->avctx is internal to lavf.
Accessors like this should be avoided.


If you look further up in util


ffprobe is already decoding frames for the purpose of show_frames, and
in fact if you add -show_frames to the above command line example you
gave, the output of show_streams will report closed_captions=1.


Yes, I know that, but if you don't - the output is wrong.


Yeah, and fixing that would be ideal. The output of show_streams should 
(if possible) not depend on other options also being passed.
Your patch will only do it for properties, and it requires new public 
API, whereas my suggestion will do it for all other fields, like 
coded_{width,height}, and requires changes contained entirely within 
ffprobe with proper usage of existing API.





So the correct approach here is to make ffprobe decode a few frames when
you request show_streams, even if you don't request show_frames.


This is something that I would want to avoid. It has already happened
and the result is available already. The "Closed Captions" part in
the video codec string is coming from that result.

It doesn't make sense IMO, to perform another decoding run to replicate
that result, because:

- It can't be taken for granted that this will lead to the same result
   that already exists
   How many frames do you think would be the right amount to process?
   What if the file start with a bunch of audio frames?


You decode until you get the info you need, which is what 
avformat_find_stream_info() does to fill its own internal 
AVCodecContext. The simplest way would be to ensure one frame per stream 
is decoded.


I'm not going to approve more accessors to specific fields in 
AVStream->internal->avctx (Ideally, we'd remove the few that 
unfortunately already exist) because they will just not stop being added 
after that. There will always be another avctx field someone wants to 
use, and eventually, we'll just end up with AVStream->codec all over again.



- It takes additional processing time, which could have a huge impact
   depending on how the input is being processed or a rather small
   impact.
   But even when the impact would be small - it could matter a lot
   when you are probing a library of like 10k or 100k files.

Kind regards,
softworkz



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v5 2/3] libavcodec/libx265: write out user data unregistered SEI

2021-09-18 Thread Brad Hards
On Friday, 17 September 2021 9:28:05 PM AEST Ladislav Macoun wrote:
> Fix uninitialized variable introduced in 9dee81a32f
> 
> Signed-off-by: Ladislav Macoun 
> ---
>  libavcodec/libx265.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index 52bf3b26bd..692353daa5 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -484,7 +484,7 @@ static int libx265_encode_frame(AVCodecContext *avctx,
> AVPacket *pkt, int nnal;
>  int ret;
>  int i;
> -int total_unregistered_sei;
> +int total_unregistered_sei = 0;
> 
>  ctx->api->picture_init(ctx->params, &x265pic);
> 
> --
> 2.30.1 (Apple Git-130)
LGTM, but I can't do anything to get it applied.

Brad



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of James Almer
> Sent: Sunday, 19 September 2021 05:59
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of
> closed_captions property
> 
> On 9/19/2021 12:28 AM, Soft Works wrote:
> >
> >
> >> -Original Message-
> >> From: ffmpeg-devel  On Behalf Of James
> Almer
> >> Sent: Sunday, 19 September 2021 05:05
> >> To: ffmpeg-devel@ffmpeg.org
> >> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display
> of
> >> closed_captions property
> >>
> >> On 9/18/2021 7:10 PM, Soft Works wrote:
> >>> Repro Example:
> >>> ffprobe -show_entries stream=closed_captions:disposition=:side_data=
> >> "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";
> >>>
> >>> While the codec string includes "Closed Captions",
> >>> the stream data is showing: closed_captions=0
> >>>
> >>> The test ref was incorrect as the test media file
> >>> actually does have cc.
> >>>
> >>> Signed-off-by: softworkz 
> >>> ---
> >>> v2: Fix test result. It was undiscovered locally as make fate
> >>>   does not seem to properly rebuild ffprobe.
> >>>
> >>>fftools/ffprobe.c   | 5 +++--
> >>>tests/ref/fate/ts-demux | 2 +-
> >>>2 files changed, 4 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> >>> index 880f05a6c2..9425c1a2e3 100644
> >>> --- a/fftools/ffprobe.c
> >>> +++ b/fftools/ffprobe.c
> >>> @@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w,
> >> AVFormatContext *fmt_ctx, int stream_id
> >>>print_int("width",par->width);
> >>>print_int("height",   par->height);
> >>>if (dec_ctx) {
> >>> +unsigned codec_properties =
> >> av_stream_get_codec_properties(ist->st);
> >>
> >> Library users are meant to use their own decoder contexts if they want
> >> this kind of information. AVStream->internal->avctx is internal to lavf.
> >> Accessors like this should be avoided.
> >
> > If you look further up in util
> >>
> >> ffprobe is already decoding frames for the purpose of show_frames, and
> >> in fact if you add -show_frames to the above command line example you
> >> gave, the output of show_streams will report closed_captions=1.
> >
> > Yes, I know that, but if you don't - the output is wrong.
> 
> Yeah, and fixing that would be ideal. The output of show_streams should
> (if possible) not depend on other options also being passed.
> Your patch will only do it for properties, and it requires new public
> API, whereas my suggestion will do it for all other fields, like
> coded_{width,height}, and requires changes contained entirely within
> ffprobe with proper usage of existing API.

Please don't do this. This should not be driven by what might be "proper
use of existing API".
Instead of decoding additional frames, it would even be a better option to
check for the "Closed Captions" string (even though being somewhat ridiculous)


Generally, also from a larger perspective, this isolation doesn't appear 
to make sense to me.

The tool is named ffprobe - obviously intended for probing.
It takes parameters like analyzeduration and probesize to control the 
probing, which is internally done by avformat_find_stream_info().
But then, ffprobe should not be allowed to access (all) the results
of that probing?


> I'm not going to approve more accessors to specific fields in
> AVStream->internal->avctx (Ideally, we'd remove the few that
> unfortunately already exist) because they will just not stop being added
> after that. There will always be another avctx field someone wants to
> use, and eventually, we'll just end up with AVStream->codec all over again.

Then, why not add a an API method for copying the complete avctx data 
to a supplied one? This would prevent external API users from manipulating 
the internal avctx. Besides that, would there be any other reason why the 
data would need to be kept "secret"?

Kind regards,
softworkz



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 1/4] avfilter/framesync: Separate framesync AVClass and auxiliary functions

2021-09-18 Thread Andreas Rheinhardt
Will be useful for deduplication.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/framesync.h | 33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h
index fb85e8aec7..8436aba23b 100644
--- a/libavfilter/framesync.h
+++ b/libavfilter/framesync.h
@@ -299,25 +299,34 @@ int ff_framesync_dualinput_get_writable(FFFrameSync *fs, 
AVFrame **f0, AVFrame *
 
 const AVClass *ff_framesync_child_class_iterate(void **iter);
 
-#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
-static int name##_framesync_preinit(AVFilterContext *ctx) { \
+#define FRAMESYNC_DEFINE_PURE_CLASS(name, desc, func_prefix, options) \
+static const AVClass name##_class = { \
+.class_name  = desc,  \
+.item_name   = av_default_item_name,  \
+.option  = options,   \
+.version = LIBAVUTIL_VERSION_INT, \
+.category= AV_CLASS_CATEGORY_FILTER,  \
+.child_class_iterate = ff_framesync_child_class_iterate,  \
+.child_next  = func_prefix##_child_next,  \
+}
+
+#define FRAMESYNC_AUXILIARY_FUNCS(func_prefix, context, field)\
+static int func_prefix##_framesync_preinit(AVFilterContext *ctx) {\
 context *s = ctx->priv; \
 ff_framesync_preinit(&s->field); \
 return 0; \
 } \
-static void *name##_child_next(void *obj, void *prev) { \
+static void *func_prefix##_child_next(void *obj, void *prev) {\
 context *s = obj; \
 s->fs.class = ff_framesync_get_class(); /* FIXME */ \
 return prev ? NULL : &s->field; \
-} \
-static const AVClass name##_class = { \
-.class_name   = #name, \
-.item_name= av_default_item_name, \
-.option   = name##_options, \
-.version  = LIBAVUTIL_VERSION_INT, \
-.category = AV_CLASS_CATEGORY_FILTER, \
-.child_class_iterate = ff_framesync_child_class_iterate, \
-.child_next   = name##_child_next, \
 }
 
+#define FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, options) \
+FRAMESYNC_AUXILIARY_FUNCS(name, context, field)   \
+FRAMESYNC_DEFINE_PURE_CLASS(name, #name, name, options)
+
+#define FRAMESYNC_DEFINE_CLASS(name, context, field)  \
+FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, name##_options)
+
 #endif /* AVFILTER_FRAMESYNC_H */
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of closed_captions property

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of James Almer
> Sent: Sunday, 19 September 2021 05:59
> To: ffmpeg-devel@ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display of
> closed_captions property
> 
> On 9/19/2021 12:28 AM, Soft Works wrote:
> >
> >
> >> -Original Message-
> >> From: ffmpeg-devel  On Behalf Of James
> Almer
> >> Sent: Sunday, 19 September 2021 05:05
> >> To: ffmpeg-devel@ffmpeg.org
> >> Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] ffprobe: Fix incorrect display
> of
> >> closed_captions property
> >>
> >> On 9/18/2021 7:10 PM, Soft Works wrote:
> >>> Repro Example:
> >>> ffprobe -show_entries stream=closed_captions:disposition=:side_data=
> >> "http://streams.videolan.org/streams/ts/CC/NewsStream-608-ac3.ts";
> >>>
> >>> While the codec string includes "Closed Captions",
> >>> the stream data is showing: closed_captions=0
> >>>
> >>> The test ref was incorrect as the test media file
> >>> actually does have cc.
> >>>
> >>> Signed-off-by: softworkz 
> >>> ---
> >>> v2: Fix test result. It was undiscovered locally as make fate
> >>>   does not seem to properly rebuild ffprobe.
> >>>
> >>>fftools/ffprobe.c   | 5 +++--
> >>>tests/ref/fate/ts-demux | 2 +-
> >>>2 files changed, 4 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> >>> index 880f05a6c2..9425c1a2e3 100644
> >>> --- a/fftools/ffprobe.c
> >>> +++ b/fftools/ffprobe.c
> >>> @@ -2678,10 +2678,11 @@ static int show_stream(WriterContext *w,
> >> AVFormatContext *fmt_ctx, int stream_id
> >>>print_int("width",par->width);
> >>>print_int("height",   par->height);
> >>>if (dec_ctx) {
> >>> +unsigned codec_properties =
> >> av_stream_get_codec_properties(ist->st);
> >>
> >> Library users are meant to use their own decoder contexts if they want
> >> this kind of information. AVStream->internal->avctx is internal to lavf.
> >> Accessors like this should be avoided.
> >
> > If you look further up in util
> >>
> >> ffprobe is already decoding frames for the purpose of show_frames, and
> >> in fact if you add -show_frames to the above command line example you
> >> gave, the output of show_streams will report closed_captions=1.
> >
> > Yes, I know that, but if you don't - the output is wrong.
> 
> Yeah, and fixing that would be ideal. The output of show_streams should
> (if possible) not depend on other options also being passed.
> Your patch will only do it for properties, and it requires new public
> API, whereas my suggestion will do it for all other fields, like
> coded_{width,height}, and requires changes contained entirely within
> ffprobe with proper usage of existing API.
> 
> >
> >> So the correct approach here is to make ffprobe decode a few frames when
> >> you request show_streams, even if you don't request show_frames.
> >
> > This is something that I would want to avoid. It has already happened
> > and the result is available already. The "Closed Captions" part in
> > the video codec string is coming from that result.
> >
> > It doesn't make sense IMO, to perform another decoding run to replicate
> > that result, because:
> >
> > - It can't be taken for granted that this will lead to the same result
> >that already exists
> >How many frames do you think would be the right amount to process?
> >What if the file start with a bunch of audio frames?
> 
> You decode until you get the info you need, which is what
> avformat_find_stream_info() does to fill its own internal
> AVCodecContext. The simplest way would be to ensure one frame per stream
> is decoded.

Sometimes, you could process hours of data without
seeing a frame for certain streams, so you would need a timeout
and maybe a limit for the amount of decoded data (maybe 
naming them analyyzeduration and probesize?).

What you're essentially suggesting is more or less a duplication
of avformat_find_stream_info() and to run it right after 
avformat_find_stream_info() has just been run.

I'm sure we can find a better solution :-)

Kind regards,
softworkz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 2/4] avfilter/vf_lut3d: Deduplicate options

2021-09-18 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_lut3d.c | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c
index 111e624dc3..9fbda833b9 100644
--- a/libavfilter/vf_lut3d.c
+++ b/libavfilter/vf_lut3d.c
@@ -1261,13 +1261,22 @@ static int process_command(AVFilterContext *ctx, const 
char *cmd, const char *ar
 return config_input(ctx->inputs[0]);
 }
 
+#if CONFIG_LUT3D_FILTER || CONFIG_HALDCLUT_FILTER
+
+/* These options are shared between several filters;
+ * &lut3d_haldclut_options[COMMON_OPTIONS_OFFSET] must always
+ * point to the first of the COMMON_OPTIONS. */
+#define COMMON_OPTIONS_OFFSET CONFIG_LUT3D_FILTER
+static const AVOption lut3d_haldclut_options[] = {
 #if CONFIG_LUT3D_FILTER
-static const AVOption lut3d_options[] = {
 { "file", "set 3D LUT file name", OFFSET(file), AV_OPT_TYPE_STRING, 
{.str=NULL}, .flags = FLAGS },
+#endif
 COMMON_OPTIONS
 };
 
-AVFILTER_DEFINE_CLASS(lut3d);
+#if CONFIG_LUT3D_FILTER
+
+AVFILTER_DEFINE_CLASS_EXT(lut3d, "lut3d", lut3d_haldclut_options);
 
 static av_cold int lut3d_init(AVFilterContext *ctx)
 {
@@ -1588,11 +1597,8 @@ static av_cold void haldclut_uninit(AVFilterContext *ctx)
 av_freep(&lut3d->lut);
 }
 
-static const AVOption haldclut_options[] = {
-COMMON_OPTIONS
-};
-
-FRAMESYNC_DEFINE_CLASS(haldclut, LUT3DContext, fs);
+FRAMESYNC_DEFINE_CLASS_EXT(haldclut, LUT3DContext, fs,
+   &lut3d_haldclut_options[COMMON_OPTIONS_OFFSET]);
 
 static const AVFilterPad haldclut_inputs[] = {
 {
@@ -1631,6 +1637,8 @@ const AVFilter ff_vf_haldclut = {
 };
 #endif
 
+#endif /* CONFIG_LUT3D_FILTER || CONFIG_HALDCLUT_FILTER */
+
 #if CONFIG_LUT1D_FILTER
 
 enum interp_1d_mode {
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 3/4] avfilter/vf_convolve: Deduplicate framesync auxiliary functions

2021-09-18 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/vf_convolve.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_convolve.c b/libavfilter/vf_convolve.c
index ab6d1a271f..2fa33587e3 100644
--- a/libavfilter/vf_convolve.c
+++ b/libavfilter/vf_convolve.c
@@ -655,9 +655,11 @@ static const AVFilterPad convolve_outputs[] = {
 },
 };
 
+FRAMESYNC_AUXILIARY_FUNCS(convolve, ConvolveContext, fs)
+
 #if CONFIG_CONVOLVE_FILTER
 
-FRAMESYNC_DEFINE_CLASS(convolve, ConvolveContext, fs);
+FRAMESYNC_DEFINE_PURE_CLASS(convolve, "convolve", convolve, convolve_options);
 
 const AVFilter ff_vf_convolve = {
 .name  = "convolve",
@@ -687,12 +689,12 @@ static const AVOption deconvolve_options[] = {
 { NULL },
 };
 
-FRAMESYNC_DEFINE_CLASS(deconvolve, ConvolveContext, fs);
+FRAMESYNC_DEFINE_PURE_CLASS(deconvolve, "deconvolve", convolve, 
deconvolve_options);
 
 const AVFilter ff_vf_deconvolve = {
 .name  = "deconvolve",
 .description   = NULL_IF_CONFIG_SMALL("Deconvolve first video stream with 
second video stream."),
-.preinit   = deconvolve_framesync_preinit,
+.preinit   = convolve_framesync_preinit,
 .init  = init,
 .uninit= uninit,
 .query_formats = query_formats,
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH 4/4] avfiler/framesync: Remove redundant setting of AVClass

2021-09-18 Thread Andreas Rheinhardt
Every filter exposing the framesync options via its child_next
callback already calls framesync_preinit() in its preinit callback.
So the filter is already preinited whenever its child_next is called.

Signed-off-by: Andreas Rheinhardt 
---
 libavfilter/framesync.c | 5 -
 libavfilter/framesync.h | 9 +++--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index bc6fce81f4..7510550d8e 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -68,11 +68,6 @@ enum {
 
 static int consume_from_fifos(FFFrameSync *fs);
 
-const AVClass *ff_framesync_get_class(void)
-{
-return &framesync_class;
-}
-
 void ff_framesync_preinit(FFFrameSync *fs)
 {
 if (fs->class)
diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h
index 8436aba23b..c0a9d3e969 100644
--- a/libavfilter/framesync.h
+++ b/libavfilter/framesync.h
@@ -208,11 +208,6 @@ typedef struct FFFrameSync {
 
 } FFFrameSync;
 
-/**
- * Get the class for the framesync object.
- */
-const AVClass *ff_framesync_get_class(void);
-
 /**
  * Pre-initialize a frame sync structure.
  *
@@ -310,6 +305,9 @@ static const AVClass name##_class = {   
  \
 .child_next  = func_prefix##_child_next,  \
 }
 
+/* A filter that uses the *_child_next-function from this macro
+ * is required to initialize the FFFrameSync structure in AVFilter.preinit
+ * via the *_framesync_preinit function defined alongside it. */
 #define FRAMESYNC_AUXILIARY_FUNCS(func_prefix, context, field)\
 static int func_prefix##_framesync_preinit(AVFilterContext *ctx) {\
 context *s = ctx->priv; \
@@ -318,7 +316,6 @@ static int func_prefix##_framesync_preinit(AVFilterContext 
*ctx) {\
 } \
 static void *func_prefix##_child_next(void *obj, void *prev) {\
 context *s = obj; \
-s->fs.class = ff_framesync_get_class(); /* FIXME */ \
 return prev ? NULL : &s->field; \
 }
 
-- 
2.30.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2] avcodec/truemotion1: Cleanup prediction code in truemotion1_decode_16bit and truemotion1_decode_24bit

2021-09-18 Thread Mapul Bhola
September 3, 2021 8:23 PM, "Mapul Bhola"  wrote:

> This cleans up the code in the decode24bit and decode16bit functions by 
> putting it in way that
> expresses the true intent while making it easier to read.
> 
> ---
> libavcodec/truemotion1.c | 40 +---
> 1 file changed, 13 insertions(+), 27 deletions(-)
> 
> diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
> index 32d8fb4005..9afe3f579d 100644
> --- a/libavcodec/truemotion1.c
> +++ b/libavcodec/truemotion1.c
> @@ -660,20 +660,13 @@ static void truemotion1_decode_16bit(TrueMotion1Context 
> *s)
> case 0:
> /* if macroblock width is 2, apply C-Y-C-Y; else
> * apply C-Y-Y */
> - if (s->block_width == 2) {
> - APPLY_C_PREDICTOR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_C_PREDICTOR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - } else {
> - APPLY_C_PREDICTOR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_Y_PREDICTOR();
> - OUTPUT_PIXEL_PAIR();
> - }
> + APPLY_C_PREDICTOR();
> + APPLY_Y_PREDICTOR();
> + OUTPUT_PIXEL_PAIR();
> + if (s->block_width == 2)
> + APPLY_C_PREDICTOR();
> + APPLY_Y_PREDICTOR();
> + OUTPUT_PIXEL_PAIR();
> break;
> 
> case 1:
> @@ -786,20 +779,13 @@ static void truemotion1_decode_24bit(TrueMotion1Context 
> *s)
> case 0:
> /* if macroblock width is 2, apply C-Y-C-Y; else
> * apply C-Y-Y */
> - if (s->block_width == 2) {
> - APPLY_C_PREDICTOR_24();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_C_PREDICTOR_24();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - } else {
> + APPLY_C_PREDICTOR_24();
> + APPLY_Y_PREDICTOR_24();
> + OUTPUT_PIXEL_PAIR();
> + if (s->block_width == 2)
> APPLY_C_PREDICTOR_24();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - APPLY_Y_PREDICTOR_24();
> - OUTPUT_PIXEL_PAIR();
> - }
> + APPLY_Y_PREDICTOR_24();
> + OUTPUT_PIXEL_PAIR();
> break;
> 
> case 1:
> -- 
> 2.24.3

ping
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] Plans for libavfilter

2021-09-18 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Soft Works
> Sent: Friday, 17 September 2021 19:16
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] Plans for libavfilter
> 
> 
> 
> > -Original Message-
> > From: ffmpeg-devel  On Behalf Of James
> Almer
> > Sent: Friday, 17 September 2021 18:39
> > To: ffmpeg-devel@ffmpeg.org
> > Subject: Re: [FFmpeg-devel] Plans for libavfilter
> >
> > On 9/17/2021 1:31 PM, Soft Works wrote:
> > > Hello Xiao,
> > >
> > >
> > > and welcome to this little freak-show of ffmpeg development.
> > > (some guys are nice and cool but often quiet)
> > >
> > > New contributing developers should be welcome, but actually
> > > you can be glad when you're not being told the opposite.
> > >
> > > As long as you're not a masochist or getting paid extremely
> > > well, you'll probably want to RUN, RUN, RUN away as fast
> > > as you can...
> >
> > Please, lets try to keep discussions and issues contained in their own
> > threads. Jumping onto other threads to discourage people is not going to
> > do any of us any good.
> 
> Probably not, but him.. ;-)
> 
> I wish the situation wasn't like that and my text would
> be hopelessly exaggerated, but it isn't.
> Neglection doesn't lead anywhere as the recent years have shown,
> and it's not about Xiang - it's about the hundreds of ML readers,
> many of which would probably rather take a job for resolving
> captchas than getting involved.
> 
> Facing and naming the situation as-is might be a good start.

Hi James,

I don't like the way how I had responded above. I stick to the 
point but it wasn't a good context; chiming-in in such 
situations like you did, is actually a good recipe for improving
the situation of developer relations and I do appreciate that a lot.

When more would go and stand in to break up situations starting,
to drive into a wrong direction, that could really make a change!

PS: I knew his context, I'd never discourage a new dev ;-)

Kind regards,
softworkz






___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".