32#define PP_BNK_MAX_READ_SIZE 4096
33#define PP_BNK_FILE_HEADER_SIZE 20
34#define PP_BNK_TRACK_SIZE 20
91 uint32_t sample_rate =
AV_RL32(p->buf + 4);
92 uint32_t track_count =
AV_RL32(p->buf + 12);
95 if (track_count == 0 || track_count > INT_MAX)
98 if ((sample_rate != 5512) && (sample_rate != 11025) &&
99 (sample_rate != 22050) && (sample_rate != 44100))
103 if (
AV_RL32(p->buf + 28) != sample_rate)
155 ctx->track_count =
i;
181 ctx->track_count =
i + 1;
183 "Track %d has truncated data, assuming track count == %d\n",
184 i,
ctx->track_count);
186 }
else if (ret < 0) {
192 if (
ctx->track_count == 0)
196 (
ctx->track_count == 2) &&
197 (
ctx->tracks[0].data_size ==
ctx->tracks[1].data_size);
200 for (
int i = 0;
i < (
ctx->is_music ? 1 :
ctx->track_count);
i++) {
232 for (
int i = 0;
i <
ctx->track_count;
i++,
ctx->current_track++)
238 ctx->current_track %=
ctx->track_count;
240 trk =
ctx->tracks +
ctx->current_track;
252 if (!
ctx->is_music) {
263 if (ret >= 0 && ret !=
size) {
273 pkt->stream_index =
ctx->current_track;
274 pkt->duration = ret * 2;
277 if (
pkt->stream_index == 0)
280 pkt->stream_index = 0;
283 ctx->current_track++;
310 ctx->tracks[0].bytes_read = 0;
311 ctx->tracks[1].bytes_read = 0;
313 ctx->tracks[stream_index].bytes_read = 0;
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
#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...
static int read_header(FFV1Context *f, RangeCoder *c)
@ AV_CODEC_ID_ADPCM_IMA_CUNNING
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_WARNING
Something somehow does not look correct.
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Memory handling functions.
static int pp_bnk_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
static int pp_bnk_read_packet(AVFormatContext *s, AVPacket *pkt)
#define PP_BNK_FILE_HEADER_SIZE
static void pp_bnk_parse_track(PPBnkTrack *trk, const uint8_t *buf)
static void pp_bnk_parse_header(PPBnkHeader *hdr, const uint8_t *buf)
#define PP_BNK_TRACK_SIZE
static int pp_bnk_probe(const AVProbeData *p)
static int pp_bnk_read_close(AVFormatContext *s)
static int pp_bnk_read_header(AVFormatContext *s)
#define PP_BNK_MAX_READ_SIZE
int nb_channels
Number of channels in this layout.
This struct describes the properties of an encoded stream.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int block_align
The number of bytes per coded audio frame, required by some formats.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
This structure stores compressed data.
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t duration
Decoding: duration of the stream, in stream time base.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
#define av_malloc_array(a, b)
#define avpriv_request_sample(...)
static AVFormatContext * ctx