Mercurial > libavformat.hg
comparison mp3.c @ 885:da1d5db0ce5c libavformat
COSMETICS: Remove all trailing whitespace.
author | diego |
---|---|
date | Sat, 17 Dec 2005 18:14:38 +0000 |
parents | 66cc656ea404 |
children | edbe5c3717f9 |
comparison
equal
deleted
inserted
replaced
884:2ece9c9dd94c | 885:da1d5db0ce5c |
---|---|
1 /* | 1 /* |
2 * MP3 encoder and decoder | 2 * MP3 encoder and decoder |
3 * Copyright (c) 2003 Fabrice Bellard. | 3 * Copyright (c) 2003 Fabrice Bellard. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Lesser General Public | 6 * modify it under the terms of the GNU Lesser General Public |
164 (buf[7] & 0x80) == 0 && | 164 (buf[7] & 0x80) == 0 && |
165 (buf[8] & 0x80) == 0 && | 165 (buf[8] & 0x80) == 0 && |
166 (buf[9] & 0x80) == 0); | 166 (buf[9] & 0x80) == 0); |
167 } | 167 } |
168 | 168 |
169 static void id3_get_string(char *str, int str_size, | 169 static void id3_get_string(char *str, int str_size, |
170 const uint8_t *buf, int buf_size) | 170 const uint8_t *buf, int buf_size) |
171 { | 171 { |
172 int i, c; | 172 int i, c; |
173 char *q; | 173 char *q; |
174 | 174 |
187 /* 'buf' must be ID3_TAG_SIZE byte long */ | 187 /* 'buf' must be ID3_TAG_SIZE byte long */ |
188 static int id3_parse_tag(AVFormatContext *s, const uint8_t *buf) | 188 static int id3_parse_tag(AVFormatContext *s, const uint8_t *buf) |
189 { | 189 { |
190 char str[5]; | 190 char str[5]; |
191 int genre; | 191 int genre; |
192 | 192 |
193 if (!(buf[0] == 'T' && | 193 if (!(buf[0] == 'T' && |
194 buf[1] == 'A' && | 194 buf[1] == 'A' && |
195 buf[2] == 'G')) | 195 buf[2] == 'G')) |
196 return -1; | 196 return -1; |
197 id3_get_string(s->title, sizeof(s->title), buf + 3, 30); | 197 id3_get_string(s->title, sizeof(s->title), buf + 3, 30); |
252 return AVERROR_NOMEM; | 252 return AVERROR_NOMEM; |
253 | 253 |
254 st->codec->codec_type = CODEC_TYPE_AUDIO; | 254 st->codec->codec_type = CODEC_TYPE_AUDIO; |
255 st->codec->codec_id = CODEC_ID_MP3; | 255 st->codec->codec_id = CODEC_ID_MP3; |
256 st->need_parsing = 1; | 256 st->need_parsing = 1; |
257 | 257 |
258 /* try to get the TAG */ | 258 /* try to get the TAG */ |
259 if (!url_is_streamed(&s->pb)) { | 259 if (!url_is_streamed(&s->pb)) { |
260 /* XXX: change that */ | 260 /* XXX: change that */ |
261 filesize = url_fsize(&s->pb); | 261 filesize = url_fsize(&s->pb); |
262 if (filesize > 128) { | 262 if (filesize > 128) { |
292 | 292 |
293 static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) | 293 static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) |
294 { | 294 { |
295 int ret, size; | 295 int ret, size; |
296 // AVStream *st = s->streams[0]; | 296 // AVStream *st = s->streams[0]; |
297 | 297 |
298 size= MP3_PACKET_SIZE; | 298 size= MP3_PACKET_SIZE; |
299 | 299 |
300 ret= av_get_packet(&s->pb, pkt, size); | 300 ret= av_get_packet(&s->pb, pkt, size); |
301 | 301 |
302 pkt->stream_index = 0; | 302 pkt->stream_index = 0; |
392 av_register_input_format(&mp3_iformat); | 392 av_register_input_format(&mp3_iformat); |
393 #ifdef CONFIG_MUXERS | 393 #ifdef CONFIG_MUXERS |
394 av_register_output_format(&mp2_oformat); | 394 av_register_output_format(&mp2_oformat); |
395 #ifdef CONFIG_MP3LAME | 395 #ifdef CONFIG_MP3LAME |
396 av_register_output_format(&mp3_oformat); | 396 av_register_output_format(&mp3_oformat); |
397 #endif | 397 #endif |
398 #endif //CONFIG_MUXERS | 398 #endif //CONFIG_MUXERS |
399 return 0; | 399 return 0; |
400 } | 400 } |