aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_enc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-01-10 12:20:32 +0100
committerAnton Khirnov <anton@khirnov.net>2024-01-30 09:52:00 +0100
commitb43d4a06925867fbbc0dbe21d63a3593253f672a (patch)
tree0c293b0c237177d48e6dc59aab815e03f72015b6 /fftools/ffmpeg_enc.c
parent3b84140a1bb5a5b3044915888a40a7b619921633 (diff)
downloadffmpeg-b43d4a06925867fbbc0dbe21d63a3593253f672a.tar.gz
fftools/ffmpeg_dec: export subtitle_header in Decoder
This way the encoder does not need to access the decoder AVCodecContext, which will allow to make it private in future commits.
Diffstat (limited to 'fftools/ffmpeg_enc.c')
-rw-r--r--fftools/ffmpeg_enc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 2a7fba0c51..bbd86a6fe1 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -171,7 +171,7 @@ int enc_open(void *opaque, const AVFrame *frame)
InputStream *ist = ost->ist;
Encoder *e = ost->enc;
AVCodecContext *enc_ctx = ost->enc_ctx;
- AVCodecContext *dec_ctx = NULL;
+ Decoder *dec;
const AVCodec *enc = enc_ctx->codec;
OutputFile *of = ost->file;
FrameData *fd;
@@ -193,9 +193,8 @@ int enc_open(void *opaque, const AVFrame *frame)
if (ret < 0)
return ret;
- if (ist) {
- dec_ctx = ist->dec_ctx;
- }
+ if (ist)
+ dec = ist->decoder;
// the timebase is chosen by filtering code
if (ost->type == AVMEDIA_TYPE_AUDIO || ost->type == AVMEDIA_TYPE_VIDEO) {
@@ -279,14 +278,16 @@ int enc_open(void *opaque, const AVFrame *frame)
enc_ctx->width = ost->ist->par->width;
enc_ctx->height = ost->ist->par->height;
}
- if (dec_ctx && dec_ctx->subtitle_header) {
+
+ av_assert0(dec);
+ if (dec->subtitle_header) {
/* ASS code assumes this buffer is null terminated so add extra byte. */
- enc_ctx->subtitle_header = av_mallocz(dec_ctx->subtitle_header_size + 1);
+ enc_ctx->subtitle_header = av_mallocz(dec->subtitle_header_size + 1);
if (!enc_ctx->subtitle_header)
return AVERROR(ENOMEM);
- memcpy(enc_ctx->subtitle_header, dec_ctx->subtitle_header,
- dec_ctx->subtitle_header_size);
- enc_ctx->subtitle_header_size = dec_ctx->subtitle_header_size;
+ memcpy(enc_ctx->subtitle_header, dec->subtitle_header,
+ dec->subtitle_header_size);
+ enc_ctx->subtitle_header_size = dec->subtitle_header_size;
}
break;