diff mbox series

[FFmpeg-devel] avcodec/cbs: constify decompose_unit_types

Message ID 20210110222801.3157-1-jamrial@gmail.com
State Accepted
Commit 9219ed213d10fb2ae13da15402f5acf35ffb25ba
Headers show
Series [FFmpeg-devel] avcodec/cbs: constify decompose_unit_types | 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

James Almer Jan. 10, 2021, 10:28 p.m. UTC
CBS doesn't change its contents in any way whatsoever internally, and most
users already set it to a const array.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/av1_frame_split_bsf.c | 2 +-
 libavcodec/av1_parser.c          | 2 +-
 libavcodec/cbs.h                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Andreas Rheinhardt Jan. 10, 2021, 11:04 p.m. UTC | #1
James Almer:
> CBS doesn't change its contents in any way whatsoever internally, and most
> users already set it to a const array.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/av1_frame_split_bsf.c | 2 +-
>  libavcodec/av1_parser.c          | 2 +-
>  libavcodec/cbs.h                 | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/av1_frame_split_bsf.c
> index 13bebe19f5..fa8b887b6c 100644
> --- a/libavcodec/av1_frame_split_bsf.c
> +++ b/libavcodec/av1_frame_split_bsf.c
> @@ -214,7 +214,7 @@ static int av1_frame_split_init(AVBSFContext *ctx)
>      if (ret < 0)
>          return ret;
>  
> -    s->cbc->decompose_unit_types    = (CodedBitstreamUnitType*)decompose_unit_types;
> +    s->cbc->decompose_unit_types    = decompose_unit_types;
>      s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
>  
>      if (!ctx->par_in->extradata_size)
> diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
> index 181ff3a1be..6a76ffb7bc 100644
> --- a/libavcodec/av1_parser.c
> +++ b/libavcodec/av1_parser.c
> @@ -191,7 +191,7 @@ static av_cold int av1_parser_init(AVCodecParserContext *ctx)
>      if (ret < 0)
>          return ret;
>  
> -    s->cbc->decompose_unit_types    = (CodedBitstreamUnitType *)decompose_unit_types;
> +    s->cbc->decompose_unit_types    = decompose_unit_types;
>      s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
>  
>      return 0;
> diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
> index 3fd0a0ef33..f022282b75 100644
> --- a/libavcodec/cbs.h
> +++ b/libavcodec/cbs.h
> @@ -196,7 +196,7 @@ typedef struct CodedBitstreamContext {
>       * Types not in this list will be available in bitstream form only.
>       * If NULL, all supported types will be decomposed.
>       */
> -    CodedBitstreamUnitType *decompose_unit_types;
> +    const CodedBitstreamUnitType *decompose_unit_types;
>      /**
>       * Length of the decompose_unit_types array.
>       */
> 
LGTM.

- Andreas
James Almer Jan. 11, 2021, 1:11 p.m. UTC | #2
On 1/10/2021 8:04 PM, Andreas Rheinhardt wrote:
> James Almer:
>> CBS doesn't change its contents in any way whatsoever internally, and most
>> users already set it to a const array.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/av1_frame_split_bsf.c | 2 +-
>>   libavcodec/av1_parser.c          | 2 +-
>>   libavcodec/cbs.h                 | 2 +-
>>   3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/av1_frame_split_bsf.c
>> index 13bebe19f5..fa8b887b6c 100644
>> --- a/libavcodec/av1_frame_split_bsf.c
>> +++ b/libavcodec/av1_frame_split_bsf.c
>> @@ -214,7 +214,7 @@ static int av1_frame_split_init(AVBSFContext *ctx)
>>       if (ret < 0)
>>           return ret;
>>   
>> -    s->cbc->decompose_unit_types    = (CodedBitstreamUnitType*)decompose_unit_types;
>> +    s->cbc->decompose_unit_types    = decompose_unit_types;
>>       s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
>>   
>>       if (!ctx->par_in->extradata_size)
>> diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
>> index 181ff3a1be..6a76ffb7bc 100644
>> --- a/libavcodec/av1_parser.c
>> +++ b/libavcodec/av1_parser.c
>> @@ -191,7 +191,7 @@ static av_cold int av1_parser_init(AVCodecParserContext *ctx)
>>       if (ret < 0)
>>           return ret;
>>   
>> -    s->cbc->decompose_unit_types    = (CodedBitstreamUnitType *)decompose_unit_types;
>> +    s->cbc->decompose_unit_types    = decompose_unit_types;
>>       s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
>>   
>>       return 0;
>> diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
>> index 3fd0a0ef33..f022282b75 100644
>> --- a/libavcodec/cbs.h
>> +++ b/libavcodec/cbs.h
>> @@ -196,7 +196,7 @@ typedef struct CodedBitstreamContext {
>>        * Types not in this list will be available in bitstream form only.
>>        * If NULL, all supported types will be decomposed.
>>        */
>> -    CodedBitstreamUnitType *decompose_unit_types;
>> +    const CodedBitstreamUnitType *decompose_unit_types;
>>       /**
>>        * Length of the decompose_unit_types array.
>>        */
>>
> LGTM.
> 
> - Andreas

Applied, thanks.
diff mbox series

Patch

diff --git a/libavcodec/av1_frame_split_bsf.c b/libavcodec/av1_frame_split_bsf.c
index 13bebe19f5..fa8b887b6c 100644
--- a/libavcodec/av1_frame_split_bsf.c
+++ b/libavcodec/av1_frame_split_bsf.c
@@ -214,7 +214,7 @@  static int av1_frame_split_init(AVBSFContext *ctx)
     if (ret < 0)
         return ret;
 
-    s->cbc->decompose_unit_types    = (CodedBitstreamUnitType*)decompose_unit_types;
+    s->cbc->decompose_unit_types    = decompose_unit_types;
     s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
 
     if (!ctx->par_in->extradata_size)
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 181ff3a1be..6a76ffb7bc 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -191,7 +191,7 @@  static av_cold int av1_parser_init(AVCodecParserContext *ctx)
     if (ret < 0)
         return ret;
 
-    s->cbc->decompose_unit_types    = (CodedBitstreamUnitType *)decompose_unit_types;
+    s->cbc->decompose_unit_types    = decompose_unit_types;
     s->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
 
     return 0;
diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h
index 3fd0a0ef33..f022282b75 100644
--- a/libavcodec/cbs.h
+++ b/libavcodec/cbs.h
@@ -196,7 +196,7 @@  typedef struct CodedBitstreamContext {
      * Types not in this list will be available in bitstream form only.
      * If NULL, all supported types will be decomposed.
      */
-    CodedBitstreamUnitType *decompose_unit_types;
+    const CodedBitstreamUnitType *decompose_unit_types;
     /**
      * Length of the decompose_unit_types array.
      */