This sample demonstrates how to use CRI Movie's cuepoint feature. For a general overview of cuepoints, refer to
Cue Points .
Program Flow
The basic procedure for cuepoint playback is as follows:
- Register the memory allocator function for metadata.
- Register the cuepoint callback.
- Start playback.
1. Register the Memory Allocator Function for Metadata
CriManaPlayerHn criManaPlayer_Create(void *work, CriSint32 work_size)
Create Mana player (no config specified)
void criManaPlayer_SetMetaDataWorkAllocator(CriManaPlayerHn player, CriManaMetaMallocFunc allocfunc, CriManaMetaFreeFunc freefunc, void *obj, CriManaMetaFlag meta_flag)
Register meta data allocator.
@ CRIMANA_META_FLAG_ALL
Definition: cri_mana.h:342
To perform cuepoint playback, you must use the
criManaPlayer_SetMetaDataWorkAllocator function before header analysis to register an allocator for metadata separately from normal allocators. The allocator can be the same as an allocator registered with the ::criMana_UserAllocator function. However, note that during multithreaded operation the allocator for metadata may be called from another thread.
If you do not register an allocator, you will be unable to perform cuepoint playback.
2. Register the Cuepoint Callback
if (app_obj->cueinf != NULL) {
user_print_cuepoint_list(app_obj->cueinf);
} else {
criFwPrt_DebugPrintf("<NO CUEPOINT INFO FOUND>");
}
CriManaCuePointInfo * criManaPlayer_GetCuePointInfo(CriManaPlayerHn player)
Get a list of Cuepoint information.
void criManaPlayer_SetCuePointCallback(CriManaPlayerHn player, CriManaPlayerCuePointCbFunc func, void *obj)
Set Cuepoint callback.
If there is cuepoint information in the movie, you can get the cuepoint list information via the
criManaPlayer_GetCuePointInfo function after header analysis is finished. Once you confirm that cuepoints exist, use the
criManaPlayer_SetCuePointCallback function to register an event callback.
3. Start Playback
The following procedure is the same as normal playback to start movie playback. Movie playback proceeds and when the playback time reaches a cuepoint time, an event callback will be triggered from within the
criMana_ExecuteMain function. When this event is triggered, any required processing is performed by the application.
{
CriUint64 tcount, tunit;
AppObj *app_obj = (AppObj*)obj;
}
CriManaPlayerObj * CriManaPlayerHn
Player handle.
Definition: cri_mana.h:571
Event point information.
Definition: cri_mana.h:474