aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2011-08-11 14:44:05 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-17 15:00:42 +0200
commit7c1f6df4b5f80ead35b66e5373af6c8046bace56 (patch)
tree53842e72bcfd13d61eb77ab5752c9bc24041e5b5
parent331971116d7d36743601bd2dc5384c5211d3bb48 (diff)
downloadffmpeg-7c1f6df4b5f80ead35b66e5373af6c8046bace56.tar.gz
rmdec: correct DTS calculation in RealMedia container.
First, container stores only DTS and not PTS as it was believed. Second, multiple frames in a packet store timestamp instead of position after the frame length. Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavformat/rmdec.c11
-rw-r--r--tests/ref/fate/rv3024
2 files changed, 19 insertions, 16 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 54267485b7..5ee75b53b9 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -568,7 +568,8 @@ skip:
static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
RMDemuxContext *rm, RMStream *vst,
- AVPacket *pkt, int len, int *pseq)
+ AVPacket *pkt, int len, int *pseq,
+ int64_t *timestamp)
{
int hdr, seq, pic_num, len2, pos;
int type;
@@ -588,8 +589,10 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
return -1;
rm->remaining_len = len;
if(type&1){ // frame, not slice
- if(type == 3) // frame as a part of packet
+ if(type == 3){ // frame as a part of packet
len= len2;
+ *timestamp = pos;
+ }
if(rm->remaining_len < len)
return -1;
rm->remaining_len -= len;
@@ -697,7 +700,7 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
rm->current_stream= st->id;
- if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq))
+ if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp))
return -1; //got partial frame
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if ((st->codec->codec_id == CODEC_ID_RA_288) ||
@@ -772,7 +775,7 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
}
#endif
- pkt->pts= timestamp;
+ pkt->pts = timestamp;
if (flags & 2)
pkt->flags |= AV_PKT_FLAG_KEY;
diff --git a/tests/ref/fate/rv30 b/tests/ref/fate/rv30
index 6c99871eb6..867151bd66 100644
--- a/tests/ref/fate/rv30
+++ b/tests/ref/fate/rv30
@@ -1,16 +1,16 @@
0, 0, 126720, 0xcefaec47
0, 7500, 126720, 0xa416ece5
0, 15000, 126720, 0xa416ece5
-0, 22500, 126720, 0xa416ece5
-0, 30000, 126720, 0xcc10f4b7
+0, 22500, 126720, 0x259af497
+0, 30000, 126720, 0x5e6ff4d7
0, 37500, 126720, 0xeb6fb8d7
-0, 45000, 126720, 0xda71b917
-0, 52500, 126720, 0xbb1abbb7
-0, 60000, 126720, 0x273fbc37
-0, 67500, 126720, 0x16eebbd7
-0, 75000, 126720, 0x105eb927
-0, 82500, 126720, 0x7fa3ae27
-0, 90000, 126720, 0xd115a757
+0, 45000, 126720, 0xbb1abbb7
+0, 52500, 126720, 0x273fbc37
+0, 60000, 126720, 0x7fa3ae27
+0, 67500, 126720, 0x722e99f7
+0, 75000, 126720, 0x29d6a887
+0, 82500, 126720, 0xd115a757
+0, 90000, 126720, 0x6ddaef32
0, 97500, 126720, 0x04e7897c
0, 105000, 126720, 0x68cfda2b
0, 112500, 126720, 0xe572dfc9
@@ -25,11 +25,11 @@
0, 180000, 126720, 0x72f2a47d
0, 187500, 126720, 0x4f639ebe
0, 195000, 126720, 0x534a10cc
-0, 202500, 126720, 0xfdca11d3
+0, 202500, 126720, 0x5fd753d8
0, 210000, 126720, 0x0c735615
0, 217500, 126720, 0x0eaf0c1b
-0, 225000, 126720, 0xce5e6794
-0, 232500, 126720, 0x14cf7974
+0, 225000, 126720, 0x14cf7974
+0, 232500, 126720, 0x1c2a513d
0, 240000, 126720, 0xbc513f2a
0, 247500, 126720, 0xbc303fae
0, 255000, 126720, 0xd9f67585