diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-18 18:58:54 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-16 10:47:11 -0500 |
commit | 9546f331c6723d046f302da15acaa0ed52c03866 (patch) | |
tree | 67b18d386a100a782c74c98705da334eac99a985 | |
parent | 05e4ae833ce9be39880c98a0cfb27edce4722bab (diff) | |
download | ffmpeg-9546f331c6723d046f302da15acaa0ed52c03866.tar.gz |
bethsoftvid: Set video packet duration instead of accumulating pts.
-rw-r--r-- | libavformat/bethsoftvid.c | 12 | ||||
-rw-r--r-- | tests/ref/fate/bethsoft-vid | 41 |
2 files changed, 25 insertions, 28 deletions
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index b01f73a558..10be7d2521 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -42,9 +42,6 @@ typedef struct BVID_DemuxContext * to free, unofficial documentation) */ int bethsoft_global_delay; - /** video presentation time stamp. - * delay = 16 milliseconds * (global_delay + per_frame_delay) */ - int video_pts; uint8_t *palette; int is_finished; @@ -76,6 +73,7 @@ static int vid_read_header(AVFormatContext *s) stream = avformat_new_stream(s, NULL); if (!stream) return AVERROR(ENOMEM); + stream->start_time = 0; avpriv_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps stream->codec->codec_type = AVMEDIA_TYPE_VIDEO; stream->codec->codec_id = CODEC_ID_BETHSOFTVID; @@ -107,7 +105,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, int vidbuf_nbytes = 0; int code; int bytes_copied = 0; - int position; + int position, duration; unsigned int vidbuf_capacity; int ret = 0; @@ -120,8 +118,8 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, vidbuf_start[vidbuf_nbytes++] = block_type; - // get the video delay (next int16), and set the presentation time - vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb); + // get the current packet duration + duration = vid->bethsoft_global_delay + avio_rl16(pb); // set the y offset if it exists (decoder header data should be in data section) if(block_type == VIDEO_YOFF_P_FRAME){ @@ -171,7 +169,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, pkt->pos = position; pkt->stream_index = 0; // use the video decoder, which was initialized as the first stream - pkt->pts = vid->video_pts; + pkt->duration = duration; if (block_type == VIDEO_I_FRAME) pkt->flags |= AV_PKT_FLAG_KEY; diff --git a/tests/ref/fate/bethsoft-vid b/tests/ref/fate/bethsoft-vid index 7abc9952d8..e6b1451e39 100644 --- a/tests/ref/fate/bethsoft-vid +++ b/tests/ref/fate/bethsoft-vid @@ -5,13 +5,13 @@ 1, 740, 740, 740, 1480, 0x20a92bd4 0, 4, 4, 1, 192000, 0x01a6cf45 1, 1480, 1480, 925, 1850, 0xa9e48a74 -0, 9, 9, 1, 192000, 0xd07d57e9 +0, 8, 8, 1, 192000, 0xd07d57e9 1, 2405, 2405, 740, 1480, 0x23ecd018 0, 13, 13, 1, 192000, 0x3cb1dff5 1, 3145, 3145, 740, 1480, 0x206bb915 0, 17, 17, 1, 192000, 0xd1aaa8fb 1, 3885, 3885, 925, 1850, 0xb0e10e75 -0, 22, 22, 1, 192000, 0x75f526cd +0, 21, 21, 1, 192000, 0x75f526cd 1, 4810, 4810, 740, 1480, 0x8d9baedd 0, 26, 26, 1, 192000, 0x0f673577 1, 5550, 5550, 740, 1480, 0xb802aae1 @@ -19,13 +19,13 @@ 1, 6290, 6290, 740, 1480, 0xecd7b5cc 0, 34, 34, 1, 192000, 0x81e6b7f7 1, 7030, 7030, 925, 1850, 0x16861355 -0, 39, 39, 1, 192000, 0x1f45ce61 +0, 38, 38, 1, 192000, 0x1f45ce61 1, 7955, 7955, 740, 1480, 0xa51690bd 0, 43, 43, 1, 192000, 0x5a0772a6 1, 8695, 8695, 740, 1480, 0xdd0b90d1 0, 47, 47, 1, 192000, 0xf78732b3 1, 9435, 9435, 925, 1850, 0x3ce6e333 -0, 52, 52, 1, 192000, 0x8427f9e5 +0, 51, 51, 1, 192000, 0x8427f9e5 1, 10360, 10360, 740, 1480, 0xf8ce8ea3 0, 56, 56, 1, 192000, 0x40473f11 1, 11100, 11100, 740, 1480, 0xda4597af @@ -33,13 +33,13 @@ 1, 11840, 11840, 740, 1480, 0x918f7cb3 0, 64, 64, 1, 192000, 0x136b9516 1, 12580, 12580, 925, 1850, 0xca6edb15 -0, 69, 69, 1, 192000, 0x138d11ae +0, 68, 68, 1, 192000, 0x138d11ae 1, 13505, 13505, 740, 1480, 0xba279597 0, 73, 73, 1, 192000, 0x063dbff3 1, 14245, 14245, 740, 1480, 0xc5a38a9e 0, 77, 77, 1, 192000, 0x5280852f 1, 14985, 14985, 925, 1850, 0x8147eef5 -0, 82, 82, 1, 192000, 0x99943a8f +0, 81, 81, 1, 192000, 0x99943a8f 1, 15910, 15910, 740, 1480, 0xce2c7cb5 0, 86, 86, 1, 192000, 0x0330a728 1, 16650, 16650, 740, 1480, 0x4282819f @@ -47,13 +47,13 @@ 1, 17390, 17390, 740, 1480, 0xbdbb8da6 0, 94, 94, 1, 192000, 0xfd436343 1, 18130, 18130, 925, 1850, 0xdbbeea10 -0, 99, 99, 1, 192000, 0xc323fcfe +0, 98, 98, 1, 192000, 0xc323fcfe 1, 19055, 19055, 740, 1480, 0xbe6a77c2 0, 103, 103, 1, 192000, 0x2a1530a0 1, 19795, 19795, 740, 1480, 0xa85c75b2 0, 107, 107, 1, 192000, 0xbd43bb60 1, 20535, 20535, 925, 1850, 0xa45bde21 -0, 112, 112, 1, 192000, 0xa47f5eab +0, 111, 111, 1, 192000, 0xa47f5eab 1, 21460, 21460, 740, 1480, 0x84aa7895 0, 116, 116, 1, 192000, 0xff17f5f7 1, 22200, 22200, 740, 1480, 0x147f7d9f @@ -61,13 +61,13 @@ 1, 22940, 22940, 740, 1480, 0xc8e77b85 0, 124, 124, 1, 192000, 0xb8782cc4 1, 23680, 23680, 925, 1850, 0x10d4d81b -0, 129, 129, 1, 192000, 0x92975b8b +0, 128, 128, 1, 192000, 0x92975b8b 1, 24605, 24605, 740, 1480, 0xb4ae8bb1 0, 133, 133, 1, 192000, 0xf42a64d6 1, 25345, 25345, 740, 1480, 0x3ef782a5 0, 137, 137, 1, 192000, 0x2cc7077d 1, 26085, 26085, 925, 1850, 0xdeebda14 -0, 142, 142, 1, 192000, 0x00080cc8 +0, 141, 141, 1, 192000, 0x00080cc8 1, 27010, 27010, 740, 1480, 0x4c7e7bbb 0, 146, 146, 1, 192000, 0x584b48f3 1, 27750, 27750, 740, 1480, 0x0e0e9198 @@ -75,13 +75,13 @@ 1, 28490, 28490, 740, 1480, 0x5c1f819f 0, 154, 154, 1, 192000, 0x60158422 1, 29230, 29230, 925, 1850, 0x0e4cf6ff -0, 159, 159, 1, 192000, 0xd7fb89e6 +0, 158, 158, 1, 192000, 0xd7fb89e6 1, 30155, 30155, 740, 1480, 0x374388a7 0, 163, 163, 1, 192000, 0x97f1c76a 1, 30895, 30895, 740, 1480, 0xed729389 0, 167, 167, 1, 192000, 0x46c4bb9e 1, 31635, 31635, 925, 1850, 0xe0f1e43f -0, 172, 172, 1, 192000, 0xd32f9b66 +0, 171, 171, 1, 192000, 0xd32f9b66 1, 32560, 32560, 740, 1480, 0x3b27839a 0, 176, 176, 1, 192000, 0x74f43886 1, 33300, 33300, 740, 1480, 0xe6287e94 @@ -89,13 +89,13 @@ 1, 34040, 34040, 740, 1480, 0x7e0d84b5 0, 184, 184, 1, 192000, 0xb5ac0a58 1, 34780, 34780, 925, 1850, 0xf08bebf7 -0, 189, 189, 1, 192000, 0xcc572b31 +0, 188, 188, 1, 192000, 0xcc572b31 1, 35705, 35705, 740, 1480, 0x94cf73a0 0, 193, 193, 1, 192000, 0xb1739d26 1, 36445, 36445, 740, 1480, 0xfef384ae 0, 197, 197, 1, 192000, 0x73da5473 1, 37185, 37185, 925, 1850, 0x3b93e0f7 -0, 202, 202, 1, 192000, 0x5f79f5bc +0, 201, 201, 1, 192000, 0x5f79f5bc 1, 38110, 38110, 740, 1480, 0x28d27bae 0, 206, 206, 1, 192000, 0x0affc0a0 1, 38850, 38850, 740, 1480, 0x94d57da5 @@ -103,13 +103,13 @@ 1, 39590, 39590, 740, 1480, 0xc9327db5 0, 214, 214, 1, 192000, 0x309b41bc 1, 40330, 40330, 925, 1850, 0xe781f604 -0, 219, 219, 1, 192000, 0xd42b6424 +0, 218, 218, 1, 192000, 0xd42b6424 1, 41255, 41255, 740, 1480, 0x752f8c5b 0, 223, 223, 1, 192000, 0x4795c948 1, 41995, 41995, 740, 1480, 0x30068032 0, 227, 227, 1, 192000, 0xbc1a3a8b 1, 42735, 42735, 925, 1850, 0x7895023e -0, 232, 232, 1, 192000, 0x16529c5b +0, 231, 231, 1, 192000, 0x16529c5b 1, 43660, 43660, 740, 1480, 0xa1e0a6e1 0, 236, 236, 1, 192000, 0x6b1b31ba 1, 44400, 44400, 740, 1480, 0x6af4b500 @@ -117,13 +117,13 @@ 1, 45140, 45140, 740, 1480, 0xc26ea4c7 0, 244, 244, 1, 192000, 0xe6ea9866 1, 45880, 45880, 925, 1850, 0x16a72419 -0, 249, 249, 1, 192000, 0x102c6076 +0, 248, 248, 1, 192000, 0x102c6076 1, 46805, 46805, 740, 1480, 0x1794aacc 0, 253, 253, 1, 192000, 0xb29f527a 1, 47545, 47545, 740, 1480, 0x2ecad8d0 0, 257, 257, 1, 192000, 0x040b4eee 1, 48285, 48285, 925, 1850, 0x2e645e07 -0, 262, 262, 1, 192000, 0x92574f4a +0, 261, 261, 1, 192000, 0x92574f4a 1, 49210, 49210, 740, 1480, 0x1c54dfe7 0, 266, 266, 1, 192000, 0x1e8acdce 1, 49950, 49950, 740, 1480, 0xbd35feec @@ -131,14 +131,13 @@ 1, 50690, 50690, 740, 1480, 0x419403d6 0, 274, 274, 1, 192000, 0xb62e9776 1, 51430, 51430, 925, 1850, 0x78699d2a -0, 279, 279, 1, 192000, 0xed37a08e +0, 278, 278, 1, 192000, 0xed37a08e 1, 52355, 52355, 740, 1480, 0x74ec68e0 0, 283, 283, 1, 192000, 0xc0719912 1, 53095, 53095, 740, 1480, 0x76af64d9 0, 287, 287, 1, 192000, 0x24cf7a7e 1, 53835, 53835, 925, 1850, 0x5a303d1a -0, 292, 292, 1, 192000, 0x0307f62f +0, 291, 291, 1, 192000, 0x0307f62f 1, 54760, 54760, 537, 1074, 0x142ce7ba 0, 296, 296, 1, 192000, 0x79b7417b 1, 55297, 55297, 925, 1850, 0x7ff682f7 -1, 56222, 56222, 740, 1480, 0xc33867e6 |