]> git.sesse.net Git - vlc/blobdiff - modules/demux/mkv/mkv.hpp
Contribs: add live for Android
[vlc] / modules / demux / mkv / mkv.hpp
index 296ef1316bbe4c6a7114aeab8d1a2e70b31f270e..c299ae3a64e264f9be7f2687597be4c345308726 100644 (file)
@@ -49,7 +49,6 @@
 #   include <time.h>                                               /* time() */
 #endif
 
-#include <vlc_iso_lang.h>
 #include <vlc_meta.h>
 #include <vlc_charset.h>
 #include <vlc_input.h>
@@ -87,7 +86,7 @@
 #include "matroska/KaxSegment.h"
 #include "matroska/KaxTag.h"
 #include "matroska/KaxTags.h"
-#include "matroska/KaxTagMulti.h"
+//#include "matroska/KaxTagMulti.h"
 #include "matroska/KaxTracks.h"
 #include "matroska/KaxTrackAudio.h"
 #include "matroska/KaxTrackVideo.h"
@@ -116,7 +115,7 @@ extern "C" {
 
 #define MKVD_TIMECODESCALE 1000000
 
-#define MKV_IS_ID( el, C ) ( EbmlId( (*el) ) == C::ClassInfos.GlobalId )
+#define MKV_IS_ID( el, C ) ( el != NULL && typeid( *el ) == typeid( C ) )
 
 
 using namespace LIBMATROSKA_NAMESPACE;
@@ -128,44 +127,48 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
 class attachment_c
 {
 public:
-    attachment_c()
-        :p_data(NULL)
-        ,i_size(0)
-    {}
-    virtual ~attachment_c()
+    attachment_c( std::string _psz_file_name, std::string _psz_mime_type, int _i_size )
+        :i_size(_i_size)
+        ,psz_file_name( _psz_file_name)
+        ,psz_mime_type( _psz_mime_type)
     {
-        free( p_data );
+        p_data = NULL;
     }
+    virtual ~attachment_c() { free( p_data ); }
+
+    /* Allocs the data space. Returns true if allocation went ok */
+    bool init()
+    {
+        p_data = malloc( i_size );
+        return (p_data != NULL);
+    }
+
+    const char* fileName() { return psz_file_name.c_str(); }
+    const char* mimeType() { return psz_mime_type.c_str(); }
+    int         size()     { return i_size; }
 
-    std::string    psz_file_name;
-    std::string    psz_mime_type;
     void          *p_data;
+private:
     int            i_size;
+    std::string    psz_file_name;
+    std::string    psz_mime_type;
 };
 
 class matroska_segment_c;
-
 class matroska_stream_c
 {
 public:
-    matroska_stream_c( demux_sys_t & demuxer )
-        :p_in(NULL)
-        ,p_es(NULL)
-        ,sys(demuxer)
-    {}
-
+    matroska_stream_c() :p_io_callback(NULL) ,p_estream(NULL) {}
     virtual ~matroska_stream_c()
     {
-        delete p_in;
-        delete p_es;
+        delete p_io_callback;
+        delete p_estream;
     }
 
-    IOCallback         *p_in;
-    EbmlStream         *p_es;
+    IOCallback         *p_io_callback;
+    EbmlStream         *p_estream;
 
     std::vector<matroska_segment_c*> segments;
-
-    demux_sys_t                      & sys;
 };
 
 
@@ -180,7 +183,7 @@ typedef struct
     bool         b_enabled;
     unsigned int i_number;
 
-    int          i_extra_data;
+    unsigned int i_extra_data;
     uint8_t      *p_extra_data;
 
     char         *psz_codec;