mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
libeplayer3: cleanup unused code
This commit is contained in:
@@ -41,92 +41,27 @@ if (debug_level >= level) printf(x); } while (0)
|
||||
#define container_err(x...)
|
||||
#endif
|
||||
|
||||
|
||||
static const char FILENAME[] = __FILE__;
|
||||
|
||||
static Container_t *AvailableContainer[] = {
|
||||
&FFMPEGContainer,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void printContainerCapabilities()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
container_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);
|
||||
container_printf(10, "Capabilities: ");
|
||||
|
||||
for (i = 0; AvailableContainer[i] != NULL; i++)
|
||||
for (j = 0; AvailableContainer[i]->Capabilities[j] != NULL; j++)
|
||||
container_printf(10, "%s ",
|
||||
AvailableContainer[i]->Capabilities[j]);
|
||||
container_printf(10, "\n");
|
||||
}
|
||||
|
||||
static int selectContainer(Context_t * context, char *extension
|
||||
__attribute__ ((unused)))
|
||||
{
|
||||
#if 0
|
||||
int i, j;
|
||||
int ret = -1;
|
||||
|
||||
container_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);
|
||||
|
||||
for (i = 0; AvailableContainer[i] != NULL; i++) {
|
||||
for (j = 0; AvailableContainer[i]->Capabilities[j] != NULL; j++)
|
||||
if (!strcasecmp
|
||||
(AvailableContainer[i]->Capabilities[j], extension)) {
|
||||
context->container->selectedContainer =
|
||||
AvailableContainer[i];
|
||||
|
||||
container_printf(10, "Selected Container: %s\n",
|
||||
context->container->selectedContainer->
|
||||
Name);
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
if (ret == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
container_err("No Container found :-(\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
context->container->selectedContainer = AvailableContainer[0];
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int Command(void *_context, ContainerCmd_t command, void *argument)
|
||||
static int Command(void *_context, ContainerCmd_t command, void *argument __attribute__((unused)))
|
||||
{
|
||||
Context_t *context = (Context_t *) _context;
|
||||
int ret = 0;
|
||||
|
||||
container_printf(10, "%s::%s\n", FILENAME, __FUNCTION__);
|
||||
container_printf(10, "%s::%s\n", __FILE__, __func__);
|
||||
|
||||
switch (command) {
|
||||
case CONTAINER_ADD:{
|
||||
ret = selectContainer(context, (char *) argument);
|
||||
case CONTAINER_ADD:
|
||||
context->container->selectedContainer = &FFMPEGContainer;
|
||||
break;
|
||||
}
|
||||
case CONTAINER_CAPABILITIES:{
|
||||
printContainerCapabilities();
|
||||
break;
|
||||
}
|
||||
case CONTAINER_DEL:{
|
||||
context->container->selectedContainer = NULL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
container_err("%s::%s ContainerCmd %d not supported!\n", FILENAME,
|
||||
__FUNCTION__, command);
|
||||
container_err("%s::%s ContainerCmd %d not supported!\n", __FILE__,
|
||||
__func__, command);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "aac.h"
|
||||
#endif
|
||||
#include "pcm.h"
|
||||
#include "ffmpeg_metadata.h"
|
||||
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
@@ -226,26 +225,6 @@ long long int calcPts(AVStream * stream, int64_t pts)
|
||||
return pts;
|
||||
}
|
||||
|
||||
/* search for metadata in context and stream
|
||||
* and map it to our metadata.
|
||||
*/
|
||||
|
||||
static char *searchMeta(AVDictionary * metadata, char *ourTag)
|
||||
{
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
int i = 0;
|
||||
|
||||
while (metadata_map[i]) {
|
||||
if (!strcasecmp(ourTag, metadata_map[i]))
|
||||
while ((tag = av_dict_get(metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
if (!strcasecmp(tag->key, ourTag) || !strcmp(tag->key, metadata_map[i + 1]))
|
||||
return tag->value;
|
||||
i += 2;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* **************************** */
|
||||
/* Worker Thread */
|
||||
/* **************************** */
|
||||
@@ -1417,62 +1396,6 @@ static int container_ffmpeg_switch_teletext(Context_t * context __attribute__ ((
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
|
||||
/* konfetti comment: I dont like the mechanism of overwriting
|
||||
* the pointer in infostring. This lead in most cases to
|
||||
* user errors, like it is in the current version (libeplayer2 <-->e2->servicemp3.cpp)
|
||||
* From e2 there is passed a tag=strdup here and we overwrite this
|
||||
* strdupped tag. This lead to dangling pointers which are never freed!
|
||||
* I do not free the string here because this is the wrong way. The mechanism
|
||||
* should be changed, or e2 should pass it in a different way...
|
||||
*/
|
||||
static int container_ffmpeg_get_info(Context_t * context, char **infoString)
|
||||
{
|
||||
Track_t *videoTrack = NULL;
|
||||
Track_t *audioTrack = NULL;
|
||||
char *meta = NULL;
|
||||
|
||||
ffmpeg_printf(20, ">\n");
|
||||
|
||||
if (avContext != NULL) {
|
||||
if ((infoString == NULL) || (*infoString == NULL)) {
|
||||
ffmpeg_err("infostring NULL\n");
|
||||
return cERR_CONTAINER_FFMPEG_ERR;
|
||||
}
|
||||
|
||||
ffmpeg_printf(20, "%s\n", *infoString);
|
||||
|
||||
context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack);
|
||||
context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack);
|
||||
|
||||
if ((meta = searchMeta(avContext->metadata, *infoString)) == NULL) {
|
||||
if (audioTrack != NULL) {
|
||||
AVStream *stream = audioTrack->stream;
|
||||
|
||||
meta = searchMeta(stream->metadata, *infoString);
|
||||
}
|
||||
|
||||
if ((meta == NULL) && (videoTrack != NULL)) {
|
||||
AVStream *stream = videoTrack->stream;
|
||||
|
||||
meta = searchMeta(stream->metadata, *infoString);
|
||||
}
|
||||
}
|
||||
|
||||
if (meta != NULL) {
|
||||
*infoString = strdup(meta);
|
||||
} else {
|
||||
ffmpeg_printf(1, "no metadata found for \"%s\"\n", *infoString);
|
||||
*infoString = strdup("not found");
|
||||
}
|
||||
} else {
|
||||
ffmpeg_err("avContext NULL\n");
|
||||
return cERR_CONTAINER_FFMPEG_ERR;
|
||||
}
|
||||
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
|
||||
}
|
||||
|
||||
static int container_ffmpeg_get_metadata(Context_t * context, char ***p)
|
||||
{
|
||||
Track_t *videoTrack = NULL;
|
||||
@@ -1582,22 +1505,10 @@ static int Command(void *_context, ContainerCmd_t command, void *argument)
|
||||
ret = container_ffmpeg_switch_subtitle(context, (int *) argument);
|
||||
break;
|
||||
}
|
||||
case CONTAINER_INFO:{
|
||||
ret = container_ffmpeg_get_info(context, (char **) argument);
|
||||
break;
|
||||
}
|
||||
case CONTAINER_METADATA:{
|
||||
ret = container_ffmpeg_get_metadata(context, (char ***) argument);
|
||||
break;
|
||||
}
|
||||
case CONTAINER_STATUS:{
|
||||
*((int *) argument) = hasPlayThreadStarted;
|
||||
break;
|
||||
}
|
||||
case CONTAINER_LAST_PTS:{
|
||||
*((long long int *) argument) = latestPts;
|
||||
break;
|
||||
}
|
||||
case CONTAINER_SWITCH_TELETEXT:{
|
||||
ret = container_ffmpeg_switch_teletext(context, (int *) argument);
|
||||
break;
|
||||
|
@@ -6,7 +6,6 @@
|
||||
typedef enum {
|
||||
CONTAINER_INIT,
|
||||
CONTAINER_ADD,
|
||||
CONTAINER_CAPABILITIES,
|
||||
CONTAINER_PLAY,
|
||||
CONTAINER_STOP,
|
||||
CONTAINER_SEEK,
|
||||
@@ -15,13 +14,8 @@ typedef enum {
|
||||
CONTAINER_DEL,
|
||||
CONTAINER_SWITCH_AUDIO,
|
||||
CONTAINER_SWITCH_SUBTITLE,
|
||||
CONTAINER_SWITCH_DVBSUBTITLE,
|
||||
CONTAINER_SWITCH_TELETEXT,
|
||||
CONTAINER_INFO,
|
||||
CONTAINER_METADATA,
|
||||
CONTAINER_STATUS,
|
||||
CONTAINER_LAST_PTS,
|
||||
CONTAINER_DATA
|
||||
} ContainerCmd_t;
|
||||
|
||||
typedef struct Container_s {
|
||||
|
@@ -1,44 +0,0 @@
|
||||
#ifndef _ffmpeg_metadata_123
|
||||
#define _ffmpeg_metadata_123
|
||||
|
||||
/* these file contains a list of metadata tags which can be used by applications
|
||||
* to stream specific information. it maps the tags to ffmpeg specific tags.
|
||||
*
|
||||
* fixme: if we add other container for some resons later (maybe some other libs
|
||||
* support better demuxing or something like this), then we should think on a
|
||||
* more generic mechanism!
|
||||
*/
|
||||
|
||||
/* metatdata map list:
|
||||
*/
|
||||
char *metadata_map[] = {
|
||||
/* our tags ffmpeg tag / id3v2 */
|
||||
"Title", "TIT2",
|
||||
"Title", "TT2",
|
||||
"Artist", "TPE1",
|
||||
"Artist", "TP1",
|
||||
"AlbumArtist", "TPE2",
|
||||
"AlbumArtist", "TP2",
|
||||
"Album", "TALB",
|
||||
"Album", "TAL",
|
||||
"Year", "TDRL", /* fixme */
|
||||
"Year", "TDRC", /* fixme */
|
||||
"Comment", "unknown",
|
||||
"Track", "TRCK",
|
||||
"Track", "TRK",
|
||||
"Copyright", "TCOP",
|
||||
"Composer", "TCOM",
|
||||
"Genre", "TCON",
|
||||
"Genre", "TCO",
|
||||
"EncodedBy", "TENC",
|
||||
"EncodedBy", "TEN",
|
||||
"Language", "TLAN",
|
||||
"Performer", "TPE3",
|
||||
"Performer", "TP3",
|
||||
"Publisher", "TPUB",
|
||||
"Encoder", "TSSE",
|
||||
"Disc", "TPOS",
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif
|
@@ -6,7 +6,7 @@ typedef enum { PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP,
|
||||
PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM,
|
||||
PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_SEEK_ABS,
|
||||
PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO,
|
||||
PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_METADATA, PLAYBACK_SLOWMOTION,
|
||||
PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_METADATA, PLAYBACK_SLOWMOTION,
|
||||
PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT,
|
||||
PLAYBACK_SWITCH_TELETEXT
|
||||
} PlaybackCmd_t;
|
||||
|
@@ -738,28 +738,6 @@ static int PlaybackSwitchTeletext(Context_t * context, int *pid)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int PlaybackInfo(Context_t * context, char **infoString)
|
||||
{
|
||||
int ret = cERR_PLAYBACK_NO_ERROR;
|
||||
|
||||
playback_printf(10, "\n");
|
||||
|
||||
/* konfetti comment:
|
||||
* removed if clause here (playback running) because its
|
||||
* not necessary for all container. e.g. in case of ffmpeg
|
||||
* container playback must not play to get the info.
|
||||
*/
|
||||
|
||||
if (context->container && context->container->selectedContainer)
|
||||
context->container->selectedContainer->Command(context,
|
||||
CONTAINER_INFO,
|
||||
infoString);
|
||||
|
||||
playback_printf(10, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int PlaybackMetadata(Context_t * context, char ***metadata)
|
||||
{
|
||||
int ret = cERR_PLAYBACK_NO_ERROR;
|
||||
@@ -837,10 +815,6 @@ static int Command(void *_context, PlaybackCmd_t command, void *argument)
|
||||
ret = PlaybackSwitchSubtitle(context, (int *) argument);
|
||||
break;
|
||||
}
|
||||
case PLAYBACK_INFO:{
|
||||
ret = PlaybackInfo(context, (char **) argument);
|
||||
break;
|
||||
}
|
||||
case PLAYBACK_METADATA:{
|
||||
ret = PlaybackMetadata(context, (char ***) argument);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user