aw_playlist.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 184 行

H
184
字号
/*****************************************************************
**                                                             	**
**  Copyright (C) 2004 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : aw_input.c /Project:AVOS  					** 
**        Revision : 1.0                                       	**
**                                                             	**
*****************************************************************/
#ifndef __AW_PLAYLIST_H_
#define __AW_PLAYLIST_H_

#include "includes.h"
#include <listop.h>

#define AW_VIDEO_LIST           (MEDIA_AVI | MEDIA_MPEG1 | MEDIA_MPEG2 | MEDIA_MOV | MEDIA_REAL | MEDIA_SWF | MEDIA_MP4)
#define AW_PIC_LIST             (MEDIA_PIC )
#define AW_AUDIO_LIST           (MEDIA_MP3 | MEDIA_WMA | MEDIA_GENERAL | MEDIA_GENERAL_ | MEDIA_CDA)
#define AW_AUDIO_FOR_PICMIX_LIST    (MEDIA_MP3 | MEDIA_WMA | MEDIA_GENERAL | MEDIA_CDA)

/**
 * @file aw_app.h
 * @author LiChao, chao_li@amlogic.com.cn
 *
 * This is the head file of play list manager API. paly list manager will handle all
 * list save, sort, get routine function. Any media UI can use it to simplify their 
 * code.
 *
*/

  
/**
 * @brief Following is the defination of play mode, play list manager will according play mode 
 * to return next play file.
 */
#define PLAY_MODE_NORMAL       0x00
#define PLAY_MODE_REPEAT_ALL   0x01
#define PLAY_MODE_REPEAT_ONE   0x02
#define PLAY_MODE_RANDOM       0x04
#define PLAY_MODE_SUFFLE       0x08 
#define PLAY_MODE_DIR_REPEAT   0x10 
#define PLAY_MODE_ALL_MODE     0x1f
#define PLAY_MODE_ONLYONE     0x40
#define PLAY_ITEM_PLAYED      0x80000000

/**
 * @brief Following struct is the basic information for all play list item.
 */
typedef struct{
    ///point to next item in current play list
    list_t      next_item ;
    ///save the media type of this item, play see aw_app.h to get the media type for different 
    ///type file. The highest bit used to indicat if this file played or not.
    INT32U      item_media_type;
    // this is the file index in the path, can speed up to find item.
    INT16U      item_select_index;
    ///the path of file, we can according this path to locate it(open/read/write).
    char *      item_path ;
}PLAYLISTITEM ;

/**
 * @brief Following struct is the basic information for one play list. It save some information to
 * manager the whole list.
 */
typedef struct{
    ///this is the head of play list.
    struct list_head play_list ;
    ///the media types of this list will hold. You can set a few different paly list for different media.
    INT32U          list_media_type ;
    ///the max item num this list will hold.
    INT16U          max_item_num ;
    ///the current item num in this list
    INT16U          cur_item_num ;
    ///the current item.
    PLAYLISTITEM    *cur_play_item ;
    ///current play mode, play list manager will return next play file accoding this mode.
    INT16U          play_mode ;
    ///list status, reserved now
    INT8U           play_list_status ;
}PLAYLIST ; 

/**
 * @brief Call this function to initialize play list manager.
 * @param [in] list_num The play list num we will created. We can manager a few different media type 
 * list at same time. 
 * @param [in] list_media_type This is the array of list media type(list_media_type[list_num]).
 * @param [in] max_list_item_num This is the array of max item for every list(max_list_item_num[list_num]).
 * @return Return 0 if success or -1 for fail.
 */
INT32S AWPlaylistInit(INT32S list_num, INT32U *list_media_type, INT16U *max_list_item_num) ;

/**
 * @brief Call this function to add one play file to play list.
 * @param [in] item_path The file path, according this path, we can open/read/write the file.
 * @param [in] item_media_t This is the media type of this file. Play list manager according this media 
 * type to search a proper list to save this item. If no list can save this type media, return -1.
 * @param [in] item_index This is the file index in the path. Play list manager according this media 
 * @return Return 0 if success or -1 for fail.
 */
