UFO: Alien Invasion
Loading...
Searching...
No Matches
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>
Include dependency graph for cl_cinematic_ogm.cpp:

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

◆ OGG_BUFFER_SIZE

#define OGG_BUFFER_SIZE   (8 * 1024)

Definition at line 37 of file cl_cinematic_ogm.cpp.

Referenced by CIN_OGM_LoadBlockToSync().

◆ OGMCIN

◆ SIZEOF_RAWBUFF

#define SIZEOF_RAWBUFF   SAMPLE_SIZE * 1024

Definition at line 213 of file cl_cinematic_ogm.cpp.

Function Documentation

◆ CIN_OGM_CloseCinematic()

void CIN_OGM_CloseCinematic ( cinematic_t * cin)

◆ CIN_OGM_DrawCinematic()

◆ CIN_OGM_Init()

void CIN_OGM_Init ( void )

Definition at line 774 of file cl_cinematic_ogm.cpp.

References i, long(), and ogmCin_yuvTable.

Referenced by CIN_Init().

◆ CIN_OGM_LoadAudioFrame()

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 i, int(), M_AddToSampleBuffer(), cinematic_t::noSound, OBJZERO, OGMCIN, and rawBuffer.

Referenced by CIN_OGM_LoadFrame().

◆ CIN_OGM_LoadBlockToSync()

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().

◆ CIN_OGM_LoadFrame()

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().

◆ CIN_OGM_LoadPagesToStream()

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().

◆ CIN_OGM_LoadVideoFrame()

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().

◆ CIN_OGM_OpenCinematic()

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_t::cinematicType, CL_Milliseconds(), cinematic_t::codecData, Com_Printf(), FILE_READ, FS_OpenFile(), i, Mem_PoolAllocType, OGMCIN, and vid_genericPool.

Referenced by CIN_OpenCinematic().

◆ CIN_OGM_RunCinematic()

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

◆ ogmCin_yuvTable

yuvTable_t ogmCin_yuvTable
static

Definition at line 79 of file cl_cinematic_ogm.cpp.

Referenced by CIN_OGM_Init().

◆ rawBuffer

byte rawBuffer[SIZEOF_RAWBUFF]
static

Definition at line 214 of file cl_cinematic_ogm.cpp.

Referenced by CIN_OGM_LoadAudioFrame().