add "divx" as known file extension
[enigma2.git] / lib / service / servicemp3.cpp
index 19b7735b2888b7b8cbe9750bbdd30e55da297567..9c1972d7cd5ab99fb909bfcb44b43a693b8b49b3 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/stat.h>
 /* for subtitles */
 #include <lib/gui/esubtitle.h>
+#include <errno.h>
 
 // eServiceFactoryMP3
 
@@ -36,6 +37,7 @@ eServiceFactoryMP3::eServiceFactoryMP3()
                extensions.push_back("wave");
                extensions.push_back("mkv");
                extensions.push_back("avi");
+               extensions.push_back("divx");
                extensions.push_back("dat");
                extensions.push_back("flac");
                extensions.push_back("mp4");
@@ -206,7 +208,7 @@ eServiceMP3::eServiceMP3(const char *filename): m_filename(filename), m_pump(eAp
                sourceinfo.containertype = ctMPEGTS;
        else if ( strcasecmp(ext, ".mkv") == 0 )
                sourceinfo.containertype = ctMKV;
-       else if ( strcasecmp(ext, ".avi") == 0 )
+       else if ( strcasecmp(ext, ".avi") == 0 || strcasecmp(ext, ".divx") == 0)
                sourceinfo.containertype = ctAVI;
        else if ( strcasecmp(ext, ".mp4") == 0 )
                sourceinfo.containertype = ctMP4;
@@ -944,6 +946,17 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                        m_audioStreams.push_back(audio);
                }
 
+               GValue *gv_image = gst_tag_list_get_value_index(tags, GST_TAG_IMAGE, 0);
+               if ( gv_image )
+               {
+                       GstBuffer *buf_image;
+                       buf_image = gst_value_get_buffer (gv_image);
+                       int fd = open("/tmp/.id3coverart", O_CREAT|O_WRONLY|O_TRUNC, 0644);
+                       int ret = write(fd, GST_BUFFER_DATA(buf_image), GST_BUFFER_SIZE(buf_image));
+                       close(fd);
+                       m_event((iPlayableService*)this, evUser+13);
+               }
+
                gst_tag_list_free(tags);
                m_event((iPlayableService*)this, evUpdatedInfo);
                break;
@@ -984,7 +997,7 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
        {
                if ( gst_is_missing_plugin_message(msg) )
                {
-                       gchar *description = gst_missing_plugin_message_get_description(msg);                   
+                       gchar *description = gst_missing_plugin_message_get_description(msg);
                        if ( description )
                        {
                                m_error_message = "GStreamer plugin " + (std::string)description + " not available!\n";