diff mbox series

[FFmpeg-devel,21/21] fftools/ffmpeg: pass subtitle decoder dimensions to sub2video

Message ID 20230614164908.28712-21-anton@khirnov.net
State Accepted
Commit 1617d1a752d5e97d5e74f6c384609c027c884553
Headers show
Series [FFmpeg-devel,01/21] fftools/ffmpeg_dec: drop always-0 InputStream.prev_sub.ret | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov June 14, 2023, 4:49 p.m. UTC
Restores behavior from before 20cacfe4936a8d5b643421b5ca93bb098f6b76dd.
Eventually this should be handled similarly to audio/video - with a
filtergraph reset or a manual scaler.
---
 fftools/ffmpeg_dec.c    | 3 +++
 fftools/ffmpeg_filter.c | 3 +++
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c
index e0c0038f50..4ff30b44b2 100644
--- a/fftools/ffmpeg_dec.c
+++ b/fftools/ffmpeg_dec.c
@@ -509,6 +509,9 @@  static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
         return ret;
     }
 
+    frame->width  = ist->dec_ctx->width;
+    frame->height = ist->dec_ctx->height;
+
     ret = tq_send(d->queue_out, 0, frame);
     if (ret < 0)
         av_frame_unref(frame);
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index acc8596836..60e09866af 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1791,6 +1791,9 @@  int ifilter_sub2video(InputFilter *ifilter, const AVFrame *frame)
             return av_buffersrc_add_frame(ifp->filter, NULL);
         }
 
+        ifp->width  = frame->width  ? frame->width  : ifp->width;
+        ifp->height = frame->height ? frame->height : ifp->height;
+
         sub2video_update(ifp, INT64_MIN, (const AVSubtitle*)frame->buf[0]->data);
     } else if (frame) {
         AVFrame *tmp = av_frame_clone(frame);