From ad7a6eb1e022a1914ca1cc7384da7551487aa3b0 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 23 Mar 2014 10:31:53 +0100 Subject: [PATCH] libeplayer3: cleanup unused code Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/4ca4f581d590ae8289fe26bce5646a8163ae0bcc Author: martii Date: 2014-03-23 (Sun, 23 Mar 2014) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3/container/container.c | 79 ++------------------- libeplayer3/container/container_ffmpeg.c | 89 ------------------------ libeplayer3/include/container.h | 6 -- libeplayer3/include/ffmpeg_metadata.h | 44 ------------ libeplayer3/include/playback.h | 2 +- libeplayer3/playback/playback.c | 26 ------- 6 files changed, 8 insertions(+), 238 deletions(-) delete mode 100644 libeplayer3/include/ffmpeg_metadata.h diff --git a/libeplayer3/container/container.c b/libeplayer3/container/container.c index d6ec0a6..3713f07 100644 --- a/libeplayer3/container/container.c +++ b/libeplayer3/container/container.c @@ -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; } diff --git a/libeplayer3/container/container_ffmpeg.c b/libeplayer3/container/container_ffmpeg.c index 30434bb..5ac2f41 100644 --- a/libeplayer3/container/container_ffmpeg.c +++ b/libeplayer3/container/container_ffmpeg.c @@ -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; diff --git a/libeplayer3/include/container.h b/libeplayer3/include/container.h index 63c878d..2414eef 100644 --- a/libeplayer3/include/container.h +++ b/libeplayer3/include/container.h @@ -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 { diff --git a/libeplayer3/include/ffmpeg_metadata.h b/libeplayer3/include/ffmpeg_metadata.h deleted file mode 100644 index 4c2e640..0000000 --- a/libeplayer3/include/ffmpeg_metadata.h +++ /dev/null @@ -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 diff --git a/libeplayer3/include/playback.h b/libeplayer3/include/playback.h index 53c44b6..8af3179 100644 --- a/libeplayer3/include/playback.h +++ b/libeplayer3/include/playback.h @@ -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; diff --git a/libeplayer3/playback/playback.c b/libeplayer3/playback/playback.c index 3d92379..411deeb 100644 --- a/libeplayer3/playback/playback.c +++ b/libeplayer3/playback/playback.c @@ -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;