static pthread_mutex_t lock_mute;
int modify_inode_for_chain(int index, char *content_id, int play_time)
{
pthread_mutex_lock(&lock_mute);
if(chain_list[index]->head == NULL || chain_list[index]->count == 0)
{
pthread_mutex_unlock(&lock_mute);
return 0;
}
node_gut* temp = chain_list[index]->head;
while(1)
{
if(strcmp(temp->content_id, content_id) == 0)
{
temp->play_num = play_time;
pthread_mutex_unlock(&lock_mute);
return 1;
}
if(temp->next == NULL)
{
pthread_mutex_unlock(&lock_mute);
return 0;
}
temp = temp->next;
}
pthread_mutex_unlock(&lock_mute);
return 0;
}
//*content_id指针参数 指针参数 传入副本需判NULL
//&lock_mute引用参数 引用参数 在转入前已指向具体pthread_mutex_t 类型 传入副本只能使用lock_mute
-----------------------------------------------------------------
D_INT32 curindex = 0;
char *cur_filename = NULL;
dg_player_play_tree_cur_get(&curindex);
D_INT32 dg_player_play_tree_cur_get(D_INT32 *pindex)
{
if (NULL == pindex)
{
return D_FAILURE;
}
*pindex = play_tree.cur;
return D_SUCCESS;
}
D_INT32 dg_player_play_tree_cur_get_JXHY(D_INT32 type,D_INT32 *pindex)
{
D_INT8* filenameinlist;
display_info fileInfo;
FILEINFO pinfo;
dg_player_play_tree_index_file_get(0, &filenameinlist);
if (NULL == filenameinlist)
{
return D_FAILURE;
}
//printf("播放列表的第一个: %s --------------jason\n",filenameinlist);
D_INT32 file_count;
file_count = get_inode_count_from_chain(type);
//DG_MW_file_browser_file_count(&file_count);
//printf("file_count == %d ---------------jason\n", file_count);
node_gut *node_file = NULL;
node_file = get_header_addr_from_chain(type);
/*
if (NULL == node_file)
{
return D_FAILURE;
}
for (int index = 0; index < file_count -2; index ++)
{
if (NULL == node_file)
{
return D_FAILURE;
}
node_file = node_file->next;
}
*/
printf("node_file->file name == %s ,contendid [%s ]\n",
node_file->file_name, node_file->content_id);
//Dare_GetInfoByContentID(node_file->content_id,&pinfo);
for (int i = 0; i < file_count; i++)
{
//DG_MW_file_browser_file_info_JXHY(i, &fileInfo);
//get_inode_value_from_chain(type,file_count-i-1,&fileInfo);
//int ret = Dare_GetInfoByContentID(fileInfo.content_id,&pinfo);
if (NULL == node_file)
{
return D_FAILURE;
}
int ret = Dare_GetInfoByContentID(node_file->content_id,&pinfo);
if(D_FAILURE ==ret)
{
printf("get info failed ---2\n");
return D_FAILURE;
}
if ((NULL != pinfo.filmfile) && (NULL != filenameinlist))
{
if (0 == strcmp(pinfo.filmfile, filenameinlist))
{
D_INT32 index = 0;
//DG_MW_GetIndexByContentID(fileInfo.contentid, &index);
get_chainindex(type, node_file->content_id, &index);
if(index<0)
{
index = 0;
}
printf("--------------index == %d -------------\n", index);
*pindex = index;
return D_SUCCESS;
}
}
node_file = node_file->next;
}
return D_SUCCESS;
}