SWILIB API (SG)    
Loading...
Searching...
No Matches
OBS

Detailed Description

Multifunction media framework: converting, resizing, rotating, streaming, recording and other.

Usage: #include <swilib.h> or #include <swilib/obs.h>

Data Structures

struct  OBSevent
 Event for Obs_TranslateMessageGBS. More...
 
struct  OBS_FILE_STREAM_METHODS
 Method table of the Obs file streams (see RamObsFileStreamMethods). More...
 

Typedefs

typedef int HObj
 
typedef struct OBSevent OBSevent
 
typedef struct OBS_FILE_STREAM_METHODS OBS_FILE_STREAM_METHODS
 

Enumerations

enum  ObsEventID {
  OBS_EV_NO_MSG = 0x00 ,
  OBS_EV_GetInfoCon = 0x01 ,
  OBS_EV_ConvDestroyed = 0x05 ,
  OBS_EV_ParamChanged = 0x06 ,
  OBS_EV_StatusChanged = 0x08 ,
  OBS_EV_StatusUpdated = 0x09 ,
  OBS_EV_FrameUpdate = 0x0A ,
  OBS_EV_LoopUpdate = 0x0B ,
  OBS_EV_Error = 0x0C ,
  OBS_EV_StopInd = 0x13 ,
  OBS_EV_PauseInd = 0x14 ,
  OBS_EV_ResumeInd = 0x15 ,
  OBS_EV_StopCon = 0x16 ,
  OBS_EV_PauseCon = 0x17 ,
  OBS_EV_ResumeCon = 0x18 ,
  OBS_EV_EndList = 0x2F
}
 OBS events for async mode. More...
 

Functions

HObj Obs_CreateObject (int uid_in, int uid_out, int prio, int msg_callback, int emb4, int sync, uint32_t *err)
 Create OBS object.
 
int Obs_DestroyObject (HObj obs)
 Destroy OBS object.
 
int Obs_SetInput_File (HObj obs, int unk, WSHDR *path)
 Use the file as input.
 
int Obs_SetInput_Memory (HObj obs, int unk, char *buf, int len)
 Use the memory as input.
 
int Obs_GetInputImageSize (HObj obs, short *w, short *h)
 Get the resolution of the input image.
 
int Obs_Graphics_SetClipping (HObj obs, short x, short y, short w, short h)
 Clip image.
 
int Obs_SetRenderOffset (HObj obs, short x, short y)
 Set render offset.
 
int Obs_SetOutputImageSize (HObj obs, short w, short h)
 Resize image.
 
int Obs_SetRotation (HObj obs, int angle)
 Rotate image.
 
int Obs_SetScaling (HObj obs, int method)
 Set scaling method.
 
int Obs_Prepare (HObj obs)
 Prepare before start.
 
int Obs_Start (HObj obs)
 Start processing.
 
int Obs_Stop (HObj obs)
 Stop processing.
 
int Obs_Pause (HObj obs)
 Pause processing.
 
int Obs_Resume (HObj obs)
 Resume paused processing.
 
int Obs_Output_GetPictstruct (HObj obs, IMGHDR **img)
 Get the IMGHDR of the input image.
 
int Obs_GetInfo (HObj obs, int unk)
 Get information from the input file.
 
int Obs_TranslateMessageGBS (const GBS_MSG *msg, const OBSevent *handlers)
 Process async callbacks from GBS message.
 
int Obs_SetPosition (HObj obs, int position)
 Set the given position for playing audio or video.
 
static int Obs_GetPosition (HObj obs, int *position)
 Get the current position of playing audio or video.
 
static int Obs_GetDuration (HObj obs, int *position)
 Get the duration of playing audio or video.
 
int Obs_Mam_SetPurpose (HObj obs, char purpose)
 Set purpose for MAM.
 
int Obs_Sound_SetPurpose (HObj obs, int purpose)
 Set purpose for Sound.
 
int Obs_Sound_SetVolumeEx (HObj obs, char volume, char delta)
 Set sound volume.
 
int Obs_Sound_GetVolume (HObj obs, char *volume)
 Get current sound volume.
 
int Obs_Sound_SetAMRFormat (HObj obs, int format)
 Set AMR format.
 
