diff mbox series

[FFmpeg-devel,v2,6/7] avformat/mxfenc: allow all frame rates if -strict mode is set to unofficial or lower

Message ID 20200305215628.19514-6-cus@passwd.hu
State Accepted
Headers show
Series [FFmpeg-devel,v2,1/7] avformat/audiointerleave: disallow using a samples_per_frame array | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Marton Balint March 5, 2020, 9:56 p.m. UTC
There was no consensus wheter or not to allow unofficial frame rates due to
possible interoperability issues, a compromise is to only allow it if -strict
mode is set to unofficial.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/mxfenc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Tomas Härdin March 7, 2020, 11:37 a.m. UTC | #1
tor 2020-03-05 klockan 22:56 +0100 skrev Marton Balint:
> There was no consensus wheter or not to allow unofficial frame rates due to
> possible interoperability issues, a compromise is to only allow it if -strict
> mode is set to unofficial.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavformat/mxfenc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index 51e2dc5f31..6279ba9d6d 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -2413,8 +2413,12 @@ static int mxf_init_timecode(AVFormatContext *s, AVStream *st, AVRational tbc)
>      AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
>  
>      if (!ff_mxf_get_content_package_rate(tbc)) {
> -        av_log(s, AV_LOG_ERROR, "Unsupported frame rate %d/%d\n", tbc.den, tbc.num);
> -        return AVERROR(EINVAL);
> +        if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
> +            av_log(s, AV_LOG_ERROR, "Unsupported frame rate %d/%d. Set -strict option to 'unofficial' or lower in order to allow it!\n", tbc.den, tbc.num);
> +            return AVERROR(EINVAL);
> +        } else {
> +            av_log(s, AV_LOG_WARNING, "Unofficial frame rate %d/%d.\n", tbc.den, tbc.num);
> +        }

This can work. That way we make it clear to users that here be dragons

/Tomas
Marton Balint March 12, 2020, 9:21 p.m. UTC | #2
On Sat, 7 Mar 2020, Tomas Härdin wrote:

> tor 2020-03-05 klockan 22:56 +0100 skrev Marton Balint:
>> There was no consensus wheter or not to allow unofficial frame rates due to
>> possible interoperability issues, a compromise is to only allow it if -strict
>> mode is set to unofficial.
>> 
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavformat/mxfenc.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
>> index 51e2dc5f31..6279ba9d6d 100644
>> --- a/libavformat/mxfenc.c
>> +++ b/libavformat/mxfenc.c
>> @@ -2413,8 +2413,12 @@ static int mxf_init_timecode(AVFormatContext *s, AVStream *st, AVRational tbc)
>>      AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
>>
>>      if (!ff_mxf_get_content_package_rate(tbc)) {
>> -        av_log(s, AV_LOG_ERROR, "Unsupported frame rate %d/%d\n", tbc.den, tbc.num);
>> -        return AVERROR(EINVAL);
>> +        if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
>> +            av_log(s, AV_LOG_ERROR, "Unsupported frame rate %d/%d. Set -strict option to 'unofficial' or lower in order to allow it!\n", tbc.den, tbc.num);
>> +            return AVERROR(EINVAL);
>> +        } else {
>> +            av_log(s, AV_LOG_WARNING, "Unofficial frame rate %d/%d.\n", tbc.den, tbc.num);
>> +        }
>
> This can work. That way we make it clear to users that here be dragons

Thanks, it seems there are no further comments for patches 1-6, so I plan 
to apply them soon.

Regards,
Marton
diff mbox series

Patch

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 51e2dc5f31..6279ba9d6d 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2413,8 +2413,12 @@  static int mxf_init_timecode(AVFormatContext *s, AVStream *st, AVRational tbc)
     AVDictionaryEntry *tcr = av_dict_get(s->metadata, "timecode", NULL, 0);
 
     if (!ff_mxf_get_content_package_rate(tbc)) {
-        av_log(s, AV_LOG_ERROR, "Unsupported frame rate %d/%d\n", tbc.den, tbc.num);
-        return AVERROR(EINVAL);
+        if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) {
+            av_log(s, AV_LOG_ERROR, "Unsupported frame rate %d/%d. Set -strict option to 'unofficial' or lower in order to allow it!\n", tbc.den, tbc.num);
+            return AVERROR(EINVAL);
+        } else {
+            av_log(s, AV_LOG_WARNING, "Unofficial frame rate %d/%d.\n", tbc.den, tbc.num);
+        }
     }
 
     mxf->timecode_base = (tbc.den + tbc.num/2) / tbc.num;