100 #define BUFFER_PADDING_SIZE 1000
104 uint8_t * vidbuf_start =
NULL;
105 int vidbuf_nbytes = 0;
107 int bytes_copied = 0;
109 unsigned int vidbuf_capacity;
118 vidbuf_start[vidbuf_nbytes++] = block_type;
125 if(
avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
136 vidbuf_start[vidbuf_nbytes++] = code;
140 vidbuf_start[vidbuf_nbytes++] =
avio_r8(pb);
142 if(
avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
144 vidbuf_nbytes += code;
146 bytes_copied += code & 0x7F;
147 if(bytes_copied == npixels){
153 if(bytes_copied > npixels)
160 memcpy(pkt->
data, vidbuf_start, vidbuf_nbytes);
168 return vidbuf_nbytes;
179 unsigned char block_type;
191 if(ret_value != 3 * 256 + 1){
207 return ret_value != audio_length ?
AVERROR(EIO) : ret_value;
212 return read_frame(vid, pb, pkt, block_type, s,
221 av_log(s,
AV_LOG_ERROR,
"unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
222 block_type, block_type, block_type);
return -1;
227 .
name =
"bethsoftvid",
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
int bethsoft_global_delay
delay value between frames, added to individual frame delay.
static int vid_probe(AVProbeData *p)
int64_t pos
byte position in stream, -1 if unknown
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static int read_header(FFV1Context *f)
void av_free_packet(AVPacket *pkt)
Free a packet.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
struct BVID_DemuxContext BVID_DemuxContext
#define BUFFER_PADDING_SIZE
int avio_r8(AVIOContext *s)
AVCodecContext * codec
codec context
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVInputFormat ff_bethsoftvid_demuxer
int bit_rate
the average bitrate
int width
picture width / height.
static int vid_read_header(AVFormatContext *s, AVFormatParameters *ap)
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int read_probe(AVProbeData *p)
enum AVMediaType codec_type
int sample_rate
samples per second
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
This structure contains the data a format has to probe a file.
unsigned int avio_rl16(AVIOContext *s)
8 bit with PIX_FMT_RGB32 palette
int eof_reached
true if eof reached
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.
int channels
number of audio channels
void * priv_data
Format private data.
static int vid_read_packet(AVFormatContext *s, AVPacket *pkt)
#define MKTAG(a, b, c, d)
int video_pts
video presentation time stamp.
static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, uint8_t block_type, AVFormatContext *s, int npixels)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...