Merge remote-tracking branch 'qatar/master'

* qatar/master:
  rtmppkt: Rename the ts_delta field to ts_field

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/293/head
Michael Niedermayer 11 years ago
commit 4fc339faea
  1. 20
      libavformat/rtmppkt.c
  2. 2
      libavformat/rtmppkt.h

@ -196,7 +196,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
hdr >>= 6; // header size indicator
if (hdr == RTMP_PS_ONEBYTE) {
ts_field = prev_pkt[channel_id].ts_delta;
ts_field = prev_pkt[channel_id].ts_field;
} else {
if (ffurl_read_complete(h, buf, 3) != 3)
return AVERROR(EIO);
@ -235,7 +235,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
return ret;
p->read = written;
p->offset = 0;
prev_pkt[channel_id].ts_delta = ts_field;
prev_pkt[channel_id].ts_field = ts_field;
prev_pkt[channel_id].timestamp = timestamp;
} else {
// previous packet in this channel hasn't completed reading
@ -244,7 +244,7 @@ static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
p->size = prev->size;
p->channel_id = prev->channel_id;
p->type = prev->type;
p->ts_delta = prev->ts_delta;
p->ts_field = prev->ts_field;
p->extra = prev->extra;
p->offset = prev->offset;
p->read = prev->read + written;
@ -323,16 +323,16 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
timestamp -= prev_pkt[pkt->channel_id].timestamp;
}
if (timestamp >= 0xFFFFFF) {
pkt->ts_delta = 0xFFFFFF;
pkt->ts_field = 0xFFFFFF;
} else {
pkt->ts_delta = timestamp;
pkt->ts_field = timestamp;
}
if (use_delta) {
if (pkt->type == prev_pkt[pkt->channel_id].type &&
pkt->size == prev_pkt[pkt->channel_id].size) {
mode = RTMP_PS_FOURBYTES;
if (pkt->ts_delta == prev_pkt[pkt->channel_id].ts_delta)
if (pkt->ts_field == prev_pkt[pkt->channel_id].ts_field)
mode = RTMP_PS_ONEBYTE;
} else {
mode = RTMP_PS_EIGHTBYTES;
@ -349,7 +349,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
bytestream_put_le16(&p, pkt->channel_id - 64);
}
if (mode != RTMP_PS_ONEBYTE) {
bytestream_put_be24(&p, pkt->ts_delta);
bytestream_put_be24(&p, pkt->ts_field);
if (mode != RTMP_PS_FOURBYTES) {
bytestream_put_be24(&p, pkt->size);
bytestream_put_byte(&p, pkt->type);
@ -357,14 +357,14 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
bytestream_put_le32(&p, pkt->extra);
}
}
if (pkt->ts_delta == 0xFFFFFF)
if (pkt->ts_field == 0xFFFFFF)
bytestream_put_be32(&p, timestamp);
// save history
prev_pkt[pkt->channel_id].channel_id = pkt->channel_id;
prev_pkt[pkt->channel_id].type = pkt->type;
prev_pkt[pkt->channel_id].size = pkt->size;
prev_pkt[pkt->channel_id].timestamp = pkt->timestamp;
prev_pkt[pkt->channel_id].ts_delta = pkt->ts_delta;
prev_pkt[pkt->channel_id].ts_field = pkt->ts_field;
prev_pkt[pkt->channel_id].extra = pkt->extra;
if ((ret = ffurl_write(h, pkt_hdr, p - pkt_hdr)) < 0)
@ -398,7 +398,7 @@ int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
pkt->type = type;
pkt->timestamp = timestamp;
pkt->extra = 0;
pkt->ts_delta = 0;
pkt->ts_field = 0;
return 0;
}

@ -78,7 +78,7 @@ typedef struct RTMPPacket {
int channel_id; ///< RTMP channel ID (nothing to do with audio/video channels though)
RTMPPacketType type; ///< packet payload type
uint32_t timestamp; ///< packet full timestamp
uint32_t ts_delta; ///< 24-bit timestamp or increment to the previous one, in milliseconds (latter only for media packets). Clipped to a maximum of 0xFFFFFF, indicating an extended timestamp field.
uint32_t ts_field; ///< 24-bit timestamp or increment to the previous one, in milliseconds (latter only for media packets). Clipped to a maximum of 0xFFFFFF, indicating an extended timestamp field.
uint32_t extra; ///< probably an additional channel ID used during streaming data
uint8_t *data; ///< packet payload
int size; ///< packet payload size

Loading…
Cancel
Save