Commit 7c1f6df4 authored by Kostya Shishkov's avatar Kostya Shishkov Committed by Anton Khirnov

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: 's avatarAnton Khirnov <anton@khirnov.net>
parent 33197111
......@@ -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;
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment