mirror of
https://git.videolan.org/git/ffmpeg.git
synced 2024-08-25 02:41:50 +02:00
write a single pes for video frames, some proprietary player needs it
Originally committed as revision 18792 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
61a4fd8e64
commit
e4358e70f8
@ -619,6 +619,8 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
|
||||
len = payload_size + header_len + 3;
|
||||
if (private_code != 0)
|
||||
len++;
|
||||
if (len > 0xffff)
|
||||
len = 0;
|
||||
*q++ = len >> 8;
|
||||
*q++ = len;
|
||||
val = 0x80;
|
||||
@ -709,31 +711,7 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
}
|
||||
ts_st->first_pts_check = 0;
|
||||
|
||||
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) {
|
||||
/* for subtitle, a single PES packet must be generated */
|
||||
mpegts_write_pes(s, st, buf, size, pts, AV_NOPTS_VALUE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (st->codec->codec_id == CODEC_ID_DIRAC) {
|
||||
/* for Dirac, a single PES packet must be generated */
|
||||
mpegts_write_pes(s, st, buf, size, pts, dts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO ||
|
||||
st->codec->codec_id == CODEC_ID_MPEG1VIDEO) {
|
||||
const uint8_t *p = pkt->data;
|
||||
const uint8_t *end = pkt->data+pkt->size;
|
||||
uint32_t state = -1;
|
||||
while (p < end) {
|
||||
p = ff_find_start_code(p, end, &state);
|
||||
if (state == PICTURE_START_CODE) {
|
||||
access_unit_index = p - 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} if (st->codec->codec_id == CODEC_ID_H264) {
|
||||
if (st->codec->codec_id == CODEC_ID_H264) {
|
||||
if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
|
||||
av_log(s, AV_LOG_ERROR, "h264 bitstream malformated\n");
|
||||
return -1;
|
||||
@ -759,6 +737,14 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (st->codec->codec_type == CODEC_TYPE_SUBTITLE ||
|
||||
st->codec->codec_type == CODEC_TYPE_VIDEO) {
|
||||
// for video and subtitle, write a single pes packet
|
||||
mpegts_write_pes(s, st, buf, size, pts, dts);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// audio
|
||||
while (size > 0) {
|
||||
len = DEFAULT_PES_PAYLOAD_SIZE - ts_st->payload_index;
|
||||
if (len > size)
|
||||
|
@ -15,8 +15,8 @@ bdb7484c68db722f66ba1630cf79844c *./tests/data/b-lavf.mpg
|
||||
0a7cc51de3da754ce36dffeeda290c45 *./tests/data/b-lavf.mxf_d10
|
||||
5330989 ./tests/data/b-lavf.mxf_d10
|
||||
./tests/data/b-lavf.mxf_d10 CRC=0xd241c8b6
|
||||
368950c12c4ba186725b757ec5625085 *./tests/data/b-lavf.ts
|
||||
471316 ./tests/data/b-lavf.ts
|
||||
88ed42ab4e1974c902b22ca17dfb3474 *./tests/data/b-lavf.ts
|
||||
451764 ./tests/data/b-lavf.ts
|
||||
./tests/data/b-lavf.ts CRC=0xcc4948e1
|
||||
1b28a16652bb8ac528b33f7478ca18b6 *./tests/data/b-lavf.swf
|
||||
335771 ./tests/data/b-lavf.swf
|
||||
|
@ -3605,57 +3605,57 @@ ret:-1 st:-1 ts:-0.645825 flags:1
|
||||
tests/data/b-lavf.ts
|
||||
ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24921 flags:1
|
||||
ret: 0 st:-1 ts:-1.000000 flags:0
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29704 size:22036 flags:1
|
||||
ret: 0 st:-1 ts:1.894167 flags:1
|
||||
ret: 0 st: 0 dts:1.881344 pts:-102481911520608.625000 pos:29328 size:3142 flags:1
|
||||
ret: 0 st: 0 dts:1.881344 pts:-102481911520608.625000 pos:29704 size:852 flags:1
|
||||
ret: 0 st: 0 ts:0.788333 flags:0
|
||||
ret: 0 st: 0 dts:0.803344 pts:-102481911520608.625000 pos:68996 size:1524 flags:1
|
||||
ret: 0 st: 0 dts:0.803344 pts:-102481911520608.625000 pos:66176 size:16769 flags:0
|
||||
ret: 0 st: 0 ts:-0.317500 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:48880 size:22036 flags:1
|
||||
ret: 0 st: 1 ts:2.576667 flags:0
|
||||
ret: 0 st: 0 dts:2.590844 pts:-102481911520608.625000 pos:29328 size:10829 flags:1
|
||||
ret: 0 st: 0 dts:2.590844 pts:-102481911520608.625000 pos:29704 size:7612 flags:1
|
||||
ret: 0 st: 1 ts:1.470833 flags:1
|
||||
ret: 0 st: 0 dts:1.468844 pts:-102481911520608.625000 pos:50948 size:14870 flags:0
|
||||
ret: 0 st: 0 dts:1.468844 pts:-102481911520608.625000 pos:99264 size:13188 flags:1
|
||||
ret: 0 st:-1 ts:0.365002 flags:0
|
||||
ret: 0 st: 0 dts:0.374344 pts:-102481911520608.625000 pos:68996 size:13236 flags:1
|
||||
ret: 0 st: 0 dts:0.374344 pts:-102481911520608.625000 pos:66176 size:12788 flags:1
|
||||
ret: 0 st:-1 ts:-0.740831 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29704 size:22036 flags:1
|
||||
ret: 0 st: 0 ts:2.153333 flags:0
|
||||
ret: 0 st: 0 dts:2.167344 pts:-102481911520608.625000 pos:29328 size:8612 flags:1
|
||||
ret: 0 st: 0 dts:2.167344 pts:-102481911520608.625000 pos:29704 size:5935 flags:1
|
||||
ret: 0 st: 0 ts:1.047500 flags:1
|
||||
ret: 0 st: 0 dts:1.039844 pts:-102481911520608.625000 pos:83472 size:11965 flags:1
|
||||
ret: 0 st: 0 dts:1.039844 pts:-102481911520608.625000 pos:82720 size:10704 flags:1
|
||||
ret: 0 st: 1 ts:-0.058333 flags:0
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:50948 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:48880 size:22036 flags:1
|
||||
ret: 0 st: 1 ts:2.835833 flags:1
|
||||
ret: 0 st: 0 dts:2.832844 pts:-102481911520608.625000 pos:29328 size:4969 flags:1
|
||||
ret: 0 st: 0 dts:2.832844 pts:-102481911520608.625000 pos:29704 size:1444 flags:1
|
||||
ret: 0 st:-1 ts:1.730004 flags:0
|
||||
ret: 0 st: 0 dts:1.738344 pts:-102481911520608.625000 pos:101520 size:6080 flags:1
|
||||
ret: 0 st: 0 dts:1.738344 pts:-102481911520608.625000 pos:99264 size:3940 flags:1
|
||||
ret: 0 st:-1 ts:0.624171 flags:1
|
||||
ret: 0 st: 0 dts:0.616344 pts:-102481911520608.625000 pos:68996 size:7376 flags:1
|
||||
ret: 0 st: 0 dts:0.616344 pts:-102481911520608.625000 pos:66176 size:6620 flags:1
|
||||
ret: 0 st: 0 ts:-0.481667 flags:0
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29704 size:22036 flags:1
|
||||
ret: 0 st: 0 ts:2.412500 flags:1
|
||||
ret: 0 st: 0 dts:2.403844 pts:-102481911520608.625000 pos:29328 size:2760 flags:1
|
||||
ret: 0 st: 0 dts:2.403844 pts:-102481911520608.625000 pos:-1 size:13937 flags:0
|
||||
ret: 0 st: 1 ts:1.306667 flags:0
|
||||
ret: 0 st: 0 dts:1.309344 pts:-102481911520608.625000 pos:83472 size:3175 flags:1
|
||||
ret: 0 st: 0 dts:1.309344 pts:-102481911520608.625000 pos:99264 size:1456 flags:1
|
||||
ret: 0 st: 1 ts:0.200844 flags:1
|
||||
ret: 0 st: 0 dts:0.187344 pts:-102481911520608.625000 pos:50948 size:19104 flags:1
|
||||
ret: 0 st: 0 dts:0.187344 pts:-102481911520608.625000 pos:48880 size:18956 flags:1
|
||||
ret: 0 st:-1 ts:-0.904994 flags:0
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.044344 pts:-102481911520608.625000 pos:29704 size:22036 flags:1
|
||||
ret: 0 st:-1 ts:1.989173 flags:1
|
||||
ret: 0 st: 0 dts:1.974844 pts:-102481911520608.625000 pos:68996 size:14472 flags:0
|
||||
ret: 0 st: 0 dts:1.974844 pts:-102481911520608.625000 pos:29704 size:12103 flags:1
|
||||
ret: 0 st: 0 ts:0.883344 flags:0
|
||||
ret: 0 st: 0 dts:0.896844 pts:-102481911520608.625000 pos:83472 size:14905 flags:1
|
||||
ret: 0 st: 0 dts:0.896844 pts:-102481911520608.625000 pos:82720 size:13784 flags:1
|
||||
ret: 0 st: 0 ts:-0.222489 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:50948 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:48880 size:22036 flags:1
|
||||
ret: 0 st: 1 ts:2.671678 flags:0
|
||||
ret: 0 st: 0 dts:2.684344 pts:-102481911520608.625000 pos:29328 size:9171 flags:1
|
||||
ret: 0 st: 0 dts:2.684344 pts:-102481911520608.625000 pos:29704 size:5796 flags:1
|
||||
ret: 0 st: 1 ts:1.565844 flags:1
|
||||
ret: 0 st: 0 dts:1.562344 pts:-102481911520608.625000 pos:101520 size:11942 flags:1
|
||||
ret: 0 st: 0 dts:1.562344 pts:-102481911520608.625000 pos:99264 size:10100 flags:1
|
||||
ret: 0 st:-1 ts:0.460008 flags:0
|
||||
ret: 0 st: 0 dts:0.467844 pts:-102481911520608.625000 pos:68996 size:10314 flags:1
|
||||
ret: 0 st: 0 dts:0.467844 pts:-102481911520608.625000 pos:66176 size:9708 flags:1
|
||||
ret: 0 st:-1 ts:-0.645825 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29328 size:22036 flags:1
|
||||
ret: 0 st: 0 dts:0.027844 pts:-102481911520608.625000 pos:29704 size:22036 flags:1
|
||||
----------------
|
||||
tests/data/b-lavf.ul
|
||||
ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:0 size:1024 flags:1
|
||||
|
Loading…
Reference in New Issue
Block a user