diff mbox

[FFmpeg-devel] h264: add AVOption to set x264_build default

Message ID 20171223021449.19578-1-nfxjfg@googlemail.com
State Accepted
Commit cf57cb3ae4364ab8e70af37beea7a45a86de90e9
Headers show

Commit Message

wm4 Dec. 23, 2017, 2:14 a.m. UTC
This provides a generic way to the API user to deal with files that
either lack this SEI, or which have the SEI only in packets not passed
to the decoder (such as the common case of the SEI being in the very
firsat video packet, but decoding is started somewhere in the middle of
the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
somewhat of a necessity.

This intentionally uses the version in the SEI instead, if any is found.
---
A bit crappy. Better than other workarounds I've thought of. And at
least it doesn't require the API user to guess which x264 versions
trigger which bugs.
---
 libavcodec/h264dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

wm4 Dec. 26, 2017, 2:02 a.m. UTC | #1
On Sat, 23 Dec 2017 03:14:49 +0100
wm4 <nfxjfg@googlemail.com> wrote:

> This provides a generic way to the API user to deal with files that
> either lack this SEI, or which have the SEI only in packets not passed
> to the decoder (such as the common case of the SEI being in the very
> firsat video packet, but decoding is started somewhere in the middle of
> the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
> somewhat of a necessity.
> 
> This intentionally uses the version in the SEI instead, if any is found.
> ---
> A bit crappy. Better than other workarounds I've thought of. And at
> least it doesn't require the API user to guess which x264 versions
> trigger which bugs.
> ---
>  libavcodec/h264dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> index 1e98765439..8c9c6d9f3b 100644
> --- a/libavcodec/h264dec.c
> +++ b/libavcodec/h264dec.c
> @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
>      h->flags                 = avctx->flags;
>      h->poc.prev_poc_msb      = 1 << 16;
>      h->recovery_frame        = -1;
> -    h->x264_build            = -1;
>      h->frame_recovered       = 0;
>      h->poc.prev_frame_num    = -1;
>      h->sei.frame_packing.arrangement_cancel_flag = -1;
> @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = {
>      { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
>      { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
>      { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
> +    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
>      { NULL },
>  };
>  

Pushed.
Carl Eugen Hoyos Dec. 27, 2017, 11:56 p.m. UTC | #2
2017-12-26 3:02 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
> On Sat, 23 Dec 2017 03:14:49 +0100
> wm4 <nfxjfg@googlemail.com> wrote:
>
>> This provides a generic way to the API user to deal with files that
>> either lack this SEI, or which have the SEI only in packets not passed
>> to the decoder (such as the common case of the SEI being in the very
>> firsat video packet, but decoding is started somewhere in the middle of
>> the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
>> somewhat of a necessity.
>>
>> This intentionally uses the version in the SEI instead, if any is found.
>> ---
>> A bit crappy. Better than other workarounds I've thought of. And at
>> least it doesn't require the API user to guess which x264 versions
>> trigger which bugs.
>> ---
>>  libavcodec/h264dec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
>> index 1e98765439..8c9c6d9f3b 100644
>> --- a/libavcodec/h264dec.c
>> +++ b/libavcodec/h264dec.c
>> @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
>>      h->flags                 = avctx->flags;
>>      h->poc.prev_poc_msb      = 1 << 16;
>>      h->recovery_frame        = -1;
>> -    h->x264_build            = -1;
>>      h->frame_recovered       = 0;
>>      h->poc.prev_frame_num    = -1;
>>      h->sei.frame_packing.arrangement_cancel_flag = -1;
>> @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = {
>>      { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
>>      { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
>>      { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
>> +    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
>>      { NULL },
>>  };
>>
>
> Pushed.

That's a new low even for your standards.

Carl Eugen
wm4 Dec. 27, 2017, 11:58 p.m. UTC | #3
On Thu, 28 Dec 2017 00:56:05 +0100
Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:

> 2017-12-26 3:02 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
> > On Sat, 23 Dec 2017 03:14:49 +0100
> > wm4 <nfxjfg@googlemail.com> wrote:
> >  
> >> This provides a generic way to the API user to deal with files that
> >> either lack this SEI, or which have the SEI only in packets not passed
> >> to the decoder (such as the common case of the SEI being in the very
> >> firsat video packet, but decoding is started somewhere in the middle of
> >> the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
> >> somewhat of a necessity.
> >>
> >> This intentionally uses the version in the SEI instead, if any is found.
> >> ---
> >> A bit crappy. Better than other workarounds I've thought of. And at
> >> least it doesn't require the API user to guess which x264 versions
> >> trigger which bugs.
> >> ---
> >>  libavcodec/h264dec.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
> >> index 1e98765439..8c9c6d9f3b 100644
> >> --- a/libavcodec/h264dec.c
> >> +++ b/libavcodec/h264dec.c
> >> @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
> >>      h->flags                 = avctx->flags;
> >>      h->poc.prev_poc_msb      = 1 << 16;
> >>      h->recovery_frame        = -1;
> >> -    h->x264_build            = -1;
> >>      h->frame_recovered       = 0;
> >>      h->poc.prev_frame_num    = -1;
> >>      h->sei.frame_packing.arrangement_cancel_flag = -1;
> >> @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = {
> >>      { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
> >>      { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
> >>      { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
> >> +    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
> >>      { NULL },
> >>  };
> >>  
> >
> > Pushed.  
> 
> That's a new low even for your standards.

What is it now again that you're once again so obnoxious and insulting?
Carl Eugen Hoyos Dec. 28, 2017, 12:31 a.m. UTC | #4
2017-12-28 0:58 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
> On Thu, 28 Dec 2017 00:56:05 +0100
> Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>
>> 2017-12-26 3:02 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
>> > On Sat, 23 Dec 2017 03:14:49 +0100
>> > wm4 <nfxjfg@googlemail.com> wrote:
>> >
>> >> This provides a generic way to the API user to deal with files that
>> >> either lack this SEI, or which have the SEI only in packets not passed
>> >> to the decoder (such as the common case of the SEI being in the very
>> >> firsat video packet, but decoding is started somewhere in the middle of
>> >> the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
>> >> somewhat of a necessity.
>> >>
>> >> This intentionally uses the version in the SEI instead, if any is found.
>> >> ---
>> >> A bit crappy. Better than other workarounds I've thought of. And at
>> >> least it doesn't require the API user to guess which x264 versions
>> >> trigger which bugs.
>> >> ---
>> >>  libavcodec/h264dec.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
>> >> index 1e98765439..8c9c6d9f3b 100644
>> >> --- a/libavcodec/h264dec.c
>> >> +++ b/libavcodec/h264dec.c
>> >> @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
>> >>      h->flags                 = avctx->flags;
>> >>      h->poc.prev_poc_msb      = 1 << 16;
>> >>      h->recovery_frame        = -1;
>> >> -    h->x264_build            = -1;
>> >>      h->frame_recovered       = 0;
>> >>      h->poc.prev_frame_num    = -1;
>> >>      h->sei.frame_packing.arrangement_cancel_flag = -1;
>> >> @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = {
>> >>      { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
>> >>      { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
>> >>      { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
>> >> +    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
>> >>      { NULL },
>> >>  };
>> >>
>> >
>> > Pushed.
>>
>> That's a new low even for your standards.
>
> What is it now again that you're once again so obnoxious and insulting?

Is there really no way to stop you?

Carl Eugen
James Almer Dec. 28, 2017, 12:35 a.m. UTC | #5
On 12/27/2017 9:31 PM, Carl Eugen Hoyos wrote:
> 2017-12-28 0:58 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
>> On Thu, 28 Dec 2017 00:56:05 +0100
>> Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>>
>>> 2017-12-26 3:02 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
>>>> On Sat, 23 Dec 2017 03:14:49 +0100
>>>> wm4 <nfxjfg@googlemail.com> wrote:
>>>>
>>>>> This provides a generic way to the API user to deal with files that
>>>>> either lack this SEI, or which have the SEI only in packets not passed
>>>>> to the decoder (such as the common case of the SEI being in the very
>>>>> firsat video packet, but decoding is started somewhere in the middle of
>>>>> the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
>>>>> somewhat of a necessity.
>>>>>
>>>>> This intentionally uses the version in the SEI instead, if any is found.
>>>>> ---
>>>>> A bit crappy. Better than other workarounds I've thought of. And at
>>>>> least it doesn't require the API user to guess which x264 versions
>>>>> trigger which bugs.
>>>>> ---
>>>>>  libavcodec/h264dec.c | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
>>>>> index 1e98765439..8c9c6d9f3b 100644
>>>>> --- a/libavcodec/h264dec.c
>>>>> +++ b/libavcodec/h264dec.c
>>>>> @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
>>>>>      h->flags                 = avctx->flags;
>>>>>      h->poc.prev_poc_msb      = 1 << 16;
>>>>>      h->recovery_frame        = -1;
>>>>> -    h->x264_build            = -1;
>>>>>      h->frame_recovered       = 0;
>>>>>      h->poc.prev_frame_num    = -1;
>>>>>      h->sei.frame_packing.arrangement_cancel_flag = -1;
>>>>> @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = {
>>>>>      { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
>>>>>      { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
>>>>>      { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
>>>>> +    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
>>>>>      { NULL },
>>>>>  };
>>>>>
>>>>
>>>> Pushed.
>>>
>>> That's a new low even for your standards.
>>
>> What is it now again that you're once again so obnoxious and insulting?
> 
> Is there really no way to stop you?

I don't know what's gotten into you right now, but antagonizing people
out of nowhere without being provoked is not a welcome behavior at all.
Carl Eugen Hoyos Dec. 28, 2017, 12:44 a.m. UTC | #6
2017-12-28 1:35 GMT+01:00 James Almer <jamrial@gmail.com>:
> On 12/27/2017 9:31 PM, Carl Eugen Hoyos wrote:
>> 2017-12-28 0:58 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
>>> On Thu, 28 Dec 2017 00:56:05 +0100
>>> Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
>>>
>>>> 2017-12-26 3:02 GMT+01:00 wm4 <nfxjfg@googlemail.com>:
>>>>> On Sat, 23 Dec 2017 03:14:49 +0100
>>>>> wm4 <nfxjfg@googlemail.com> wrote:
>>>>>
>>>>>> This provides a generic way to the API user to deal with files that
>>>>>> either lack this SEI, or which have the SEI only in packets not passed
>>>>>> to the decoder (such as the common case of the SEI being in the very
>>>>>> firsat video packet, but decoding is started somewhere in the middle of
>>>>>> the file). Bugs like 840b41b2a643fc8f0617c0370125a19c02c6b586 make this
>>>>>> somewhat of a necessity.
>>>>>>
>>>>>> This intentionally uses the version in the SEI instead, if any is found.
>>>>>> ---
>>>>>> A bit crappy. Better than other workarounds I've thought of. And at
>>>>>> least it doesn't require the API user to guess which x264 versions
>>>>>> trigger which bugs.
>>>>>> ---
>>>>>>  libavcodec/h264dec.c | 2 +-
>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
>>>>>> index 1e98765439..8c9c6d9f3b 100644
>>>>>> --- a/libavcodec/h264dec.c
>>>>>> +++ b/libavcodec/h264dec.c
>>>>>> @@ -315,7 +315,6 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
>>>>>>      h->flags                 = avctx->flags;
>>>>>>      h->poc.prev_poc_msb      = 1 << 16;
>>>>>>      h->recovery_frame        = -1;
>>>>>> -    h->x264_build            = -1;
>>>>>>      h->frame_recovered       = 0;
>>>>>>      h->poc.prev_frame_num    = -1;
>>>>>>      h->sei.frame_packing.arrangement_cancel_flag = -1;
>>>>>> @@ -1037,6 +1036,7 @@ static const AVOption h264_options[] = {
>>>>>>      { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
>>>>>>      { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
>>>>>>      { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
>>>>>> +    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
>>>>>>      { NULL },
>>>>>>  };
>>>>>>
>>>>>
>>>>> Pushed.
>>>>
>>>> That's a new low even for your standards.
>>>
>>> What is it now again that you're once again so obnoxious and insulting?
>>
>> Is there really no way to stop you?
>
> I don't know what's gotten into you right now, but antagonizing people

> out of nowhere without being provoked is not a welcome behavior at all.

That doesn't sound correct to me.

Carl Eugen
Derek Buitenhuis Dec. 28, 2017, 3:43 p.m. UTC | #7
On 12/28/2017 12:44 AM, Carl Eugen Hoyos wrote:
>> out of nowhere without being provoked is not a welcome behavior at all.
> 
> That doesn't sound correct to me.

He literally said nothing to you on this thread before you insulted him.

Cut it out.

- Derek
Carl Eugen Hoyos Dec. 28, 2017, 10:19 p.m. UTC | #8
2017-12-28 16:43 GMT+01:00 Derek Buitenhuis <derek.buitenhuis@gmail.com>:
> On 12/28/2017 12:44 AM, Carl Eugen Hoyos wrote:
>>> out of nowhere without being provoked is not a welcome behavior at all.
>>
>> That doesn't sound correct to me.
>
> He literally said nothing to you on this thread before you insulted him.

I care much less about what he says (did he really talk to you?) or
writes, more about what he does.

Carl Eugen
Hendrik Leppkes Dec. 28, 2017, 11:11 p.m. UTC | #9
On Thu, Dec 28, 2017 at 11:19 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
> 2017-12-28 16:43 GMT+01:00 Derek Buitenhuis <derek.buitenhuis@gmail.com>:
>> On 12/28/2017 12:44 AM, Carl Eugen Hoyos wrote:
>>>> out of nowhere without being provoked is not a welcome behavior at all.
>>>
>>> That doesn't sound correct to me.
>>
>> He literally said nothing to you on this thread before you insulted him.
>
> I care much less about what he says (did he really talk to you?) or
> writes, more about what he does.
>

You have also not commented on any behavior, but directly went to
insults. And apparently you don't recognize that you are violating
various rules here.
As others have said, cut it out.

-  Hendrik
Derek Buitenhuis Dec. 29, 2017, 3:17 a.m. UTC | #10
On 12/28/2017 10:19 PM, Carl Eugen Hoyos wrote:
> I care much less about what he says (did he really talk to you?) or
> writes, more about what he does.

For the record: Nobody talked to me. There is no conspiracy.

- Derek
diff mbox

Patch

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 1e98765439..8c9c6d9f3b 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -315,7 +315,6 @@  static int h264_init_context(AVCodecContext *avctx, H264Context *h)
     h->flags                 = avctx->flags;
     h->poc.prev_poc_msb      = 1 << 16;
     h->recovery_frame        = -1;
-    h->x264_build            = -1;
     h->frame_recovered       = 0;
     h->poc.prev_frame_num    = -1;
     h->sei.frame_packing.arrangement_cancel_flag = -1;
@@ -1037,6 +1036,7 @@  static const AVOption h264_options[] = {
     { "is_avc", "is avc", OFFSET(is_avc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 },
     { "nal_length_size", "nal_length_size", OFFSET(nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0 },
     { "enable_er", "Enable error resilience on damaged frames (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
+    { "x264_build", "Assume this x264 version if no x264 version found in any SEI", OFFSET(x264_build), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VD },
     { NULL },
 };