CRI Sofdec2  Last Updated: 2022-11-21 16:25 p

Data Structures

struct  CriManaLibConfig
 Mana library initialization parameters. More...
 
struct  CriManaPlaybackCommonParams
 Basic parameters for playback work. More...
 

Macros

#define criMana_SetDefaultLibConfig(p_config)
 Set default values for the library initialization config structure. More...
 
#define CriManaMetaMallocFunc   CriManaMallocFunc
 Memory allocation function for meta data work. More...
 
#define CriManaMetaFreeFunc   CriManaFreeFunc
 Memory release function for meta data work. More...
 

Typedefs

typedef void *(* CriManaMallocFunc) (void *obj, CriUint32 size)
 Memory allocation function. More...
 
typedef void(* CriManaFreeFunc) (void *obj, void *mem)
 Memory release function. More...
 

Enumerations

enum  CriManaThreadModel { CRIMANA_THREAD_MODEL_MULTI = 0 , CRIMANA_THREAD_MODEL_SINGLE = 1 , CRIMANA_THREAD_MODEL_ENUM_SIZE_IS_4BYTES = 0x7FFFFFFF }
 Thread model. More...
 
enum  CriManaDecodeMode { CRIMANA_DECODE_MODE_NORMAL = 0 , CRIMANA_DECODE_MODE_B_SKIP = 1 , CRIMANA_DECODE_MODE_ENUM_SIZE_IS_4BYTES = 0x7FFFFFFF }
 Decoder operation mode. More...
 

Functions

const CriChar8 * criMana_GetLibraryVersionString (void)
 Returns the version number of the Mana library and build information. More...
 
void criMana_SetUserAllocator (CriManaMallocFunc malloc_func, CriManaFreeFunc free_func, void *obj)
 Register user allocator. More...
 
CriSint32 criMana_CalculateLibWorkSize (const CriManaLibConfig *config)
 Calculate library initialization work area size. More...
 
void criMana_Initialize (const CriManaLibConfig *config, void *work, CriSint32 work_size)
 Library initialization. More...
 
void criMana_InitializeFrameARGB32 (void)
 Initialize frame conversion (32bit ARGB8888 format) More...
 
void criMana_Finalize (void)
 Finalize library. More...
 
CriBool criMana_IsInitialized (void)
 Get library initialization status. More...
 
void criMana_ExecuteMain (void)
 Execute server processing. More...
 
void criMana_SyncMasterTimer (void)
 Synchronize with the master timer. More...
 
void criMana_AdvanceManualTimer (void)
 
void criMana_ExecuteVideoProcess (void)
 Decode video (all handles at once) More...
 
void criMana_SetDecodeSkipFlag (CriBool flag)
 Set the decoding skip flag (all handles at once) More...
 
void criMana_SetAllPauseFlag (CriBool flag)
 Set overall pause (all handles together) More...
 
CriBool criMana_GetAllPauseFlag (void)
 Get the overall pause flag. More...
 
void criMana_Lock (void)
 Prevent decoding interruptions. More...
 
void criMana_Unlock (void)
 Cancel decoding interruption prevention. More...
 
void criMana_UseStreamerManager (CriBool flag)
 Set control flag on whether to use the streaming management module. More...
 
CriBool criMana_IsStreamerManagerUsed (void)
 Get the control flag as to whether or not to use the streaming management module. More...
 
void criManaPlayer_SetExtDecoderWorkAllocator (CriManaPlayerHn player, CriManaExtDecoderWorkMallocFunc allocfunc, CriManaExtDecoderWorkFreeFunc freefunc, void *obj)
 Register callback for extended decoder work allocation. More...
 
void criManaPlayer_SetSoundCategoryByName (CriManaPlayerHn player, CriUint32 track_id, const CriChar8 *category_name)
 Audio track category setting. More...
 
void criManaPlayer_UnsetSoundCategory (CriManaPlayerHn player, CriUint32 track_id)
 Delete audio track category. More...
 

Detailed Description

Macro Definition Documentation

◆ criMana_SetDefaultLibConfig

#define criMana_SetDefaultLibConfig (   p_config)
Value:
{\
(p_config)->max_decoder_handles = 4;\
(p_config)->thread_model = CRIMANA_THREAD_MODEL_MULTI;\
(p_config)->version = CRIMANA_VERSION;\
(p_config)->version_string = CRIMANA_VER_NAME;\
}
@ CRIMANA_THREAD_MODEL_MULTI
Definition: cri_mana.h:256

