1 /*
2 * Packed Animation File audio decoder
3 * Copyright (c) 2012 Paul B Mahol
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
23
28
30 {
34 }
35
38
39 return 0;
40 }
41
44 {
46 int16_t *output_samples;
50
52 if (frames < 1)
54
57 return ret;
58
59 output_samples = (int16_t *)frame->
data[0];
60 // codebook of 256 16-bit samples and 8-bit indices to it
62 for (i = 0; i < 256; i++)
64 src += 256 * 2;
65 // always 2 channels
67 *output_samples++ = cb[*src++];
68 }
69 *got_frame = 1;
70
72 }
73
82 };
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
#define PAF_SOUND_FRAME_SIZE
ptrdiff_t const GLvoid * data
#define AV_CH_LAYOUT_STEREO
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static double cb(void *priv, double x, double y)
enum AVSampleFormat sample_fmt
audio sample format
static int paf_audio_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt)
#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. ...
const char * name
Name of the codec implementation.
uint64_t channel_layout
Audio channel layout.
Libavcodec external API header.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define PAF_SOUND_SAMPLES
static av_const int sign_extend(int val, unsigned bits)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVCodec ff_paf_audio_decoder
static av_cold int paf_audio_init(AVCodecContext *avctx)
common internal api header.
int channels
number of audio channels
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.