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
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 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 (size_t 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     size_t Open (const 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     size_t Open (const int8u* Begin, size_t Begin_Size, const int8u* 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     size_t Save (size_t FilePos);
00080         /// Save all files opened before with Open() (modifications of tags)
00081         /// @brief Save all files
00082         /// @retval Count of files saved
00083     void Close (size_t FilePos=(size_t)-1);
00084 
00085         /// Get all details about a file in one string
00086         /// @brief Get all details about a file
00087         /// @param FilePos File position \n
00088         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00089         /// @pre You can change default presentation with Inform_Set()
00090     String Inform (size_t FilePos=(size_t)-1, size_t Reserved=0);
00091 
00092     //Get
00093         /// Get a piece of information about a file (parameter is an integer)
00094         /// @brief Get a piece of information about a file (parameter is an integer)
00095         /// @param FilePos File position \n
00096         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00097         /// @param StreamKind Kind of stream (general, video, audio...)
00098         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00099         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00100         /// @param KindOfInfo Kind of information you want about the parameter (the text, the measure, the help...)
00101         /// @return a string about information you search \n
00102         ///         an empty string if there is a problem
00103     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
00104         /// Get a piece of information about a file (parameter is a string)
00105         /// @brief Get a piece of information about a file (parameter is a string)
00106         /// @param FilePos File position \n
00107         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00108         /// @param StreamKind Kind of stream (general, video, audio...)
00109         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00110         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00111         ///        See Info_Parameters() to have the full list
00112         /// @param KindOfInfo Kind of information you want about the parameter (the text, the measure, the help...)
00113         /// @param KindOfSearch Where to look for the parameter
00114         /// @return a string about information you search \n
00115         ///         an empty string if there is a problem
00116     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?
00117 
00118     //Set
00119         /// Set a piece of information about a file (parameter is an int)
00120         /// @brief Set a piece of information about a file (parameter is an int)
00121         /// @param FilePos File position \n
00122         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00123         /// @param StreamKind Kind of stream (general, video, audio...)
00124         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00125         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00126         /// @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
00127         /// @retval >0 succeed
00128         /// @retval 0 failed
00129     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
00130         /// @brief Get information about a file (parameter is a string)
00131         /// @param FilePos File position \n
00132         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00133         /// @param StreamKind Kind of stream (general, video, audio...)
00134         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00135         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00136         ///        See Option("Info_Parameters") to have the full list
00137         /// @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
00138         /// @retval >0 succeed
00139         /// @retval 0 failed
00140     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?
00141 
00142     //Info
00143         /// Configure or get information about MediaInfoLib
00144         /// @param Option The name of option
00145         /// @param Value The value of option
00146         /// @return Depend of the option : by default "" (nothing) means No, other means Yes
00147         /// @post Known options are : See MediaInfo::Option()
00148     String        Option (const String &Option, const String &Value=String(_T("")));
00149     static String Option_Static (const String &Option, const String &Value=String(_T("")));
00150         /// @brief (NOT IMPLEMENTED YET) Get the state of the library
00151         /// @retval <1000 No information is available for the file yet
00152         /// @retval >=1000_<5000 Only local (into the file) information is available, getting Internet information (titles only) is no finished yet
00153         /// @retval 5000 (only if Internet connection is accepted) User interaction is needed (use Option() with "Internet_Title_Get") \n
00154         ///              Warning : even there is only one possible, user interaction (or the software) is needed
00155         /// @retval >5000<=10000 Only local (into the file) information is available, getting Internet information (all) is no finished yet
00156         /// @retval <10000 Done
00157     size_t                  State_Get ();
00158         /// @brief Count of streams, or count of piece of information in this stream
00159         /// @param FilePos File position \n
00160         ///        (you can know the position in searching the filename with MediaInfoList::Get(FilePos, 0, 0, "CompleteName") )
00161         /// @param StreamKind Kind of stream (general, video, audio...)
00162         /// @param StreamNumber Stream number in this kind of stream (first, second...)
00163     size_t                  Count_Get (size_t FilePos, stream_t StreamKind, size_t StreamNumber=(size_t)-1);
00164         /// @brief Get the count of opened files
00165         /// @return Count of files opened
00166     size_t                  Count_Get ();
00167 
00168 private :
00169     std::vector<MediaInfo*> Info;
00170     WxThread* Thread;
00171     int BlockMethod; //Open() return : 0=immedialtly, 1=after local info, 2=when user interaction is needed
00172 
00173 };
00174 
00175 } //NameSpace
00176 #endif

Generated on Mon May 14 15:51:00 2007 for MediaInfoLib by  doxygen 1.5.1-p1