sub: update codec info

This commit is contained in:
Kacper Michajłow 2024-04-12 18:25:30 +02:00
parent f8f47d06f4
commit 94859997b8
3 changed files with 16 additions and 0 deletions

View File

@ -103,6 +103,7 @@ struct lavc_conv *lavc_conv_create(struct sd *sd)
priv->avctx = avctx;
priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
avctx->subtitle_header_size);
mp_codec_info_from_av(avctx, sd->codec);
return priv;
error:

View File

@ -285,6 +285,17 @@ static int init(struct sd *sd)
ctx->packer = mp_ass_packer_alloc(ctx);
// Subtitles does not have any profile value, so put the converted type as a profile.
const char **desc = ctx->converter ? &sd->codec->codec_profile : &sd->codec->codec_desc;
switch (ctx->ass_track->track_type) {
case TRACK_TYPE_ASS:
*desc = "Advanced Sub Station Alpha";
break;
case TRACK_TYPE_SSA:
*desc = "Sub Station Alpha";
break;
}
return 0;
}

View File

@ -56,6 +56,7 @@ struct seekpoint {
};
struct sd_lavc_priv {
struct mp_codec_params *codec;
AVCodecContext *avctx;
AVPacket *avpkt;
AVRational pkt_timebase;
@ -119,6 +120,7 @@ static int init(struct sd *sd)
}
priv->avpkt = av_packet_alloc();
priv->codec = sd->codec;
if (!priv->avpkt)
goto error;
if (mp_set_avctx_codec_headers(ctx, sd->codec) < 0)
@ -347,6 +349,8 @@ static void decode(struct sd *sd, struct demux_packet *packet)
if (res < 0 || !got_sub)
return;
mp_codec_info_from_av(ctx, priv->codec);
packet->sub_duration = sub.end_display_time;
if (sub.pts != AV_NOPTS_VALUE)