mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
8b6857b360
Usage: For an ANM file <somefile>.anm/ANM, EDuke32 looks for <somefile>.ivf, which is the VP8 stream transported by an IVF container. It can be extracted from a WebM file with e.g. mkvextract tracks <filename>.webm 1:<filename>.ivf (part of Mkvtoolnix, the Matroska toolset) Libvpx is required, and the 'YUV'-->RGB conversion is implemented using a fragment shader, so it's for OpenGL modes only. Also, this commit doesn't enable the code. Unfinished: sound, aspect correction for fullscreen w/ non-square pixels, ... ? --- Make MAXNODESPERLINE in engine_priv.h actually a macro that depends on MAXYSAVES and MAXDIM instead of using the obsolete precomputed value. I think this might have been the cause for the latest patched-up overhead view crash. git-svn-id: https://svn.eduke32.com/eduke32@1933 1a8010ca-5511-0410-912e-c29ae57300e0
83 lines
2 KiB
C
83 lines
2 KiB
C
#ifndef USE_OPENGL
|
|
# error "VP8 support requires OpenGL"
|
|
#endif
|
|
|
|
#ifndef ANIM_VPX_H
|
|
#define ANIM_VPX_H
|
|
|
|
#define VPX_CODEC_DISABLE_COMPAT 1
|
|
#include <vpx/vpx_decoder.h>
|
|
//#include <vpx/vp8dx.h>
|
|
|
|
// IVF format: http://wiki.multimedia.cx/index.php?title=IVF
|
|
#pragma pack(push,1)
|
|
typedef struct
|
|
{
|
|
char magic[4];
|
|
uint16_t version;
|
|
uint16_t hdrlen;
|
|
|
|
char fourcc[4];
|
|
uint16_t width;
|
|
uint16_t height;
|
|
|
|
uint32_t fpsnumer;
|
|
uint32_t fpsdenom;
|
|
|
|
uint32_t numframes;
|
|
uint32_t unused_;
|
|
} animvpx_ivf_header_t;
|
|
#pragma pack(pop)
|
|
|
|
const char *animvpx_read_ivf_header_errmsg[7];
|
|
int32_t animvpx_read_ivf_header(int32_t inhandle, animvpx_ivf_header_t *hdr);
|
|
|
|
|
|
typedef struct
|
|
{
|
|
const char *errmsg; // non-NULL if codec error? better always check...
|
|
const char *errmsg_detail; // may be NULL even if codec error
|
|
|
|
uint16_t width, height;
|
|
uint8_t *pic; // lines of [Y U V 0], calloc'ed on init
|
|
|
|
// VVV everything that follows should be considered private! VVV
|
|
|
|
int32_t inhandle; // the kread() file handle
|
|
|
|
// state of this struct:
|
|
// 0: uninited (either not yet or already)
|
|
// 1: codec init OK
|
|
// -1: error while initing
|
|
// -2: error while uniniting
|
|
int32_t initstate;
|
|
|
|
// decoder state:
|
|
// 0: first time / begin
|
|
// 1: have more frames
|
|
// 2: reached EOF
|
|
// -1: unspecified error
|
|
// -2: decoder error
|
|
int32_t decstate;
|
|
|
|
uint32_t compbuflen;
|
|
uint32_t compbufallocsiz;
|
|
uint8_t *compbuf; // compressed data buffer (one IVF/VP8 frame)
|
|
|
|
vpx_codec_ctx_t codec;
|
|
vpx_codec_iter_t iter;
|
|
} animvpx_codec_ctx;
|
|
|
|
|
|
int32_t animvpx_init_codec(const animvpx_ivf_header_t *info, int32_t inhandle, animvpx_codec_ctx *codec);
|
|
int32_t animvpx_uninit_codec(animvpx_codec_ctx *codec);
|
|
|
|
const char *animvpx_nextpic_errmsg[8];
|
|
int32_t animvpx_nextpic(animvpx_codec_ctx *codec, uint8_t **pic);
|
|
|
|
void animvpx_setup_glstate(void);
|
|
void animvpx_restore_glstate(void);
|
|
int32_t animvpx_render_frame(const animvpx_codec_ctx *codec);
|
|
|
|
|
|
#endif // !defined ANIM_VPX_H
|