30 #include "libavutil/channel_layout.h"
31 #include "libavutil/intreadwrite.h"
36 #define BVID_PALETTE_SIZE 3 * 256
38 #define DEFAULT_SAMPLE_RATE 11111
92 #define BUFFER_PADDING_SIZE 1000
97 int vidbuf_nbytes = 0;
101 unsigned int vidbuf_capacity;
112 "having no audio packet before the first "
131 vidbuf_start[vidbuf_nbytes++] = block_type;
138 if (
avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2) {
151 vidbuf_start[vidbuf_nbytes++] = code;
155 vidbuf_start[vidbuf_nbytes++] =
avio_r8(pb);
157 if (
avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code) {
161 vidbuf_nbytes += code;
163 bytes_copied += code & 0x7F;
164 if(bytes_copied == npixels){
170 if (bytes_copied > npixels) {
179 memcpy(pkt->
data, vidbuf_start, vidbuf_nbytes);
208 unsigned char block_type;
252 if ((ret_value =
av_get_packet(pb, pkt, audio_length)) != audio_length) {
266 return read_frame(vid, pb, pkt, block_type, s);
274 av_log(s,
AV_LOG_ERROR,
"unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
275 block_type, block_type, block_type);
288 .
name =
"bethsoftvid",
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int bethsoft_global_delay
delay value between frames, added to individual frame delay.
static int vid_read_header(AVFormatContext *s)
static int vid_probe(AVProbeData *p)
#define AV_LOG_WARNING
Something somehow does not look correct.
int64_t pos
byte position in stream, -1 if unknown
AVCodecContext * codec
Codec context associated with this stream.
int index
stream index in AVFormatContext
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int ctx_flags
Flags signalling stream properties.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int sample_rate
audio sample rate
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define BVID_PALETTE_SIZE
static av_cold int read_close(AVFormatContext *ctx)
#define AV_LOG_VERBOSE
Detailed information.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define DEFAULT_SAMPLE_RATE
int video_index
video stream index
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
int flags
A combination of AV_PKT_FLAG values.
uint64_t channel_layout
Audio channel layout.
#define BUFFER_PADDING_SIZE
AVInputFormat ff_bethsoftvid_demuxer
int bit_rate
the average bitrate
int width
picture width / height.
AVStream ** streams
A list of all streams in the file.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int read_header(FFV1Context *f)
static int vid_read_close(AVFormatContext *s)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
int audio_index
audio stream index
This structure contains the data a format has to probe a file.
static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, uint8_t block_type, AVFormatContext *s)
#define MKTAG(a, b, c, d)
int64_t start_time
Decoding: pts of the first frame of the stream, in stream time base.
int eof_reached
true if eof reached
int channels
number of audio channels
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
static int vid_read_packet(AVFormatContext *s, AVPacket *pkt)
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.