Created
December 21, 2015 22:02
-
-
Save tmm1/28efc9de933e966ffc22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c | |
index 92ea8bd..490c718 100644 | |
--- a/video/decode/vd_lavc.c | |
+++ b/video/decode/vd_lavc.c | |
@@ -660,40 +660,61 @@ static void decode(struct dec_video *vd, struct demux_packet *packet, | |
} | |
return; | |
} | |
if (ctx->hwdec && ctx->hwdec_failed) { | |
av_frame_unref(ctx->pic); | |
return; | |
} | |
// Skipped frame, or delayed output due to multithreaded decoding. | |
if (!got_picture) | |
return; | |
ctx->hwdec_fail_count = 0; | |
struct mp_image_params params; | |
update_image_params(vd, ctx->pic, ¶ms); | |
vd->codec_pts = mp_pts_from_av(ctx->pic->pkt_pts, NULL); | |
vd->codec_dts = mp_pts_from_av(ctx->pic->pkt_dts, NULL); | |
+ AVFrameSideData *sd = NULL; | |
+ sd = av_frame_get_side_data(ctx->pic, AV_FRAME_DATA_A53_CC); | |
+ if (sd) { | |
+ AVPacket cc_pkt; | |
+ int ret; | |
+ if ((ret = av_new_packet(&cc_pkt, sd->size)) < 0) | |
+ return ret; | |
+ memcpy(cc_pkt.data, sd->data, sd->size); | |
+ cc_pkt.stream_index = stream_idx; | |
+ cc_pkt.pts = frame->pts; | |
+ cc_pkt.pos = av_frame_get_pkt_pos(ctx->pic); | |
+ | |
+ /* | |
+ AVStream *st; | |
+ if (!(st = avformat_new_stream(avctx, NULL))) | |
+ return AVERROR(ENOMEM); | |
+ st->codec->codec_id = AV_CODEC_ID_EIA_608; | |
+ st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; | |
+ */ | |
+ } | |
+ | |
struct mp_image *mpi = mp_image_from_av_frame(ctx->pic); | |
av_frame_unref(ctx->pic); | |
if (!mpi) | |
return; | |
assert(mpi->planes[0] || mpi->planes[3]); | |
mp_image_set_params(mpi, ¶ms); | |
if (ctx->hwdec && ctx->hwdec->process_image) | |
mpi = ctx->hwdec->process_image(ctx, mpi); | |
*out_image = mp_img_swap_to_native(mpi); | |
} | |
static struct mp_image *decode_with_fallback(struct dec_video *vd, | |
struct demux_packet *packet, int flags) | |
{ | |
vd_ffmpeg_ctx *ctx = vd->priv; | |
if (!ctx->avctx) | |
return NULL; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment