38 const char *buf,
int *
offset,
45 switch (data_type & 0xff) {
108 #define SPDIF_MAX_OFFSET 16384
120 const uint8_t *expected_code = buf + 7;
123 int consecutive_codes = 0;
126 for (; buf < probe_end; buf++) {
133 if (buf == expected_code) {
134 if (++consecutive_codes >= 2)
137 consecutive_codes = 0;
147 &buf[5], &
offset, codec)) {
148 if (buf +
offset >= p_buf + buf_size)
150 expected_code = buf +
offset;
151 buf = expected_code - 7;
179 int pkt_size_bits,
offset, ret;
190 if (pkt_size_bits % 16)
213 if (!
s->nb_streams) {
221 }
else if (
codec_id !=
s->streams[0]->codecpar->codec_id) {
226 if (!
s->bit_rate &&
s->streams[0]->codecpar->sample_rate)
229 s->bit_rate = 2 * 16 *
s->streams[0]->codecpar->sample_rate;
Common code between the AC-3 encoder and decoder.
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, uint8_t *frames)
Extract the number of samples and frames from AAC data.
#define AV_AAC_ADTS_HEADER_SIZE
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rl16(AVIOContext *s)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int avio_r8(AVIOContext *s)
AVCodecID
Identify the syntax and semantics of the bitstream.
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_EOF
End of file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
void ff_spdif_bswap_buf16(uint16_t *dst, const uint16_t *src, int w)
@ IEC61937_MPEG1_LAYER1
MPEG-1 layer 1.
@ IEC61937_DTS3
DTS type III (2048 samples)
@ IEC61937_MPEG1_LAYER23
MPEG-1 layer 2 or 3 data or MPEG-2 without extension.
@ IEC61937_MPEG2_EXT
MPEG-2 data with extension.
@ IEC61937_DTS2
DTS type II (1024 samples)
@ IEC61937_MPEG2_AAC
MPEG-2 AAC ADTS.
@ IEC61937_MPEG2_LAYER2_LSF
MPEG-2, layer-2 low sampling frequency.
@ IEC61937_MPEG2_LAYER1_LSF
MPEG-2, layer-1 low sampling frequency.
@ IEC61937_DTS1
DTS type I (512 samples)
@ IEC61937_MPEG2_LAYER3_LSF
MPEG-2, layer-3 low sampling frequency.
static const uint16_t spdif_mpeg_pkt_offset[2][3]
#define BURST_HEADER_SIZE
int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec)
AVInputFormat ff_spdif_demuxer
static int spdif_read_header(AVFormatContext *s)
int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
static int spdif_probe(const AVProbeData *p)
static int spdif_get_offset_and_codec(AVFormatContext *s, enum IEC61937DataType data_type, const char *buf, int *offset, enum AVCodecID *codec)
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
This structure contains the data a format has to probe a file.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define avpriv_request_sample(...)
static const uint8_t offset[127][2]