diff mbox series

[FFmpeg-devel] avformat/movenc: correct range for movie_timescale

Message ID 20210507132208.973-1-ffmpeg@gyani.pro
State New
Headers show
Series [FFmpeg-devel] avformat/movenc: correct range for movie_timescale | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Gyan Doshi May 7, 2021, 1:22 p.m. UTC
ISO 14496-12 declares it as a 32-bit unsigned integer
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer May 7, 2021, 1:30 p.m. UTC | #1
On 5/7/2021 10:22 AM, Gyan Doshi wrote:
> ISO 14496-12 declares it as a 32-bit unsigned integer
> ---
>   libavformat/movenc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 2ab507df15..9fe58b312e 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -107,7 +107,7 @@ static const AVOption options[] = {
>       { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
>       { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
>       { "empty_hdlr_name", "write zero-length name string in hdlr atoms within mdia and minf atoms", offsetof(MOVMuxContext, empty_hdlr_name), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
> -    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
> +    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, UINT32_MAX, AV_OPT_FLAG_ENCODING_PARAM},

The type for movie_timescale in MOVMuxContext would need to be changed 
too, and all its uses double checked to make sure nothing breaks.

I see one case where it's used as the den value for AVRational, which is 
an int.

>       { NULL },
>   };
>   
>
Gyan Doshi May 7, 2021, 3:56 p.m. UTC | #2
On 2021-05-07 19:00, James Almer wrote:
> On 5/7/2021 10:22 AM, Gyan Doshi wrote:
>> ISO 14496-12 declares it as a 32-bit unsigned integer
>> ---
>>   libavformat/movenc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>> index 2ab507df15..9fe58b312e 100644
>> --- a/libavformat/movenc.c
>> +++ b/libavformat/movenc.c
>> @@ -107,7 +107,7 @@ static const AVOption options[] = {
>>       { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
>> MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
>>       { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 
>> 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
>>       { "empty_hdlr_name", "write zero-length name string in hdlr 
>> atoms within mdia and minf atoms", offsetof(MOVMuxContext, 
>> empty_hdlr_name), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 
>> AV_OPT_FLAG_ENCODING_PARAM},
>> -    { "movie_timescale", "set movie timescale", 
>> offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = 
>> MOV_TIMESCALE}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
>> +    { "movie_timescale", "set movie timescale", 
>> offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = 
>> MOV_TIMESCALE}, 1, UINT32_MAX, AV_OPT_FLAG_ENCODING_PARAM},
>
> The type for movie_timescale in MOVMuxContext would need to be changed 
> too, and all its uses double checked to make sure nothing breaks.
>
> I see one case where it's used as the den value for AVRational, which 
> is an int.

Better to leave it as is then.

Thanks.
diff mbox series

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2ab507df15..9fe58b312e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -107,7 +107,7 @@  static const AVOption options[] = {
     { "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
     { "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
     { "empty_hdlr_name", "write zero-length name string in hdlr atoms within mdia and minf atoms", offsetof(MOVMuxContext, empty_hdlr_name), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
-    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
+    { "movie_timescale", "set movie timescale", offsetof(MOVMuxContext, movie_timescale), AV_OPT_TYPE_INT, {.i64 = MOV_TIMESCALE}, 1, UINT32_MAX, AV_OPT_FLAG_ENCODING_PARAM},
     { NULL },
 };