Revision aad512b4

View differences:

libavcodec/avcodec.h
238 238
    CODEC_ID_DSICINAUDIO,
239 239
    CODEC_ID_IMC,
240 240
    CODEC_ID_MUSEPACK7,
241
    CODEC_ID_MLP,
241 242

  
242 243
    /* subtitle codecs */
243 244
    CODEC_ID_DVD_SUBTITLE= 0x17000,
libavformat/mpeg.c
1445 1445
{
1446 1446
    MpegDemuxContext *m = s->priv_data;
1447 1447
    int len, size, startcode, c, flags, header_len;
1448
    int pes_ext, ext2_len, id_ext, skip;
1448 1449
    int64_t pts, dts;
1449 1450
    int64_t last_sync= url_ftell(&s->pb);
1450 1451

  
......
1478 1479
    /* find matching stream */
1479 1480
    if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
1480 1481
          (startcode >= 0x1e0 && startcode <= 0x1ef) ||
1481
          (startcode == 0x1bd)))
1482
          (startcode == 0x1bd) || (startcode == 0x1fd)))
1482 1483
        goto redo;
1483 1484
    if (ppos) {
1484 1485
        *ppos = url_ftell(&s->pb) - 4;
......
1531 1532
                header_len -= 5;
1532 1533
            }
1533 1534
        }
1535
        if (flags & 0x01) { /* PES extension */
1536
            pes_ext = get_byte(&s->pb);
1537
            header_len--;
1538
            if (pes_ext & 0x40) { /* pack header - should be zero in PS */
1539
                goto error_redo;
1540
            }
1541
            /* Skip PES private data, program packet sequence counter and P-STD buffer */
1542
            skip = (pes_ext >> 4) & 0xb;
1543
            skip += skip & 0x9;
1544
            url_fskip(&s->pb, skip);
1545
            header_len -= skip;
1546

  
1547
            if (pes_ext & 0x01) { /* PES extension 2 */
1548
                ext2_len = get_byte(&s->pb);
1549
                header_len--;
1550
                if ((ext2_len & 0x7f) > 0) {
1551
                    id_ext = get_byte(&s->pb);
1552
                    if ((id_ext & 0x80) == 0)
1553
                        startcode = ((startcode & 0xff) << 8) | id_ext;
1554
                    header_len--;
1555
                }
1556
            }
1557
        }
1534 1558
        if(header_len < 0)
1535 1559
            goto error_redo;
1536 1560
        url_fskip(&s->pb, header_len);
......
1541 1565
    if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
1542 1566
        startcode = get_byte(&s->pb);
1543 1567
        len--;
1544
        if (startcode >= 0x80 && startcode <= 0xbf) {
1568
        if (startcode >= 0x80 && startcode <= 0xcf) {
1545 1569
            /* audio: skip header */
1546 1570
            get_byte(&s->pb);
1547 1571
            get_byte(&s->pb);
1548 1572
            get_byte(&s->pb);
1549 1573
            len -= 3;
1574
            if (startcode >= 0xb0 && startcode <= 0xbf) {
1575
                /* MLP/TrueHD audio has a 4-byte header */
1576
                get_byte(&s->pb);
1577
                len--;
1578
            }
1550 1579
        }
1551 1580
    }
1552 1581
    if(len<0)
......
1629 1658
    } else if (startcode >= 0x80 && startcode <= 0x87) {
1630 1659
        type = CODEC_TYPE_AUDIO;
1631 1660
        codec_id = CODEC_ID_AC3;
1632
    } else if (startcode >= 0x88 && startcode <= 0x9f) {
1661
    } else if ((startcode >= 0x88 && startcode <= 0x8f)
1662
               ||( startcode >= 0x98 && startcode <= 0x9f)) {
1663
        /* 0x90 - 0x97 is reserved for SDDS in DVD specs */
1633 1664
        type = CODEC_TYPE_AUDIO;
1634 1665
        codec_id = CODEC_ID_DTS;
1635
    } else if (startcode >= 0xa0 && startcode <= 0xbf) {
1666
    } else if (startcode >= 0xa0 && startcode <= 0xaf) {
1636 1667
        type = CODEC_TYPE_AUDIO;
1637 1668
        codec_id = CODEC_ID_PCM_S16BE;
1669
    } else if (startcode >= 0xb0 && startcode <= 0xbf) {
1670
        type = CODEC_TYPE_AUDIO;
1671
        codec_id = CODEC_ID_MLP;
1672
    } else if (startcode >= 0xc0 && startcode <= 0xcf) {
1673
        /* Used for both AC-3 and E-AC-3 in EVOB files */
1674
        type = CODEC_TYPE_AUDIO;
1675
        codec_id = CODEC_ID_AC3;
1638 1676
    } else if (startcode >= 0x20 && startcode <= 0x3f) {
1639 1677
        type = CODEC_TYPE_SUBTITLE;
1640 1678
        codec_id = CODEC_ID_DVD_SUBTITLE;
1679
    } else if (startcode >= 0xfd55 && startcode <= 0xfd5f) {
1680
        type = CODEC_TYPE_VIDEO;
1681
        codec_id = CODEC_ID_VC1;
1641 1682
    } else {
1642 1683
    skip:
1643 1684
        /* skip packet */
......
1655 1696
 found:
1656 1697
    if(st->discard >= AVDISCARD_ALL)
1657 1698
        goto skip;
1658
    if (startcode >= 0xa0 && startcode <= 0xbf) {
1699
    if (startcode >= 0xa0 && startcode <= 0xaf) {
1659 1700
        int b1, freq;
1660 1701

  
1661 1702
        /* for LPCM, we just skip the header and consider it is raw

Also available in: Unified diff