コード例 #1
0
ファイル: playlist.c プロジェクト: gzmorell/buildroot
void * 
createPlayList(char * title)
{
    PlayList * pl = MEM_ALLOC(sizeof(PlayList));
    if (pl==NULL){
        PL_ERR("%s failed, no memory!\n", __FUNCTION__);
        goto err;
    }

    MEM_ZERO(pl, sizeof(PlayList));

    if (title==NULL)
        title = DEFAULT_PL_TITLE;

    
    pl->title = MEM_ALLOC(strlen(title)+1);
    if (pl->title==NULL){
        PL_ERR("%s failed, no memory!\n");
        goto err;
    }
    strcpy(pl->title, title);
    
    
    return (void *)pl;
err:
    if (pl){
        MEM_FREE(pl);
        pl=NULL;
    }
    return (void *)pl;
}
コード例 #2
0
ファイル: playlist.c プロジェクト: gzmorell/buildroot
PlayItem * 
addItemAtTail(void * hdl, fsl_player_s8 * iName, fsl_player_s32 copy)
{
    PlayItemCtl * item = NULL;
    PlayList * pl = (PlayList *)hdl;
    
    if ((pl==NULL)||(iName==NULL)){
        PL_ERR("%s failed, parameters error!\n", __FUNCTION__);
        goto err;
    }

    item = MEM_ALLOC(sizeof(PlayItemCtl));
    if (item==NULL){
        PL_ERR("%s failed, no memory!\n");
        goto err;
    }

    MEM_ZERO(item, sizeof(PlayItemCtl));

    if (copy){
        item->buffer = MEM_ALLOC(strlen(iName));
        if (item->buffer==NULL){
            PL_ERR("%s failed, no memory!\n");
            goto err;
        }
        strcpy(item->buffer, iName);
        item->pi.name = item->buffer;
    }else{
        item->pi.name = iName;
    }

    item->pl = pl;

    item->prev = pl->tail;
    
    if (pl->head){
        pl->tail->next = item;
        pl->tail= item;
    }else{
        pl->head = pl->tail = item;
    }
    return (PlayItem *)item;
err:
    if (item){
        MEM_FREE(item);
        item=NULL;
    }
    return (PlayItem *)item;
}
コード例 #3
0
void 
destroyPlayList(void * hdl)
{
    PlayList * pl = (PlayList *)hdl;
    PlayItemCtl * item, *itemnext;

    if (!pl)
      return;

     if (pl->title){
      MEM_FREE(pl->title);
     }
    
    if (pl==NULL){
        PL_ERR("%s failed, parameters error!\n", __FUNCTION__);
        return;
    }
    item = pl->head;
    while(item){
        itemnext = item->next;
        destroyPlayItemCtl(item);
        item=itemnext;
    }
    MEM_FREE(pl);
}
コード例 #4
0
ファイル: playlist.c プロジェクト: gzmorell/buildroot
PlayItem * 
getNextItem(PlayItem * itm)
{
    PlayItemCtl * item = (PlayItemCtl *)itm;
    if (item==NULL){
        PL_ERR("%s failed, parameters error!\n", __FUNCTION__);
        return NULL;
    }
    return (PlayItem *)(item->next);
}
コード例 #5
0
ファイル: playlist.c プロジェクト: gzmorell/buildroot
PlayItem * 
getLastItem(void * hdl)
{
    PlayList * pl = (PlayList *)hdl;
    if (pl==NULL){
        PL_ERR("%s failed, parameters error!\n", __FUNCTION__);
        return NULL;
    }
    return (PlayItem *)(pl->tail);
}