Set default values for the library initialization config structure.

Parameters
[out]p_configPointer to the initialization config structure
Description:
Sets the default values for the config structure ( CriManaLibConfig ) that will be set to the criMana_Initialize function.
Notes:
Platform specific functions may exist on each platform. See the reference for each platform for more information.
See also
CriManaLibConfig

◆ CriManaMetaMallocFunc

#define CriManaMetaMallocFunc   CriManaMallocFunc

Memory allocation function for meta data work.

Description:
Interface for allocating the meta data work area.
See also
criManaPlayer_SetMetaDataWorkAllocator

◆ CriManaMetaFreeFunc

#define CriManaMetaFreeFunc   CriManaFreeFunc

Memory release function for meta data work.

Description:
Interface for releasing the meta data work area.
See also
criManaPlayer_SetMetaDataWorkAllocator

Typedef Documentation

◆ CriManaMallocFunc

typedef void*( * CriManaMallocFunc) (void *obj, CriUint32 size)

Memory allocation function.

Parameters
[in]objUser specified object
[in]sizeRequested memory size (in bytes)
Returns
void* Allocated memory address (NULL if failed)
Description:
Interface for registering the memory allocation function.
Used when you want to replace memory allocation that the CRI Mana performs within the library with the user's own memory allocation.
Notes:
The memory size needed for the size is set when the callback function is executed.
Allocate memory for the size to the callback function and return the allocated memory address as a return value.
The user specified object registered by the criMana_SetUserAllocator function will be passed into the argument obj.
When you allocate memory and need to reference the memory manger, set the said object into the criMana_SetUserAllocator function argument and reference it through this callback function argument.
Attention
Be aware that if memory allocation fails, an error callback may be returned and you may fail to call the original function.
See also
CriManaFreeFunc, criMana_SetUserAllocator

◆ CriManaFreeFunc

typedef void( * CriManaFreeFunc) (void *obj, void *mem)

Memory release function.

Parameters
[in]objUser specified object
[in]memAddress of memory to release
Returns
None
Description:
Interface for registering the memory release function.
Used when you want to replace the memory release that the CRI Mana performs within the library with the user's own memory release.
Notes:
The address of the memory to be released into mem will be set when the callback function is executed.
Release the memory into the mem area with a callback function. The user specified object registered to the criMana_SetUserAllocator function will be passed into the argument obj.
When you allocate memory and need to reference the memory manger, set the said object into the criMana_SetUserAllocator function argument and reference it through this callback function argument.
See also
CriManaMallocFunc, criMana_SetUserAllocator

Enumeration Type Documentation

◆ CriManaThreadModel

Thread model.

Description:
Displays what kind of thread model the CRI Mana library operates on.
See also
CriManaLibConfig, criMana_CalculateLibWorkSize, criMana_Initialize
Enumerator
CRIMANA_THREAD_MODEL_MULTI 

Multi-thread operation model.

CRIMANA_THREAD_MODEL_SINGLE 

Single thread operation model.

◆ CriManaDecodeMode

Decoder operation mode.

Description:
Displays the decoder operation mode
See also
criManaPlayer_SetDecodeMode
Enumerator
CRIMANA_DECODE_MODE_NORMAL 

Normal decoding mode.

Description:
Executes normal decoding.
Default values for the Mana library and Mana player.
CRIMANA_DECODE_MODE_B_SKIP 

Forced B picture skip mode.

Description:
Decoding will not be executed on B pictures if they are included in the video stream of the movie data being played.
Specify this operation mode if you want to decrease the load during movie play back.
Notes:
Only the Sofdec.Prime codec is supported.

Function Documentation

◆ criMana_GetLibraryVersionString()

const CriChar8* criMana_GetLibraryVersionString ( void  )

Returns the version number of the Mana library and build information.

Returns
const CriChar8 * Library information string
Call conditions:
This is thread safe.
Description:
Displays the library information, build time, and platform information.

◆ criMana_SetUserAllocator()

void criMana_SetUserAllocator ( CriManaMallocFunc  malloc_func,
CriManaFreeFunc  free_func,
void *  obj 
)

