Fix indentation caused by the added stream_id check.
Unified · Split
| @@ -1460,99 +1460,99 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, · 1459 unmodified lines | ||
| 1460 | 1460 | stream_id != STREAM_ID_DSMCC_STREAM && |
| 1461 | 1461 | stream_id != STREAM_ID_TYPE_E_STREAM) { |
| 1462 | 1462 | |
| 1463 | − flags = 0; | |
| 1464 | − if (pts != AV_NOPTS_VALUE) { | |
| 1465 | − header_len += 5; | |
| 1466 | − flags |= 0x80; | |
| 1467 | − } | |
| 1468 | − if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { | |
| 1469 | − header_len += 5; | |
| 1470 | − flags |= 0x40; | |
| 1471 | − } | |
| 1472 | − if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && | |
| 1473 | − st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { | |
| 1474 | − /* set PES_extension_flag */ | |
| 1475 | − pes_extension = 1; | |
| 1476 | − flags |= 0x01; | |
| 1477 | − | |
| 1478 | − /* One byte for PES2 extension flag + | |
| 1479 | − * one byte for extension length + | |
| 1480 | − * one byte for extension id */ | |
| 1481 | − header_len += 3; | |
| 1482 | − } | |
| 1483 | − /* for Blu-ray AC3 Audio the PES Extension flag should be as follow | |
| 1484 | − * otherwise it will not play sound on blu-ray | |
| 1485 | − */ | |
| 1486 | − if (ts->m2ts_mode && | |
| 1487 | − st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && | |
| 1488 | − st->codecpar->codec_id == AV_CODEC_ID_AC3) { | |
| 1489 | − /* set PES_extension_flag */ | |
| 1490 | − pes_extension = 1; | |
| 1491 | − flags |= 0x01; | |
| 1492 | − header_len += 3; | |
| 1493 | − } | |
| 1494 | − if (is_dvb_teletext) { | |
| 1495 | − pes_header_stuffing_bytes = 0x24 - header_len; | |
| 1496 | − header_len = 0x24; | |
| 1497 | − } | |
| 1498 | − len = payload_size + header_len + 3; | |
| 1499 | − /* 3 extra bytes should be added to DVB subtitle payload: 0x20 0x00 at the beginning and trailing 0xff */ | |
| 1500 | − if (is_dvb_subtitle) { | |
| 1501 | − len += 3; | |
| 1502 | − payload_size++; | |
| 1503 | − } | |
| 1504 | − if (len > 0xffff) | |
| 1505 | − len = 0; | |
| 1506 | − if (ts->omit_video_pes_length && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { | |
| 1507 | − len = 0; | |
| 1508 | − } | |
| 1509 | − *q++ = len >> 8; | |
| 1510 | − *q++ = len; | |
| 1511 | − val = 0x80; | |
| 1512 | − /* data alignment indicator is required for subtitle and data streams */ | |
| 1513 | − if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) | |
| 1514 | − val |= 0x04; | |
| 1515 | − *q++ = val; | |
| 1516 | − *q++ = flags; | |
| 1517 | − *q++ = header_len; | |
| 1518 | − if (pts != AV_NOPTS_VALUE) { | |
| 1519 | − write_pts(q, flags >> 6, pts); | |
| 1520 | − q += 5; | |
| 1521 | − } | |
| 1522 | − if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { | |
| 1523 | − write_pts(q, 1, dts); | |
| 1524 | − q += 5; | |
| 1525 | − } | |
| 1526 | − if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { | |
| 1527 | − flags = 0x01; /* set PES_extension_flag_2 */ | |
| 1528 | − *q++ = flags; | |
| 1529 | − *q++ = 0x80 | 0x01; /* marker bit + extension length */ | |
| 1530 | − /* Set the stream ID extension flag bit to 0 and | |
| 1531 | − * write the extended stream ID. */ | |
| 1532 | − *q++ = 0x00 | 0x60; | |
| 1533 | − } | |
| 1534 | − /* For Blu-ray AC3 Audio Setting extended flags */ | |
| 1535 | − if (ts->m2ts_mode && | |
| 1536 | − pes_extension && | |
| 1537 | − st->codecpar->codec_id == AV_CODEC_ID_AC3) { | |
| 1538 | − flags = 0x01; /* set PES_extension_flag_2 */ | |
| 1463 | + flags = 0; | |
| 1464 | + if (pts != AV_NOPTS_VALUE) { | |
| 1465 | + header_len += 5; | |
| 1466 | + flags |= 0x80; | |
| 1467 | + } | |
| 1468 | + if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { | |
| 1469 | + header_len += 5; | |
| 1470 | + flags |= 0x40; | |
| 1471 | + } | |
| 1472 | + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && | |
| 1473 | + st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { | |
| 1474 | + /* set PES_extension_flag */ | |
| 1475 | + pes_extension = 1; | |
| 1476 | + flags |= 0x01; | |
| 1477 | + | |
| 1478 | + /* One byte for PES2 extension flag + | |
| 1479 | + * one byte for extension length + | |
| 1480 | + * one byte for extension id */ | |
| 1481 | + header_len += 3; | |
| 1482 | + } | |
| 1483 | + /* for Blu-ray AC3 Audio the PES Extension flag should be as follow | |
| 1484 | + * otherwise it will not play sound on blu-ray | |
| 1485 | + */ | |
| 1486 | + if (ts->m2ts_mode && | |
| 1487 | + st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && | |
| 1488 | + st->codecpar->codec_id == AV_CODEC_ID_AC3) { | |
| 1489 | + /* set PES_extension_flag */ | |
| 1490 | + pes_extension = 1; | |
| 1491 | + flags |= 0x01; | |
| 1492 | + header_len += 3; | |
| 1493 | + } | |
| 1494 | + if (is_dvb_teletext) { | |
| 1495 | + pes_header_stuffing_bytes = 0x24 - header_len; | |
| 1496 | + header_len = 0x24; | |
| 1497 | + } | |
| 1498 | + len = payload_size + header_len + 3; | |
| 1499 | + /* 3 extra bytes should be added to DVB subtitle payload: 0x20 0x00 at the beginning and trailing 0xff */ | |
| 1500 | + if (is_dvb_subtitle) { | |
| 1501 | + len += 3; | |
| 1502 | + payload_size++; | |
| 1503 | + } | |
| 1504 | + if (len > 0xffff) | |
| 1505 | + len = 0; | |
| 1506 | + if (ts->omit_video_pes_length && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { | |
| 1507 | + len = 0; | |
| 1508 | + } | |
| 1509 | + *q++ = len >> 8; | |
| 1510 | + *q++ = len; | |
| 1511 | + val = 0x80; | |
| 1512 | + /* data alignment indicator is required for subtitle and data streams */ | |
| 1513 | + if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) | |
| 1514 | + val |= 0x04; | |
| 1515 | + *q++ = val; | |
| 1539 | 1516 | *q++ = flags; |
| 1540 | − *q++ = 0x80 | 0x01; /* marker bit + extension length */ | |
| 1541 | − *q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on blue-rays) */ | |
| 1542 | − } | |
| 1517 | + *q++ = header_len; | |
| 1518 | + if (pts != AV_NOPTS_VALUE) { | |
| 1519 | + write_pts(q, flags >> 6, pts); | |
| 1520 | + q += 5; | |
| 1521 | + } | |
| 1522 | + if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { | |
| 1523 | + write_pts(q, 1, dts); | |
| 1524 | + q += 5; | |
| 1525 | + } | |
| 1526 | + if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { | |
| 1527 | + flags = 0x01; /* set PES_extension_flag_2 */ | |
| 1528 | + *q++ = flags; | |
| 1529 | + *q++ = 0x80 | 0x01; /* marker bit + extension length */ | |
| 1530 | + /* Set the stream ID extension flag bit to 0 and | |
| 1531 | + * write the extended stream ID. */ | |
| 1532 | + *q++ = 0x00 | 0x60; | |
| 1533 | + } | |
| 1534 | + /* For Blu-ray AC3 Audio Setting extended flags */ | |
| 1535 | + if (ts->m2ts_mode && | |
| 1536 | + pes_extension && | |
| 1537 | + st->codecpar->codec_id == AV_CODEC_ID_AC3) { | |
| 1538 | + flags = 0x01; /* set PES_extension_flag_2 */ | |
| 1539 | + *q++ = flags; | |
| 1540 | + *q++ = 0x80 | 0x01; /* marker bit + extension length */ | |
| 1541 | + *q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on blue-rays) */ | |
| 1542 | + } | |
| 1543 | 1543 | |
| 1544 | 1544 | |
| 1545 | − if (is_dvb_subtitle) { | |
| 1546 | − /* First two fields of DVB subtitles PES data: | |
| 1547 | − * data_identifier: for DVB subtitle streams shall be coded with the value 0x20 | |
| 1548 | − * subtitle_stream_id: for DVB subtitle stream shall be identified by the value 0x00 */ | |
| 1549 | − *q++ = 0x20; | |
| 1550 | − *q++ = 0x00; | |
| 1551 | − } | |
| 1552 | − if (is_dvb_teletext) { | |
| 1553 | − memset(q, 0xff, pes_header_stuffing_bytes); | |
| 1554 | − q += pes_header_stuffing_bytes; | |
| 1555 | − } | |
| 1545 | + if (is_dvb_subtitle) { | |
| 1546 | + /* First two fields of DVB subtitles PES data: | |
| 1547 | + * data_identifier: for DVB subtitle streams shall be coded with the value 0x20 | |
| 1548 | + * subtitle_stream_id: for DVB subtitle stream shall be identified by the value 0x00 */ | |
| 1549 | + *q++ = 0x20; | |
| 1550 | + *q++ = 0x00; | |
| 1551 | + } | |
| 1552 | + if (is_dvb_teletext) { | |
| 1553 | + memset(q, 0xff, pes_header_stuffing_bytes); | |
| 1554 | + q += pes_header_stuffing_bytes; | |
| 1555 | + } | |
| 1556 | 1556 | } else { |
| 1557 | 1557 | len = payload_size; |
| 1558 | 1558 | *q++ = len >> 8; |