diff options
author | Martin Storsjö <martin@martin.st> | 2010-10-01 17:43:27 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-10-01 17:43:27 +0000 |
commit | ad4ad27fb6d352a874d97d42ba95ae0b5cbfa860 (patch) | |
tree | 3be53d41d26d0108c40ad39afc9425916139435b | |
parent | 96a7c9753e81ac1f2de12f3249ea7c001d50a3f7 (diff) | |
download | ffmpeg-streaming-ad4ad27fb6d352a874d97d42ba95ae0b5cbfa860.zip ffmpeg-streaming-ad4ad27fb6d352a874d97d42ba95ae0b5cbfa860.tar.gz |
rtsp/rtpdec: Allow rtp_parse_packet to take ownership of the packet buffer
Do the same change for ff_rdt_parse_packet, too, to keep the interfaces
similar.
Originally committed as revision 25289 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/rdt.c | 3 | ||||
-rw-r--r-- | libavformat/rdt.h | 2 | ||||
-rw-r--r-- | libavformat/rtpdec.c | 5 | ||||
-rw-r--r-- | libavformat/rtpdec.h | 2 | ||||
-rw-r--r-- | libavformat/rtsp.c | 4 |
5 files changed, 9 insertions, 7 deletions
diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 8baceca..303a2a8 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -337,8 +337,9 @@ get_cache: int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len) + uint8_t **bufptr, int len) { + uint8_t *buf = bufptr ? *bufptr : NULL; int seq_no, flags = 0, stream_id, set_id, is_keyframe; uint32_t timestamp; int rv= 0; diff --git a/libavformat/rdt.h b/libavformat/rdt.h index 8117989..19a4a7b 100644 --- a/libavformat/rdt.h +++ b/libavformat/rdt.h @@ -96,7 +96,7 @@ int ff_rdt_parse_header(const uint8_t *buf, int len, * Usage similar to rtp_parse_packet(). */ int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len); + uint8_t **buf, int len); /** * Parse a server-related SDP line. diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 942b8d7..65fa064 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -414,14 +414,15 @@ static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestam * Parse an RTP or RTCP packet directly sent as a buffer. * @param s RTP parse context. * @param pkt returned packet - * @param buf input buffer or NULL to read the next packets + * @param bufptr pointer to the input buffer or NULL to read the next packets * @param len buffer len * @return 0 if a packet is returned, 1 if a packet is returned and more can follow * (use buf as NULL to read the next). -1 if no packet (error or no more packet). */ int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len) + uint8_t **bufptr, int len) { + uint8_t* buf = bufptr ? *bufptr : NULL; unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; AVStream *st; diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 8548459..df2ec77 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -39,7 +39,7 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, RTPDynamicProtocolHandler *handler); int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - const uint8_t *buf, int len); + uint8_t **buf, int len); void rtp_parse_close(RTPDemuxContext *s); #if (LIBAVFORMAT_VERSION_MAJOR <= 53) int rtp_get_local_port(URLContext *h); diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index be99587..b1ef46f 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1843,9 +1843,9 @@ static int rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt) if (len == 0) return AVERROR_EOF; if (rt->transport == RTSP_TRANSPORT_RDT) { - ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, rt->recvbuf, len); + ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); } else { - ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, rt->recvbuf, len); + ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, &rt->recvbuf, len); if (ret < 0) { /* Either bad packet, or a RTCP packet. Check if the * first_rtcp_ntp_time field was initialized. */ |