MediaInfoList.h

Go to the documentation of this file.
00001 // MediaInfoList - A list of MediaInfo
00002 // Copyright (C) 2002-2007 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 // MediaInfoList
00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00021 //
00022 // Give information about a lot of media files
00023 //
00024 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00025 
00026 //---------------------------------------------------------------------------
00027 #ifndef MediaInfoListH
00028 #define MediaInfoListH
00029 //---------------------------------------------------------------------------
00030 
00031 //---------------------------------------------------------------------------
00032 #include "MediaInfo/MediaInfo.h"
00033 #include <vector>
00034 //---------------------------------------------------------------------------
00035 
00036 namespace MediaInfoLib
00037 {
00038 
00039 //***************************************************************************
00040 /// @brief MediaInfoList
00041 /// @version 0.7
00042 //***************************************************************************
00043 
00044 class MediaInfoList
00045 {
00046 public :
00047     //Class
00048         /// @brief Constructor
00049         /// @param Count_Init optimization information : How many files do you plan to handle?
00050     MediaInfoList (size_t Count_Init=64);
00051     ~MediaInfoList ();
00052 
00053     //Files
00054         /// Open one or more files and collect information about them (technical information and tags)
00055         /// @brief Open files
00056         /// @param File Full name of file(s) to open \n
00057         ///             or Full name of folder(s) to open \n
00058         ///             (if multiple names, names must be separated by "|")
00059         /// @param Options : FileOption_Recursive = Recursive mode for folders \n
00060         ///                  FileOption_Close = Close all already opened files before
00061         /// @retval Number of files successfuly added
00062     size_t Open (const String &File, const fileoptions_t Options=FileOption_Nothing);
00063         /// Open a buffer (Begin and end of the stream) and collect information about it (technical information and tags)
00064         /// @brief Open a stream
00065         /// @param Begin First bytes of the buffer
00066         /// @param Begin_Size Size of Begin
00067         /// @param End Last bytes of the buffer
00068         /// @param End_Size Size of End
00069         /// @retval 0 File not opened
00070         /// @retval 1 File opened
00071     size_t Open (const int8u* Begin, size_t Begin_Size, const int8u* End=NULL, size_t End_Size=NULL, int64u FileSize=0);
00072         /// Save the file opened before with Open() (modifications of tags)
00073         /// @brief Save the file
00074         /// @param FilePos File position \n
00075         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00076         /// @retval 0 failed
00077         /// @retval 1 suceed
00078     size_t Save (size_t FilePos);
00079         /// Save all files opened before with Open() (modifications of tags)
00080         /// @brief Save all files
00081         /// @retval Count of files saved
00082     void Close (size_t FilePos=(size_t)-1);
00083 
00084         /// Get all details about a file in one string
00085         /// @brief Get all details about a file
00086         /// @param FilePos File position \n
00087         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00088         /// @pre You can change default presentation with Inform_Set()
00089     String Inform (size_t FilePos=(size_t)-1, size_t Reserved=0);
00090 
00091     //Get
00092         /// Get a piece of information about a file (parameter is an integer)
00093         /// @brief Get a piece of information about a file (parameter is an integer)
00094         /// @param FilePos File position \n
00095         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00096         /// @param StreamKind Kind of stream (general, video, audio...)
00097         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00098         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00099         /// @param KindOfInfo Kind of information you want about the parameter (the text, the measure, the help...)
00100         /// @return a string about information you search \n
00101         ///         an empty string if there is a problem
00102     String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t KindOfInfo=Info_Text); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name, text, measure, options, name (language), measure (language), info, how to
00103         /// Get a piece of information about a file (parameter is a string)
00104         /// @brief Get a piece of information about a file (parameter is a string)
00105         /// @param FilePos File position \n
00106         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00107         /// @param StreamKind Kind of stream (general, video, audio...)
00108         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00109         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00110         ///        See Info_Parameters() to have the full list
00111         /// @param KindOfInfo Kind of information you want about the parameter (the text, the measure, the help...)
00112         /// @param KindOfSearch Where to look for the parameter
00113         /// @return a string about information you search \n
00114         ///         an empty string if there is a problem
00115     String Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t KindOfInfo=Info_Text, info_t KindOfSearch=Info_Name); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name text measure options name(language) measure(language) information how to, KindOfSearch=which Kind Of information Parameter must be searched?
00116 
00117     //Set
00118         /// Set a piece of information about a file (parameter is an int)
00119         /// @brief Set a piece of information about a file (parameter is an int)
00120         /// @param FilePos File position \n
00121         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00122         /// @param StreamKind Kind of stream (general, video, audio...)
00123         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00124         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00125         /// @param OldValue The old value of the parameter \n if OldValue is empty and ToSet is filled : tag is added \n if OldValue is filled and ToSet is filled : tag is replaced \n if OldValue is filled and ToSet is empty : tag is deleted
00126         /// @retval >0 succeed
00127         /// @retval 0 failed
00128     size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=_T("")); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name, text, measure, options name(language) measure(language) information how to
00129         /// @brief Get information about a file (parameter is a string)
00130         /// @param FilePos File position \n
00131         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00132         /// @param StreamKind Kind of stream (general, video, audio...)
00133         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00134         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00135         ///        See Option("Info_Parameters") to have the full list
00136         /// @param OldValue The old value of the parameter \n if OldValue is empty and ToSet is filled : tag is added \n if OldValue is filled and ToSet is filled : tag is replaced \n if OldValue is filled and ToSet is empty : tag is deleted
00137         /// @retval >0 succeed
00138         /// @retval 0 failed
00139     size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=_T("")); //Get info, FilePos=File position, StreamKind=General video audio text chapter, StreamNumber=stream number, PosInStream=parameter you want, KindOfInfo=name text measure options name (language) measure (language) information how to, KindOfSearch=which Kind Of information Parameter must be searched?
00140 
00141     //Output_Buffered
00142         /// Output buffer retrieving, used for File_Duplicate option.
00143         /// @brief Output buffer retrieving
00144         /// @param Output_Buffer_Size A pointer to the variable that receives the size of the buffer \n
00145         ///        Note: you must use all the size of the buffer before the next call to this procedure
00146         /// @return A pointer on the output buffer, NULL if there is nothing in the buffer
00147     char* Output_Buffer_Get (size_t &Output_Buffer_Size);
00148 
00149     //Info
00150         /// Configure or get information about MediaInfoLib
00151         /// @param Option The name of option
00152         /// @param Value The value of option
00153         /// @return Depend of the option : by default "" (nothing) means No, other means Yes
00154         /// @post Known options are : See MediaInfo::Option()
00155     String        Option (const String &Option, const String &Value=String(_T("")));
00156     static String Option_Static (const String &Option, const String &Value=String(_T("")));
00157         /// @brief (NOT IMPLEMENTED YET) Get the state of the library
00158         /// @retval <1000 No information is available for the file yet
00159         /// @retval >=1000_<5000 Only local (into the file) information is available, getting Internet information (titles only) is no finished yet
00160         /// @retval 5000 (only if Internet connection is accepted) User interaction is needed (use Option() with "Internet_Title_Get") \n
00161         ///              Warning : even there is only one possible, user interaction (or the software) is needed
00162         /// @retval >5000<=10000 Only local (into the file) information is available, getting Internet information (all) is no finished yet
00163         /// @retval <10000 Done
00164     size_t                  State_Get ();
00165         /// @brief Count of streams, or count of piece of information in this stream
00166         /// @param FilePos File position \n
00167         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00168         /// @param StreamKind Kind of stream (general, video, audio...)
00169         /// @param StreamNumber Stream number in this kind of stream (first, second...)
00170     size_t                  Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber=(size_t)-1);
00171         /// @brief Get the count of opened files
00172         /// @return Count of files opened
00173     size_t                  Count_Get ();
00174 
00175 private :
00176     std::vector<MediaInfo*> Info;
00177     WxThread* Thread;
00178     int BlockMethod; //Open() return : 0=immedialtly, 1=after local info, 2=when user interaction is needed
00179 
00180 };
00181 
00182 } //NameSpace
00183 #endif

Generated on Fri Nov 2 17:13:16 2007 for MediaInfoLib by  doxygen 1.5.1-p1