export data from private streams

Originally committed as revision 19073 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2009-06-02 07:26:58 +00:00
parent 0802356cfc
commit 1c4df2ab24
1 changed files with 23 additions and 16 deletions

View File

@ -923,6 +923,11 @@ static int mpegts_push_data(MpegTSFilter *filter,
pes->header[2] == 0x01) {
/* it must be an mpeg2 PES stream */
code = pes->header[3] | 0x100;
dprintf(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
if ((pes->st && pes->st->discard == AVDISCARD_ALL) ||
code == 0x1be) /* padding_stream */
goto skip;
/* stream not present in PMT */
if (!pes->st)
@ -930,16 +935,27 @@ static int mpegts_push_data(MpegTSFilter *filter,
if (!pes->st)
return AVERROR(ENOMEM);
if (pes->st->discard == AVDISCARD_ALL ||
!((code >= 0x1c0 && code <= 0x1df) ||
(code >= 0x1e0 && code <= 0x1ef) ||
(code == 0x1bd) || (code == 0x1fd)))
goto skip;
pes->state = MPEGTS_PESHEADER_FILL;
pes->total_size = AV_RB16(pes->header + 4);
/* NOTE: a zero total size means the PES size is
unbounded */
pes->pes_header_size = pes->header[8] + 9;
if (!pes->total_size)
pes->total_size = MAX_PES_PAYLOAD;
/* allocate pes buffer */
pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
if (!pes->buffer)
return AVERROR(ENOMEM);
if (code != 0x1bc && code != 0x1bf && /* program_stream_map, private_stream_2 */
code != 0x1f0 && code != 0x1f1 && /* ECM, EMM */
code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */
code != 0x1f8) { /* ITU-T Rec. H.222.1 type E stream */
pes->state = MPEGTS_PESHEADER_FILL;
pes->pes_header_size = pes->header[8] + 9;
} else {
pes->state = MPEGTS_PAYLOAD;
pes->data_index = 0;
}
} else {
/* otherwise, it should be a table */
/* skip packet */
@ -979,15 +995,6 @@ static int mpegts_push_data(MpegTSFilter *filter,
r += 5;
}
if (pes->total_size > pes->data_index - 6)
pes->total_size -= pes->data_index - 6;
else
pes->total_size = MAX_PES_PAYLOAD;
/* allocate pes buffer */
pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
if (!pes->buffer)
return AVERROR(ENOMEM);
/* we got the full header. We parse it and get the payload */
pes->state = MPEGTS_PAYLOAD;
pes->data_index = 0;