Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/mythtv/external/FFmpeg/libavcodec/avcodec.h b/mythtv/external/FFmpeg/libavcodec/avcodec.h
- index c6a4812..45d2539 100644
- --- a/mythtv/external/FFmpeg/libavcodec/avcodec.h
- +++ b/mythtv/external/FFmpeg/libavcodec/avcodec.h
- @@ -457,6 +457,9 @@ enum AVCodecID {
- /* DSMCC codec */
- AV_CODEC_ID_DSMCC_B,
- + /* PRIVATE_STREAM_2 codec (DVD NAV packets) */
- + AV_CODEC_ID_PRIVATE_STREAM_2,
- +
- /* other specific kind of codecs (generally used for attachments) */
- AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
- AV_CODEC_ID_TTF = 0x18000,
- diff --git a/mythtv/external/FFmpeg/libavcodec/utils-mythtv.c b/mythtv/external/FFmpeg/libavcodec/utils-mythtv.c
- index b578c6d..16f0b44 100644
- --- a/mythtv/external/FFmpeg/libavcodec/utils-mythtv.c
- +++ b/mythtv/external/FFmpeg/libavcodec/utils-mythtv.c
- @@ -212,6 +212,8 @@ const char *ff_codec_id_string(enum CodecID codec_id)
- case AV_CODEC_ID_DSMCC_B: return "DSMCC_B";
- + case AV_CODEC_ID_PRIVATE_STREAM_2: return "PRIVATE_STREAM_2";
- +
- case AV_CODEC_ID_MPEG2TS: return "MPEG2TS";
- /* Attachment codecs */
- diff --git a/mythtv/external/FFmpeg/libavformat/mpeg.c b/mythtv/external/FFmpeg/libavformat/mpeg.c
- index fbea0f7..b2eb2bf 100644
- --- a/mythtv/external/FFmpeg/libavformat/mpeg.c
- +++ b/mythtv/external/FFmpeg/libavformat/mpeg.c
- @@ -239,23 +239,6 @@ static int mpegps_read_pes_header(AVFormatContext *s,
- avio_skip(s->pb, avio_rb16(s->pb));
- goto redo;
- }
- - if (startcode == PRIVATE_STREAM_2) {
- - len = avio_rb16(s->pb);
- - if (!m->sofdec) {
- - while (len-- >= 6) {
- - if (avio_r8(s->pb) == 'S') {
- - uint8_t buf[5];
- - avio_read(s->pb, buf, sizeof(buf));
- - m->sofdec = !memcmp(buf, "ofdec", 5);
- - len -= sizeof(buf);
- - break;
- - }
- - }
- - m->sofdec -= !m->sofdec;
- - }
- - avio_skip(s->pb, len);
- - goto redo;
- - }
- if (startcode == PROGRAM_STREAM_MAP) {
- mpegps_psm_parse(m, s->pb);
- goto redo;
- @@ -264,7 +247,9 @@ static int mpegps_read_pes_header(AVFormatContext *s,
- /* find matching stream */
- if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
- (startcode >= 0x1e0 && startcode <= 0x1ef) ||
- - (startcode == 0x1bd) || (startcode == 0x1fd)))
- + (startcode == 0x1bd) ||
- + (startcode == PRIVATE_STREAM_2) ||
- + (startcode == 0x1fd)))
- goto redo;
- if (ppos) {
- *ppos = avio_tell(s->pb) - 4;
- @@ -272,79 +257,82 @@ static int mpegps_read_pes_header(AVFormatContext *s,
- len = avio_rb16(s->pb);
- pts =
- dts = AV_NOPTS_VALUE;
- - /* stuffing */
- - for(;;) {
- - if (len < 1)
- - goto error_redo;
- - c = avio_r8(s->pb);
- - len--;
- - /* XXX: for mpeg1, should test only bit 7 */
- - if (c != 0xff)
- - break;
- - }
- - if ((c & 0xc0) == 0x40) {
- - /* buffer scale & size */
- - avio_r8(s->pb);
- - c = avio_r8(s->pb);
- - len -= 2;
- - }
- - if ((c & 0xe0) == 0x20) {
- - dts = pts = get_pts(s->pb, c);
- - len -= 4;
- - if (c & 0x10){
- - dts = get_pts(s->pb, -1);
- - len -= 5;
- + if (startcode != PRIVATE_STREAM_2)
- + {
- + /* stuffing */
- + for(;;) {
- + if (len < 1)
- + goto error_redo;
- + c = avio_r8(s->pb);
- + len--;
- + /* XXX: for mpeg1, should test only bit 7 */
- + if (c != 0xff)
- + break;
- + }
- + if ((c & 0xc0) == 0x40) {
- + /* buffer scale & size */
- + avio_r8(s->pb);
- + c = avio_r8(s->pb);
- + len -= 2;
- }
- - } else if ((c & 0xc0) == 0x80) {
- - /* mpeg 2 PES */
- - flags = avio_r8(s->pb);
- - header_len = avio_r8(s->pb);
- - len -= 2;
- - if (header_len > len)
- - goto error_redo;
- - len -= header_len;
- - if (flags & 0x80) {
- - dts = pts = get_pts(s->pb, -1);
- - header_len -= 5;
- - if (flags & 0x40) {
- + if ((c & 0xe0) == 0x20) {
- + dts = pts = get_pts(s->pb, c);
- + len -= 4;
- + if (c & 0x10){
- dts = get_pts(s->pb, -1);
- + len -= 5;
- + }
- + } else if ((c & 0xc0) == 0x80) {
- + /* mpeg 2 PES */
- + flags = avio_r8(s->pb);
- + header_len = avio_r8(s->pb);
- + len -= 2;
- + if (header_len > len)
- + goto error_redo;
- + len -= header_len;
- + if (flags & 0x80) {
- + dts = pts = get_pts(s->pb, -1);
- header_len -= 5;
- + if (flags & 0x40) {
- + dts = get_pts(s->pb, -1);
- + header_len -= 5;
- + }
- }
- - }
- - if (flags & 0x3f && header_len == 0){
- - flags &= 0xC0;
- - av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n");
- - }
- - if (flags & 0x01) { /* PES extension */
- - pes_ext = avio_r8(s->pb);
- - header_len--;
- - /* Skip PES private data, program packet sequence counter and P-STD buffer */
- - skip = (pes_ext >> 4) & 0xb;
- - skip += skip & 0x9;
- - if (pes_ext & 0x40 || skip > header_len){
- - av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext);
- - pes_ext=skip=0;
- + if (flags & 0x3f && header_len == 0){
- + flags &= 0xC0;
- + av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n");
- }
- - avio_skip(s->pb, skip);
- - header_len -= skip;
- -
- - if (pes_ext & 0x01) { /* PES extension 2 */
- - ext2_len = avio_r8(s->pb);
- + if (flags & 0x01) { /* PES extension */
- + pes_ext = avio_r8(s->pb);
- header_len--;
- - if ((ext2_len & 0x7f) > 0) {
- - id_ext = avio_r8(s->pb);
- - if ((id_ext & 0x80) == 0)
- - startcode = ((startcode & 0xff) << 8) | id_ext;
- + /* Skip PES private data, program packet sequence counter and P-STD buffer */
- + skip = (pes_ext >> 4) & 0xb;
- + skip += skip & 0x9;
- + if (pes_ext & 0x40 || skip > header_len){
- + av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext);
- + pes_ext=skip=0;
- + }
- + avio_skip(s->pb, skip);
- + header_len -= skip;
- +
- + if (pes_ext & 0x01) { /* PES extension 2 */
- + ext2_len = avio_r8(s->pb);
- header_len--;
- + if ((ext2_len & 0x7f) > 0) {
- + id_ext = avio_r8(s->pb);
- + if ((id_ext & 0x80) == 0)
- + startcode = ((startcode & 0xff) << 8) | id_ext;
- + header_len--;
- + }
- }
- }
- + if(header_len < 0)
- + goto error_redo;
- + avio_skip(s->pb, header_len);
- }
- - if(header_len < 0)
- - goto error_redo;
- - avio_skip(s->pb, header_len);
- + else if( c!= 0xf )
- + goto redo;
- }
- - else if( c!= 0xf )
- - goto redo;
- if (startcode == PRIVATE_STREAM_1) {
- startcode = avio_r8(s->pb);
- @@ -448,6 +436,9 @@ static int mpegps_read_packet(AVFormatContext *s,
- else
- request_probe= 1;
- type = AVMEDIA_TYPE_VIDEO;
- + } else if (startcode == PRIVATE_STREAM_2) {
- + type = AVMEDIA_TYPE_DATA;
- + codec_id = AV_CODEC_ID_PRIVATE_STREAM_2;
- } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
- type = AVMEDIA_TYPE_AUDIO;
- codec_id = m->sofdec > 0 ? AV_CODEC_ID_ADPCM_ADX : AV_CODEC_ID_MP2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement