AVCodecContext *ictx;
AVPacket packet;
AVSubtitle sub;
- int length, got_subtitle;
+ int length, got_subtitle;
subtitle_stream_t *ss = (subtitle_stream_t*)ts;
icodec = ss->sub_icodec;
//ocodec = ss->sub_ocodec;
+
if (!avcodec_is_open(ictx)) {
if (avcodec_open2(ictx, icodec, NULL) < 0) {
tvherror("transcode", "%04X: Unable to open %s decoder",
shortid(t), icodec->name);
transcoder_stream_invalidate(ts);
- goto cleanup;
+ return;
}
}
packet.dts = pkt->pkt_dts;
packet.duration = pkt->pkt_duration;
+ memset(&sub, 0, sizeof(sub));
+
length = avcodec_decode_subtitle2(ictx, &sub, &got_subtitle, &packet);
if (length <= 0) {
if (length == AVERROR_INVALIDDATA) goto cleanup;