From abf74a11694ae3c621d47af482027074b88727eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 11 Dec 2012 18:24:46 +0200 Subject: [PATCH 1/3] rtpdec: Get rid of a useless _s suffix on a struct name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtpdec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 415b77d0d8..7173ca795c 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -28,7 +28,7 @@ #include "url.h" typedef struct PayloadContext PayloadContext; -typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler; +typedef struct RTPDynamicProtocolHandler RTPDynamicProtocolHandler; #define RTP_MIN_PACKET_LENGTH 12 #define RTP_MAX_PACKET_LENGTH 1500 @@ -108,7 +108,7 @@ typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx, const uint8_t * buf, int len, int flags); -struct RTPDynamicProtocolHandler_s { +struct RTPDynamicProtocolHandler { const char enc_name[50]; enum AVMediaType codec_type; enum AVCodecID codec_id; @@ -126,7 +126,7 @@ struct RTPDynamicProtocolHandler_s { void (*free)(PayloadContext *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data. DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet. - struct RTPDynamicProtocolHandler_s *next; + struct RTPDynamicProtocolHandler *next; }; typedef struct RTPPacket { From 584a01792541246d965893b67787705065ad3660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 11 Dec 2012 20:23:50 +0200 Subject: [PATCH 2/3] rtpdec: Cosmetic cleanup of the header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtpdec.h | 45 +++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index 7173ca795c..668a1f7c98 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -19,6 +19,7 @@ * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + #ifndef AVFORMAT_RTPDEC_H #define AVFORMAT_RTPDEC_H @@ -38,7 +39,9 @@ typedef struct RTPDynamicProtocolHandler RTPDynamicProtocolHandler; #define RTP_NOTS_VALUE ((uint32_t)-1) typedef struct RTPDemuxContext RTPDemuxContext; -RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, int queue_size); +RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, + URLContext *rtpc, int payload_type, + int queue_size); void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, RTPDynamicProtocolHandler *handler); int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, @@ -100,13 +103,12 @@ typedef struct RTPStatistics { * @param len length of buf * @param flags flags from the RTP packet header (RTP_FLAG_*) */ -typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx, - PayloadContext *s, - AVStream *st, - AVPacket * pkt, - uint32_t *timestamp, - const uint8_t * buf, - int len, int flags); +typedef int (*DynamicPayloadPacketHandlerProc)(AVFormatContext *ctx, + PayloadContext *s, + AVStream *st, AVPacket *pkt, + uint32_t *timestamp, + const uint8_t * buf, + int len, int flags); struct RTPDynamicProtocolHandler { const char enc_name[50]; @@ -116,15 +118,17 @@ struct RTPDynamicProtocolHandler { * payload ID (PCMU), too, but that format doesn't * require any custom depacketization code. */ - // may be null - int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data); ///< Initialize dynamic protocol handler, called after the full rtpmap line is parsed - int (*parse_sdp_a_line) (AVFormatContext *s, - int st_index, - PayloadContext *priv_data, - const char *line); ///< Parse the a= line from the sdp field - PayloadContext *(*alloc) (void); ///< allocate any data needed by the rtp parsing for this dynamic data. - void (*free)(PayloadContext *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data. - DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet. + /** Initialize dynamic protocol handler, called after the full rtpmap line is parsed, may be null */ + int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data); + /** Parse the a= line from the sdp field */ + int (*parse_sdp_a_line)(AVFormatContext *s, int st_index, + PayloadContext *priv_data, const char *line); + /** Allocate any data needed by the rtp parsing for this dynamic data. */ + PayloadContext *(*alloc)(void); + /** Free any data needed by the rtp parsing for this dynamic data. */ + void (*free)(PayloadContext *protocol_data); + /** Parse handler for this dynamic packet */ + DynamicPayloadPacketHandlerProc parse_packet; struct RTPDynamicProtocolHandler *next; }; @@ -156,7 +160,8 @@ struct RTPDemuxContext { URLContext *rtp_ctx; char hostname[256]; - RTPStatistics statistics; ///< Statistics for this stream (used by RTCP receiver reports) + /** Statistics for this stream (used by RTCP receiver reports) */ + RTPStatistics statistics; /** Fields for packet reordering @{ */ int prev_ret; ///< The return value of the actual parsing of the previous packet @@ -189,7 +194,9 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, enum AVMediaType codec_type); -int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size); ///< from rtsp.c, but used by rtp dynamic protocol handlers. +/* from rtsp.c, but used by rtp dynamic protocol handlers. */ +int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, + char *value, int value_size); int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p, int (*parse_fmtp)(AVStream *stream, From f3f60dcbdd6ff2201526a603fe28293975bb7667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 11 Dec 2012 21:42:32 +0200 Subject: [PATCH 3/3] rtpdec_mpeg4: Cosmetic cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtpdec_mpeg4.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c index cc92c88636..dda48d8972 100644 --- a/libavformat/rtpdec_mpeg4.c +++ b/libavformat/rtpdec_mpeg4.c @@ -32,9 +32,8 @@ #include "libavutil/avstring.h" #include "libavcodec/get_bits.h" -/** Structure listing useful vars to parse RTP packet payload*/ -struct PayloadContext -{ +/** Structure listing useful vars to parse RTP packet payload */ +struct PayloadContext { int sizelength; int indexlength; int indexdeltalength; @@ -69,8 +68,7 @@ typedef struct { /* All known fmtp parameters and the corresponding RTPAttrTypeEnum */ #define ATTR_NAME_TYPE_INT 0 #define ATTR_NAME_TYPE_STR 1 -static const AttrNameMap attr_names[]= -{ +static const AttrNameMap attr_names[] = { { "SizeLength", ATTR_NAME_TYPE_INT, offsetof(PayloadContext, sizelength) }, { "IndexLength", ATTR_NAME_TYPE_INT, @@ -91,14 +89,14 @@ static PayloadContext *new_context(void) return av_mallocz(sizeof(PayloadContext)); } -static void free_context(PayloadContext * data) +static void free_context(PayloadContext *data) { av_free(data->au_headers); av_free(data->mode); av_free(data); } -static int parse_fmtp_config(AVCodecContext * codec, char *value) +static int parse_fmtp_config(AVCodecContext *codec, char *value) { /* decode the hexa encoded parameter */ int len = ff_hex_to_data(NULL, value); @@ -159,11 +157,8 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf) /* Follows RFC 3640 */ -static int aac_parse_packet(AVFormatContext *ctx, - PayloadContext *data, - AVStream *st, - AVPacket *pkt, - uint32_t *timestamp, +static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data, + AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { if (rtp_parse_mp4_au(data, buf))