diff mbox series

[FFmpeg-devel] ffmpeg: stop accessing private AVStream.codec_info_nb_frames

Message ID 20210429143825.53040-1-jamrial@gmail.com
State Accepted
Commit 4d3474432f8f23e8e97f3e2ef363a6906d8d211e
Headers show
Series [FFmpeg-devel] ffmpeg: stop accessing private AVStream.codec_info_nb_frames | 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 April 29, 2021, 2:38 p.m. UTC
Use AVSTREAM_EVENT_FLAG_NEW_PACKETS instead, which should provide the
same information in this case.
Finishes removing all uses of this field as started by 87f0c8280c.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 fftools/ffmpeg_opt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

James Almer May 2, 2021, 11:18 p.m. UTC | #1
On 4/29/2021 11:38 AM, James Almer wrote:
> Use AVSTREAM_EVENT_FLAG_NEW_PACKETS instead, which should provide the
> same information in this case.
> Finishes removing all uses of this field as started by 87f0c8280c.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   fftools/ffmpeg_opt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
> index c0b9f023bd..849d24b16d 100644
> --- a/fftools/ffmpeg_opt.c
> +++ b/fftools/ffmpeg_opt.c
> @@ -2272,7 +2272,8 @@ static int open_output_file(OptionsContext *o, const char *filename)
>               for (i = 0; i < nb_input_streams; i++) {
>                   int score;
>                   ist = input_streams[i];
> -                score = ist->st->codecpar->channels + 100000000*!!ist->st->codec_info_nb_frames
> +                score = ist->st->codecpar->channels
> +                        + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
>                           + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
>                   if (ist->user_set_discard == AVDISCARD_ALL)
>                       continue;

Will apply.
diff mbox series

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index c0b9f023bd..849d24b16d 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2272,7 +2272,8 @@  static int open_output_file(OptionsContext *o, const char *filename)
             for (i = 0; i < nb_input_streams; i++) {
                 int score;
                 ist = input_streams[i];
-                score = ist->st->codecpar->channels + 100000000*!!ist->st->codec_info_nb_frames
+                score = ist->st->codecpar->channels
+                        + 100000000 * !!(ist->st->event_flags & AVSTREAM_EVENT_FLAG_NEW_PACKETS)
                         + 5000000*!!(ist->st->disposition & AV_DISPOSITION_DEFAULT);
                 if (ist->user_set_discard == AVDISCARD_ALL)
                     continue;