comparison rtp_asf.c @ 5114:51b1a9987537 libavformat

Cosmetics: remove spaces between function name and arguments in declaration, and put return type ("static void") on the same line as function name.
author rbultje
date Mon, 27 Jul 2009 14:32:54 +0000
parents 75e51cba276e
children 8fddfdd5e9e7
comparison
equal deleted inserted replaced
5113:75e51cba276e 5114:51b1a9987537
38 * contain any padding. Unfortunately, the header min/max_pktsize are not 38 * contain any padding. Unfortunately, the header min/max_pktsize are not
39 * updated (thus making min_pktsize invalid). Here, we "fix" these faulty 39 * updated (thus making min_pktsize invalid). Here, we "fix" these faulty
40 * min_pktsize values in the ASF file header. 40 * min_pktsize values in the ASF file header.
41 * @return 0 on success, <0 on failure (currently -1). 41 * @return 0 on success, <0 on failure (currently -1).
42 */ 42 */
43 static int 43 static int rtp_asf_fix_header(uint8_t *buf, int len)
44 rtp_asf_fix_header(uint8_t *buf, int len)
45 { 44 {
46 uint8_t *p = buf, *end = buf + len; 45 uint8_t *p = buf, *end = buf + len;
47 46
48 if (len < sizeof(ff_asf_guid) * 2 + 22 || 47 if (len < sizeof(ff_asf_guid) * 2 + 22 ||
49 memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) { 48 memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {
76 * The following code is basically a buffered ByteIOContext, 75 * The following code is basically a buffered ByteIOContext,
77 * with the added benefit of returning -EAGAIN (instead of 0) 76 * with the added benefit of returning -EAGAIN (instead of 0)
78 * on packet boundaries, such that the ASF demuxer can return 77 * on packet boundaries, such that the ASF demuxer can return
79 * safely and resume business at the next packet. 78 * safely and resume business at the next packet.
80 */ 79 */
81 static int 80 static int packetizer_read(void *opaque, uint8_t *buf, int buf_size)
82 packetizer_read(void *opaque, uint8_t *buf, int buf_size)
83 { 81 {
84 return AVERROR(EAGAIN); 82 return AVERROR(EAGAIN);
85 } 83 }
86 84
87 static void 85 static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len)
88 init_packetizer(ByteIOContext *pb, uint8_t *buf, int len)
89 { 86 {
90 init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL); 87 init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL);
91 88
92 /* this "fills" the buffer with its current content */ 89 /* this "fills" the buffer with its current content */
93 pb->pos = len; 90 pb->pos = len;
116 av_free(buf); 113 av_free(buf);
117 rt->asf_ctx->pb = NULL; 114 rt->asf_ctx->pb = NULL;
118 } 115 }
119 } 116 }
120 117
121 static int 118 static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
122 asfrtp_parse_sdp_line (AVFormatContext *s, int stream_index, 119 PayloadContext *asf, const char *line)
123 PayloadContext *asf, const char *line)
124 { 120 {
125 if (av_strstart(line, "stream:", &line)) { 121 if (av_strstart(line, "stream:", &line)) {
126 RTSPState *rt = s->priv_data; 122 RTSPState *rt = s->priv_data;
127 123
128 s->streams[stream_index]->id = strtol(line, NULL, 10); 124 s->streams[stream_index]->id = strtol(line, NULL, 10);
153 /** 149 /**
154 * @return 0 when a packet was written into /p pkt, and no more data is left; 150 * @return 0 when a packet was written into /p pkt, and no more data is left;
155 * 1 when a packet was written into /p pkt, and more packets might be left; 151 * 1 when a packet was written into /p pkt, and more packets might be left;
156 * <0 when not enough data was provided to return a full packet, or on error. 152 * <0 when not enough data was provided to return a full packet, or on error.
157 */ 153 */
158 static int 154 static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
159 asfrtp_parse_packet (AVFormatContext *s, PayloadContext *asf, AVStream *st, 155 AVStream *st, AVPacket *pkt,
160 AVPacket *pkt, uint32_t *timestamp, 156 uint32_t *timestamp,
161 const uint8_t *buf, int len, int flags) 157 const uint8_t *buf, int len, int flags)
162 { 158 {
163 ByteIOContext *pb = &asf->pb; 159 ByteIOContext *pb = &asf->pb;
164 int res, mflags, len_off; 160 int res, mflags, len_off;
165 RTSPState *rt = s->priv_data; 161 RTSPState *rt = s->priv_data;
166 162
251 } 247 }
252 248
253 return res == 1 ? -1 : res; 249 return res == 1 ? -1 : res;
254 } 250 }
255 251
256 static PayloadContext * 252 static PayloadContext *asfrtp_new_context(void)
257 asfrtp_new_context (void)
258 { 253 {
259 return av_mallocz(sizeof(PayloadContext)); 254 return av_mallocz(sizeof(PayloadContext));
260 } 255 }
261 256
262 static void 257 static void asfrtp_free_context(PayloadContext *asf)
263 asfrtp_free_context (PayloadContext *asf)
264 { 258 {
265 if (asf->pktbuf) { 259 if (asf->pktbuf) {
266 uint8_t *p = NULL; 260 uint8_t *p = NULL;
267 url_close_dyn_buf(asf->pktbuf, &p); 261 url_close_dyn_buf(asf->pktbuf, &p);
268 asf->pktbuf = NULL; 262 asf->pktbuf = NULL;