From: Jaroslav Kysela Date: Tue, 24 Nov 2015 10:45:53 +0000 (+0100) Subject: transcode: set metadata (extradata) for H264 X-Git-Tag: v4.2.1~1479 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e599201184c1398b9dede1d537becc64510d9016;p=thirdparty%2Ftvheadend.git transcode: set metadata (extradata) for H264 --- diff --git a/src/plumbing/transcoding.c b/src/plumbing/transcoding.c index 1956e55ae..c5aad65c1 100644 --- a/src/plumbing/transcoding.c +++ b/src/plumbing/transcoding.c @@ -1178,6 +1178,18 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt) got_ref = 0; if (!avcodec_is_open(ictx)) { + if (icodec->id == AV_CODEC_ID_H264) { + if (pkt->pkt_meta) { + ictx->extradata_size = pktbuf_len(pkt->pkt_meta); + ictx->extradata = av_malloc(ictx->extradata_size); + memcpy(ictx->extradata, + pktbuf_ptr(pkt->pkt_meta), pktbuf_len(pkt->pkt_meta)); + } else { + /* wait for metadata */ + return; + } + } + if (avcodec_open2(ictx, icodec, NULL) < 0) { tvherror("transcode", "%04X: Unable to open %s decoder", shortid(t), icodec->name); transcoder_stream_invalidate(ts);