diff mbox series

[FFmpeg-devel] avformat/utils: remove AVStreamInternal.orig_codec_id

Message ID 20210714190749.4540-1-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avformat/utils: remove AVStreamInternal.orig_codec_id | expand

Checks

Context Check Description
andriy/x86_make_warn warning New warnings during build
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 July 14, 2021, 7:07 p.m. UTC
It's a write only field.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/internal.h | 2 --
 libavformat/utils.c    | 6 ------
 2 files changed, 8 deletions(-)

Comments

Andreas Rheinhardt July 17, 2021, 8:30 p.m. UTC | #1
James Almer:
> It's a write only field.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/internal.h | 2 --
>  libavformat/utils.c    | 6 ------
>  2 files changed, 8 deletions(-)
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 240de9e289..4b7ab082e7 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -204,8 +204,6 @@ struct AVStreamInternal {
>       */
>      int avctx_inited;
>  
> -    enum AVCodecID orig_codec_id;
> -
>      /* the context for extracting extradata in find_stream_info()
>       * inited=1/bsf=NULL signals that extracting is not possible (codec not
>       * supported) */
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 998fddf270..efdb6f062f 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -604,9 +604,6 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
>  
>      update_stream_avctx(s);
>  
> -    for (i = 0; i < s->nb_streams; i++)
> -        s->streams[i]->internal->orig_codec_id = s->streams[i]->codecpar->codec_id;
> -
>      if (options) {
>          av_dict_free(options);
>          *options = tmp;
> @@ -3614,9 +3611,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
>              }
>          }
>  
> -        if (st->codecpar->codec_id != st->internal->orig_codec_id)
> -            st->internal->orig_codec_id = st->codecpar->codec_id;
> -
>          ret = avcodec_parameters_to_context(avctx, st->codecpar);
>          if (ret < 0)
>              goto find_stream_info_err;
> 
LGTM.

- Andreas
Andreas Rheinhardt July 17, 2021, 10:17 p.m. UTC | #2
James Almer:
> It's a write only field.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/internal.h | 2 --
>  libavformat/utils.c    | 6 ------
>  2 files changed, 8 deletions(-)
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 240de9e289..4b7ab082e7 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -204,8 +204,6 @@ struct AVStreamInternal {
>       */
>      int avctx_inited;
>  
> -    enum AVCodecID orig_codec_id;
> -
>      /* the context for extracting extradata in find_stream_info()
>       * inited=1/bsf=NULL signals that extracting is not possible (codec not
>       * supported) */
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 998fddf270..efdb6f062f 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -604,9 +604,6 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
>  
>      update_stream_avctx(s);
>  
> -    for (i = 0; i < s->nb_streams; i++)

This loop is the only user of i, so it needs to be removed as well. LGTM
apart from that.
(Found via patchwork; thanks Andriy again. Btw, this shows why we should
use for loops with variable declaration (i.e. "for (int i = 0;").)

> -        s->streams[i]->internal->orig_codec_id = s->streams[i]->codecpar->codec_id;
> -
>      if (options) {
>          av_dict_free(options);
>          *options = tmp;
> @@ -3614,9 +3611,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
>              }
>          }
>  
> -        if (st->codecpar->codec_id != st->internal->orig_codec_id)
> -            st->internal->orig_codec_id = st->codecpar->codec_id;
> -
>          ret = avcodec_parameters_to_context(avctx, st->codecpar);
>          if (ret < 0)
>              goto find_stream_info_err;
>
James Almer July 17, 2021, 10:43 p.m. UTC | #3
On 7/17/2021 7:17 PM, Andreas Rheinhardt wrote:
> James Almer:
>> It's a write only field.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavformat/internal.h | 2 --
>>   libavformat/utils.c    | 6 ------
>>   2 files changed, 8 deletions(-)
>>
>> diff --git a/libavformat/internal.h b/libavformat/internal.h
>> index 240de9e289..4b7ab082e7 100644
>> --- a/libavformat/internal.h
>> +++ b/libavformat/internal.h
>> @@ -204,8 +204,6 @@ struct AVStreamInternal {
>>        */
>>       int avctx_inited;
>>   
>> -    enum AVCodecID orig_codec_id;
>> -
>>       /* the context for extracting extradata in find_stream_info()
>>        * inited=1/bsf=NULL signals that extracting is not possible (codec not
>>        * supported) */
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index 998fddf270..efdb6f062f 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -604,9 +604,6 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
>>   
>>       update_stream_avctx(s);
>>   
>> -    for (i = 0; i < s->nb_streams; i++)
> 
> This loop is the only user of i, so it needs to be removed as well. LGTM
> apart from that.
> (Found via patchwork; thanks Andriy again. Btw, this shows why we should
> use for loops with variable declaration (i.e. "for (int i = 0;").)

Yeah, i noticed the warning after sending the patch and already had it 
amended locally.

Pushed, thanks.

> 
>> -        s->streams[i]->internal->orig_codec_id = s->streams[i]->codecpar->codec_id;
>> -
>>       if (options) {
>>           av_dict_free(options);
>>           *options = tmp;
>> @@ -3614,9 +3611,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
>>               }
>>           }
>>   
>> -        if (st->codecpar->codec_id != st->internal->orig_codec_id)
>> -            st->internal->orig_codec_id = st->codecpar->codec_id;
>> -
>>           ret = avcodec_parameters_to_context(avctx, st->codecpar);
>>           if (ret < 0)
>>               goto find_stream_info_err;
>>
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 240de9e289..4b7ab082e7 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -204,8 +204,6 @@  struct AVStreamInternal {
      */
     int avctx_inited;
 
-    enum AVCodecID orig_codec_id;
-
     /* the context for extracting extradata in find_stream_info()
      * inited=1/bsf=NULL signals that extracting is not possible (codec not
      * supported) */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 998fddf270..efdb6f062f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -604,9 +604,6 @@  int avformat_open_input(AVFormatContext **ps, const char *filename,
 
     update_stream_avctx(s);
 
-    for (i = 0; i < s->nb_streams; i++)
-        s->streams[i]->internal->orig_codec_id = s->streams[i]->codecpar->codec_id;
-
     if (options) {
         av_dict_free(options);
         *options = tmp;
@@ -3614,9 +3611,6 @@  int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             }
         }
 
-        if (st->codecpar->codec_id != st->internal->orig_codec_id)
-            st->internal->orig_codec_id = st->codecpar->codec_id;
-
         ret = avcodec_parameters_to_context(avctx, st->codecpar);
         if (ret < 0)
             goto find_stream_info_err;