45 switch (data_type & 0xff) {
69 *offset = samples << 2;
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++) {
127 state = (state << 8) | *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;
182 state = (state << 8) |
avio_r8(pb);
190 if (pkt_size_bits % 16)
static int spdif_get_offset_and_codec(AVFormatContext *s, enum IEC61937DataType data_type, const char *buf, int *offset, enum AVCodecID *codec)
int64_t pos
byte position in stream, -1 if unknown
#define BURST_HEADER_SIZE
MPEG-2, layer-1 low sampling frequency.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
static int spdif_read_header(AVFormatContext *s)
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void ff_spdif_bswap_buf16(uint16_t *dst, const uint16_t *src, int w)
int ctx_flags
Flags signalling stream properties.
int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec)
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.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int spdif_probe(AVProbeData *p)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
AVStream ** streams
A list of all streams in the file.
#define AVERROR_EOF
End of file.
DTS type II (1024 samples)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
DTS type III (2048 samples)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
preferred ID for decoding MPEG audio layer 1, 2 or 3
enum AVMediaType codec_type
General type of the encoded data.
MPEG-1 layer 2 or 3 data or MPEG-2 without extension.
MPEG-2, layer-3 low sampling frequency.
static const uint8_t offset[127][2]
#define AV_AAC_ADTS_HEADER_SIZE
int avio_r8(AVIOContext *s)
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.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
This structure contains the data a format has to probe a file.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
MPEG-2, layer-2 low sampling frequency.
int sample_rate
Audio only.
unsigned int avio_rl16(AVIOContext *s)
MPEG-2 data with extension.
static const uint16_t spdif_mpeg_pkt_offset[2][3]
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
This structure stores compressed data.
Common code between the AC-3 encoder and decoder.
AVInputFormat ff_spdif_demuxer