mirror of https://github.com/mpv-player/mpv
sub: update codec info
This commit is contained in:
parent
f8f47d06f4
commit
94859997b8
|
@ -103,6 +103,7 @@ struct lavc_conv *lavc_conv_create(struct sd *sd)
|
||||||
priv->avctx = avctx;
|
priv->avctx = avctx;
|
||||||
priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
|
priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
|
||||||
avctx->subtitle_header_size);
|
avctx->subtitle_header_size);
|
||||||
|
mp_codec_info_from_av(avctx, sd->codec);
|
||||||
return priv;
|
return priv;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
11
sub/sd_ass.c
11
sub/sd_ass.c
|
@ -285,6 +285,17 @@ static int init(struct sd *sd)
|
||||||
|
|
||||||
ctx->packer = mp_ass_packer_alloc(ctx);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct seekpoint {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sd_lavc_priv {
|
struct sd_lavc_priv {
|
||||||
|
struct mp_codec_params *codec;
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
AVPacket *avpkt;
|
AVPacket *avpkt;
|
||||||
AVRational pkt_timebase;
|
AVRational pkt_timebase;
|
||||||
|
@ -119,6 +120,7 @@ static int init(struct sd *sd)
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->avpkt = av_packet_alloc();
|
priv->avpkt = av_packet_alloc();
|
||||||
|
priv->codec = sd->codec;
|
||||||
if (!priv->avpkt)
|
if (!priv->avpkt)
|
||||||
goto error;
|
goto error;
|
||||||
if (mp_set_avctx_codec_headers(ctx, sd->codec) < 0)
|
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)
|
if (res < 0 || !got_sub)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mp_codec_info_from_av(ctx, priv->codec);
|
||||||
|
|
||||||
packet->sub_duration = sub.end_display_time;
|
packet->sub_duration = sub.end_display_time;
|
||||||
|
|
||||||
if (sub.pts != AV_NOPTS_VALUE)
|
if (sub.pts != AV_NOPTS_VALUE)
|
||||||
|
|
Loading…
Reference in New Issue