mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
- libeplayer3: sync with max_10
This commit is contained in:
@@ -153,45 +153,6 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
return tracklist;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static TrackDescription_t *ManagerList(Context_t *context __attribute__((unused)))
|
||||
{
|
||||
int i = 0;
|
||||
TrackDescription_t *tracklist = NULL;
|
||||
|
||||
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
|
||||
if (Tracks != NULL)
|
||||
{
|
||||
tracklist = malloc(sizeof(TrackDescription_t) * ((TrackCount) + 1));
|
||||
|
||||
if (tracklist == NULL)
|
||||
{
|
||||
audio_mgr_err("%s::%s malloc failed\n", __FILE__, __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int j = 0;
|
||||
for (i = 0; i < TrackCount; ++i)
|
||||
{
|
||||
if (Tracks[i].pending || Tracks[i].Id < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tracklist[j].Id = Tracks[i].Id;
|
||||
tracklist[j].Name = strdup(Tracks[i].Name);
|
||||
tracklist[j].Encoding = strdup(Tracks[i].Encoding);
|
||||
++j;
|
||||
}
|
||||
|
||||
tracklist[j].Id = -1;
|
||||
}
|
||||
//audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
|
||||
|
||||
return tracklist;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int ManagerDel(Context_t *context)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -372,7 +333,6 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
struct Manager_s AudioManager =
|
||||
{
|
||||
"Audio",
|
||||
|
@@ -151,8 +151,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
tracklist[j] = NULL;
|
||||
}
|
||||
|
||||
chapter_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME,
|
||||
__FUNCTION__, tracklist, j, TrackCount);
|
||||
chapter_mgr_printf(10, "%s::%s return %p (%d - %d)\n", FILENAME, __FUNCTION__, tracklist, j, TrackCount);
|
||||
|
||||
return tracklist;
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "manager.h"
|
||||
#include "common.h"
|
||||
@@ -32,7 +33,7 @@
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#define TRACKWRAP 20
|
||||
#define TRACKWRAP 10
|
||||
|
||||
/* Error Constants */
|
||||
#define cERR_SUBTITLE_MGR_NO_ERROR 0
|
||||
@@ -47,6 +48,7 @@
|
||||
/* ***************************** */
|
||||
|
||||
static Track_t *Tracks = NULL;
|
||||
static int TrackSlotCount = 0;
|
||||
static int TrackCount = 0;
|
||||
static int CurrentTrack = -1; //no as default.
|
||||
|
||||
@@ -60,15 +62,26 @@ static int CurrentTrack = -1; //no as default.
|
||||
|
||||
static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
|
||||
{
|
||||
int i = 0;
|
||||
subtitle_mgr_printf(10, "%s::%s %s %s %d\n", __FILE__, __FUNCTION__, track.Name, track.Encoding, track.Id);
|
||||
|
||||
if (Tracks == NULL)
|
||||
if (TrackCount == TrackSlotCount)
|
||||
{
|
||||
Tracks = malloc(sizeof(Track_t) * TRACKWRAP);
|
||||
int i;
|
||||
for (i = 0; i < TRACKWRAP; i++)
|
||||
static Track_t *t;
|
||||
t = realloc(Tracks, (TrackSlotCount + TRACKWRAP) * sizeof(Track_t));
|
||||
if (t)
|
||||
{
|
||||
Tracks[i].Id = -1;
|
||||
Tracks = t;
|
||||
TrackSlotCount += TRACKWRAP;
|
||||
for (i = TrackCount; i < TrackSlotCount; ++i)
|
||||
{
|
||||
Tracks[i].Id = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitle_mgr_err("%s:%s realloc failed\n", __FILE__, __FUNCTION__);
|
||||
return cERR_SUBTITLE_MGR_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +91,7 @@ static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
|
||||
return cERR_SUBTITLE_MGR_ERROR;
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < TRACKWRAP; i++)
|
||||
for (i = 0; i < TrackSlotCount; i++)
|
||||
{
|
||||
if (Tracks[i].Id == track.Id)
|
||||
{
|
||||
@@ -88,14 +100,14 @@ static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
|
||||
}
|
||||
}
|
||||
|
||||
if (TrackCount < TRACKWRAP)
|
||||
if (TrackCount < TrackSlotCount)
|
||||
{
|
||||
copyTrack(&Tracks[TrackCount], &track);
|
||||
TrackCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitle_mgr_err("%s::%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP);
|
||||
subtitle_mgr_err("%s::%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TrackSlotCount);
|
||||
return cERR_SUBTITLE_MGR_ERROR;
|
||||
}
|
||||
|
||||
@@ -147,32 +159,33 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
return tracklist;
|
||||
}
|
||||
|
||||
static int ManagerDel(Context_t *context __attribute__((unused)))
|
||||
static int ManagerDel(Context_t *context __attribute__((unused)), int32_t onlycurrent)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
|
||||
|
||||
if (Tracks != NULL)
|
||||
if (onlycurrent == 0)
|
||||
{
|
||||
for (i = 0; i < TrackCount; i++)
|
||||
if (Tracks != NULL)
|
||||
{
|
||||
freeTrack(&Tracks[i]);
|
||||
for (i = 0; i < TrackCount; i++)
|
||||
{
|
||||
freeTrack(&Tracks[i]);
|
||||
}
|
||||
free(Tracks);
|
||||
Tracks = NULL;
|
||||
}
|
||||
|
||||
free(Tracks);
|
||||
Tracks = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitle_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__);
|
||||
return cERR_SUBTITLE_MGR_ERROR;
|
||||
else
|
||||
{
|
||||
subtitle_mgr_err("%s::%s nothing to delete!\n", __FILE__, __FUNCTION__);
|
||||
return cERR_SUBTITLE_MGR_ERROR;
|
||||
}
|
||||
TrackCount = 0;
|
||||
TrackSlotCount = 0;
|
||||
context->playback->isSubtitle = 0;
|
||||
}
|
||||
|
||||
TrackCount = 0;
|
||||
CurrentTrack = -1;
|
||||
// context->playback->isSubtitle = 0;
|
||||
|
||||
subtitle_mgr_printf(10, "%s::%s return no error\n", __FILE__, __FUNCTION__);
|
||||
|
||||
return cERR_SUBTITLE_MGR_NO_ERROR;
|
||||
@@ -272,19 +285,21 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
}
|
||||
case MANAGER_SET:
|
||||
{
|
||||
int i;
|
||||
int i = 0;
|
||||
int32_t requestedTrackId = *((int *)argument);
|
||||
|
||||
subtitle_mgr_printf(20, "%s::%s MANAGER_SET id=%d\n", __FILE__, __FUNCTION__, *((int *)argument));
|
||||
|
||||
if (*((int *)argument) < 0)
|
||||
if (requestedTrackId == -1)
|
||||
{
|
||||
// track id -1 mean disable subtitle
|
||||
CurrentTrack = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < TrackCount; i++)
|
||||
{
|
||||
if (Tracks[i].Id == *((int *)argument))
|
||||
if (Tracks[i].Id == requestedTrackId)
|
||||
{
|
||||
CurrentTrack = i;
|
||||
break;
|
||||
@@ -300,7 +315,14 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
}
|
||||
case MANAGER_DEL:
|
||||
{
|
||||
ret = ManagerDel(context);
|
||||
if (argument == NULL)
|
||||
{
|
||||
ret = ManagerDel(context, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ManagerDel(context, *((int *)argument));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MANAGER_INIT_UPDATE:
|
||||
|
@@ -328,7 +328,6 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
struct Manager_s VideoManager =
|
||||
{
|
||||
"Video",
|
||||
|
Reference in New Issue
Block a user