aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rmdec.c
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 /libavformat/rmdec.c
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>
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r--libavformat/rmdec.c11
1 files changed, 7 insertions, 4 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;