diff mbox series

[FFmpeg-devel,2/5] avdevice/lavfi: Don't reimplement av_frame_get_side_data()

Message ID 20200830145045.4437-2-andreas.rheinhardt@gmail.com
State Accepted
Commit ebd485db926889b5686cab440a6f514d6831209f
Headers show
Series [FFmpeg-devel,1/5] avdevice/lavfi: Use av_packet_move_ref() for packet ownership transfer | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 30, 2020, 2:50 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavdevice/lavfi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Paul B Mahol Aug. 30, 2020, 3:27 p.m. UTC | #1
On 8/30/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavdevice/lavfi.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>


probably ok

> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
> index 2a95cb013c..5e814eada8 100644
> --- a/libavdevice/lavfi.c
> +++ b/libavdevice/lavfi.c
> @@ -362,16 +362,12 @@ static int create_subcc_packet(AVFormatContext *avctx,
> AVFrame *frame,
>  {
>      LavfiContext *lavfi = avctx->priv_data;
>      AVFrameSideData *sd;
> -    int stream_idx, i, ret;
> +    int stream_idx, ret;
>
>      if ((stream_idx = lavfi->sink_stream_subcc_map[sink_idx]) < 0)
>          return 0;
> -    for (i = 0; i < frame->nb_side_data; i++)
> -        if (frame->side_data[i]->type == AV_FRAME_DATA_A53_CC)
> -            break;
> -    if (i >= frame->nb_side_data)
> +    if (!(sd = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC)))
>          return 0;
> -    sd = frame->side_data[i];
>      if ((ret = av_new_packet(&lavfi->subcc_packet, sd->size)) < 0)
>          return ret;
>      memcpy(lavfi->subcc_packet.data, sd->data, sd->size);
> --
> 2.20.1
>
> _______________________________________________
> 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/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 2a95cb013c..5e814eada8 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -362,16 +362,12 @@  static int create_subcc_packet(AVFormatContext *avctx, AVFrame *frame,
 {
     LavfiContext *lavfi = avctx->priv_data;
     AVFrameSideData *sd;
-    int stream_idx, i, ret;
+    int stream_idx, ret;
 
     if ((stream_idx = lavfi->sink_stream_subcc_map[sink_idx]) < 0)
         return 0;
-    for (i = 0; i < frame->nb_side_data; i++)
-        if (frame->side_data[i]->type == AV_FRAME_DATA_A53_CC)
-            break;
-    if (i >= frame->nb_side_data)
+    if (!(sd = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC)))
         return 0;
-    sd = frame->side_data[i];
     if ((ret = av_new_packet(&lavfi->subcc_packet, sd->size)) < 0)
         return ret;
     memcpy(lavfi->subcc_packet.data, sd->data, sd->size);