UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_cinematic_ogm.cpp File Reference
#include "cl_cinematic_ogm.h"
#include "cl_cinematic.h"
#include "../client.h"
#include "../renderer/r_draw.h"
#include "../sound/s_main.h"
#include "../sound/s_music.h"
#include <ogg/ogg.h>
#include <vorbis/codec.h>

Go to the source code of this file.

Data Structures

struct  yuvTable_t
 
struct  ogmCinematic_t
 

Macros

#define OGG_BUFFER_SIZE   (8 * 1024)
 
#define OGMCIN   (*((ogmCinematic_t*)cin->codecData))
 
#define SIZEOF_RAWBUFF   SAMPLE_SIZE * 1024
 

Functions

static int CIN_OGM_LoadBlockToSync (cinematic_t *cin)
 
static int CIN_OGM_LoadPagesToStream (cinematic_t *cin)
 
static bool CIN_OGM_LoadAudioFrame (cinematic_t *cin)
 
static int CIN_OGM_LoadVideoFrame (cinematic_t *cin)
 
static bool CIN_OGM_LoadFrame (cinematic_t *cin)
 
int CIN_OGM_OpenCinematic (cinematic_t *cin, const char *filename)
 
static void CIN_OGM_DrawCinematic (cinematic_t *cin)
 
bool CIN_OGM_RunCinematic (cinematic_t *cin)
 
void CIN_OGM_CloseCinematic (cinematic_t *cin)
 
void CIN_OGM_Init (void)
 

Variables

static yuvTable_t ogmCin_yuvTable
 
static byte rawBuffer [SIZEOF_RAWBUFF]
 

Detailed Description

Note
Taken from World Of Padman Engine
This is a "ogm"-decoder to use a "better" (smaller files, higher resolutions) Cinematic-Format than roq In this code "ogm" is only: ogg wrapper, vorbis audio, xvid video (or theora video) (ogm(Ogg Media) in general is ogg wrapper with all kind of audio/video/subtitle/...)

Definition in file cl_cinematic_ogm.cpp.

Macro Definition Documentation

#define OGG_BUFFER_SIZE   (8 * 1024)

Definition at line 37 of file cl_cinematic_ogm.cpp.

Referenced by CIN_OGM_LoadBlockToSync().

#define SIZEOF_RAWBUFF   SAMPLE_SIZE * 1024

Definition at line 213 of file cl_cinematic_ogm.cpp.

Function Documentation

void CIN_OGM_CloseCinematic ( cinematic_t cin)
static void CIN_OGM_DrawCinematic ( cinematic_t cin)
static
void CIN_OGM_Init ( void  )

Definition at line 774 of file cl_cinematic_ogm.cpp.

References f, i, long(), yuvTable_t::ub, yuvTable_t::ug, yuvTable_t::vg, yuvTable_t::vr, and yuvTable_t::yy.

Referenced by CIN_Init().

static bool CIN_OGM_LoadAudioFrame ( cinematic_t cin)
static
Returns
true if audio wants more packets

Definition at line 219 of file cl_cinematic_ogm.cpp.

References f, i, int(), M_AddToSampleBuffer(), cinematic_s::noSound, OBJZERO, OGMCIN, and rawBuffer.

Referenced by CIN_OGM_LoadFrame().

static int CIN_OGM_LoadBlockToSync ( cinematic_t cin)
static
Returns
!0 -> no data transferred

Definition at line 162 of file cl_cinematic_ogm.cpp.

References FS_Read(), OGG_BUFFER_SIZE, and OGMCIN.

Referenced by CIN_OGM_LoadFrame(), and CIN_OGM_OpenCinematic().

static bool CIN_OGM_LoadFrame ( cinematic_t cin)
static
Returns
true => noDataTransfered

Definition at line 473 of file cl_cinematic_ogm.cpp.

References CIN_OGM_LoadAudioFrame(), CIN_OGM_LoadBlockToSync(), CIN_OGM_LoadPagesToStream(), CIN_OGM_LoadVideoFrame(), and OGMCIN.

Referenced by CIN_OGM_RunCinematic().

static int CIN_OGM_LoadPagesToStream ( cinematic_t cin)
static
Returns
!0 -> no data transferred (or not for all streams)

Definition at line 181 of file cl_cinematic_ogm.cpp.

References OGMCIN.

Referenced by CIN_OGM_LoadFrame(), and CIN_OGM_OpenCinematic().

static int CIN_OGM_LoadVideoFrame ( cinematic_t cin)
static
Returns
1 -> loaded a new frame (OGMCIN.outputBuffer points to the actual frame), 0 -> no new frame <0 -> error
1 -> loaded a new frame (OGMCIN.outputBuffer points to the actual frame), 0 -> no new frame <0 -> error

Definition at line 448 of file cl_cinematic_ogm.cpp.

References OGMCIN.

Referenced by CIN_OGM_LoadFrame().

int CIN_OGM_OpenCinematic ( cinematic_t cin,
const char *  filename 
)
Returns
0 -> no problem
Todo:

vorbis/theora-header & init in sub-functions

"clean" error-returns ...

Todo:
FIXME? can serialno be 0 in ogg? (better way to check initialized?)
Todo:
support for more than one audio stream? / detect files with one stream(or without correct ones)

Definition at line 549 of file cl_cinematic_ogm.cpp.

References CIN_OGM_CloseCinematic(), CIN_OGM_LoadBlockToSync(), CIN_OGM_LoadPagesToStream(), CINEMATIC_TYPE_OGM, cinematic_s::cinematicType, CL_Milliseconds(), cinematic_s::codecData, Com_Printf(), FILE_READ, FS_OpenFile(), i, Mem_PoolAllocType, OGMCIN, and vid_genericPool.

Referenced by CIN_OpenCinematic().

bool CIN_OGM_RunCinematic ( cinematic_t cin)
Returns
true if the cinematic is still running, false otherwise

Definition at line 722 of file cl_cinematic_ogm.cpp.

References CIN_OGM_DrawCinematic(), CIN_OGM_LoadFrame(), CL_Milliseconds(), and OGMCIN.

Referenced by CIN_RunCinematic().

Variable Documentation

yuvTable_t ogmCin_yuvTable
static

Definition at line 79 of file cl_cinematic_ogm.cpp.

byte rawBuffer[SIZEOF_RAWBUFF]
static

Definition at line 214 of file cl_cinematic_ogm.cpp.

Referenced by CIN_OGM_LoadAudioFrame().