flicvideo.c File Reference

Autodesk Animator FLI/FLC Video Decoder by Mike Melanson (melan.nosp@m.son@.nosp@m.pcisy.nosp@m.s.ne.nosp@m.t) for more information on the .fli/.flc file format and all of its many variations, visit: http://www.compuphase.com/flic.htm. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "mathops.h"
Include dependency graph for flicvideo.c:

Go to the source code of this file.

Data Structures

struct  FlicDecodeContext
 

Macros

#define FLI_256_COLOR   4
 
#define FLI_DELTA   7
 
#define FLI_COLOR   11
 
#define FLI_LC   12
 
#define FLI_BLACK   13
 
#define FLI_BRUN   15
 
#define FLI_COPY   16
 
#define FLI_MINI   18
 
#define FLI_DTA_BRUN   25
 
#define FLI_DTA_COPY   26
 
#define FLI_DTA_LC   27
 
#define FLI_TYPE_CODE   (0xAF11)
 
#define FLC_FLX_TYPE_CODE   (0xAF12)
 
#define FLC_DTA_TYPE_CODE   (0xAF44) /* Marks an "Extended FLC" comes from Dave's Targa Animator (DTA) */
 
#define FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE   (0xAF13)
 
#define CHECK_PIXEL_PTR(n)
 

Typedefs

typedef struct FlicDecodeContext FlicDecodeContext
 

Functions

static av_cold int flic_decode_init (AVCodecContext *avctx)
 
static int flic_decode_frame_8BPP (AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size)
 
static int flic_decode_frame_15_16BPP (AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size)
 
static int flic_decode_frame_24BPP (AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size)
 
static int flic_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int flic_decode_end (AVCodecContext *avctx)
 

Variables

AVCodec ff_flic_decoder
 

Detailed Description

Autodesk Animator FLI/FLC Video Decoder by Mike Melanson (melan.nosp@m.son@.nosp@m.pcisy.nosp@m.s.ne.nosp@m.t) for more information on the .fli/.flc file format and all of its many variations, visit: http://www.compuphase.com/flic.htm.

This decoder outputs PAL8/RGB555/RGB565 and maybe one day RGB24 colorspace data, depending on the FLC. To use this decoder, be sure that your demuxer sends the FLI file header to the decoder via the extradata chunk in AVCodecContext. The chunk should be 128 bytes large. The only exception is for FLI files from the game "Magic Carpet", in which the header is only 12 bytes.

Definition in file flicvideo.c.

Macro Definition Documentation

#define CHECK_PIXEL_PTR (   n)
Value:
if (pixel_ptr + n > pixel_limit) { \
av_log (s->avctx, AV_LOG_ERROR, "Invalid pixel_ptr = %d > pixel_limit = %d\n", \
pixel_ptr + n, pixel_limit); \
} \
const char * s
Definition: avisynth_c.h:668
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:148
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 This method is called when a frame is wanted on an output For an 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 it should return

Definition at line 65 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLC_DTA_TYPE_CODE   (0xAF44) /* Marks an "Extended FLC" comes from Dave's Targa Animator (DTA) */

Definition at line 62 of file flicvideo.c.

#define FLC_FLX_TYPE_CODE   (0xAF12)

Definition at line 61 of file flicvideo.c.

Referenced by flic_decode_init().

#define FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE   (0xAF13)

Definition at line 63 of file flicvideo.c.

Referenced by flic_decode_frame_8BPP(), and flic_decode_init().

#define FLI_256_COLOR   4

Definition at line 48 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_BLACK   13

Definition at line 52 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_BRUN   15

Definition at line 53 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_COLOR   11

Definition at line 50 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_COPY   16

Definition at line 54 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_DELTA   7

Definition at line 49 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_DTA_BRUN   25

Definition at line 56 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP().

#define FLI_DTA_COPY   26

Definition at line 57 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP().

#define FLI_DTA_LC   27

Definition at line 58 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP().

#define FLI_LC   12

Definition at line 51 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_MINI   18

Definition at line 55 of file flicvideo.c.

Referenced by flic_decode_frame_15_16BPP(), and flic_decode_frame_8BPP().

#define FLI_TYPE_CODE   (0xAF11)

Definition at line 60 of file flicvideo.c.

Referenced by flic_decode_init().

Typedef Documentation

Function Documentation

static av_cold int flic_decode_end ( AVCodecContext avctx)
static

Definition at line 794 of file flicvideo.c.

static int flic_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 765 of file flicvideo.c.

static int flic_decode_frame_15_16BPP ( AVCodecContext avctx,
void data,
int *  got_frame,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 473 of file flicvideo.c.

Referenced by flic_decode_frame().

static int flic_decode_frame_24BPP ( AVCodecContext avctx,
void data,
int *  got_frame,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 757 of file flicvideo.c.

Referenced by flic_decode_frame().

static int flic_decode_frame_8BPP ( AVCodecContext avctx,
void data,
int *  got_frame,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 150 of file flicvideo.c.

Referenced by flic_decode_frame().

static av_cold int flic_decode_init ( AVCodecContext avctx)
static

Definition at line 81 of file flicvideo.c.

Variable Documentation

AVCodec ff_flic_decoder
Initial value:
= {
.name = "flic",
.priv_data_size = sizeof(FlicDecodeContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"),
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
struct FlicDecodeContext FlicDecodeContext
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
static int flic_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: flicvideo.c:765
static av_cold int flic_decode_end(AVCodecContext *avctx)
Definition: flicvideo.c:794
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868
static av_cold int flic_decode_init(AVCodecContext *avctx)
Definition: flicvideo.c:81

Definition at line 803 of file flicvideo.c.