28 #define PP_BNK_MAX_READ_SIZE 4096
29 #define PP_BNK_FILE_HEADER_SIZE 20
30 #define PP_BNK_TRACK_SIZE 20
91 if (track_count == 0 || track_count > INT_MAX)
153 ctx->track_count =
i;
182 ctx->track_count =
i + 1;
184 "Track %d has truncated data, assuming track count == %d\n",
185 i,
ctx->track_count);
187 }
else if (ret < 0) {
193 if (
ctx->track_count == 0) {
199 (
ctx->track_count == 2) &&
200 (
ctx->tracks[0].data_size ==
ctx->tracks[1].data_size);
203 for (
int i = 0;
i < (
ctx->is_music ? 1 :
ctx->track_count);
i++) {
248 for (
int i = 0;
i <
ctx->track_count;
i++,
ctx->current_track++)
254 ctx->current_track %=
ctx->track_count;
256 trk =
ctx->tracks +
ctx->current_track;
268 if (!
ctx->is_music) {
279 if (ret >= 0 && ret !=
size) {
299 ctx->current_track++;
326 ctx->tracks[0].bytes_read = 0;
327 ctx->tracks[1].bytes_read = 0;
329 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.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
static int read_header(FFV1Context *f)
#define AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_STEREO
@ 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 AVCodec *c)
Add a new stream to a media file.
#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)
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)
AVInputFormat ff_pp_bnk_demuxer
static int pp_bnk_read_close(AVFormatContext *s)
static int pp_bnk_read_header(AVFormatContext *s)
#define PP_BNK_MAX_READ_SIZE
This struct describes the properties of an encoded stream.
uint64_t channel_layout
Audio only.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
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
Audio only.
int bits_per_raw_sample
This is the number of valid bits in each output sample.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
Audio only.
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
This structure contains the data a format has to probe a file.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
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(...)