INT32S AWAddPlaylistItem(char *item_path, INT32U item_media_t, INT16U item_index) ;

/**
 * @brief Call this function will return if the item in the playlist.
 * @param [in] item_path The file path, no include the filename.
 * @param [in] item_media_t This is the media type of this file. Play list manager according this media 
 * @param [in] item_index This is the file index in the path. Play list manager according this media 
 * @return Return if exist return 0 else return -1 or -2.
 */
INT32S AWCheckPlayListItemExist(char *item_path, INT32U item_media_t, INT16U item_index) ;

/**
 * @brief Call this function to remove one play file from play list.
 * @param [in] item_path The file path, according this path, play list manager can fint the file.
 * @param [in] item_media_t This is the media type of this file. Play list manager according this media 
 * @param [in] item_index This is the file index in the path. Play list manager according this media 
 * type to search a proper list to find this file. If no list can found this type media, return -1.
 * @param [in] item_index This is the file index in the path. Play list manager according this media 
 * @return Return 0 if success or -1 for fail.
 */
INT32S AWRemovePlaylistItem(char *item_path, INT32U item_media_t, INT16U item_index) ;

/**
 * @brief Call this function will return first media file to play.
 * if the play list have multi media file, like music list have MP3 and WMA, you can 
 * get only one kind of media file, for example, you can call
 * AWGetFirstPlaylistItem(MEDIA_MP3) to get mp3 file from music list which have mp3 and wma 
 * at the same time.
 * @param [in] media_type Play list manager will search list according this.
 * @return Return the path of play list item if success  or NULL for fail.
 */
char* AWGetFirstPlaylistItem(INT32U media_type) ;

/**
 * @brief Call this function will return next media file to play.
 * @param [in] media_type Play list manager will according this to find the list.
 * @return Return the path of play list item if success  or NULL for fail.
 */
char* AWGetNextPlaylistItem(INT32U media_type) ;

/**
 * @brief Call this function will return previous media file to play.
 * @param [in] media_type Play list manager will according this to find the list.
 * @return Return the path of play list item if success  or NULL for fail.
 */
char* AWGetPrevPlaylistItem(INT32U media_type) ;

/**
 * @brief Call this function to set play mode for the list.
 * @param [in] source_list_media_type Play list manager will according this to find the list.
 * @return Return 0 if success or -1 for fail.
 */
INT32S AWSetPlaylistPlayMode(INT32U list_media_type, INT16U play_mode) ;

INT32S AWUnSetPlaylistPlayMode(INT32U list_media_type, INT16U play_mode) ;

/**
 * @brief Call this function to free all the items in the list.
 * @param [in] source_list_media_type Play list manager will according this to find the list.
 * @return Return 0 if success or -1 for fail.
 */
INT32S AWClearPlaylist(INT32U list_media_type) ;

/**
 * @brief Call this function to get play mode for the list.
 * @param [in] list_media_type Play list manager will according this to find the list.
 * @return Return play list's play mode(like PLAY_MODE_REPEAT_ALL, PLAY_MODE_REPEAT_ONE).
 */
INT16U AWGetPlaylistPlayMode(INT32U list_media_type) ;

/**
 * @brief Call this function to get current play item's media type.
 * @param [in] media_type Play list manager will according this to find the list.
 * @return Return play list's current play item's media type(like MEDIA_MP3).
 */
INT32U AWGetCurrentPlaylistItemType(INT32U media_type) ;

/**
 * @brief Call this function to get current play item's path.
 * @param [in] media_type Play list manager will according this to find the list.
 * @return Return play list's current play item's path.
 */
char* AWGetCurrentPlaylistItem(INT32U media_type) ;

#endif //end of  __AW_PLAYLIST_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?