From 4e3773c5687ace2876713ca7ddc05d87409a7bc4 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 15 Feb 2012 00:16:11 +0100 Subject: [PATCH] spark: use libeplayer3 for playback --- Makefile.am | 2 +- include/playback_td.h | 2 +- libspark/Makefile.am | 5 +++-- libspark/audio_lib.h | 1 + libspark/playback_libeplayer3.cpp | 25 ++++++++++++++++++++++--- libspark/playback_libeplayer3.h | 23 ++++------------------- libspark/video_lib.h | 1 + 7 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3ab6aee..b472c86 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,7 @@ libstb_hal_a_LIBADD += \ libspark/init.o \ libspark/irmp.o \ libspark/lirmp_input.o \ - libspark/playback.o \ + libspark/playback_libeplayer3.o \ libspark/pwrmngr.o \ libspark/record.o \ libspark/video.o diff --git a/include/playback_td.h b/include/playback_td.h index 513f17d..da5ce54 100644 --- a/include/playback_td.h +++ b/include/playback_td.h @@ -2,7 +2,7 @@ #if HAVE_TRIPLEDRAGON #include "../libtriple/playback_td.h" #elif HAVE_SPARK_HARDWARE -#include "../libspark/playback_lib.h" +#include "../libspark/playback_libeplayer3.h" #else #error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined #endif diff --git a/libspark/Makefile.am b/libspark/Makefile.am index 3b04731..d7beb77 100644 --- a/libspark/Makefile.am +++ b/libspark/Makefile.am @@ -1,5 +1,6 @@ INCLUDES = \ - -I$(top_srcdir)/common + -I$(top_srcdir)/common \ + -I$(top_srcdir)/libeplayer3/include noinst_LIBRARIES = libspark.a @@ -14,7 +15,7 @@ libspark_a_SOURCES = \ video.cpp \ audio.cpp \ init.cpp \ - playback.cpp \ + playback_libeplayer3.cpp \ pwrmngr.cpp \ record.cpp diff --git a/libspark/audio_lib.h b/libspark/audio_lib.h index 41042df..5dbb054 100644 --- a/libspark/audio_lib.h +++ b/libspark/audio_lib.h @@ -30,6 +30,7 @@ typedef enum class cAudio { + friend class cPlayback; private: int fd; bool Muted; diff --git a/libspark/playback_libeplayer3.cpp b/libspark/playback_libeplayer3.cpp index ea5eac4..32d2fa0 100644 --- a/libspark/playback_libeplayer3.cpp +++ b/libspark/playback_libeplayer3.cpp @@ -2,9 +2,23 @@ #include #include -#include "playback_cs.h" +#include +#include -static const char * FILENAME = "playback_cs.cpp"; +#include +extern OutputHandler_t OutputHandler; +extern PlaybackHandler_t PlaybackHandler; +extern ContainerHandler_t ContainerHandler; +extern ManagerHandler_t ManagerHandler; + +#include "playback_libeplayer3.h" + +static Context_t * player; + +extern cAudio *audioDecoder; +extern cVideo *videoDecoder; + +static const char * FILENAME = "playback_libeplayer3.cpp"; // void cPlayback::Attach(void) @@ -42,6 +56,9 @@ bool cPlayback::Open(playmode_t PlayMode) "PLAYMODE_FILE" }; + audioDecoder->closeDevice(); + videoDecoder->closeDevice(); + printf("%s:%s - PlayMode=%s\n", FILENAME, __FUNCTION__, aPLAYMODE[PlayMode]); player = (Context_t*) malloc(sizeof(Context_t)); @@ -72,11 +89,13 @@ void cPlayback::Close(void) //Dagobert: movieplayer does not call stop, it calls close ;) Stop(); + audioDecoder->openDevice(); + videoDecoder->openDevice(); } //Used by Fileplay -bool cPlayback::Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3) +bool cPlayback::Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, int ac3, unsigned int) { bool ret = false; bool isHTTP = false; diff --git a/libspark/playback_libeplayer3.h b/libspark/playback_libeplayer3.h index d14048c..d2747cb 100644 --- a/libspark/playback_libeplayer3.h +++ b/libspark/playback_libeplayer3.h @@ -6,23 +6,11 @@ /* (C) 2008 CoolStream International */ /* */ /*******************************************************************************/ -#ifndef __PLAYBACK_CS_H -#define __PLAYBACK_CS_H +#ifndef __HAL_PLAYBACK_H +#define __HAL_PLAYBACK_H #include -#include -extern OutputHandler_t OutputHandler; -extern PlaybackHandler_t PlaybackHandler; -extern ContainerHandler_t ContainerHandler; -extern ManagerHandler_t ManagerHandler; - -#ifndef CS_PLAYBACK_PDATA -typedef struct { - int nothing; -} CS_PLAYBACK_PDATA; -#endif - typedef enum { PLAYMODE_TS = 0, PLAYMODE_FILE @@ -34,10 +22,6 @@ class cPlayback int timeout; pthread_cond_t read_cond; pthread_mutex_t mutex; - CS_PLAYBACK_PDATA * privateData; -#ifdef __sh__ - Context_t * player; -#endif bool enabled; bool paused; bool playing; @@ -57,7 +41,8 @@ class cPlayback void DMNotify(int Event, void *pTsBuf, void *Tag); bool Open(playmode_t PlayMode); void Close(void); - bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3); + bool Start(char *filename, unsigned short vpid, int vtype, unsigned short apid, + int ac3, unsigned int duration); bool Stop(void); bool SetAPid(unsigned short pid, bool ac3); bool SetSpeed(int speed); diff --git a/libspark/video_lib.h b/libspark/video_lib.h index 59088a5..f312b29 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -113,6 +113,7 @@ typedef enum class cVideo { friend class cDemux; + friend class cPlayback; private: /* video device */ int fd;