aw_playlist2.h
来自「AMLOGIC DPF source code」· C头文件 代码 · 共 260 行
H
260 行
/*******************************************************************
*
* Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
*
* Description: Playlist declarations.
*
* Author: EK
* Created: Thu Mar 16 20:22:25 2006
*
*******************************************************************/
#ifndef AW_PLAYLIST2_H
#define AW_PLAYLIST2_H
#include <aw_playlist.h>
#define PLAYLIST_LOCKED 0x01
#define PLAYLIST_DELETING 0x02
typedef enum {
PLAYLIST_STATUS_OK, /**< Request succeeded */
PLAYLIST_STATUS_ASYNCH, /**< Wait for asynchronous result. */
PLAYLIST_STATUS_GET_NEXT, /**< Asynchronous result error, need search next item again. */
PLAYLIST_STATUS_GET_PREV, /**< Asynchronous result error, need search previous item again */
PLAYLIST_STATUS_ERROR, /**< An error of some sort occured */
PLAYLIST_STATUS_BEGIN, /**< Start of list */
PLAYLIST_STATUS_END /**< No more items */
} PlaylistStatus_t;
typedef enum {
PLAYLIST_TYPE_AUDIO,
PLAYLIST_TYPE_VIDEO,
PLAYLIST_TYPE_IMAGE
} PlaylistType_t;
typedef struct {
char *location;
char *title;
} PlaylistItem_t;
typedef struct {
list_t list;
PlaylistItem_t item;
} PlaylistEntry_t;
typedef struct _playlist_s Playlist_t;
typedef void (*PlaylistResultCb_t)
(Playlist_t *playlist, PlaylistItem_t *item, PlaylistStatus_t status);
typedef PlaylistStatus_t (*PlaylistGetCb_t)(Playlist_t *playlist,
int item_offset,
void *context);
typedef unsigned char (*PlaylistCheckItem_UpdateParameter_Cb_t)(Playlist_t *playlist, int item_to_get, void *context, unsigned *total_items, unsigned *start_index);
typedef void (*PlaylistDeleteCb_t)(Playlist_t *playlist, void *context);
struct _playlist_s
{
unsigned magic;
///the current item.
PlaylistEntry_t *cur_play_item ;
list_t playlist_history;
unsigned history_count;
unsigned max_history;
unsigned played_flag; // this mean the 0(not first) or the end item played flag.
unsigned start_index;
unsigned current_index;
unsigned total_items;
unsigned status;
PlaylistType_t list_type;
///current play mode, play list manager will return next play file accoding this mode.
unsigned short play_mode ;
PlaylistGetCb_t playlist_get_cb;
PlaylistDeleteCb_t playlist_delete;
PlaylistResultCb_t app_cb;
PlaylistCheckItem_UpdateParameter_Cb_t checkitem_updateparameter_cb;
void *context;
};
/*;emacs generated header for file aw_playlist2.c. Global function declarations only. */
/**
* Flush all entries from the \a Playlist_t's history.
*/
extern void
AWFlushPlaylistHistory(Playlist_t *playlist);
/**
* Insert a \a PlaylistItem_t into a \a Playlist_t's history.
*/
extern void
AWInsertPlaylistHistory(Playlist_t *playlist, PlaylistItem_t *item);
/**
* Free a \a PlaylistItem_t.
*/
extern void
AWFreePlaylistItem(PlaylistItem_t *pli);
/**
* Create a new \a PlaylistItem_t.
* @param[in] location Location of the resource.
* @param[in] title Human readable descriptive title.
*
* @returns a new \a PlaylistItem_t, or NULL if allocation failed.
*/
extern PlaylistItem_t *
AWCreatePlaylistItem(char *location, char *title);
/**
* Callback from the playlist module with the result from the last
* get request.
*/
extern void
AWPlaylistResult(Playlist_t *playlist, PlaylistItem_t *item, PlaylistStatus_t status);
/**
* Return the \a PlaylistType_t for a playlist.
*/
extern PlaylistType_t
AWGetPlaylistType(Playlist_t *playlist);
/**
* Set the \a playlist's \a playlist mode. After this is called, all
* further requests will be performed according to the new \a mode.
*/
extern void
AWSetPlaylistPlayMode2(Playlist_t *playlist, unsigned short mode);
/**
* Retrieve the \a playlist's \a playlist mode
*/
extern unsigned short
AWGetPlaylistPlayMode2(Playlist_t *playlist);
/**
* Retrieve the \a playlist's \a playlist total items.
*/
unsigned
AWGetPlaylistTotalItems2(Playlist_t *playlist);
/**
* Retrieve the top playlist item from a \a Playlist_t.
* @returns the current offset into the playlist or -1 if the playlist is
* invalid.
*/
extern int
AWGetCurrentPlaylistIndex(Playlist_t *playlist);
/**
* Retrieve the top playlist item from a \a Playlist_t.
*/
extern PlaylistItem_t *
AWGetCurrentPlaylistItem2(Playlist_t *playlist);
/**
* Retrieve the previous Playlist_t's item. If possible it will retrieve it
* from the \a playlist's history.
*/
extern PlaylistStatus_t
AWGetPrevPlaylistItem2(Playlist_t *playlist);
/**
* Retrieve the next \a Playlist_t item, depending on the \a playlist mode set
* for this playlist.
* It is possible to receive the callback \b immediately and in the same
* context as the calling application.
*/
extern PlaylistStatus_t
AWGetNextPlaylistItem2(Playlist_t *playlist);
/**
* Retrieve the current \a Playlist_t item.
* @returns \a PlaylistStatus_t, PLAYLIST_STATUS_ASYNCH if successful.
*/
extern PlaylistStatus_t
AWGetStartPlaylistItem2(Playlist_t *playlist);
/**
* Retrieve the Nth \a Playlist_t item.
*/
extern PlaylistStatus_t
AWGetNthPlaylistItem2(Playlist_t *playlist, int n);
/**
* Set the lock flag for \a Playlist_t to prevent operation of deletion.
*/
extern void
AWLockPlaylist(Playlist_t *playlist);
/**
* Clear the lock flag for \a Playlist_t to allow operation of deletion.
*/
extern void
AWUnLockPlaylist(Playlist_t *playlist);
/**
* Check if \a Playlist_t should be deleted or not.
*/
unsigned
AWPlaylistIsInvalid(Playlist_t *playlist);
/**
* If \a Playlist_t is locked, set deleting flag and return 1,
* otherwise delete \a Playlist_t and all of its underlying
* context and return 0.
*/
extern unsigned
AWPlaylistDelete2(Playlist_t *playlist);
/**
* Set the application callback for \a Playlist_t request results.
*/
extern void
AWSetPlaylistAppCb(Playlist_t *playlist, PlaylistResultCb_t app_cb);
/**
* Set the application callback for \a Playlist_t CheckItem_UpdateParameter.
* unsigned char checkitem_updateparameter_cb(Playlist_t *playlist, int item_to_get, void *context, unsigned *total_items, unsigned *start_index),
* compulsory: return 0 if item_to_get is not available, return 1 if item_to_get is available; return value is not used if item_to_get<0
* optional: update total_items and start_index
*/
extern void
AWSetPlaylistCheckUpdateCb(Playlist_t *playlist, PlaylistCheckItem_UpdateParameter_Cb_t checkitem_updateparameter_cb);
/**
* Create a \a Playlist_t.
* @param[in] playlist_get_cb Callback to get an entry from the playlist.
* @param[in] playlist_delete Callback to free context information.
* @param[in] start_index Initial index to pass to \a playlist_get_cb.
* @param[in] total_items Total number of items in the playlist. total_items can be 0 if AWSetPlaylistCheckUpdateCb() is called.
* @param[in] play_mode Start \a playlist mode.
* @param[in] list_type \a PlaylistType_t to retrieve.
* @param[in] context Playlist module's context.
*
* @returns \a Playlist_t if successful, NULL if not.
*/
extern Playlist_t *
AWPlaylistInit2(PlaylistGetCb_t playlist_get_cb,
PlaylistDeleteCb_t playlist_delete,
unsigned start_index,
unsigned total_items,
unsigned short play_mode,
PlaylistType_t list_type,
void *context);
/**
* Get Next file but do not move current pointer .
*/
//extern char *
//AWGetNextPlaylistItem2Name(Playlist_t *playlist,int add);
/*;end emacs generated header for file aw_playlist2.c. Global function declarations only. */
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?