Register user allocator.

Parameters
[in]malloc_funcMemory allocation function
[in]free_funcMemory release function
[in]objUser object (optional)
Call conditions:
Call this before the criMana_Initialize function.

This is not thread safe.
Description:
Registers a memory allocator (memory allocation/release functions) in the CRI Mana library.
Used when you want to replace the memory release that the CRI Mana performs within the library with the user's own memory release.
Notes:
The registered memory allocator may be called by multiple threads. Register a multi-thread safe allocator.
See also
CriManaMallocFunc, CriManaFreeFunc

◆ criMana_CalculateLibWorkSize()

CriSint32 criMana_CalculateLibWorkSize ( const CriManaLibConfig config)

Calculate library initialization work area size.

Parameters
[in]configInitialization config structure
Returns
CriSint32 Library work area size
Call conditions:
This is thread safe.
Description:
Gets the work area size necessary for using the Mana library.
The work area size that the library needs changes depending on the nature of the library's initialization config structure.
The argument config information is only referenced in the function. The config area can be released without problem after the function is executed.
Notes:
Specific functions may exist on each platform. See the reference for each platform for more information.

◆ criMana_Initialize()

void criMana_Initialize ( const CriManaLibConfig config,
void *  work,
CriSint32  work_size 
)

Library initialization.

Parameters
[in]configInitialization config structure
[in]workWork area address allocated on the app side (aligned internally)
[in]work_sizeWork area size (=criMana_CalculateLibWorkSize return value)
Call conditions:
Call after the AtomEx library has been initialized and before all CRI Mana API.

This is not thread safe.
Description:
Initializes the Mana library.
You will always need to execute this function to use the library functions.

When initializing the library, you will need to allocate the memory area (work area) so that the library can use it internally.

Specify the maximum number of handle resources that are used concurrently and the thread model with this function. If you want to adjust the number of handle resources midway, stop all playback and recall this function once it is completed using the criMana_Finalize function.
When specifying NULL in work and zero in work_size, it will use the memory allocation function registered by the criMana_SetUserAllocator function and allocate memory internally.
Notes:
The work area size that the library needs changes to meet the nature of the initialization config structure.
The size of the work area required will also differ depending on the platform.
The argument config information will only be referenced in the function.
It cannot be referenced after exiting this function, so releasing the config area after the function has been executed will not cause problems
Notes:
Specific functions may exist on each platform. See the reference for each platform for more information.
See also
criMana_Finalize

◆ criMana_InitializeFrameARGB32()

void criMana_InitializeFrameARGB32 ( void  )

Initialize frame conversion (32bit ARGB8888 format)

Call conditions:
Execute this function after initializing the CRI Mana library.
This is not thread safe.
Description:
Initialization function necessary for grabbing a frame in 32bit ARGB8888 format.
Always call this function before the grab function when grabbing a frame in the above format.

Notes
Calling this function will link the static memory area (several hundred KB) required to the internal frame color conversion. Therefore, do not use this function with applications that grab frames in other formats that do not use the above format.
See also
criManaPlayer_CopyFrameToBufferARGB32

◆ criMana_Finalize()

void criMana_Finalize ( void  )

Finalize library.

Call conditions:
All handles will be in the CRIMANAPLAYER_STATUS_STOP or CRIMANAPLAYER_STATUS_PLAYEND status.
Call the AtomEx library finalization function after this function.

This is not thread safe.
Description:
Finalizes the Mana library.
Notes:
Specific functions may exist on each platform. See the reference for each platform for more information.
See also
criMana_Initialize

◆ criMana_IsInitialized()

CriBool criMana_IsInitialized ( void  )

Get library initialization status.

Returns
CriBool True if the library was initialized, false otherwise
Return values
CRI_FALSEUninitialized
CRI_TRUEInitialized
Description:
Check if the CRI Mana library has already been initialized.
See also
criMana_Initialize, criMana_Finalize

◆ criMana_ExecuteMain()

void criMana_ExecuteMain ( void  )

Execute server processing.

Call conditions:
Library initialization is complete.

This is not thread safe.
Description:
Updates the internal status of the Mana library.
The application will need to periodically execute this function.

Use the criManaPlayer_ExecuteMain function when you want to manage the updating of the internal status of each handle.

