allow gstreamer to signalize missing plugins to the gui (requires reconfiguring enigm...
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>
Wed, 15 Oct 2008 14:38:38 +0000 (14:38 +0000)
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>
Wed, 15 Oct 2008 14:38:38 +0000 (14:38 +0000)
libflac7, gst-plugin-flac)

configure.ac
lib/python/Components/Scanner.py
lib/python/Plugins/Extensions/MediaPlayer/plugin.py
lib/service/servicemp3.cpp
lib/service/servicemp3.h
main/Makefile.am

index fd3dc63..b870075 100644 (file)
@@ -40,6 +40,7 @@ TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng)
 TUXBOX_APPS_LIB_PKGCONFIG(SIGC,sigc++-1.2)
 TUXBOX_APPS_LIB_PKGCONFIG(DVBSI,libdvbsi++)
 _TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL(GSTREAMER,gstreamer,HAVE_GSTREAMER)
+_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL(GSTREAMERPBUTILS,gstreamer-pbutils,HAVE_GSTSTREAMERPBUTILS)
 AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
 JPEG_LIBS="-ljpeg"
 AC_SUBST(JPEG_LIBS)
@@ -68,10 +69,10 @@ fi
 AM_CONDITIONAL(WITH_SDL, test "$WITH_SDL" = "yes")
 
 CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)'
-CPPFLAGS="$CPPFLAGS -D_REENTRANT $PYTHON_CPPFLAGS $MD5SUM_CFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SDL_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $DVBSI_CFLAGS $GSTREAMER_CFLAGS $LIBUNGIF_CLFAGS"
+CPPFLAGS="$CPPFLAGS -D_REENTRANT $PYTHON_CPPFLAGS $MD5SUM_CFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SDL_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $DVBSI_CFLAGS $GSTREAMER_CFLAGS $GSTREAMERPBUTILS_CFLAGS $LIBUNGIF_CLFAGS"
 #CPPFLAGS="$CPPFLAGS -DMEMLEAK_CHECK"
 CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions -Wall"
-LDFLAGS="$LDFLAGS -pthread $PYTHON_LDFLAGS $SDL_LDFLAGS $GSTREAMER_LDFLAGS $LIBUNGIF_LDFLAGS"
+LDFLAGS="$LDFLAGS -pthread $PYTHON_LDFLAGS $SDL_LDFLAGS $GSTREAMER_LDFLAGS $GSTREAMERPBUTILS_LDFLAGS $LIBUNGIF_LDFLAGS"
 #LDFLAGS="-rdynamic $LDFLAGS"
 
 TUXBOX_APPS_GETTEXT
index e13370b..5a26a7d 100644 (file)
@@ -16,6 +16,7 @@ def getExtension(file):
 
 def getType(file):
        (type, _) = guess_type(file)
+       print "guessed type:", type
        if type is None:
                # Detect some mimetypes unknown to dm7025
                # TODO: do mimetypes.add_type once should be better
@@ -24,6 +25,8 @@ def getType(file):
                        return "application/x-debian-package"
                elif ext == "ogg":
                        return "application/ogg"
+               elif ext == "flac":
+                       return "audio/x-flac"
                elif ext == "dmpkg":
                        return "application/x-dream-package"
                elif ext == "ts":
index 6495e99..66f95fc 100644 (file)
@@ -64,7 +64,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                self.addPlaylistParser(PlaylistIOInternal, "e2pls")
 
                # 'None' is magic to start at the list of mountpoints
-               self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|dat)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
+               self.filelist = FileList(None, matchingPattern = "(?i)^.*\.(mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|mkv|dat|flac)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
                self["filelist"] = self.filelist
 
                self.playlist = MyPlayList()
@@ -179,7 +179,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
                        {
                                iPlayableService.evUpdatedInfo: self.__evUpdatedInfo,
-                               iPlayableService.evUser+11: self.__evDecodeError
+                               iPlayableService.evUser+11: self.__evDecodeError,
+                               iPlayableService.evUser+12: self.__evPluginError
                        })
 
        def doNothing(self):
@@ -224,7 +225,13 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                currPlay = self.session.nav.getCurrentService()
                sVideoType = currPlay.info().getInfoString(iServiceInformation.sVideoType)
                print "[__evDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType)
