57 0xd79e8283acea4620, 0x7a9762f445afd0d8,
58 0x354d60a60b8c79f1, 0x584e1cde00b07aee,
59 0x1573cd93da7df623, 0x47f98d79620dd535
91 av_log(s, level,
"%s: %s\n", name, buf);
102 len =
FFMIN(len, 16);
106 if (r_val != oc->
r_val) {
107 memset(oc->
r_val, 0, 24);
108 memcpy(oc->
r_val, r_val, len);
110 memcpy(&oc->
r_val[16], r_val, 8);
113 if (n_val != oc->
n_val) {
114 memset(oc->
n_val, 0, 24);
115 memcpy(oc->
n_val, n_val, len);
117 memcpy(&oc->
n_val[16], n_val, 8);
123 #define OMA_RPROBE_M_VAL 48 + 1 132 if (!enc_header || !r_val ||
158 return memcmp(&enc_header[pos], oc->
sm_val, 8) ? -1 : 0;
166 uint32_t taglen, datalen;
169 if (!enc_header || !n_val ||
170 size < OMA_ENC_HEADER_SIZE + oc->
k_size + 4)
174 if (!memcmp(&enc_header[pos],
"EKB ", 4))
183 taglen =
AV_RB32(&enc_header[pos + 32]);
184 datalen =
AV_RB32(&enc_header[pos + 36]) >> 4;
186 pos += 44LL + taglen;
188 if (pos + (((uint64_t)datalen) << 4) > size)
196 while (datalen-- > 0) {
221 if (!strcmp(em->
tag,
"GEOB") &&
236 "Invalid GEOB data size: %"PRIu32
"\n", geob->
datasize);
255 OMA_ENC_HEADER_SIZE + 48 > geob->
datasize) {
259 oc->
rid =
AV_RB32(&gdata[OMA_ENC_HEADER_SIZE + 28]);
262 memcpy(oc->
iv, &header[0x58], 8);
280 kset(s, buf, buf, 16);
298 &gdata[OMA_ENC_HEADER_SIZE + 40], 1,
NULL, 0);
316 if (ret < packet_size)
335 if (ret == packet_size)
337 (packet_size >> 3), oc->
iv, 1);
339 memset(oc->
iv, 0, 8);
358 else if (tag !=
MKBETAG(0,
'B',
'L',
'K'))
367 if (ret < packet_size)
379 pkt->
pts = pts * 1024LL;
382 pkt->
pts = pts * 2048LL;
390 int ret, framesize, jsflag, samplerate;
391 uint32_t codec_params, channel_id;
409 if (memcmp(buf, ((
const uint8_t[]){
'E',
'A',
'3'}), 3) ||
419 if (eid != -1 && eid != -128 &&
decrypt_init(s, extra_meta, buf) < 0) {
426 codec_params =
AV_RB24(&buf[33]);
447 if (samplerate != 44100)
450 framesize = (codec_params & 0x3FF) * 8;
453 jsflag = (codec_params >> 17) & 1;
467 AV_WL32(&edata[2], samplerate);
476 channel_id = (codec_params >> 10) & 7;
479 "Invalid ATRAC-X channel id: %"PRIu32
"\n", channel_id);
484 framesize = ((codec_params & 0x3FF) * 8) + 8;
545 unsigned tag_len = 0;
564 int stream_index, int64_t timestamp,
int flags)
591 memset(oc->
iv, 0, 8);
612 .extensions =
"oma,omg,aa3",
static int oma_read_header(AVFormatContext *s)
static int rprobe(AVFormatContext *s, uint8_t *enc_header, unsigned size, const uint8_t *r_val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypts / decrypts using the DES algorithm.
static int aal_read_packet(AVFormatContext *s, AVPacket *pkt)
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t pos
byte position in stream, -1 if unknown
AVInputFormat ff_oma_demuxer
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
#define AV_CH_LAYOUT_STEREO
unsigned int avio_rb16(AVIOContext *s)
static int kset(AVFormatContext *s, const uint8_t *r_val, const uint8_t *n_val, int len)
static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
const AVCodecTag ff_oma_codec_tags[]
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define ID3v2_HEADER_SIZE
int ff_id3v2_parse_chapters(AVFormatContext *s, ID3v2ExtraMeta **extra_meta)
Create chapters for all CHAP tags found in the ID3v2 header.
unsigned int avio_rb32(AVIOContext *s)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
enum AVStreamParseType need_parsing
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.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static const uint8_t header[24]
uint64_t channel_layout
Audio only.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
int(* read_packet)(AVFormatContext *s, AVPacket *pkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int av_des_init(AVDES *d, const uint8_t *key, int key_bits, av_unused int decrypt)
enum AVMediaType codec_type
General type of the encoded data.
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta)
Free memory allocated parsing special (non-text) metadata.
int av_log_get_level(void)
Get the current log level.
int flags
A combination of AV_PKT_FLAG values.
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.
int block_align
Audio only.
audio channel layout utility functions
unsigned int avio_rb24(AVIOContext *s)
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define OMA_ENC_HEADER_SIZE
#define FF_ARRAY_ELEMS(a)
static int read_header(FFV1Context *f)
AVDES * av_des_alloc(void)
Allocate an AVDES context.
#define AV_LOG_INFO
Standard information.
static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
AVIOContext * pb
I/O context.
const uint64_t ff_oma_chid_to_native_layout[7]
map ATRAC-X channel id to internal channel layout
static void hex_log(AVFormatContext *s, int level, const char *name, const uint8_t *value, int len)
void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count)
Calculates CBC-MAC using the DES algorithm.
static const uint64_t leaf_table[]
This structure contains the data a format has to probe a file.
static int oma_read_seek(struct AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
int sample_rate
Audio only.
const int ff_oma_chid_to_num_channels[7]
map ATRAC-X channel id to total number of channels
int ff_id3v2_match(const uint8_t *buf, const char *magic)
Detect ID3v2 Header.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta, unsigned int max_search_size)
Read an ID3v2 tag, including supported extra metadata.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
#define MKBETAG(a, b, c, d)
static int nprobe(AVFormatContext *s, uint8_t *enc_header, unsigned size, const uint8_t *n_val)
int ff_id3v2_tag_len(const uint8_t *buf)
Get the length of an ID3v2 tag.
void * priv_data
Format private data.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static int oma_read_close(AVFormatContext *s)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
const uint16_t ff_oma_srate_tab[8]
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int oma_read_probe(AVProbeData *p)