FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
mp3dec.c File Reference
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/crc.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"
#include "id3v2.h"
#include "id3v1.h"
#include "replaygain.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/mpegaudiodecheader.h"

Go to the source code of this file.

Data Structures

struct  MP3DecContext
 

Macros

#define XING_FLAG_FRAMES   0x01
 
#define XING_FLAG_SIZE   0x02
 
#define XING_FLAG_TOC   0x04
 
#define XING_FLAC_QSCALE   0x08
 
#define XING_TOC_COUNT   100
 
#define SAME_HEADER_MASK   (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))
 
#define LAST_BITS(k, n)   ((k) & ((1 << (n)) - 1))
 
#define MIDDLE_BITS(k, m, n)   LAST_BITS((k) >> (m), ((n) - (m)))
 
#define MP3_PACKET_SIZE   1024
 
#define SEEK_WINDOW   4096
 
#define MIN_VALID   3
 

Enumerations

enum  CheckRet { CHECK_WRONG_HEADER = -1, CHECK_SEEK_FAILED = -2 }
 

Functions

static int check (AVIOContext *pb, int64_t pos, uint32_t *header)
 
static int mp3_read_probe (AVProbeData *p)
 
static void read_xing_toc (AVFormatContext *s, int64_t filesize, int64_t duration)
 
static void mp3_parse_info_tag (AVFormatContext *s, AVStream *st, MPADecodeHeader *c, uint32_t spf)
 
static void mp3_parse_vbri_tag (AVFormatContext *s, AVStream *st, int64_t base)
 
static int mp3_parse_vbr_tags (AVFormatContext *s, AVStream *st, int64_t base)
 Try to find Xing/Info/VBRI tags and compute duration from info therein. More...
 
static int mp3_read_header (AVFormatContext *s)
 
static int mp3_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int64_t mp3_sync (AVFormatContext *s, int64_t target_pos, int flags)
 
static int mp3_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 

Variables

static const AVOption options []
 
static const AVClass demuxer_class
 
AVInputFormat ff_mp3_demuxer
 

Macro Definition Documentation

#define XING_FLAG_FRAMES   0x01

Definition at line 38 of file mp3dec.c.

Referenced by mp3_parse_info_tag().

#define XING_FLAG_SIZE   0x02

Definition at line 39 of file mp3dec.c.

Referenced by mp3_parse_info_tag().

#define XING_FLAG_TOC   0x04

Definition at line 40 of file mp3dec.c.

Referenced by mp3_parse_info_tag().

#define XING_FLAC_QSCALE   0x08

Definition at line 41 of file mp3dec.c.

#define XING_TOC_COUNT   100

Definition at line 43 of file mp3dec.c.

Referenced by read_xing_toc().

#define SAME_HEADER_MASK   (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))

Definition at line 45 of file mp3dec.c.

Referenced by mp3_read_header().

#define LAST_BITS (   k,
  n 
)    ((k) & ((1 << (n)) - 1))
#define MIDDLE_BITS (   k,
  m,
  n 
)    LAST_BITS((k) >> (m), ((n) - (m)))
#define MP3_PACKET_SIZE   1024

Definition at line 422 of file mp3dec.c.

Referenced by mp3_read_packet().

#define SEEK_WINDOW   4096

Definition at line 448 of file mp3dec.c.

Referenced by mp3_sync().

#define MIN_VALID   3

Referenced by mp3_sync().

Enumeration Type Documentation

enum CheckRet
Enumerator
CHECK_WRONG_HEADER 
CHECK_SEEK_FAILED 

Definition at line 60 of file mp3dec.c.

Function Documentation

static int check ( AVIOContext pb,
int64_t  pos,
uint32_t *  header 
)
static

Definition at line 450 of file mp3dec.c.

Referenced by mp3_read_header(), and mp3_sync().

static int mp3_read_probe ( AVProbeData p)
static

Definition at line 69 of file mp3dec.c.

static void read_xing_toc ( AVFormatContext s,
int64_t  filesize,
int64_t  duration 
)
static

Definition at line 116 of file mp3dec.c.

Referenced by mp3_parse_info_tag().

static void mp3_parse_info_tag ( AVFormatContext s,
AVStream st,
MPADecodeHeader c,
uint32_t  spf 
)
static

Definition at line 141 of file mp3dec.c.

Referenced by mp3_parse_vbr_tags().

static void mp3_parse_vbri_tag ( AVFormatContext s,
AVStream st,
int64_t  base 
)
static

Definition at line 279 of file mp3dec.c.

Referenced by mp3_parse_vbr_tags().

static int mp3_parse_vbr_tags ( AVFormatContext s,
AVStream st,
int64_t  base 
)
static

Try to find Xing/Info/VBRI tags and compute duration from info therein.

Definition at line 301 of file mp3dec.c.

Referenced by mp3_read_header().

static int mp3_read_header ( AVFormatContext s)
static

Definition at line 344 of file mp3dec.c.

static int mp3_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 424 of file mp3dec.c.

static int64_t mp3_sync ( AVFormatContext s,
int64_t  target_pos,
int  flags 
)
static

Definition at line 474 of file mp3dec.c.

Referenced by mp3_seek().

static int mp3_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 524 of file mp3dec.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ "usetoc", "use table of contents", 0x42, AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM},
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:276

Definition at line 576 of file mp3dec.c.

const AVClass demuxer_class
static
Initial value:
= {
.class_name = "mp3",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
static const AVOption options[]
Definition: mp3dec.c:576

Definition at line 581 of file mp3dec.c.

AVInputFormat ff_mp3_demuxer
Initial value:
= {
.name = "mp3",
.long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
.read_probe = mp3_read_probe,
.read_header = mp3_read_header,
.read_packet = mp3_read_packet,
.read_seek = mp3_seek,
.priv_data_size = sizeof(MP3DecContext),
.extensions = "mp2,mp3,m2a,mpa",
.priv_class = &demuxer_class,
}
static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: mp3dec.c:424
static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: mp3dec.c:524
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static int mp3_read_header(AVFormatContext *s)
Definition: mp3dec.c:344
static int mp3_read_probe(AVProbeData *p)
Definition: mp3dec.c:69
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:487
static int flags
Definition: cpu.c:47
static const AVClass demuxer_class
Definition: mp3dec.c:581

Definition at line 589 of file mp3dec.c.