-               self.session.open(MessageBox, _("This Dreambox can't decode %s video streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 10 )
+               self.session.open(MessageBox, _("This Dreambox can't decode %s video streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 )
+
+       def __evPluginError(self):
+               currPlay = self.session.nav.getCurrentService()
+               message = currPlay.info().getInfoString(iServiceInformation.sUser+12)
+               print "[__evPluginError]" , message
+               self.session.open(MessageBox, ("GStreamer Error: missing %s") % message, type = MessageBox.TYPE_INFO,timeout = 20 )
 
        def delMPTimer(self):
                del self.rightKeyTimer
@@ -684,10 +691,10 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                                currref = self.playlist.getServiceRefList()[idx]
                                text = self.getIdentifier(currref)
                                text = ">"+text
-                               ext = text[-3:].lower()
+                               ext = text[-4:].lower()
 
                                # FIXME: the information if the service contains video (and we should hide our window) should com from the service instead 
-                               if ext not in ["mp3", "wav", "ogg"] and not self.isAudioCD:
+                               if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD:
                                        self.hide()
                                else:
                                        needsInfoUpdate = True
@@ -713,8 +720,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
                                idx = self.playlist.getCurrentIndex()
                                currref = self.playlist.getServiceRefList()[idx]
                                text = currref.getPath()
-                               ext = text[-3:].lower()
-                               if ext not in ["mp3", "wav", "ogg"] and not self.isAudioCD:
+                               ext = text[-4:].lower()
+                               if ext not in [".mp3", ".wav", ".ogg", "flac"] and not self.isAudioCD:
                                        self.hide()
                                else:
                                        needsInfoUpdate = True
@@ -852,7 +859,7 @@ def filescan(**kwargs):
                        description = "View Video CD...",
                        openfnc = filescan_open,
                ),
-               Scanner(mimetypes = ["audio/mpeg", "audio/x-wav", "application/ogg"],
+               Scanner(mimetypes = ["audio/mpeg", "audio/x-wav", "application/ogg", "audio/x-flac"],
                        paths_to_scan =
                                [
                                        ScanPath(path = "", with_subdirs = False),
index 4e56496..e435863 100644 (file)
@@ -12,6 +12,7 @@
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
 #include <gst/gst.h>
+#include <gst/pbutils/missing-plugins.h>find 
 #include <sys/stat.h>
 /* for subtitles */
 #include <lib/gui/esubtitle.h>
@@ -35,6 +36,7 @@ eServiceFactoryMP3::eServiceFactoryMP3()
                extensions.push_back("mkv");
                extensions.push_back("avi");
                extensions.push_back("dat");
+               extensions.push_back("flac");
                sc->addServiceFactory(eServiceFactoryMP3::id, this, extensions);
        }
 
@@ -679,6 +681,7 @@ int eServiceMP3::getInfo(int w)
        case sTracknumber:
        case sGenre:
        case sVideoType:
+       case sUser+12:
                return resIsString;
        case sCurrentTitle:
                tag = GST_TAG_TRACK_NUMBER;
@@ -727,6 +730,8 @@ std::string eServiceMP3::getInfoString(int w)
        case sVideoType:
                tag = GST_TAG_VIDEO_CODEC;
                break;
+       case sUser+12:
+               return m_error_message;
        default:
                return "";
        }
@@ -947,6 +952,19 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                        }
                }
        }
+        case GST_MESSAGE_ELEMENT:
+       {
+               if ( gst_is_missing_plugin_message(msg) )
+               {
+                       gchar *description = gst_missing_plugin_message_get_description(msg);                   
+                       if ( description )
+                       {
+                               m_error_message = description;
+                               g_free(description);
+                               m_event((iPlayableService*)this, evUser+12);
+                       }
+               }
+       }
        default:
                break;
        }
index fc3c85f..823fb79 100644 (file)
@@ -153,6 +153,7 @@ private:
        GstElement *m_gst_pipeline;
        GstTagList *m_stream_tags;
        eFixedMessagePump<int> m_pump;
+       std::string m_error_message;
 
        audiotype_t gstCheckAudioPad(GstStructure* structure);
        void gstBusCall(GstBus *bus, GstMessage *msg);
index 67d8466..91606de 100644 (file)
@@ -48,6 +48,7 @@ enigma2_LDADD = \
        @DVBSI_LIBS@ \
        @FRIBIDI_LIBS@ \
        @GSTREAMER_LIBS@ \
+       @GSTREAMERPBUTILS_LIBS@ \
        @JPEG_LIBS@ \
        @LIBUNGIF_LIBS@ \
        @XML2_LIBS@ \