Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 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);
}
Exemplo n.º 4
0
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);
}
Exemplo n.º 5
0
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);
}