Attention
Unlike the CRI Atom library's criAtomEx_ExecuteMain function, this function will not automatically execute itself periodically in the Mana library, even if CRIMANA_THREAD_MODEL_MULTI is set. Therefore, delaying the calling of this function may cause stuttering during movie playback.

◆ criMana_SyncMasterTimer()

void criMana_SyncMasterTimer ( void  )

Synchronize with the master timer.

Call conditions:
Library initialization is complete.

This is not thread safe. Executing with a separate thread may cause a bad time returned by GetTime.
Description:
Synchronizes all Mana player handle playback times in the master timer.
Use the criManaPlayer_SyncMasterTimer function if you want to manage the master timer time synchronization for each handle.
Attention
At a minimum, this function needs to be called in a shorter cycle than the frame rate.

◆ criMana_AdvanceManualTimer()

void criMana_AdvanceManualTimer ( void  )
Call conditions:
Library initialization is complete.

This is not thread safe.
Description:
Advances the manual timer time of all Mana player handles. Refer to the criManaPlayer_AdvanceManualTimer function for each handle for more information on its functions.
See also
criManaPlayer_AdvanceManualTimer

◆ criMana_ExecuteVideoProcess()

void criMana_ExecuteVideoProcess ( void  )

Decode video (all handles at once)

Call conditions:
Library initialization is complete.

This is thread safe.
Description:
Executes the criManaPlayer_ExecuteVideoProcess function for each Mana player handle that has been created.
If CRIMANA_THREAD_MODEL_MULTI has been set using the criMana_Initialize function, then this function will be automatically executed on top of the separate thread that was created in the Mana library. Therefore, there is no need to call it from the application. Set it so that it has a lower priority than the main thread.

◆ criMana_SetDecodeSkipFlag()

void criMana_SetDecodeSkipFlag ( CriBool  flag)

Set the decoding skip flag (all handles at once)

Call conditions:
This is thread safe.
Description:
Enables the decoding skip function.
Enables skipping if the argument flag is CRI_TRUE(1). * Disables skipping if the argument flag is CRI_FALSE(0).

Enabling decoding skip will automatically skip the required number of frames internally if slowdown occurs due to playback load. While there will be some visual stuttering, it will make it easier to prevent sound jumping.

Whether skipping is enabled by default depends on the platform. It is disabled by default on platforms with uniquely determined device performance and enabled by default on platforms without.
Attention:
Valid for Sofdec.Prime only; H.264/VP9 is not supported for decode skipping.

◆ criMana_SetAllPauseFlag()

void criMana_SetAllPauseFlag ( CriBool  flag)

Set overall pause (all handles together)

Parameters
[in]flagOverall pause flag (CRI_TRUE:Enable overall pause, CRI_FALSE:Disable overall pause)
Call conditions:
Library initialization is complete.

This is not thread safe.
Description:
Enables the overall pause function.
Enables overall pause if the argument flag is CRI_TRUE(1). * Disables overall pause if the argument flag is CRI_FALSE(0).

Switching overall pause from disabled to enabled will pause all handles.
(Looking at it from the app side, all movies will be paused.) However, information on whether the pause switch (user pause flag) individually specified by the user with the criManaPlayer_Pause function is enabled or disabled will be kept internally. (It will refresh the user pause flag using the criManaPlayer_Pause function even while overall pause is enabled.)
The criManaPlayer_IsPaused function will return information on the user pause flag, so information on whether the overall flag is enabled or disabled will be separate.
When switching overall pause from enabled to disabled, handles enabled by the user pause flag will continue to be paused, while handles disabled by the user pause flag will restart the movie.
See also
criMana_GetAllPauseFlag, criManaPlayer_Pause, criManaPlayer_IsPaused

◆ criMana_GetAllPauseFlag()

CriBool criMana_GetAllPauseFlag ( void  )

Get the overall pause flag.

Returns
CriBool Overall pause flag
Call conditions:
This is not thread safe.
Description:
Gets the overall pause flag.

Be aware that the user pause flag that can be gotten with the criManaPlayer_IsPaused function is different.
See also
criMana_SetAllPauseFlag

◆ criMana_Lock()

void criMana_Lock ( void  )

Prevent decoding interruptions.

Description:
Prevents decoding interruptions.
Prevents the decoding operation from being interrupted after this function is executed until the criMana_Unlock function is executed.
See also
criMana_Unlock

