Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
transcoding: subtitle - fix AVSubtittle variable initialization - cov…
…erity
  • Loading branch information
perexg committed May 23, 2016
1 parent ea841ce commit 6bfd9f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/plumbing/transcoding.c
Expand Up @@ -401,7 +401,7 @@ transcoder_stream_subtitle(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *p
AVCodecContext *ictx;
AVPacket packet;
AVSubtitle sub;
int length, got_subtitle;
int length, got_subtitle;

subtitle_stream_t *ss = (subtitle_stream_t*)ts;

Expand All @@ -411,12 +411,13 @@ transcoder_stream_subtitle(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *p
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;
}
}

Expand All @@ -427,6 +428,8 @@ transcoder_stream_subtitle(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *p
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;
Expand Down

0 comments on commit 6bfd9f4

Please sign in to comment.