Go to the documentation of this file.
31 #define AES3_HEADER_LEN 4
61 bits = ((
h >> 4) & 0x0003) * 4 + 16;
98 const uint8_t *buf = avpkt->
data;
99 int buf_size = avpkt->
size;
102 int non_pcm_data_type = -1;
113 frame->nb_samples = 2 * (buf_size / block_size) / avctx->
channels;
118 32 * 48000 /
frame->nb_samples;
119 buf_size = (
frame->nb_samples * avctx->
channels / 2) * block_size;
122 uint32_t *o = (uint32_t *)
frame->data[0];
123 for (; buf_size > 6; buf_size -= 7) {
127 *o++ = ((unsigned)
ff_reverse[buf[6] & 0xf0] << 28) |
133 o = (uint32_t *)
frame->data[0];
135 for (
i=0;
i<
frame->nb_samples * 2 - 6;
i+=2) {
136 if (o[
i] || o[
i+1] || o[
i+2] || o[
i+3])
138 if (o[
i+4] == 0x96F87200U && o[
i+5] == 0xA54E1F00) {
139 non_pcm_data_type = (o[
i+6] >> 16) & 0x1F;
144 uint32_t *o = (uint32_t *)
frame->data[0];
145 for (; buf_size > 5; buf_size -= 6) {
146 *o++ = ((unsigned)
ff_reverse[buf[2] & 0xf0] << 28) |
149 *o++ = ((unsigned)
ff_reverse[buf[5] & 0xf0] << 28) |
154 o = (uint32_t *)
frame->data[0];
156 for (
i=0;
i<
frame->nb_samples * 2 - 6;
i+=2) {
157 if (o[
i] || o[
i+1] || o[
i+2] || o[
i+3])
159 if (o[
i+4] == 0x6F872000U && o[
i+5] == 0x54E1F000) {
160 non_pcm_data_type = (o[
i+6] >> 16) & 0x1F;
165 uint16_t *o = (uint16_t *)
frame->data[0];
166 for (; buf_size > 4; buf_size -= 5) {
174 o = (uint16_t *)
frame->data[0];
176 for (
i=0;
i<
frame->nb_samples * 2 - 6;
i+=2) {
177 if (o[
i] || o[
i+1] || o[
i+2] || o[
i+3])
179 if (o[
i+4] == 0xF872U && o[
i+5] == 0x4E1F) {
180 non_pcm_data_type = (o[
i+6] & 0x1F);
186 if (non_pcm_data_type != -1) {
187 if (
s->non_pcm_mode == 3) {
189 "S302 non PCM mode with data type %d not supported\n",
193 if (
s->non_pcm_mode & 1) {
205 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_DECODING_PARAM
207 {
"non_pcm_mode",
"Chooses what to do with NON-PCM", offsetof(
S302Context, non_pcm_mode),
AV_OPT_TYPE_INT, {.i64 = 3}, 0, 3,
FLAGS,
"non_pcm_mode"},
208 {
"copy" ,
"Pass NON-PCM through unchanged" , 0,
AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 3,
FLAGS,
"non_pcm_mode"},
210 {
"decode_copy" ,
"Decode if possible else passthrough", 0,
AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 3,
FLAGS,
"non_pcm_mode"},
211 {
"decode_drop" ,
"Decode if possible else drop" , 0,
AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 3,
FLAGS,
"non_pcm_mode"},
uint64_t channel_layout
Audio channel layout.
int sample_rate
samples per second
This structure describes decoded (raw) audio or video data.
const uint8_t ff_reverse[256]
static const AVClass s302m_class
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_QUAD
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
const AVCodec ff_s302m_decoder
#define AV_CH_LAYOUT_STEREO_DOWNMIX
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int64_t bit_rate
the average bitrate
const char * av_default_item_name(void *ptr)
Return the context name.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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 AV_CH_LAYOUT_5POINT1_BACK
int channels
number of audio channels
#define i(width, name, range_min, range_max)
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Name of the codec implementation.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
static int s302m_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static const AVOption s302m_options[]
This structure stores compressed data.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
@ AV_SAMPLE_FMT_S32
signed 32 bits
static int s302m_parse_frame_header(AVCodecContext *avctx, const uint8_t *buf, int buf_size)