int Obs_Sound_SetAMRDTX (HObj obs, int dtx)
 Set AMR DTX.
 
int Obs_Sound_SetNofChannels (HObj obs, int num_channels)
 Set count of the channels.
 
int Obs_Sound_SetAMRMode (HObj obs, int data_rate)
 Set AMR data rate.
 
int Obs_Sound_SetFIsRecording (HObj obs, int is_recording)
 Set recording mode.
 
int Obs_Sound_SetMaxFileSize (HObj obs, int max_file_size)
 Set maximum file size.
 
int Obs_Sound_SetRecordingMode (HObj obs, int recording_mode)
 Set mode of the recording.
 
int Obs_SetOutput_File (HObj obs, const char *filename)
 Set output filename.
 
int Obs_SetOutput_Uid (HObj obs, int uid)
 Set output file type (extension UID).
 
int Obs_Sound_SetBitrate (HObj obs, int bitrate)
 Set sound bitrate.
 
int Obs_SetUserPointer (HObj obs, void *user_pointer)
 Set custom user pointer to the OBS object.
 
int Obs_SetCSM (HObj obs, CSM_RAM *csm)
 Link CSM to the OBS object.
 
int Obs_GetUserPointer (HObj obs, void **p_user_pointer)
 Get custom user pointer from the OBS object.
 
void * Obs_MemAlloc (int size)
 Allocate memory from the Obs heap (the pool of the Obs file stream chunks).
 
void Obs_MemFree (void *ptr)
 Free memory allocated with Obs_MemAlloc.
 
OBS_FILE_STREAM_METHODS * RamObsFileStreamMethods (void)
 Get the global method table of the Obs file streams, shared by all file stream objects.
 

Data Structure Documentation

◆ OBSevent

struct OBSevent

◆ OBS_FILE_STREAM_METHODS

struct OBS_FILE_STREAM_METHODS

Typedef Documentation

◆ HObj

typedef int HObj

Definition at line 21 of file obs.h.

◆ OBSevent

typedef struct OBSevent OBSevent

Definition at line 22 of file obs.h.

◆ OBS_FILE_STREAM_METHODS

typedef struct OBS_FILE_STREAM_METHODS OBS_FILE_STREAM_METHODS

Definition at line 23 of file obs.h.

Enumeration Type Documentation

◆ ObsEventID

enum ObsEventID

OBS events for async mode.

Enumerator
OBS_EV_NO_MSG 
OBS_EV_GetInfoCon 
OBS_EV_ConvDestroyed 
OBS_EV_ParamChanged 
OBS_EV_StatusChanged 
OBS_EV_StatusUpdated 
OBS_EV_FrameUpdate 
OBS_EV_LoopUpdate 
OBS_EV_Error 
OBS_EV_StopInd 
OBS_EV_PauseInd 
OBS_EV_ResumeInd 
OBS_EV_StopCon 
OBS_EV_PauseCon 
OBS_EV_ResumeCon 
OBS_EV_EndList 

Definition at line 36 of file obs.h.

Function Documentation

◆ Obs_CreateObject()

HObj Obs_CreateObject ( int uid_in,
int uid_out,
int prio,
int msg_callback,
int emb4,
int sync,
uint32_t * err )

Create OBS object.

Parameters
uid_inUID of file type for input
uid_outUID of file type for output
priopriority
msg_callbackGBS message ID for async operations
emb4unknown, set to 1
sync1: sync mode, 0: async mode
[out]errerror code
Returns
OBS object or 0

◆ Obs_DestroyObject()

int Obs_DestroyObject ( HObj obs)

Destroy OBS object.

Parameters
obsOBS object
Returns
0 or error

◆ Obs_SetInput_File()

int Obs_SetInput_File ( HObj obs,
int unk,
WSHDR * path )

Use the file as input.

Parameters
obsOBS object
unkunknown, set to 0
pathpath to the file
Returns
0 or error

◆ Obs_SetInput_Memory()

int Obs_SetInput_Memory ( HObj obs,
int unk,
char * buf,
int len )

Use the memory as input.

Parameters
obsOBS object
unkunknown, set to 0
bufpointer to the input buffer
lensize of the input buffer
Returns
0 or error

◆ Obs_GetInputImageSize()

