aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtmppkt.c
diff options
context:
space:
mode:
authorSergiy <piratfm@gmail.com>2009-12-01 15:07:32 +0000
committerKostya Shishkov <kostya.shishkov@gmail.com>2009-12-01 15:07:32 +0000
commit59b6482a04fcf2d45383cf5a700e9fddcd0c00b5 (patch)
tree22969de0846b1bbac66977051e84ecc11d810d0b /libavformat/rtmppkt.c
parent1ab21f1980080d697cd6f873083a5465d2d7cea6 (diff)
downloadffmpeg-59b6482a04fcf2d45383cf5a700e9fddcd0c00b5.tar.gz
Read and write extended timestamps for RTMP packets.
Extracted from patch by Sergiy in thread "[PATCH] rtmp-output" Originally committed as revision 20683 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtmppkt.c')
-rw-r--r--libavformat/rtmppkt.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 8f9d71dc46..7e7670e2b6 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -111,6 +111,11 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
extra = AV_RL32(buf);
}
}
+ if (timestamp == 0xFFFFFF) {
+ if (url_read_complete(h, buf, 4) != 4)
+ return AVERROR(EIO);
+ timestamp = AV_RB32(buf);
+ }
}
if (ff_rtmp_packet_create(p, channel_id, type, timestamp, data_size))
return -1;
@@ -148,13 +153,15 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
//TODO: header compression
bytestream_put_byte(&p, pkt->channel_id | (mode << 6));
if (mode != RTMP_PS_ONEBYTE) {
- bytestream_put_be24(&p, pkt->timestamp);
+ bytestream_put_be24(&p, pkt->timestamp >= 0xFFFFFF ? 0xFFFFFF : pkt->timestamp);
if (mode != RTMP_PS_FOURBYTES) {
bytestream_put_be24(&p, pkt->data_size);
bytestream_put_byte(&p, pkt->type);
if (mode == RTMP_PS_TWELVEBYTES)
bytestream_put_le32(&p, pkt->extra);
}
+ if (pkt->timestamp >= 0xFFFFFF)
+ bytestream_put_be32(&p, pkt->timestamp);
}
url_write(h, pkt_hdr, p-pkt_hdr);
while (off < pkt->data_size) {