FFmpeg
Loading...
Searching...
No Matches
omadec.c File Reference

This is a demuxer for Sony OpenMG Music files. More...

#include <inttypes.h>
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/des.h"
#include "libavutil/mathematics.h"
#include "oma.h"
#include "pcm.h"
#include "id3v2.h"

Go to the source code of this file.

Data Structures

struct  OMAContext
 

Macros

#define OMA_RPROBE_M_VAL   48 + 1
 

Functions

static int oma_read_close (AVFormatContext *s)
 
static void hex_log (AVFormatContext *s, int level, const char *name, const uint8_t *value, int len)
 
static int kset (AVFormatContext *s, const uint8_t *r_val, const uint8_t *n_val, int len)
 
static int rprobe (AVFormatContext *s, uint8_t *enc_header, unsigned size, const uint8_t *r_val)
 
static int nprobe (AVFormatContext *s, uint8_t *enc_header, unsigned size, const uint8_t *n_val)
 
static int decrypt_init (AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header)
 
static int read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int aal_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int oma_read_header (AVFormatContext *s)
 
static int oma_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int oma_read_probe (const AVProbeData *p)
 
static int oma_read_seek (struct AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 

Variables

static const uint64_t leaf_table []
 
static const AVChannelLayout oma_chid_to_native_layout [7]
 map ATRAC-X channel id to internal channel layout
 
const FFInputFormat ff_oma_demuxer
 

Detailed Description

This is a demuxer for Sony OpenMG Music files.

Known file extensions: ".oma", "aa3" The format of such files consists of three parts:

  • "ea3" header carrying overall info and metadata. Except for starting with "ea" instead of "ID", it's an ID3v2 header.
  • "EA3" header is a Sony-specific header containing information about the OpenMG file: codec type (usually ATRAC, can also be MP3 or WMA), codec specific info (packet size, sample rate, channels and so on) and DRM related info (file encryption, content id).
  • Sound data organized in packets follow the EA3 header (can be encrypted using the Sony DRM!).

Supported decoders: ATRAC3, ATRAC3+, MP3, LPCM

Definition in file omadec.c.

Macro Definition Documentation

◆ OMA_RPROBE_M_VAL

#define OMA_RPROBE_M_VAL   48 + 1

Definition at line 142 of file omadec.c.

Referenced by rprobe().

Function Documentation

◆ oma_read_close()

static int oma_read_close ( AVFormatContext * s)
static

Definition at line 95 of file omadec.c.

◆ hex_log()

static void hex_log ( AVFormatContext * s,
int level,
const char * name,
const uint8_t * value,
int len )
static

Definition at line 102 of file omadec.c.

Referenced by decrypt_init().

◆ kset()

static int kset ( AVFormatContext * s,
const uint8_t * r_val,
const uint8_t * n_val,
int len )
static

Definition at line 113 of file omadec.c.

Referenced by decrypt_init(), and nprobe().

◆ rprobe()

static int rprobe ( AVFormatContext * s,
uint8_t * enc_header,
unsigned size,
const uint8_t * r_val )
static

Definition at line 144 of file omadec.c.

Referenced by decrypt_init(), and nprobe().

◆ nprobe()

static int nprobe ( AVFormatContext * s,
uint8_t * enc_header,
unsigned size,
const uint8_t * n_val )
static

Definition at line 180 of file omadec.c.

Referenced by decrypt_init().

◆ decrypt_init()

static int decrypt_init ( AVFormatContext * s,
ID3v2ExtraMeta * em,
uint8_t * header )
static

Definition at line 229 of file omadec.c.

Referenced by oma_read_header().

◆ read_packet()

static int read_packet ( AVFormatContext * s,
AVPacket * pkt )
static

Definition at line 325 of file omadec.c.

◆ aal_read_packet()

static int aal_read_packet ( AVFormatContext * s,
AVPacket * pkt )
static

Definition at line 363 of file omadec.c.

Referenced by oma_read_header().

◆ oma_read_header()

static int oma_read_header ( AVFormatContext * s)
static

Definition at line 406 of file omadec.c.

◆ oma_read_packet()

static int oma_read_packet ( AVFormatContext * s,
AVPacket * pkt )
static

Definition at line 554 of file omadec.c.

◆ oma_read_probe()

static int oma_read_probe ( const AVProbeData * p)
static

Definition at line 560 of file omadec.c.

◆ oma_read_seek()

static int oma_read_seek ( struct AVFormatContext * s,
int stream_index,
int64_t timestamp,
int flags )
static

Definition at line 581 of file omadec.c.

Variable Documentation

◆ leaf_table

const uint64_t leaf_table[]
static
Initial value:
= {
0xd79e8283acea4620, 0x7a9762f445afd0d8,
0x354d60a60b8c79f1, 0x584e1cde00b07aee,
0x1573cd93da7df623, 0x47f98d79620dd535
}

Definition at line 58 of file omadec.c.

Referenced by decrypt_init().

◆ oma_chid_to_native_layout

const AVChannelLayout oma_chid_to_native_layout[7]
static
Initial value:
= {
}
#define AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_5POINT1_BACK
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_6POINT1_BACK
#define AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_7POINT1

map ATRAC-X channel id to internal channel layout

Definition at line 65 of file omadec.c.

Referenced by oma_read_header().

◆ ff_oma_demuxer

const FFInputFormat ff_oma_demuxer
Initial value:
= {
.p.name = "oma",
.p.long_name = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
.p.flags = AVFMT_GENERIC_INDEX,
.p.extensions = "oma,omg,aa3",
.p.codec_tag = ff_oma_codec_tags_list,
.priv_data_size = sizeof(OMAContext),
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
}
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition avformat.h:499
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int read_probe(const AVProbeData *p)
Definition cdg.c:30
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition demux.h:35
static int read_header(FFV1Context *f, RangeCoder *c)
Definition ffv1dec.c:578
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static av_cold int read_close(AVFormatContext *ctx)
Definition libcdio.c:143
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition libcdio.c:151
const AVCodecTag *const ff_oma_codec_tags_list[]
Definition oma.c:39
static int oma_read_probe(const AVProbeData *p)
Definition omadec.c:560
static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition omadec.c:554
static int oma_read_close(AVFormatContext *s)
Definition omadec.c:95
static int oma_read_header(AVFormatContext *s)
Definition omadec.c:406
static int oma_read_seek(struct AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition omadec.c:581

Definition at line 613 of file omadec.c.