Skip to content

Commit

Permalink
mpegts-mythtv.c: harmonize functions 1h mpegts_read_packet (modified)
Browse files Browse the repository at this point in the history
The line that was causing MHEG to not work is from:
mpegts: Make sure we don't return uninitialized packets
FFmpeg/FFmpeg@df8aa45

I will test after further harmonization, but it looks like handle_packets
or something it calls will likely need additional modification.
  • Loading branch information
ulmus-scott authored and bennettpeter committed Aug 15, 2022
1 parent 74e01be commit f6d361a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c
Expand Up @@ -3527,30 +3527,33 @@ static int mpegts_raw_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}

static int mpegts_read_packet(AVFormatContext *s,
AVPacket *pkt)
static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt)
{
MpegTSContext *ts = s->priv_data;
int ret, i;

//pkt->size = -1; // this breaks MHEG
ts->pkt = pkt;
ret = handle_packets(ts, 0);
if (ret < 0) {
av_free_packet(ts->pkt);
av_packet_unref(ts->pkt);
/* flush pes data left */
for (i = 0; i < NB_PID_MAX; i++) {
for (i = 0; i < NB_PID_MAX; i++)
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
new_pes_packet(pes, pkt);
ret = new_pes_packet(pes, pkt);
if (ret < 0)
return ret;
pes->state = MPEGTS_SKIP;
ret = 0;
break;
}
}
}
}

if (!ret && pkt->size < 0)
ret = AVERROR_INVALIDDATA;
return ret;
}

Expand Down

0 comments on commit f6d361a

Please sign in to comment.