30 #define AES3_HEADER_LEN 4
58 frame_size = (h >> 16) & 0xffff;
59 channels = ((h >> 14) & 0x0003) * 2 + 2;
60 bits = ((h >> 4) & 0x0003) * 4 + 16;
89 32 * (48000 / (buf_size * 8 /
102 int buf_size = avpkt->
size;
105 int non_pcm_data_type = -1;
123 uint32_t *o = (uint32_t *)frame->
data[0];
124 for (; buf_size > 6; buf_size -= 7) {
134 o = (uint32_t *)frame->
data[0];
136 for (i=0; i<frame->
nb_samples * 2 - 6; i+=2) {
137 if (o[i] || o[i+1] || o[i+2] || o[i+3])
139 if (o[i+4] == 0x96F87200U && o[i+5] == 0xA54E1F00) {
140 non_pcm_data_type = (o[i+6] >> 16) & 0x1F;
145 uint32_t *o = (uint32_t *)frame->
data[0];
146 for (; buf_size > 5; buf_size -= 6) {
155 o = (uint32_t *)frame->
data[0];
157 for (i=0; i<frame->
nb_samples * 2 - 6; i+=2) {
158 if (o[i] || o[i+1] || o[i+2] || o[i+3])
160 if (o[i+4] == 0x6F872000U && o[i+5] == 0x54E1F000) {
161 non_pcm_data_type = (o[i+6] >> 16) & 0x1F;
166 uint16_t *o = (uint16_t *)frame->
data[0];
167 for (; buf_size > 4; buf_size -= 5) {
175 o = (uint16_t *)frame->
data[0];
177 for (i=0; i<frame->
nb_samples * 2 - 6; i+=2) {
178 if (o[i] || o[i+1] || o[i+2] || o[i+3])
180 if (o[i+4] == 0xF872U && o[i+5] == 0x4E1F) {
181 non_pcm_data_type = (o[i+6] & 0x1F);
187 if (non_pcm_data_type != -1) {
190 "S302 non PCM mode with data type %d not supported\n",
206 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM
208 {
"non_pcm_mode",
"Chooses what to do with NON-PCM", offsetof(
S302Context, non_pcm_mode),
FF_OPT_TYPE_INT, {.i64 = 3}, 0, 3,
FLAGS,
"non_pcm_mode"},
209 {
"copy" ,
"Pass NON-PCM through unchanged" , 0,
FF_OPT_TYPE_CONST, {.i64 = 0}, 0, 3,
FLAGS,
"non_pcm_mode"},
211 {
"decode_copy" ,
"Decode if possible else passthrough", 0,
FF_OPT_TYPE_CONST, {.i64 = 2}, 0, 3,
FLAGS,
"non_pcm_mode"},
212 {
"decode_drop" ,
"Decode if possible else drop" , 0,
FF_OPT_TYPE_CONST, {.i64 = 3}, 0, 3,
FLAGS,
"non_pcm_mode"},
217 "SMPTE 302M Decoder",
231 .priv_class = &s302m_class,
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
#define LIBAVUTIL_VERSION_INT
static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
static const AVOption s302m_options[]
#define AV_CH_LAYOUT_STEREO
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
enum AVSampleFormat sample_fmt
audio sample format
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#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. ...
#define AV_CH_LAYOUT_QUAD
const char * name
Name of the codec implementation.
Libavcodec external API header.
uint64_t channel_layout
Audio channel layout.
static const AVClass s302m_class
int bit_rate
the average bitrate
#define AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_5POINT1_BACK
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int sample_rate
samples per second
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Describe the class of an AVClass context structure.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
common internal api header.
int channels
number of audio channels
static int s302m_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
const uint8_t ff_reverse[256]
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame