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
103103 priv->avctx = avctx;
104104 priv->extradata = talloc_strndup(priv, avctx->subtitle_header,
105105 avctx->subtitle_header_size);
106+ mp_codec_info_from_av(avctx, sd->codec);
106107 return priv;
107108
108109 error:
sub/sd_ass.c+11−0
@@ -285,6 +285,17 @@ static int init(struct sd *sd) · 284 unmodified lines
285285
286286 ctx->packer = mp_ass_packer_alloc(ctx);
287287
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+
288299 return 0;
289300 }
290301
sub/sd_lavc.c+4−0
@@ -56,6 +56,7 @@ struct seekpoint { · 55 unmodified lines
5656 };
5757
5858 struct sd_lavc_priv {
59+ struct mp_codec_params *codec;
5960 AVCodecContext *avctx;
6061 AVPacket *avpkt;
6162 AVRational pkt_timebase;
@@ -119,6 +120,7 @@ static int init(struct sd *sd) · 57 unmodified lines
119120 }
120121
121122 priv->avpkt = av_packet_alloc();
123+ priv->codec = sd->codec;
122124 if (!priv->avpkt)
123125 goto error;
124126 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
347349 if (res < 0 || !got_sub)
348350 return;
349351
352+ mp_codec_info_from_av(ctx, priv->codec);
353+
350354 packet->sub_duration = sub.end_display_time;
351355
352356 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