/usr/src/packages/BUILD/Source/MediaInfoDLL/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     #define MEDIAINFODLL_NAME  "MediaInfo.dll"
00032 #elif defined(__APPLE__) && defined(__MACH__)
00033     #define MEDIAINFODLL_NAME  "libmediainfo.0.dylib"
00034     #define __stdcall
00035 #else
00036     #define MEDIAINFODLL_NAME  "libmediainfo.so.0"
00037     #define __stdcall
00038 #endif 
00039 #include <new> //For size_t in MacOS
00040 
00041 /*-------------------------------------------------------------------------*/
00042 /*Char types                                                               */
00043 #undef  _T
00044 #define _T(__x)     __T(__x)
00045 #if defined(UNICODE) || defined (_UNICODE)
00046     typedef wchar_t MediaInfo_Char;
00047     #undef  __T
00048     #define __T(__x) L ## __x
00049     #define MEDIAINFO_Ansi ""
00050 #else
00051     typedef char MediaInfo_Char;
00052     #undef  __T
00053     #define __T(__x) __x
00054     #define MEDIAINFO_Ansi "A"
00055 #endif
00056 /*-------------------------------------------------------------------------*/
00057 
00058 /*-------------------------------------------------------------------------*/
00059 /*8-bit int                                                                */
00060 typedef unsigned char       MediaInfo_int8u;
00061 /*-------------------------------------------------------------------------*/
00062 
00063 /*-------------------------------------------------------------------------*/
00064 /*64-bit int                                                               */
00065 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
00066     #undef  MAXTYPE_INT
00067     #define MAXTYPE_INT 64
00068     typedef unsigned long long  MediaInfo_int64u;
00069 #elif defined(__WIN32__) || defined(_WIN32)
00070     #undef  MAXTYPE_INT
00071     #define MAXTYPE_INT 64
00072     typedef unsigned __int64    MediaInfo_int64u;
00073 #else
00074     #pragma message This machine has no 64-bit integer type?
00075 #endif
00076 /*-------------------------------------------------------------------------*/
00077 
00078 /*-------------------------------------------------------------------------*/
00079 /*NULL                                                                      */
00080 #ifndef NULL
00081     #define NULL 0
00082 #endif
00083 /*-------------------------------------------------------------------------*/
00084 
00086 typedef enum MediaInfo_stream_t
00087 {
00088     MediaInfo_Stream_General,
00089     MediaInfo_Stream_Video,
00090     MediaInfo_Stream_Audio,
00091     MediaInfo_Stream_Text,
00092     MediaInfo_Stream_Chapters,
00093     MediaInfo_Stream_Image,
00094     MediaInfo_Stream_Menu,
00095     MediaInfo_Stream_Max
00096 } MediaInfo_stream_C;
00097 
00099 typedef enum MediaInfo_info_t
00100 {
00101     MediaInfo_Info_Name,
00102     MediaInfo_Info_Text,
00103     MediaInfo_Info_Measure,
00104     MediaInfo_Info_Options,
00105     MediaInfo_Info_Name_Text,
00106     MediaInfo_Info_Measure_Text,
00107     MediaInfo_Info_Info,
00108     MediaInfo_Info_HowTo,
00109     MediaInfo_Info_Max
00110 } MediaInfo_info_C;
00111 
00113 typedef enum MediaInfo_infooptions_t
00114 {
00115     MediaInfo_InfoOption_ShowInInform,
00116     MediaInfo_InfoOption_Reserved,
00117     MediaInfo_InfoOption_ShowInSupported,
00118     MediaInfo_InfoOption_TypeOfValue,
00119     MediaInfo_InfoOption_Max
00120 } MediaInfo_infooptions_C;
00121 
00123 typedef enum MediaInfo_fileoptions_t
00124 {
00125     MediaInfo_FileOption_Nothing        =0x00,
00126     MediaInfo_FileOption_NoRecursive    =0x01,
00127     MediaInfo_FileOption_CloseAll       =0x02,
00128     MediaInfo_FileOption_Max            =0x04
00129 } MediaInfo_fileoptions_C;
00130 
00131 
00132 #ifdef __cplusplus
00133 extern "C"
00134 {
00135 #endif /* __cplusplus */
00136 
00137 #ifdef MEDIAINFO_GLIBC
00138     #include <gmodule.h>
00139     static GModule* Module=NULL;
00140 #elif defined (_WIN32) || defined (WIN32)
00141     #include <windows.h>
00142     static HMODULE  Module=NULL;
00143 #else
00144     #include <dlfcn.h>
00145     static void*    Module=NULL;
00146 #endif
00147 static size_t Module_Count=0;
00148 
00149 #ifdef MEDIAINFO_GLIBC
00150 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00151     if (!g_module_symbol (Module, "MediaInfo"MEDIAINFO_Ansi"_"_Name2, (gpointer*)&MediaInfo_##_Name)) \
00152         Errors++;
00153 #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \
00154     if (!g_module_symbol (Module, "MediaInfoList"MEDIAINFO_Ansi"_"_Name2, (gpointer*)&MediaInfoList_##_Name)) \
00155         Errors++;
00156 #elif defined (_WIN32) || defined (WIN32)
00157 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00158     MediaInfo_##_Name=(MEDIAINFO_##_Name)GetProcAddress(Module, "MediaInfo"MEDIAINFO_Ansi"_"_Name2); \
00159     if (MediaInfo_##_Name==NULL) Errors++;
00160 #define MEDIAINFOLIST_ASSIGN(_Name,_Name2) \
00161     MediaInfoList_##_Name=(MEDIAINFOLIST_##_Name)GetProcAddress(Module, "MediaInfoList"MEDIAINFO_Ansi"_"_Name2); \
00162     if (MediaInfoList_##_Name==NULL) Errors++;
00163 #else
00164 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00165     MediaInfo_##_Name=(MEDIAINFO_##_Name)dlsym(Module, "MediaInfo"MEDIAINFO_Ansi"_"_Name2); \
00166     if (MediaInfo_##_Name==NULL) Errors++;
00167 #define MEDIAINFO_ASSIGN(_Name,_Name2) \
00168     MediaInfoList_##_Name=(MEDIAINFOLIST_##_Name)dlsym(Module, "MediaInfoList"MEDIAINFO_Ansi"_"_Name2); \
00169     if (MediaInfoList_##_Name==NULL) Errors++;
00170 #endif
00171 
00172 typedef void* (__stdcall *MEDIAINFO_New)(); static MEDIAINFO_New MediaInfo_New;
00173 typedef void* (__stdcall *MEDIAINFOLIST_New)(); static MEDIAINFOLIST_New MediaInfoList_New;
00174 typedef void (__stdcall *MEDIAINFO_Delete)(void*); static MEDIAINFO_Delete MediaInfo_Delete;
00175 typedef void (__stdcall *MEDIAINFOLIST_Delete)(void*); static MEDIAINFOLIST_Delete MediaInfoList_Delete;
00176 typedef size_t (__stdcall *MEDIAINFO_Open)(void*, const MediaInfo_Char*); static MEDIAINFO_Open MediaInfo_Open;
00177 typedef size_t (__stdcall *MEDIAINFOLIST_Open)(void*, const MediaInfo_Char*, const MediaInfo_fileoptions_C); static MEDIAINFOLIST_Open MediaInfoList_Open;
00178 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;
00179 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;
00180 typedef MediaInfo_int64u (__stdcall *MEDIAINFO_Open_Buffer_Continue_GoTo_Get)(void*); static MEDIAINFO_Open_Buffer_Continue_GoTo_Get MediaInfo_Open_Buffer_Continue_GoTo_Get;
00181 typedef size_t (__stdcall *MEDIAINFO_Open_Buffer_Finalize)(void*); static MEDIAINFO_Open_Buffer_Finalize MediaInfo_Open_Buffer_Finalize;
00182 typedef void (__stdcall *MEDIAINFO_Close)(void*); static MEDIAINFO_Close MediaInfo_Close;
00183 typedef void (__stdcall *MEDIAINFOLIST_Close)(void*, size_t); static MEDIAINFOLIST_Close MediaInfoList_Close;
00184 typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Inform)(void*, size_t Reserved); static MEDIAINFO_Inform MediaInfo_Inform;
00185 typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Inform)(void*, size_t, size_t Reserved); static MEDIAINFOLIST_Inform MediaInfoList_Inform;
00186 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;
00187 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;
00188 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;
00189 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;
00190 typedef const MediaInfo_Char* (__stdcall *MEDIAINFO_Option)(void*, const MediaInfo_Char* Parameter, const MediaInfo_Char* Value); static MEDIAINFO_Option MediaInfo_Option;
00191 typedef const MediaInfo_Char* (__stdcall *MEDIAINFOLIST_Option)(void*, const MediaInfo_Char* Parameter, const MediaInfo_Char* Value); static MEDIAINFOLIST_Option MediaInfoList_Option;
00192 typedef size_t (__stdcall *MEDIAINFO_State_Get)(void*); static MEDIAINFO_State_Get MediaInfo_State_Get;
00193 typedef size_t (__stdcall *MEDIAINFOLIST_State_Get)(void*); static MEDIAINFOLIST_State_Get MediaInfoList_State_Get;
00194 typedef size_t (__stdcall *MEDIAINFO_Count_Get)(void*, MediaInfo_stream_C StreamKind, size_t StreamNumber); static MEDIAINFO_Count_Get MediaInfo_Count_Get;
00195 typedef size_t (__stdcall *MEDIAINFOLIST_Count_Get)(void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber); static MEDIAINFOLIST_Count_Get MediaInfoList_Count_Get;
00196 typedef size_t (__stdcall *MEDIAINFO_Count_Get_Files)(void*); static MEDIAINFO_Count_Get_Files MediaInfo_Count_Get_Files;
00197 typedef size_t (__stdcall *MEDIAINFOLIST_Count_Get_Files)(void*); static MEDIAINFOLIST_Count_Get_Files MediaInfoList_Count_Get_Files;
00198 
00199 static size_t MediaInfoDLL_Load()
00200 {
00201     if (Module_Count>0)
00202     {
00203         Module_Count++;
00204         return 1;
00205     }
00206 
00207     /* Load library */
00208     #ifdef MEDIAINFO_GLIBC
00209         Module=g_module_open(MEDIAINFODLL_NAME, G_MODULE_BIND_LAZY);
00210     #elif defined (_WIN32) || defined (WIN32)
00211         Module=LoadLibrary(_T(MEDIAINFODLL_NAME));
00212     #else
00213         Module=dlopen(MEDIAINFODLL_NAME, RTLD_LAZY);
00214         if (!Module)
00215             Module=dlopen("./"MEDIAINFODLL_NAME, RTLD_LAZY);
00216         if (!Module)
00217             Module=dlopen("/usr/local/lib/"MEDIAINFODLL_NAME, RTLD_LAZY);
00218         if (!Module)
00219             Module=dlopen("/usr/local/lib64/"MEDIAINFODLL_NAME, RTLD_LAZY);
00220         if (!Module)
00221             Module=dlopen("/usr/lib/"MEDIAINFODLL_NAME, RTLD_LAZY);
00222         if (!Module)
00223             Module=dlopen("/usr/lib64/"MEDIAINFODLL_NAME, RTLD_LAZY);
00224     #endif
00225     if (!Module)
00226         return (size_t)-1;
00227 
00228     /* Load methods */
00229     size_t Errors=0;
00230     MEDIAINFO_ASSIGN    (New,"New")
00231     MEDIAINFOLIST_ASSIGN(New,"New")
00232     MEDIAINFO_ASSIGN    (Delete,"Delete")
00233     MEDIAINFOLIST_ASSIGN(Delete,"Delete")
00234     MEDIAINFO_ASSIGN    (Open,"Open")
00235     MEDIAINFOLIST_ASSIGN(Open,"Open")
00236     MEDIAINFO_ASSIGN    (Open_Buffer_Init,"Open_Buffer_Init")
00237     MEDIAINFO_ASSIGN    (Open_Buffer_Continue,"Open_Buffer_Continue")
00238     MEDIAINFO_ASSIGN    (Open_Buffer_Continue_GoTo_Get,"Open_Buffer_Continue_GoTo_Get")
00239     MEDIAINFO_ASSIGN    (Open_Buffer_Finalize,"Open_Buffer_Finalize")
00240     MEDIAINFO_ASSIGN    (Close,"Close")
00241     MEDIAINFOLIST_ASSIGN(Close,"Close")
00242     MEDIAINFO_ASSIGN    (Inform,"Inform")
00243     MEDIAINFOLIST_ASSIGN(Inform,"Inform")
00244     MEDIAINFO_ASSIGN    (GetI,"GetI")
00245     MEDIAINFOLIST_ASSIGN(GetI,"GetI")
00246     MEDIAINFO_ASSIGN    (Get,"Get")
00247     MEDIAINFOLIST_ASSIGN(Get,"Get")
00248     MEDIAINFO_ASSIGN    (Option,"Option")
00249     MEDIAINFOLIST_ASSIGN(Option,"Option")
00250     MEDIAINFO_ASSIGN    (State_Get,"State_Get")
00251     MEDIAINFOLIST_ASSIGN(State_Get,"State_Get")
00252     MEDIAINFO_ASSIGN    (Count_Get,"Count_Get")
00253     MEDIAINFOLIST_ASSIGN(Count_Get,"Count_Get")
00254     MEDIAINFOLIST_ASSIGN(Count_Get_Files,"Count_Get_Files")
00255     if (Errors>0)
00256        return (size_t)-1;
00257 
00258     Module_Count++;
00259     return (size_t)1;
00260 }
00261 
00262 static size_t MediaInfoDLL_IsLoaded()
00263 {
00264     if (Module)
00265         return 1;
00266     else
00267         return 0;
00268 }
00269 
00270 static void MediaInfoDLL_UnLoad()
00271 {
00272     Module_Count--;
00273     if (Module_Count>0)
00274         return;
00275 
00276     #ifdef MEDIAINFO_GLIBC
00277         g_module_close(Module);
00278     #elif defined (_WIN32) || defined (WIN32)
00279         FreeLibrary(Module);
00280     #else
00281         dlclose(Module);
00282     #endif
00283     Module=NULL;
00284 }
00285 
00286 #ifdef __cplusplus
00287 }
00288 #endif /*__cplusplus*/
00289 
00290 /***************************************************************************/
00291 /***************************************************************************/
00292 /***************************************************************************/
00293 
00294 #ifdef __cplusplus
00295 //DLL C++ wrapper for C functions
00296 
00297 //---------------------------------------------------------------------------
00298 #include <string>
00299 #include <sstream>
00300 //---------------------------------------------------------------------------
00301 
00302 namespace MediaInfoDLL
00303 {
00304 
00305 //---------------------------------------------------------------------------
00306 //MediaInfo_Char types
00307 #undef  _T
00308 #define _T(__x)     __T(__x)
00309 #if defined(UNICODE) || defined (_UNICODE)
00310     typedef wchar_t Char;
00311     #undef  __T
00312     #define __T(__x) L ## __x
00313 #else
00314     typedef char Char;
00315     #undef  __T
00316     #define __T(__x) __x
00317 #endif
00318 typedef std::basic_string<Char>        String;
00319 typedef std::basic_stringstream<Char>  StringStream;
00320 typedef std::basic_istringstream<Char> tiStringStream;
00321 typedef std::basic_ostringstream<Char> toStringStream;
00322 const size_t Error=(size_t)(-1);
00323 //---------------------------------------------------------------------------
00324 
00325 //---------------------------------------------------------------------------
00327 enum stream_t
00328 {
00329     Stream_General,                 
00330     Stream_Video,                   
00331     Stream_Audio,                   
00332     Stream_Text,                    
00333     Stream_Chapters,                
00334     Stream_Image,                   
00335     Stream_Menu,                    
00336     Stream_Max,
00337 };
00338 
00340 enum info_t
00341 {
00342     Info_Name,                      
00343     Info_Text,                      
00344     Info_Measure,                   
00345     Info_Options,                   
00346     Info_Name_Text,                 
00347     Info_Measure_Text,              
00348     Info_Info,                      
00349     Info_HowTo,                     
00350     Info_Max
00351 };
00352 
00357 enum infooptions_t
00358 {
00359     InfoOption_ShowInInform,        
00360     InfoOption_Reserved,            
00361     InfoOption_ShowInSupported,     
00362     InfoOption_TypeOfValue,         
00363     InfoOption_Max
00364 };
00365 
00367 enum fileoptions_t
00368 {
00369     FileOption_Nothing      =0x00,
00370     FileOption_NoRecursive  =0x01,  
00371     FileOption_CloseAll     =0x02,  
00372     FileOption_Max          =0x04
00373 };
00374 
00375 const String Unable_Load_DLL=_T("Unable to load ")_T(MEDIAINFODLL_NAME);
00376 #define MEDIAINFO_TEST_VOID \
00377     if (!IsReady()) return
00378 #define MEDIAINFO_TEST_INT \
00379     if (!IsReady()) return 0
00380 #define MEDIAINFO_TEST_STRING \
00381     if (!IsReady()) return Unable_Load_DLL
00382 #define MEDIAINFO_TEST_STRING_STATIC \
00383     if (!Module) return Unable_Load_DLL
00384 
00385 //---------------------------------------------------------------------------
00386 class MediaInfo
00387 {
00388 public :
00389     MediaInfo ()                {if (!Module) MediaInfoDLL_Load(); if (!Module) {Handle=NULL; return;}; Handle=MediaInfo_New();};
00390     ~MediaInfo ()               {MEDIAINFO_TEST_VOID; MediaInfo_Delete(Handle);};
00391 
00392     //File
00393     size_t Open (const String &File) {MEDIAINFO_TEST_INT; return MediaInfo_Open(Handle, File.c_str());};
00394     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);};
00395     size_t Open_Buffer_Continue (MediaInfo_int8u* Buffer, size_t Buffer_Size) {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Continue(Handle, Buffer, Buffer_Size);};
00396     MediaInfo_int64u Open_Buffer_Continue_GoTo_Get () {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Continue_GoTo_Get(Handle);};
00397     size_t Open_Buffer_Finalize () {MEDIAINFO_TEST_INT; return MediaInfo_Open_Buffer_Finalize(Handle);};
00398     //size_t Save () {MEDIAINFO_TEST_INT; return MediaInfo_Save(Handle);};
00399     void Close () {MEDIAINFO_TEST_VOID; return MediaInfo_Close(Handle);};
00400 
00401     //General information
00402     String Inform ()  {MEDIAINFO_TEST_STRING; return MediaInfo_Inform(Handle, 0);};
00403     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);};
00404     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);};
00405     //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());};
00406     //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());};
00407     String        Option (const String &Option, const String &Value=_T(""))  {MEDIAINFO_TEST_STRING; return MediaInfo_Option (Handle, Option.c_str(), Value.c_str());};
00408     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());};
00409     size_t                  State_Get ()  {MEDIAINFO_TEST_INT; return MediaInfo_State_Get(Handle);};
00410     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);};
00411 
00412     bool IsReady() {return (Handle && Module)?true:false;}
00413 
00414 private :
00415     void* Handle;
00416 };
00417 
00418 class MediaInfoList
00419 {
00420 public :
00421     MediaInfoList ()                {MediaInfoDLL_Load(); if (!MediaInfoDLL_IsLoaded()) {Handle=NULL; return;}; Handle=MediaInfoList_New();};
00422     ~MediaInfoList ()               {MEDIAINFO_TEST_VOID; MediaInfoList_Delete(Handle); MediaInfoDLL_UnLoad();};
00423 
00424     //File
00425     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);};
00426     //size_t Save (size_t FilePos) {MEDIAINFO_TEST_INT; return MediaInfoList_Save(Handle, FilePos);};
00427     void Close (size_t FilePos=(size_t)-1) {MEDIAINFO_TEST_VOID; return MediaInfoList_Close(Handle, FilePos);};
00428 
00429     //General information
00430     String Inform (size_t FilePos=(size_t)-1)  {MEDIAINFO_TEST_STRING; return MediaInfoList_Inform(Handle, FilePos, 0);};
00431     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);};
00432     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);};
00433     //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());};
00434     //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());};
00435     String        Option (const String &Option, const String &Value=_T(""))  {MEDIAINFO_TEST_STRING; return MediaInfoList_Option (Handle, Option.c_str(), Value.c_str());};
00436     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());};
00437     size_t        State_Get ()  {MEDIAINFO_TEST_INT; return MediaInfoList_State_Get(Handle);};
00438     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);};
00439     size_t        Count_Get ()  {MEDIAINFO_TEST_INT; return MediaInfoList_Count_Get_Files(Handle);};
00440 
00441     bool IsReady() {return (Handle && Module)?true:false;}
00442 
00443 private :
00444     void* Handle;
00445 };
00446 
00447 } //NameSpace
00448 #endif /*__cplusplus*/
00449 
00450 #endif

Generated on Wed May 20 13:16:25 2009 for MediaInfoLib by  doxygen 1.5.1