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

MediaInfoList.h

Go to the documentation of this file.
00001 // MediaInfoList - A list of MediaInfo
00002 // Copyright (C) 2002-2003 Jérôme 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 // Version 0.4.0
00024 // --------------
00025 // Give information about a lot of media files
00026 //
00027 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00028 //
00029 // 0.4.0.002 (Zen@MediaArea.net)
00030 // Add Inform and Inform_All Options
00031 //
00032 // 0.4.0 (Zen@MediaArea.net)
00033 // Adapt to new architecture and being LGPL
00034 // Namespace, use of std::string, Doxygen comments
00035 //
00036 // 0.3.0.001 (Zen@MediaArea.net)
00037 // DLL
00038 //
00039 // 0.3.0 (Zen@MediaArea.net)
00040 // uniformisation
00041 //
00042 // 0.2.0 (Zen@MediaArea.net)
00043 // in English
00044 // More tags
00045 //
00046 // 0.1.0 (Zen@MediaArea.net)
00047 //
00048 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00049 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00050 
00051 //---------------------------------------------------------------------------
00052 #ifndef MediaInfoListH
00053 #define MediaInfoListH
00054 //---------------------------------------------------------------------------
00055 
00056 //---------------------------------------------------------------------------
00057 #include <string>
00058 #include "MediaInfo/MediaInfo.h"
00059 //---------------------------------------------------------------------------
00060 
00061 //---------------------------------------------------------------------------
00062 //---------------------------------------------------------------------------
00063 
00064 namespace MediaInfoLib
00065 {
00066 //---------------------------------------------------------------------------
00067 /// @brief File opening options
00068 enum fileoptions_t
00069 {
00070     FileOption_Nothing      = 0,
00071     FileOption_Recursive    = 1,    ///< Browse folders recursively
00072     FileOption_Close        = 2,    ///< Close all files before open
00073     FileOption_Max          = 4
00074 };
00075 //---------------------------------------------------------------------------
00076 
00077 
00078 //***************************************************************************
00079 /// @brief MediaInfoList
00080 /// @version 0.4.0 beta
00081 //***************************************************************************
00082 
00083 class MediaInfoList
00084 {
00085 public :
00086     //Class
00087         /// @brief Constructor
00088         /// @param MaxCount Max number of files we have to handle
00089     MediaInfoList(int MaxCount=1000);
00090 
00091     //Files
00092         /// @brief Open one or more files
00093         /// @param File File to open (files must be separated by "|") \n
00094         ///             Folder to open
00095         /// @param Options MEDIAINFOLIB_RECURSIVE = Recursive mode for folders \n
00096         ///                MEDIAINFOLIB_CLOSE = Close all files before
00097         /// @retval >=0 Number of files added
00098     int Open (const std::string &File, const fileoptions_t Options=FileOption_Nothing);
00099         /// Save file
00100         /// @brief Save file
00101         /// @param FilePos File position to save
00102         /// @retval >=0 suceed
00103         /// @retval <0 failed
00104     int Save (int FilePos);
00105         /// Save all files
00106         /// @brief Save all files
00107     int Save_All ();
00108         /// @brief Close file (without saving)
00109         /// @warning without have saved before, modifications are lost
00110         /// @remarks All positions of files upper than FilePos are shifted
00111         /// @retval >=0 number of files saved
00112     void Close (int FilePos);
00113         /// Close all files (without saving)
00114         /// @warning without have saved before, modifications are lost
00115         /// @brief Close all files
00116     void Close_All ();
00117 
00118     ///Inform about a file in text mode
00119         /// @brief Get all details about a file in one string
00120         /// @param FilePos File position to inform
00121         /// @pre change defaults with Inform_Set()
00122     std::string Inform (int FilePos, informoptions_t Options=InformOption_Nothing);
00123         /// @brief Get all details about all files in one string
00124         /// @param Separator Separator string between files descriptions
00125         /// @pre change defaults with Inform_Set()
00126 #if defined(__BORLANDC__)
00127     #pragma warn -8058 //Borland doesn't like initialization of data in pre-compiled header
00128 #endif
00129     std::string Inform_All (informoptions_t Options=InformOption_Nothing, const std::string &Separator=std::string("\r\n\r\n---\r\n\r\n")); //Give info in Text (View_Set before)
00130 
00131     //Get file info
00132         /// @brief Get information about a file (parameter is an integer)
00133         /// @param FilePos File position
00134         /// @param StreamKind Kind of stream (general, video, audio...)
00135         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00136         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00137         /// @param KindOfInfo Kind of info you want about the parameter (the text, the measure, the help...)
00138         /// @return a string about info you search \n
00139         ///         an empty string if there is a problem
00140     std::string Get (int FilePos, stream_t StreamKind, int StreamNumber, 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
00141         /// @brief Get information about a file (parameter is a string)
00142         /// @param FilePos File position
00143         /// @param StreamKind Kind of stream (general, video, audio...)
00144         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00145         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00146         ///        See Info_Parameters() to have the full list
00147         /// @param KindOfInfo Kind of info you want about the parameter (the text, the measure, the help...)
00148         /// @param KindOfSearch Where to look for the parameter
00149         /// @return a string about info you search \n
00150         ///         an empty string if there is a problem
00151     std::string Get (int FilePos, stream_t StreamKind, int StreamNumber, const std::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) info how to, KindOfSearch=which Kind Of Info Parameter must be searched?
00152 
00153     //Set file info
00154         /// @brief Set information about a file (parameter is an int)
00155         /// @param FilePos File position
00156         /// @param StreamKind Kind of stream (general, video, audio...)
00157         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00158         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00159         /// @param KindOfInfo Kind of info you want about the parameter (the text, the measure, the help...)
00160         /// @retval >=0 suceed
00161         /// @retval <0 failed
00162     int Set (const std::string &ToSet, int FilePos, stream_t StreamKind, int StreamNumber, 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
00163         /// @brief Get information about a file (parameter is a string)
00164         /// @param FilePos File position
00165         /// @param StreamKind Kind of stream (general, video, audio...)
00166         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00167         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00168         ///        See Info_Parameters() to have the full list
00169         /// @param KindOfInfo Kind of info you want about the parameter (the text, the measure, the help...)
00170         /// @retval >=0 suceed
00171         /// @retval <0 failed
00172     int Set (const std::string &ToSet, int FilePos, stream_t StreamKind, int StreamNumber, const std::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) info how to, KindOfSearch=which Kind Of Info Parameter must be searched?
00173 
00174     ///Options
00175         /// @brief Get the number of opened files
00176         /// @return nmber of files opened
00177     int Count_Get ();
00178         /// @brief Count of streams of a certain kind, or count of info in this stream (if StreamNumber)
00179         /// @param FilePos File position
00180         /// @param StreamKind Kind of stream (general, video, audio...)
00181         /// @param StreamNumber Stream number in this kind of stream (first, second...)
00182     int  Count_Get (int FilePos, stream_t StreamKind, int StreamNumber=-1);
00183         /// @brief For debug, show all info (doesn't care of InfoOption_NoShow tag)
00184     static int Complete_Get ();
00185         /// @brief For debug, show all info (doesn't care of InfoOption_NoShow tag)
00186         /// @param Complete false if you want show only intersting tags
00187         ///                 true if you want show all tags
00188     static int Complete_Set (bool Complete);
00189         /// @brief Configure custom text
00190         /// @param Language Description of views (CSV format) \n
00191         ///                 Column 1 : code (6 lines : "General", "Video", "Audio", "Text", "Chapters", "Images") \n
00192         ///                 Column 2 : The text to show (exemple : "Audio : %FileName% is at %BitRate_String%")
00193         /// @post See Inform() function
00194     int Language_Set (const std::string &NewLanguage);
00195         /// @brief Configure custom text (static)
00196         /// @param Language Description of views (CSV format) \n
00197         ///                 Column 1 : code (6 lines : "General", "Video", "Audio", "Text", "Chapters", "Images") \n
00198         ///                 Column 2 : The text to show (exemple : "Audio : %FileName% is at %BitRate_String%")
00199         /// @post See Inform() function
00200     static int Language_Set_Static (const std::string &NewLanguage);
00201         /// @brief Configure custom text
00202         /// @param Language Description of views (CSV format) \n
00203         ///                 Column 1 : code ("General", "Video", "Audio", "Text", "Chapters") \n
00204         ///                 Column 2 : The text to show
00205         /// @post See Inform() and Inform_All() functions
00206     static int Inform_Set (const std::string &NewView);
00207 
00208     //Info
00209         /// @brief Information about what are known unique names for parameters
00210         /// @param CSV false = separated by spaces
00211         ///            true = separated by ;
00212     static std::string Info_Parameters (bool CSV=false);
00213         /// @brief Information about which parameters per format are supported
00214     static std::string Info_Capacities ();
00215         /// @brief Information about which codec is known
00216     static std::string Info_Codecs ();
00217         /// @brief Get the version of MediaInfoLib
00218     static std::string Info_Version ();
00219 
00220 private :
00221     int MaxCount;
00222     int Count;
00223     MediaInfo** Info;
00224 };
00225 
00226 } //NameSpace
00227 #endif

Generated on Mon Aug 25 23:59:39 2003 for MediaInfoLib by doxygen1.3-rc3