◆ criMana_Unlock()

void criMana_Unlock ( void  )

Cancel decoding interruption prevention.

Description:
Cancels the decoding interruption prevention through using the criMana_Lock function.
See also
criMana_Lock

◆ criMana_UseStreamerManager()

void criMana_UseStreamerManager ( CriBool  flag)

Set control flag on whether to use the streaming management module.

Parameters
[in]flagControl flag (CRI_TRUE: use, CRI_FALSE: not use)
Call conditions:
Callable even after library initialization. However, it can not be called while movies are playing.
Description:
Specify whether to use common streaming management module with the ADX2.
The default depends on the platform. For platforms that can ignore the seek load such as iOS and Android, it is not used as default.
Attention
All the platforms had used the module before this function was added. To return to the conventional behavior, specify CRI_TRUE with this function.
See also
criMana_IsStreamerManagerUsed

◆ criMana_IsStreamerManagerUsed()

CriBool criMana_IsStreamerManagerUsed ( void  )

Get the control flag as to whether or not to use the streaming management module.

Returns
Control flag (CRI_TRUE: use, CRI_FALSE: not use)
Call conditions:
It is thread safe.
Description:
Obtain control flags on whether to use the streaming management module.
See also
criMana_UseStreamerManager

◆ criManaPlayer_SetExtDecoderWorkAllocator()

void criManaPlayer_SetExtDecoderWorkAllocator ( CriManaPlayerHn  player,
CriManaExtDecoderWorkMallocFunc  allocfunc,
CriManaExtDecoderWorkFreeFunc  freefunc,
void *  obj 
)

Register callback for extended decoder work allocation.

Parameters
[in]playerMana player handle
[in]allocfuncMemory allocation function
[in]freefuncMemory release function
[in]objUser object (optional)
Call conditions:
Call this before the criMana_Initialize function.

This is not thread safe.
Description:
Registers a memory allocator (memory allocation/release functions) for extended decoder work in the CRI Mana library.
Used when you want to replace the memory release that the CRI Mana performs within the library with the user's own memory release.

◆ criManaPlayer_SetSoundCategoryByName()

void criManaPlayer_SetSoundCategoryByName ( CriManaPlayerHn  player,
CriUint32  track_id,
const CriChar8 *  category_name 
)

Audio track category setting.

Parameters
[in]playerMana player handle
[in]track_idAudio track number (0: Main, 1: Sub, 2: Extra)
[in]category_nameCategory Name
Description:
By calling this function before the criManaPlayer_Start function, you can set the category to the audio track of the movie to be played back later.
It is possible to apply different category settings to each audio track track. Specify the audio track with the value of the argument track_id.
If track_id is 0, it is main, 1 is sub, 2 is extra audio track.
To delete the set category information, use the criManaPlayer_UnsetSoundCategory function.
Please refer to the CRI ADX2 manual for details of the category function.
Call conditions:
Please use the CriManaPlayerHn created by setting the value of the CriManaPlayerConfig.use_atomex_player to CRI_TRUE.
This function can not be used with the CriManaPlayerHn created with default settings.

Please set category setting before starting playback. If you update the category setting for the sound being played back, the category playback count may become abnormal.

In addition, it is necessary to perform ACF registration in advance. Because the available category information is described in the ACF.
Please refer to the CRI ADX2 manual for details of the ACF.
This function is NOT thread-safe.
See also
criManaPlayer_CreateWithConfig, criManaPlayer_UnsetSoundCategory

◆ criManaPlayer_UnsetSoundCategory()

void criManaPlayer_UnsetSoundCategory ( CriManaPlayerHn  player,
CriUint32  track_id 
)

Delete audio track category.

Parameters
[in]playerMana player handle
[in]track_idAudio track number (0: Main, 1: Sub, 2: Extra)
Description:
Deletes the category information set for the audio track.
If track_id is 0, it is main, 1 is sub, 2 is extra audio track.
To set category, use the criManaPlayer_SetSoundCategoryByName function.
Call conditions:
Please use the CriManaPlayerHn created by setting the value of the CriManaPlayerConfig.use_atomex_player to CRI_TRUE.
This function can not be used with the CriManaPlayerHn created with default settings.

This function is NOT thread-safe.