Go to the documentation of this file.
67 int len, xmin, xmax, ymin, ymax;
92 if (xmin || ymin || !xmax || !ymax)
95 if (p->
buf[3] >= 20 || xmax < 16 || ymax < 16)
102 static int zlib_refill(
void *opaque,
uint8_t *buf,
int buf_size)
106 z_stream *z = &swf->zstream;
111 int n =
avio_read(
s->pb, swf->zbuf_in, ZBUF_SIZE);
114 z->next_in = swf->zbuf_in;
119 z->avail_out = buf_size;
122 if (
ret == Z_STREAM_END)
127 if (buf_size - z->avail_out == 0)
130 return buf_size - z->avail_out;
148 if (inflateInit(&swf->zstream) != Z_OK) {
152 if (!(swf->zbuf_in =
av_malloc(ZBUF_SIZE)) ||
153 !(swf->zbuf_out =
av_malloc(ZBUF_SIZE)) ||
159 swf->zpb->seekable = 0;
169 len = (4 * nbits - 3 + 7) / 8;
181 int sample_rate_code, sample_size_code;
196 sample_rate_code =
info>>2 & 3;
197 sample_size_code =
info>>1 & 1;
230 for (
i=0;
i<
s->nb_streams;
i++) {
252 for (
i=0;
i<
s->nb_streams;
i++) {
269 for (
i=0;
i<
s->nb_streams;
i++) {
283 if (((v>>4) & 15) == 2) {
296 for(
i=0;
i<
s->nb_streams;
i++) {
317 const int colormapbpp = 3 + alpha_bmp;
318 int linesize, colormapsize = 0;
321 const int bmp_fmt =
avio_r8(pb);
331 colormapsize =
avio_r8(pb) + 1;
335 linesize =
width * 2;
338 linesize =
width * 4;
342 goto bitmap_end_skip;
345 linesize =
FFALIGN(linesize, 4);
348 linesize >= INT_MAX /
height ||
349 linesize *
height >= INT_MAX - colormapsize * colormapbpp) {
351 goto bitmap_end_skip;
354 out_len = colormapsize * colormapbpp + linesize *
height;
356 ff_dlog(
s,
"bitmap: ch=%d fmt=%d %dx%d (linesize=%d) len=%d->%ld pal=%d\n",
357 ch_id, bmp_fmt,
width,
height, linesize,
len, out_len, colormapsize);
367 if (
len < 0 || (res = uncompress(buf, &out_len, zbuf,
len)) != Z_OK) {
369 goto bitmap_end_skip;
372 for (
i = 0;
i <
s->nb_streams;
i++) {
377 if (
i ==
s->nb_streams) {
392 if (!st->codecpar->width && !st->codecpar->height) {
394 st->codecpar->height =
height;
409 for (
i = 0;
i < colormapsize;
i++)
410 if (alpha_bmp) colormap[
i] = buf[3]<<24 |
AV_RB24(buf + 4*
i);
411 else colormap[
i] = 0xff
U <<24 |
AV_RB24(buf + 3*
i);
431 st->codecpar->format =
pix_fmt;
433 memcpy(
pkt->
data, buf + colormapsize*colormapbpp, linesize *
height);
448 for (
i = 0;
i <
s->nb_streams;
i++) {
470 for (
i=0;
i<
s->nb_streams;
i++) {
475 if (
i ==
s->nb_streams) {
531 inflateEnd(&
s->zstream);
#define AV_LOG_WARNING
Something somehow does not look correct.
AVInputFormat ff_swf_demuxer
static int swf_read_header(AVFormatContext *s)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
enum AVMediaType codec_type
General type of the encoded data.
#define AVERROR_EOF
End of file.
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
#define AV_CH_LAYOUT_MONO
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
static const AVCodecTag swf_audio_codec_tags[]
int buf_size
Size of buf except extra allocated bytes.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
unsigned int avio_rl16(AVIOContext *s)
#define AV_CH_LAYOUT_STEREO
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
const AVCodecTag ff_swf_codec_tags[]
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVStreamParseType need_parsing
static enum AVPixelFormat pix_fmt
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int read_header(FFV1Context *f)
This structure contains the data a format has to probe a file.
int sample_rate
Audio only.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int get_swf_tag(AVIOContext *pb, int *len_ptr)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
#define MKBETAG(a, b, c, d)
int avio_r8(AVIOContext *s)
@ TAG_DEFINEBITSLOSSLESS2
#define AV_LOG_INFO
Standard information.
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_PIX_FMT_RGB555
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
static int swf_probe(const AVProbeData *p)
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
int id
Format-specific stream ID.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static AVStream * create_new_audio_stream(AVFormatContext *s, int id, int info)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
uint64_t channel_layout
Audio only.
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
void * priv_data
Format private data.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.