MediaInfoDLL.h

Go to the documentation of this file.
00001 /* MediaInfoDLL - All info about media files, for DLL
00002 // Copyright (C) 2002-2009 Jerome Martinez, Zen@MediaArea.net
00003 //
00004 // This library is free software: you can redistribute it and/or modify it
00005 // under the terms of the GNU Lesser General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this library. If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00018 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00019 //
00020 // Public DLL interface implementation
00021 // Wrapper for MediaInfo Library
00022 // See MediaInfo.h for help
00023 //
00024 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
00025 
00026 #ifndef MediaInfoDLLH
00027 #define MediaInfoDLLH
00028 
00029 /*-------------------------------------------------------------------------*/
00030 #if defined (_WIN32) || defined (WIN32)
00031     #ifdef _DEBUG
00032         #define MEDIAINFODLL_NAME  "MediaInfod.dll"
00033     #else    
00034         #define MEDIAINFODLL_NAME  "MediaInfo.dll"
00035     #endif //_DEBUG
00036 #elif defined(__APPLE__) && defined(__MACH__)
00037     #define MEDIAINFODLL_NAME  "libmediainfo.0.dylib"
00038     #define __stdcall
00039 #else
00040     #define MEDIAINFODLL_NAME  "libmediainfo.so.0"
00041     #define __stdcall
00042 #endif 
00043 #include <new> //For size_t in MacOS
00044 
00045 /*-------------------------------------------------------------------------*/
00046 /*Char types                                                               */
00047 #undef  _T
00048 #define _T(__x)     __T(__x)
00049 #if defined(UNICODE) || defined (_UNICODE)
00050     typedef wchar_t MediaInfo_Char;
00051     #undef  __T
00052     #define __T(__x) L ## __x
00053     #define MEDIAINFO_Ansi ""
00054 #else
00055     typedef char MediaInfo_Char;
00056     #undef  __T
00057     #define __T(__x) __x
00058     #define MEDIAINFO_Ansi "A"
00059 #endif
00060 /*-------------------------------------------------------------------------*/
00061 
00062 /*-------------------------------------------------------------------------*/
00063 /*8-bit int                                                                */
00064 typedef unsigned char       MediaInfo_int8u;
00065 /*-------------------------------------------------------------------------*/
00066 
00067 /*-------------------------------------------------------------------------*/
00068 /*64-bit int                                                               */
00069 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
00070     #undef  MAXTYPE_INT
00071     #define MAXTYPE_INT 64
00072     typedef unsigned long long  MediaInfo_int64u;
00073 #elif defined(__WIN32__) || defined(_WIN32)
00074     #undef  MAXTYPE_INT
00075     #define MAXTYPE_INT 64
00076     typedef unsigned __int64    MediaInfo_int64u;
00077 #else
00078     #pragma message This machine has no 64-bit integer type?
00079 #endif
00080 /*-------------------------------------------------------------------------*/
00081 
00082 /*-------------------------------------------------------------------------*/
00083 /*NULL                                                                      */
00084 #ifndef NULL
00085     #define NULL 0
00086 #endif
00087 /*-------------------------------------------------------------------------*/
00088 
00090 typedef enum MediaInfo_stream_t
00091 {
00092     MediaInfo_Stream_General,
00093     MediaInfo_Stream_Video,
00094     MediaInfo_Stream_Audio,
00095     MediaInfo_Stream_Text,
00096     MediaInfo_Stream_Chapters,
00097     MediaInfo_Stream_Image,
00098     MediaInfo_Stream_Menu,
00099     MediaInfo_Stream_Max
00100 } MediaInfo_stream_C;
00101 
00103 typedef enum MediaInfo_info_t
00104 {
00105     MediaInfo_Info_Name,
00106     MediaInfo_Info_Text,
00107     MediaInfo_Info_Measure,
00108     MediaInfo_Info_Options,
00109     MediaInfo_Info_Name_Text,
00110     MediaInfo_Info_Measure_Text,
00111     MediaInfo_Info_Info,
00112     MediaInfo_Info_HowTo,
00113     MediaInfo_Info_Max
00114 } MediaInfo_info_C;
00115 
00117 typedef enum MediaInfo_infooptions_t
00118 {
00119     MediaInfo_InfoOption_ShowInInform,
00120     MediaInfo_InfoOption_Reserved,
00121     MediaInfo_InfoOption_ShowInSupported,
00122     MediaInfo_InfoOption_TypeOfValue,
00123     MediaInfo_InfoOption_Max
00124 } MediaInfo_infooptions_C;
00125 
00127 typedef enum MediaInfo_fileoptions_t
00128 {
00129     MediaInfo_FileOption_Nothing        =0x00,
00130     MediaInfo_FileOption_NoRecursive    =0x01,
00131     MediaInfo_FileOption_CloseAll       =0x02,
00132     MediaInfo_FileOption_Max            =0x04
00133 } MediaInfo_fileoptions_C;
00134 
00135 
00136 #ifdef __cplusplus
00137 extern "C"
00138 {
00139 #endif /* __cplusplus */
00140 
00141 #ifdef MEDIAINFO_GLIBC
00142     #include <gmodule.h>
00143     static GModule* Module=NULL;
00144 #elif defined (_WIN32) || defined (WIN32)
00145     #include <windows.h>
00146     static HMODULE  Module=NULL;
00147 #else
00148     #include <dlfcn.h>
00149     static void*    Module=NULL;
00150 #endif
00151 static size_t Module_Count=0;
00152 
00153 #ifdef MEDIAINFO_GLIBC
00154 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00155     if (!g_module_symbol (Module, "MediaInfo"MEDIAINFO_Ansi"_"_Name2, (gpointer*)&MediaInfo_##_Name)) \
00156         Errors++;
00157 #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \
00158     if (!g_module_symbol (Module, "MediaInfoList"MEDIAINFO_Ansi"_"_Name2, (gpointer*)&MediaInfoList_##_Name)) \
00159         Errors++;
00160 #elif defined (_WIN32) || defined (WIN32)
00161 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00162     MediaInfo_##_Name=(MEDIAINFO_##_Name)GetProcAddress(Module, "MediaInfo"MEDIAINFO_Ansi"_"_Name2); \
00163     if (MediaInfo_##_Name==NULL) Errors++;
00164 #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \
00165     MediaInfoList_##_Name=(MEDIAINFOLIST_##_Name)GetProcAddress(Module, "MediaInfoList"MEDIAINFO_Ansi"_"_Name2); \
00166     if (MediaInfoList_##_Name==NULL) Errors++;
00167 #else
00168 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00169     MediaInfo_##_Name=(MEDIAINFO_##_Name)dlsym(Module, "MediaInfo"MEDIAINFO_Ansi"_"_Name2); \
00170     if (MediaInfo_##_Name==NULL) Errors++;
00171 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00172     MediaInfoList_##_Name=(MEDIAINFOLIST_##_Name)dlsym(Module, "MediaInfoList"MEDIAINFO_Ansi"_"_Name2); \
00173     if (MediaInfoList_##_Name==NULL) Errors++;
00174 #endif
00175 
00176 typedef void* (__stdcall *MEDIAINFO_New)(); static MEDIAINFO_New MediaInfo_New;
00177 typedef void* (__stdcall *MEDIAINFOLIST_New)(); static MEDIAINFOLIST_New MediaInfoList_New;
00178 typedef void (__stdcall *MEDIAINFO_Delete)(void*); static MEDIAINFO_Delete MediaInfo_Delete;
00179 typedef void (__stdcall *MEDIAINFOLIST_Delete)(void*); static MEDIAINFOLIST_Delete MediaInfoList_Delete;
00180 typedef size_t (__stdcall *MEDIAINFO_Open)(void*, const MediaInfo_Char*); static MEDIAINFO_Open MediaInfo_Open;
00181 typedef size_t (__stdcall *MEDIAINFOLIST_Open)(void*, const MediaInfo_Char*, const MediaInfo_fileoptions_C); static MEDIAINFOLIST_Open MediaInfoList_Open;
00182 typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Init)(void*, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset); static MEDIAINFO_Open_Buffer_Init MediaInfo_Open_Buffer_Init;
00183 typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Continue)(void*, MediaInfo_int8u* Buffer, size_t Buffer_Size); static MEDIAINFO_Open_Buffer_Continue MediaInfo_Open_Buffer_Continue;
00184 typedef MediaInfo_int64u (__stdcall *MEDIAINFO_Open_Buffer_Continue_GoTo_Get)(void*); static MEDIAINFO_Open_Buffer_Continue_GoTo_Get MediaInfo_Open_Buffer_Continue_GoTo_Get;
00185 typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Finalize)(void*); static MEDIAINFO_Open_Buffer_Finalize MediaInfo_Open_Buffer_Finalize;
00186 typedef void (__stdcall *MEDIAINFO_Close)(void*); static MEDIAINFO_Close MediaInfo_Close;
00187 typedef void (__stdcall *MEDIAINFOLIST_Close)(void*, size_t); static MEDIAINFOLIST_Close MediaInfoList_Close;
00188 typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Inform)(void*, size_t Reserved); static MEDIAINFO_Inform MediaInfo_Inform;
00189 typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Inform)(void*, size_t, size_t Reserved); static MEDIAINFOLIST_Inform MediaInfoList_Inform;
00190 typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_GetI)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo); static MEDIAINFO_GetI MediaInfo_GetI;
00191 typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_GetI)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo); static MEDIAINFOLIST_GetI MediaInfoList_GetI;
00192 typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Get)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber, const MediaInfo_Char* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch); static MEDIAINFO_Get MediaInfo_Get;
00193 typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Get)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber, const MediaInfo_Char* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch); static MEDIAINFOLIST_Get MediaInfoList_Get;
00194 typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Option)(void*, const MediaInfo_Char* Parameter, const MediaInfo_Char* Value); static MEDIAINFO_Option MediaInfo_Option;
00195 typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Option)(void*, const MediaInfo_Char* Parameter, const MediaInfo_Char* Value); static MEDIAINFOLIST_Option MediaInfoList_Option;
00196 typedef size_t (__stdcall *MEDIAINFO_State_Get)(void*); static MEDIAINFO_State_Get MediaInfo_State_Get;
00197 typedef size_t (__stdcall *MEDIAINFOLIST_State_Get)(void*); static MEDIAINFOLIST_State_Get MediaInfoList_State_Get;
00198 typedef size_t (__stdcall *MEDIAINFO_Count_Get)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber); static MEDIAINFO_Count_Get MediaInfo_Count_Get;
00199 typedef size_t (__stdcall *MEDIAINFOLIST_Count_Get)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber); static MEDIAINFOLIST_Count_Get MediaInfoList_Count_Get;
00200 typedef size_t (__stdcall *MEDIAINFO_Count_Get_Files)(void*); static MEDIAINFO_Count_Get_Files MediaInfo_Count_Get_Files;
00201 typedef size_t (__stdcall *MEDIAINFOLIST_Count_Get_Files)(void*); static MEDIAINFOLIST_Count_Get_Files MediaInfoList_Count_Get_Files;
00202 
00203 static size_t MediaInfoDLL_Load()
00204 {
00205     if (Module_Count>0)
00206     {
00207         Module_Count++;
00208         return 1;
00209     }
00210 
00211     /* Load library */
00212     #ifdef MEDIAINFO_GLIBC
00213         Module=g_module_open(MEDIAINFODLL_NAME, G_MODULE_BIND_LAZY);
00214     #elif defined (_WIN32) || defined (WIN32)
00215         Module=LoadLibrary(_T(MEDIAINFODLL_NAME));
00216     #else
00217         Module=dlopen(MEDIAINFODLL_NAME, RTLD_LAZY);
00218         if (!Module)
00219             Module=dlopen("./"MEDIAINFODLL_NAME, RTLD_LAZY);
00220         if (!Module)
00221             Module=dlopen("/usr/local/lib/"MEDIAINFODLL_NAME, RTLD_LAZY);
00222         if (!Module)
00223             Module=dlopen("/usr/local/lib64/"MEDIAINFODLL_NAME, RTLD_LAZY);
00224         if (!Module)
00225             Module=dlopen("/usr/lib/"MEDIAINFODLL_NAME, RTLD_LAZY);
00226         if (!Module)
00227             Module=dlopen("/usr/lib64/"MEDIAINFODLL_NAME, RTLD_LAZY);
00228     #endif
00229     if (!Module)
00230         return (size_t)-1;
00231 
00232     /* Load methods */
00233     size_t Errors=0;
00234     MEDIAINFO_ASSIGN    (New,"New")
00235     MEDIAINFOLIST_ASSIGN(New,"New")
00236     MEDIAINFO_ASSIGN    (Delete,"Delete")
00237     MEDIAINFOLIST_ASSIGN(Delete,"Delete")
00238     MEDIAINFO_ASSIGN    (Open,"Open")
00239     MEDIAINFOLIST_ASSIGN(Open,"Open")
00240     MEDIAINFO_ASSIGN    (Open_Buffer_Init,"Open_Buffer_Init")
00241     MEDIAINFO_ASSIGN    (Open_Buffer_Continue,"Open_Buffer_Continue")
00242     MEDIAINFO_ASSIGN    (Open_Buffer_Continue_GoTo_Get,"Open_Buffer_Continue_GoTo_Get")
00243     MEDIAINFO_ASSIGN    (Open_Buffer_Finalize,"Open_Buffer_Finalize")
00244     MEDIAINFO_ASSIGN    (Close,"Close")
00245     MEDIAINFOLIST_ASSIGN(Close,"Close")
00246     MEDIAINFO_ASSIGN    (Inform,"Inform")
00247     MEDIAINFOLIST_ASSIGN(Inform,"Inform")
00248     MEDIAINFO_ASSIGN    (GetI,"GetI")
00249     MEDIAINFOLIST_ASSIGN(GetI,"GetI")
00250     MEDIAINFO_ASSIGN    (Get,"Get")
00251     MEDIAINFOLIST_ASSIGN(Get,"Get")
00252     MEDIAINFO_ASSIGN    (Option,"Option")
00253     MEDIAINFOLIST_ASSIGN(Option,"Option")
00254     MEDIAINFO_ASSIGN    (State_Get,"State_Get")
00255     MEDIAINFOLIST_ASSIGN(State_Get,"State_Get")
00256     MEDIAINFO_ASSIGN    (Count_Get,"Count_Get")
00257     MEDIAINFOLIST_ASSIGN(Count_Get,"Count_Get")
00258     MEDIAINFOLIST_ASSIGN(Count_Get_Files,"Count_Get_Files")
00259     if (Errors>0)
00260        return (size_t)-1;
00261 
00262     Module_Count++;
00263     return (size_t)1;
00264 }
00265 
00266 static size_t MediaInfoDLL_IsLoaded()
00267 {
00268     if (Module)
00269         return 1;
00270     else
00271         return 0;
00272 }
00273 
00274 static void MediaInfoDLL_UnLoad()
00275 {
00276     Module_Count--;
00277     if (Module_Count>0)
00278         return;
00279 
00280     #ifdef MEDIAINFO_GLIBC
00281         g_module_close(Module);
00282     #elif defined (_WIN32) || defined (WIN32)
00283         FreeLibrary(Module);
00284     #else
00285         dlclose(Module);
00286     #endif
00287     Module=NULL;
00288 }
00289 
00290 #ifdef __cplusplus
00291 }
00292 #endif /*__cplusplus*/
00293 
00294 /***************************************************************************/
00295 /***************************************************************************/
00296 /***************************************************************************/
00297 
00298 #ifdef __cplusplus
00299 //DLL C++ wrapper for C functions
00300 
00301 //---------------------------------------------------------------------------
00302 #include <string>
00303 #include <sstream>
00304 //---------------------------------------------------------------------------
00305 
00306 namespace MediaInfoDLL
00307 {
00308 
00309 //---------------------------------------------------------------------------
00310 //MediaInfo_Char types
00311 #undef  _T
00312 #define _T(__x)     __T(__x)
00313 #if defined(UNICODE) || defined (_UNICODE)
00314     typedef wchar_t Char;
00315     #undef  __T
00316     #define __T(__x) L ## __x
00317 #else
00318     typedef char Char;
00319     #undef  __T
00320     #define __T(__x) __x
00321 #endif
00322 typedef std::basic_string<Char>        String;
00323 typedef std::basic_stringstream<Char>  StringStream;
00324 typedef std::basic_istringstream<Char> tiStringStream;
00325 typedef std::basic_ostringstream<Char> toStringStream;
00326 const size_t Error=(size_t)(-1);
00327 //---------------------------------------------------------------------------
00328 
00329 //---------------------------------------------------------------------------
00331 enum stream_t
00332 {
00333     Stream_General,                 
00334     Stream_Video,                   
00335     Stream_Audio,                   
00336     Stream_Text,                    
00337     Stream_Chapters,                
00338     Stream_Image,                   
00339     Stream_Menu,                    
00340     Stream_Max,
00341 };
00342 
00344 enum info_t
00345 {
00346     Info_Name,                      
00347     Info_Text,                      
00348     Info_Measure,                   
00349     Info_Options,                   
00350     Info_Name_Text,                 
00351     Info_Measure_Text,              
00352     Info_Info,                      
00353     Info_HowTo,                     
00354     Info_Max
00355 };
00356 
00361 enum infooptions_t
00362 {
00363     InfoOption_ShowInInform,        
00364     InfoOption_Reserved,            
00365     InfoOption_ShowInSupported,     
00366     InfoOption_TypeOfValue,         
00367     InfoOption_Max
00368 };
00369 
00371 enum fileoptions_t
00372 {
00373     FileOption_Nothing      =0x00,
00374     FileOption_NoRecursive  =0x01,  
00375     FileOption_CloseAll     =0x02,  
00376     FileOption_Max          =0x04
00377 };
00378 
00379 const String Unable_Load_DLL=_T("Unable to load ")_T(MEDIAINFODLL_NAME);
00380 #define MEDIAINFO_TEST_VOID \
00381     if (!IsReady()) return
00382 #define MEDIAINFO_TEST_INT \
00383     if (!IsReady()) return 0
00384 #define MEDIAINFO_TEST_STRING \
00385     if (!IsReady()) return Unable_Load_DLL
00386 #define MEDIAINFO_TEST_STRING_STATIC \
00387     if (!Module) return Unable_Load_DLL
00388 
00389 //---------------------------------------------------------------------------
00390 class MediaInfo
00391 {
00392 public :
00393     MediaInfo ()                {if (!Module) MediaInfoDLL_Load(); if (!Module) {Handle=NULL; return;}; Handle=MediaInfo_New();};
00394     ~MediaInfo ()               {MEDIAINFO_TEST_VOID; MediaInfo_Delete(Handle);};
00395 
00396     //File
00397     size_t Open (const String &File) {MEDIAINFO_TEST_INT; return MediaInfo_Open(Handle, File.c_str());};
00398     size_t Open_Buffer_Init (MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset) {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Init(Handle, File_Size, File_Offset);};
00399     size_t Open_Buffer_Continue (MediaInfo_int8u* Buffer, size_t Buffer_Size) {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size);};
00400     MediaInfo_int64u Open_Buffer_Continue_GoTo_Get () {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle);};
00401     size_t Open_Buffer_Finalize () {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Finalize(Handle);};
00402     //size_t Save () {MEDIAINFO_TEST_INT; return MediaInfo_Save(Handle);};
00403     void Close () {MEDIAINFO_TEST_VOID; return MediaInfo_Close(Handle);};
00404 
00405     //General information
00406     String Inform ()  {MEDIAINFO_TEST_STRING; return MediaInfo_Inform(Handle, 0);};
00407     String Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text)  {MEDIAINFO_TEST_STRING; return MediaInfo_GetI (Handle, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, (MediaInfo_info_C)InfoKind);};
00408     String Get (stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name)  {MEDIAINFO_TEST_STRING; return MediaInfo_Get (Handle, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), (MediaInfo_info_C)InfoKind, (MediaInfo_info_C)SearchKind);};
00409     //size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=_T(""))  {MEDIAINFO_TEST_INT; return MediaInfo_SetI (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());};
00410     //size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=_T(""))  {MEDIAINFO_TEST_INT; return MediaInfo_Set (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());};
00411     String        Option (const String &Option, const String &Value=_T(""))  {MEDIAINFO_TEST_STRING; return MediaInfo_Option (Handle, Option.c_str(), Value.c_str());};
00412     static String Option_Static (const String &Option, const String &Value=_T(""))  {MEDIAINFO_TEST_STRING_STATIC; return MediaInfo_Option (NULL, Option.c_str(), Value.c_str());};
00413     size_t                  State_Get ()  {MEDIAINFO_TEST_INT; return MediaInfo_State_Get(Handle);};
00414     size_t                  Count_Get (stream_t StreamKind, size_t StreamNumber=(size_t)-1)  {MEDIAINFO_TEST_INT; return MediaInfo_Count_Get(Handle, (MediaInfo_stream_C)StreamKind, StreamNumber);};
00415 
00416     bool IsReady() {return (Handle && Module)?true:false;}
00417 
00418 private :
00419     void* Handle;
00420 };
00421 
00422 class MediaInfoList
00423 {
00424 public :
00425     MediaInfoList ()                {MediaInfoDLL_Load(); if (!MediaInfoDLL_IsLoaded()) {Handle=NULL; return;}; Handle=MediaInfoList_New();};
00426     ~MediaInfoList ()               {MEDIAINFO_TEST_VOID; MediaInfoList_Delete(Handle); MediaInfoDLL_UnLoad();};
00427 
00428     //File
00429     size_t Open (const String &File, const fileoptions_t Options=FileOption_Nothing) {MEDIAINFO_TEST_INT; return MediaInfoList_Open(Handle, File.c_str(), (MediaInfo_fileoptions_C)Options);};
00430     //size_t Save (size_t FilePos) {MEDIAINFO_TEST_INT; return MediaInfoList_Save(Handle, FilePos);};
00431     void Close (size_t FilePos=(size_t)-1) {MEDIAINFO_TEST_VOID; return MediaInfoList_Close(Handle, FilePos);};
00432 
00433     //General information
00434     String Inform (size_t FilePos=(size_t)-1)  {MEDIAINFO_TEST_STRING; return MediaInfoList_Inform(Handle, FilePos, 0);};
00435     String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text)  {MEDIAINFO_TEST_STRING; return MediaInfoList_GetI (Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, (MediaInfo_info_C)InfoKind);};
00436     String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name)  {MEDIAINFO_TEST_STRING; return MediaInfoList_Get (Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), (MediaInfo_info_C)InfoKind, (MediaInfo_info_C)SearchKind);};
00437     //size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=_T(""))  {MEDIAINFO_TEST_INT; return MediaInfoList_SetI (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());};
00438     //size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=_T(""))  {MEDIAINFO_TEST_INT; return MediaInfoList_Set (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());};
00439     String        Option (const String &Option, const String &Value=_T(""))  {MEDIAINFO_TEST_STRING; return MediaInfoList_Option (Handle, Option.c_str(), Value.c_str());};
00440     static String Option_Static (const String &Option, const String &Value=_T(""))  {MEDIAINFO_TEST_STRING_STATIC; return MediaInfoList_Option (NULL, Option.c_str(), Value.c_str());};
00441     size_t        State_Get ()  {MEDIAINFO_TEST_INT; return MediaInfoList_State_Get(Handle);};
00442     size_t        Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber=(size_t)-1)  {MEDIAINFO_TEST_INT; return MediaInfoList_Count_Get(Handle, FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber);};
00443     size_t        Count_Get ()  {MEDIAINFO_TEST_INT; return MediaInfoList_Count_Get_Files(Handle);};
00444 
00445     bool IsReady() {return (Handle && Module)?true:false;}
00446 
00447 private :
00448     void* Handle;
00449 };
00450 
00451 } //NameSpace
00452 #endif /*__cplusplus*/
00453 
00454 #endif

Generated on Fri Apr 17 08:56:03 2009 for MediaInfoLib by  doxygen 1.3.9.1