int Obs_GetInputImageSize ( HObj obs,
short * w,
short * h )

Get the resolution of the input image.

Parameters
obsOBS object
[out]w,himage resolution
Returns
0 or error

◆ Obs_Graphics_SetClipping()

int Obs_Graphics_SetClipping ( HObj obs,
short x,
short y,
short w,
short h )

Clip image.

Parameters
obsOBS object
x,y,w,hclipping region
Returns
0 or error

◆ Obs_SetRenderOffset()

int Obs_SetRenderOffset ( HObj obs,
short x,
short y )

Set render offset.

Parameters
obsOBS object
x,yrender offset
Returns
0 or error

◆ Obs_SetOutputImageSize()

int Obs_SetOutputImageSize ( HObj obs,
short w,
short h )

Resize image.

Parameters
obsOBS object
w,hnew image resolution
Returns
0 or error

◆ Obs_SetRotation()

int Obs_SetRotation ( HObj obs,
int angle )

Rotate image.

Parameters
obsOBS object
anglerotate image using this angle (0, 90, 180, 270)
Returns
0 or error

◆ Obs_SetScaling()

int Obs_SetScaling ( HObj obs,
int method )

Set scaling method.

Parameters
obsOBS object
methodset to 5
Returns
0 or error

◆ Obs_Prepare()

int Obs_Prepare ( HObj obs)

Prepare before start.

Parameters
obsOBS object
Returns
0 or error

◆ Obs_Start()

int Obs_Start ( HObj obs)

Start processing.

Parameters
obsOBS object
Returns
0 or error

◆ Obs_Stop()

int Obs_Stop ( HObj obs)

Stop processing.

Parameters
obsOBS object
Returns
0 or error

◆ Obs_Pause()

int Obs_Pause ( HObj obs)

Pause processing.

Parameters
obsOBS object
Returns
0 or error

◆ Obs_Resume()

int Obs_Resume ( HObj obs)

Resume paused processing.

Parameters
obsOBS object
Returns
0 or error

◆ Obs_Output_GetPictstruct()

int Obs_Output_GetPictstruct ( HObj obs,
IMGHDR ** img )

Get the IMGHDR of the input image.

Parameters
obsOBS object
[out]imgIMGHDR pointer
Returns
0 or error

◆ Obs_GetInfo()

int Obs_GetInfo ( HObj obs,
int unk )

Get information from the input file.

Parameters
obsOBS object
unkunknown, set to 1 or 0
Returns
0 or error

◆ Obs_TranslateMessageGBS()

int Obs_TranslateMessageGBS ( const GBS_MSG * msg,
const OBSevent * handlers )

Process async callbacks from GBS message.

Parameters
msgmessage from GBS
handlersasync callbacks (array of OBSevent)
Returns
0 or error

◆ Obs_SetPosition()

int Obs_SetPosition ( HObj obs,
int position )

Set the given position for playing audio or video.

Parameters
obsOBS object
positionposition in ms
Returns
0 or error

◆ Obs_GetPosition()

static int Obs_GetPosition ( HObj obs,
int * position )
inlinestatic

Get the current position of playing audio or video.

Parameters
obsOBS object
[out]positionposition in ms
Returns
0 or error

Definition at line 290 of file obs.h.

◆ Obs_GetDuration()

static int Obs_GetDuration ( HObj obs,
int * position )
inlinestatic

Get the duration of playing audio or video.

Parameters
obsOBS object
[out]positionduration in ms
Returns
0 or error

Definition at line 300 of file obs.h.

◆ Obs_Mam_SetPurpose()

int Obs_Mam_SetPurpose ( HObj obs,
char purpose )

Set purpose for MAM.

Parameters
obsOBS object
purposeunknown
Returns
0 or error

◆ Obs_Sound_SetPurpose()

int Obs_Sound_SetPurpose ( HObj obs,
int purpose )

Set purpose for Sound.

Parameters
obsOBS object
purposeunknown
Returns
0 or error

◆ Obs_Sound_SetVolumeEx()

int Obs_Sound_SetVolumeEx ( HObj obs,
char volume,
char delta )

Set sound volume.

Parameters
obsOBS object
volumevolume level, 0-15
deltaunknown, set to 1
Returns
0 or error

