History

sub: update codec info

Kacper Michajłow committed 2 years ago

Commit 94859991 parent f8f47d03 files · +16 −0Browse files

Unified · Split

3 files
  1. sub/lavc_conv.c +1 −0
  2. sub/sd_ass.c +11 −0
  3. sub/sd_lavc.c +4 −0
sub/lavc_conv.c+1−0
@@ -103,6 +103,7 @@ struct lavc_conv *lavc_conv_create(struct sd *sd) · 102 unmodified lines
103 priv->avctx = avctx;103 priv->avctx = avctx;
104 priv->extradata = talloc_strndup(priv, avctx->subtitle_header,104 priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
105 avctx->subtitle_header_size);105 avctx->subtitle_header_size);
106 mp_codec_info_from_av(avctx, sd->codec);
106 return priv;107 return priv;
107 108
108 error:109 error:
sub/sd_ass.c+11−0
@@ -285,6 +285,17 @@ static int init(struct sd *sd) · 284 unmodified lines
285 285
286 ctx->packer = mp_ass_packer_alloc(ctx);286 ctx->packer = mp_ass_packer_alloc(ctx);
287 287
288 // Subtitles does not have any profile value, so put the converted type as a profile.
289 const char **desc = ctx->converter ? &sd->codec->codec_profile : &sd->codec->codec_desc;
290 switch (ctx->ass_track->track_type) {
291 case TRACK_TYPE_ASS:
292 *desc = "Advanced Sub Station Alpha";
293 break;
294 case TRACK_TYPE_SSA:
295 *desc = "Sub Station Alpha";
296 break;
297 }
298
288 return 0;299 return 0;
289}300}
290 301
sub/sd_lavc.c+4−0
@@ -56,6 +56,7 @@ struct seekpoint { · 55 unmodified lines
56};56};
57 57
58struct sd_lavc_priv {58struct sd_lavc_priv {
59 struct mp_codec_params *codec;
59 AVCodecContext *avctx;60 AVCodecContext *avctx;
60 AVPacket *avpkt;61 AVPacket *avpkt;
61 AVRational pkt_timebase;62 AVRational pkt_timebase;
@@ -119,6 +120,7 @@ static int init(struct sd *sd) · 57 unmodified lines
119 }120 }
120 121
121 priv->avpkt = av_packet_alloc();122 priv->avpkt = av_packet_alloc();
123 priv->codec = sd->codec;
122 if (!priv->avpkt)124 if (!priv->avpkt)
123 goto error;125 goto error;
124 if (mp_set_avctx_codec_headers(ctx, sd->codec) < 0)126 if (mp_set_avctx_codec_headers(ctx, sd->codec) < 0)
@@ -347,6 +349,8 @@ static void decode(struct sd *sd, struct demux_packet *packet) · 222 unmodified lines
347 if (res < 0 || !got_sub)349 if (res < 0 || !got_sub)
348 return;350 return;
349 351
352 mp_codec_info_from_av(ctx, priv->codec);
353
350 packet->sub_duration = sub.end_display_time;354 packet->sub_duration = sub.end_display_time;
351 355
352 if (sub.pts != AV_NOPTS_VALUE)356 if (sub.pts != AV_NOPTS_VALUE)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t