Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

MediaInfoList.h

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

Generated on Fri Nov 24 09:38:36 2006 for MediaInfoLib by doxygen1.3-rc3