1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Add is_keyframe param to ff_rdt_parse_header(). See ML discussion in

"[PATCH] RDT/Realmedia patches #2" thread.

Originally committed as revision 15833 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ronald S. Bultje 2008-11-15 20:41:59 +00:00
parent 92765276fb
commit 114732f4c7
3 changed files with 11 additions and 7 deletions

View File

@ -173,7 +173,8 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
int int
ff_rdt_parse_header(const uint8_t *buf, int len, ff_rdt_parse_header(const uint8_t *buf, int len,
int *set_id, int *seq_no, int *stream_id, uint32_t *timestamp) int *set_id, int *seq_no, int *stream_id,
int *is_keyframe, uint32_t *timestamp)
{ {
int consumed = 10; int consumed = 10;
@ -238,7 +239,8 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
if (set_id) *set_id = (buf[0]>>1) & 0x1f; if (set_id) *set_id = (buf[0]>>1) & 0x1f;
if (seq_no) *seq_no = AV_RB16(buf+1); if (seq_no) *seq_no = AV_RB16(buf+1);
if (timestamp) *timestamp = AV_RB32(buf+4); if (timestamp) *timestamp = AV_RB32(buf+4);
if (stream_id) *stream_id = buf[3] & 0x3f; if (stream_id) *stream_id = (buf[3]>>1) & 0x1f;
if (is_keyframe) *is_keyframe = !(buf[3] & 0x1);
return consumed; return consumed;
} }
@ -287,7 +289,7 @@ int
ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
int seq_no, flags = 0, stream_id, set_id; int seq_no, flags = 0, stream_id, set_id, is_keyframe;
uint32_t timestamp; uint32_t timestamp;
int rv= 0; int rv= 0;
@ -304,10 +306,10 @@ ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
if (len < 12) if (len < 12)
return -1; return -1;
rv = ff_rdt_parse_header(buf, len, &set_id, &seq_no, &stream_id, &timestamp); rv = ff_rdt_parse_header(buf, len, &set_id, &seq_no, &stream_id, &is_keyframe, &timestamp);
if (rv < 0) if (rv < 0)
return rv; return rv;
if (!(stream_id & 1) && (set_id != s->prev_set_id || timestamp != s->prev_timestamp)) { if (is_keyframe && (set_id != s->prev_set_id || timestamp != s->prev_timestamp)) {
flags |= PKT_FLAG_KEY; flags |= PKT_FLAG_KEY;
s->prev_set_id = set_id; s->prev_set_id = set_id;
s->prev_timestamp = timestamp; s->prev_timestamp = timestamp;

View File

@ -75,11 +75,13 @@ void ff_rdt_subscribe_rule2(RDTDemuxContext *s, char *cmd, int size,
* @param set_id will be set to the set ID this packet belongs to * @param set_id will be set to the set ID this packet belongs to
* @param seq_no will be set to the sequence number this packet belongs to * @param seq_no will be set to the sequence number this packet belongs to
* @param stream_id will be set to the stream ID this packet belongs to * @param stream_id will be set to the stream ID this packet belongs to
* @param is_keyframe will be whether this packet belongs to a keyframe
* @param timestamp will be set to the timestamp of the packet * @param timestamp will be set to the timestamp of the packet
* @return the amount of bytes consumed, or <0 on error * @return the amount of bytes consumed, or <0 on error
*/ */
int ff_rdt_parse_header(const uint8_t *buf, int len, int ff_rdt_parse_header(const uint8_t *buf, int len,
int *set_id, int *seq_no, int *stream_id, uint32_t *timestamp); int *set_id, int *seq_no, int *stream_id,
int *is_keyframe, uint32_t *timestamp);
/** /**
* Parse RDT-style packet data (header + media data). * Parse RDT-style packet data (header + media data).

View File

@ -1281,7 +1281,7 @@ static int tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
if (ret != len) if (ret != len)
return -1; return -1;
if (rt->transport == RTSP_TRANSPORT_RDT && if (rt->transport == RTSP_TRANSPORT_RDT &&
ff_rdt_parse_header(buf, len, &id, NULL, NULL, NULL) < 0) ff_rdt_parse_header(buf, len, &id, NULL, NULL, NULL, NULL) < 0)
return -1; return -1;
/* find the matching stream */ /* find the matching stream */