1 /*
2 * MPEG Audio parser
3 * Copyright (c) 2003 Fabrice Bellard
4 * Copyright (c) 2003 Michael Niedermayer
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
26
27
35
36 #define MPA_HEADER_SIZE 4
37
38 /* header + layer + bitrate + freq + lsf/mpeg25 */
39 #define SAME_HEADER_MASK \
40 (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))
41
44 const uint8_t **poutbuf,
int *poutbuf_size,
46 {
50 int i;
52
53 for(i=0; i<buf_size; ){
56 i += inc;
58 state = 0;
59
61 next= i;
62 break;
63 }
64 }else{
65 while(i<buf_size){
68
69 state= (state<<8) + buf[i++];
70
72 if (ret < 4) {
73 if (i > 4)
75 } else {
82
91 }
92 }
93
96 next = buf_size;
99 "MP3ADU full parser");
101 }
102
103 break;
104 }
105 }
106 }
107 }
108
112 *poutbuf_size = 0;
113 return buf_size;
114 }
115
117 *poutbuf_size = buf_size;
118 return next;
119 }
120
121
127 };
int duration
Duration of the current frame.
static int mpegaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
AVCodecID
Identify the syntax and semantics of the bitstream.
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
#define PARSER_FLAG_COMPLETE_FRAMES
preferred ID for decoding MPEG audio layer 1, 2 or 3
void ff_parse_close(AVCodecParserContext *s)
int bit_rate
the average bitrate
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int sample_rate
samples per second
main external API structure.
uint32_t state
contains the last few bytes in MSB order
AVCodecParser ff_mpegaudio_parser
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
common internal and external API header
int channels
number of audio channels