◆ Obs_Sound_GetVolume()

int Obs_Sound_GetVolume ( HObj obs,
char * volume )

Get current sound volume.

Parameters
obsOBS object
[out]volumecurrent volume level, 0-15
Returns
0 or error

◆ Obs_Sound_SetAMRFormat()

int Obs_Sound_SetAMRFormat ( HObj obs,
int format )

Set AMR format.

Parameters
obsOBS object
formatAMR format
Returns
0 or error

◆ Obs_Sound_SetAMRDTX()

int Obs_Sound_SetAMRDTX ( HObj obs,
int dtx )

Set AMR DTX.

Parameters
obsOBS object
dtxARM DTX value
Returns
0 or error

◆ Obs_Sound_SetNofChannels()

int Obs_Sound_SetNofChannels ( HObj obs,
int num_channels )

Set count of the channels.

Parameters
obsOBS object
num_channelschannels count
Returns
0 or error

◆ Obs_Sound_SetAMRMode()

int Obs_Sound_SetAMRMode ( HObj obs,
int data_rate )

Set AMR data rate.

Parameters
obsOBS object
data_rateAMR data rate value
Returns
0 or error

◆ Obs_Sound_SetFIsRecording()

int Obs_Sound_SetFIsRecording ( HObj obs,
int is_recording )

Set recording mode.

Parameters
obsOBS object
is_recordingset to 1 when recording
Returns
0 or error

◆ Obs_Sound_SetMaxFileSize()

int Obs_Sound_SetMaxFileSize ( HObj obs,
int max_file_size )

Set maximum file size.

Parameters
obsOBS object
max_file_sizemaximum file szie value
Returns
0 or error

◆ Obs_Sound_SetRecordingMode()

int Obs_Sound_SetRecordingMode ( HObj obs,
int recording_mode )

Set mode of the recording.

Parameters
obsOBS object
recording_modemode of the recording
Returns
0 or error

◆ Obs_SetOutput_File()

int Obs_SetOutput_File ( HObj obs,
const char * filename )

Set output filename.

Parameters
obsOBS object
filenamefilename for output file
Returns
0 or error
Warning
Different function signatures across platforms!

◆ Obs_SetOutput_Uid()

int Obs_SetOutput_Uid ( HObj obs,
int uid )

Set output file type (extension UID).

Parameters
obsOBS object
uidextension UID
Returns
0 or error

◆ Obs_Sound_SetBitrate()

int Obs_Sound_SetBitrate ( HObj obs,
int bitrate )

Set sound bitrate.

Parameters
obsOBS object
bitratebitrate value
Returns
0 or error

◆ Obs_SetUserPointer()

int Obs_SetUserPointer ( HObj obs,
void * user_pointer )

Set custom user pointer to the OBS object.

Parameters
obsOBS object
user_pointercustom user pointer
Returns
0 or error

◆ Obs_SetCSM()

int Obs_SetCSM ( HObj obs,
CSM_RAM * csm )

Link CSM to the OBS object.

Parameters
obsOBS object
csmpointer to the csm
Returns
0 or error
Deprecated
Function with wrong name, use instead Obs_SetUserPointer

◆ Obs_GetUserPointer()

int Obs_GetUserPointer ( HObj obs,
void ** p_user_pointer )

Get custom user pointer from the OBS object.

Parameters
obsOBS object
p_user_pointerpointer to variable that receives the stored pointer
Returns
0 or error

◆ Obs_MemAlloc()

void * Obs_MemAlloc ( int size)

Allocate memory from the Obs heap (the pool of the Obs file stream chunks).

The file stream's get method returns its chunks from here; the reader frees them with Obs_MemFree.

Parameters
sizesize in bytes
Returns
pointer to the memory, or NULL

◆ Obs_MemFree()

void Obs_MemFree ( void * ptr)

Free memory allocated with Obs_MemAlloc.

Parameters
ptrpointer to the memory

◆ RamObsFileStreamMethods()

OBS_FILE_STREAM_METHODS * RamObsFileStreamMethods ( void )

Get the global method table of the Obs file streams, shared by all file stream objects.

Swapping methods serves virtual files to the player (s65-mp3, radio).

Returns
method table
Note
On X75 the table may have more methods than declared.