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

MediaInfo.h

Go to the documentation of this file.
00001 // MediaInfo - All info about media files
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 // MediaInfo
00021 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00022 //
00023 // Version 0.4.0
00024 // --------------
00025 // Give information about a lot of media files
00026 //
00027 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00028 //
00029 // 0.4.0.003 (Zen@MediaArea.net)
00030 // Add Inform Options
00031 //
00032 // 0.4.0 (Zen@MediaArea.net)
00033 // Namespace, use of std::string, Doxygen comments
00034 //
00035 // 0.3.0.001 (Zen@MediaArea.net)
00036 // DLL
00037 //
00038 // 0.3.0 (Zen@MediaArea.net)
00039 // uniformisation
00040 //
00041 // 0.2.0 (Zen@MediaArea.net)
00042 // in English
00043 // More tags
00044 //
00045 // 0.1.0 (Zen@MediaArea.net)
00046 //
00047 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00048 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00049 
00050 //---------------------------------------------------------------------------
00051 /// \mainpage MediaInfoLib Index Page
00052 ///
00053 /// \section Interfaces
00054 ///
00055 /// There is 3 access methods
00056 ///
00057 /// \subsection MediaInfo MediaInfo class (MediaInfoLib::MediaInfo)
00058 /// Simplest interface : one file only \n
00059 /// MediaInfoLib::MediaInfo::Open to analyse file \n
00060 /// MediaInfoLib::MediaInfo::Inform to have a summary \n
00061 /// MediaInfoLib::MediaInfo::Get to retreive one piece of info \n
00062 ///  
00063 /// \subsection MediaInfoList List class (MediaInfoLib::MediaInfoList)
00064 /// To manage a list of file \n
00065 /// MediaInfoLib::MediaInfoList::Open to analyse file \n
00066 /// MediaInfoLib::MediaInfoList::Inform to have a summary \n
00067 /// MediaInfoLib::MediaInfoList::Get to retreive one piece of info \n
00068 /// MediaInfoLib::MediaInfoList::Close to close one file \n
00069 ///  
00070 /// \subsection C C Interface (MediaInfo_*)
00071 /// For compatibility and DLL interface \n
00072 /// Note : Don't forget to include the MediaInfoDLL.Def file in your project! \n
00073 /// MediaInfoDLL::MediaInfo_Open to analyse file \n
00074 /// MediaInfoDLL::MediaInfo_Inform to have a summary \n
00075 /// MediaInfoDLL::MediaInfo_Get to retreive one piece of info \n
00076 /// MediaInfoDLL::MediaInfo_Close to free memory \n
00077 ///  
00078 //---------------------------------------------------------------------------
00079 
00080 //---------------------------------------------------------------------------
00081 #ifndef MediaInfoH
00082 #define MediaInfoH
00083 //---------------------------------------------------------------------------
00084 
00085 //---------------------------------------------------------------------------
00086 class File__Base;
00087 #include <string>
00088 //---------------------------------------------------------------------------
00089 
00090 namespace MediaInfoLib
00091 {
00092 //---------------------------------------------------------------------------
00093 /// @brief Kinds of Stream
00094 enum stream_t
00095 {
00096     Stream_General,                 ///< StreamKind = General
00097     Stream_Video,                   ///< StreamKind = Video
00098     Stream_Audio,                   ///< StreamKind = Audio
00099     Stream_Text,                    ///< StreamKind = Text
00100     Stream_Chapters,                ///< StreamKind = Chapters
00101     Stream_Image,                   ///< StreamKind = Image
00102     Stream_Max,
00103 };
00104 
00105 /// @brief Kind of information
00106 enum info_t
00107 {
00108     Info_Name,                      ///< InfoKind = Unique name of parameter
00109     Info_Text,                      ///< InfoKind = Value of parameter
00110     Info_Measure,                   ///< InfoKind = Unique name of measure unit of parameter
00111     Info_Options,                   ///< InfoKind = See infooptions_t
00112     Info_Name_Text,                 ///< InfoKind = Translated name of parameter
00113     Info_Measure_Text,              ///< InfoKind = Translated name of measure unit
00114     Info_Info,                      ///< InfoKind = More info about the parameter
00115     Info_HowTo,                     ///< InfoKind = Information : how data is found
00116     Info_Max
00117 };
00118 
00119 /// Get(...)[infooptions_t] return a string like "YNYN..." \n
00120 /// Use this enum to know at what correspond the Y (Yes) or N (No)
00121 /// If Get(...)[0]==Y, then :
00122 /// @brief Option if InfoKind = Info_Options
00123 enum infooptions_t
00124 {
00125     InfoOption_ShowInInform     = 0,    ///< Show this parameter in Inform()
00126     InfoOption_Support          = 1,    ///< how this parameter is supported, could be N (No), R (Read only), W (Read/Write), space (Non applicable)
00127     InfoOption_ShowInSupported  = 2,    ///< Internal use only (info : Must be showed in Info_Capacities() )
00128     InfoOption_Max              = 3
00129 };
00130 
00131 /// @brief Option for Inform
00132 enum informoptions_t
00133 {
00134     InformOption_Nothing        = 0,    ///< No options
00135     InformOption_Custom         = 1,    ///< Use information given by Inform_Set
00136     InformOption_HTML           = 2,    ///< Output is in HTML Format
00137     InformOption_Max            = 2
00138 };
00139 
00140 //---------------------------------------------------------------------------
00141 
00142 //***************************************************************************
00143 /// @brief MediaInfo
00144 /// @version 0.4.0
00145 //***************************************************************************
00146 
00147 class MediaInfo
00148 {
00149 public :
00150     //File
00151         /// @brief Open a file
00152         /// @param File File to open
00153         /// @retval 0 File not opened
00154         /// @retval 1 File opened
00155     int Open (const std::string &File);
00156         /// @brief Save a file
00157         /// @retval 0 failed
00158         /// @retval 1 suceed
00159     int Save ();
00160         /// @brief Close a file (without saving)
00161         /// @warning without have saved before, modifications are lost
00162     void Close ();
00163 
00164     ///Inform about a file in text mode
00165         /// @brief Get all details about a file in one string
00166         /// @pre change defaults with Inform_Set()
00167     std::string Inform (informoptions_t Options=InformOption_Nothing);
00168 
00169     //Get file info
00170         /// @brief Get information about a file (parameter is an integer)
00171         /// @param StreamKind Kind of stream (general, video, audio...)
00172         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00173         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00174         /// @param InfoKind Kind of info you want about the parameter (the text, the measure, the help...)
00175         /// @return a string about info you search \n
00176         ///         an empty string if there is a problem
00177     std::string Get (stream_t StreamKind, int StreamNumber, int Parameter, info_t InfoKind=Info_Text);
00178         /// @brief Get information about a file (parameter is a string)
00179         /// @param StreamKind Kind of stream (general, video, audio...)
00180         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00181         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) \n
00182         ///        See Info_Parameters() to have the full list
00183         /// @param InfoKind Kind of info you want about the parameter (the text, the measure, the help...)
00184         /// @param SearchKind Where to look for the parameter
00185         /// @return a string about info you search \n
00186         ///         an empty string if there is a problem
00187     std::string Get (stream_t StreamKind, int StreamNumber, const std::string &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name);
00188 
00189     //Set file info
00190         /// @brief Set information about a file (parameter is an int)
00191         /// @param StreamKind Kind of stream (general, video, audio...)
00192         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00193         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
00194         /// @param KindOfInfo Kind of info you want about the parameter (the text, the measure, the help...)
00195         /// @retval 1 suceed
00196         /// @retval 0 failed
00197     int Set (const std::string &ToSet, stream_t StreamKind, int StreamNumber, int Parameter, info_t KindOfInfo=Info_Text);
00198         /// @brief Get information about a file (parameter is a string)
00199         /// @param StreamKind Kind of stream (general, video, audio...)
00200         /// @param StreamNumber Stream number in Kind of stream (first, second...)
00201         /// @param Parameter Parameter you are looking for in the stream (Codec, width, bitrate...), in string format
00202         /// @param InfoKind Kind of info you want about the parameter (the text, the measure, the help...)
00203         /// @param SearchKind Where to look for the parameter
00204         /// @retval 1 suceed
00205         /// @retval 0 failed
00206     int Set (const std::string &ToSet, stream_t StreamKind, int StreamNumber, const std::string &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name);
00207 
00208     ///Options
00209         /// @brief Count of streams of a certain kind, or count of info in this stream (if StreamNumber)
00210         /// @param StreamKind Kind of stream (general, video, audio...)
00211         /// @param StreamNumber Stream number in this kind of stream (first, second...)
00212     int  Count_Get (stream_t StreamKind, int StreamNumber=-1);
00213         /// @brief For debug, show all info (doesn't care of InfoOption_NoShow tag)
00214     static int Complete_Get ();
00215         /// @brief For debug, show all info (doesn't care of InfoOption_NoShow tag)
00216         /// @param Complete false if you want show only intersting tags
00217         ///                 true if you want show all tags
00218     static int Complete_Set (bool Complete);
00219         /// @brief Configure language
00220         /// @param Language Description of language (CSV format) \n
00221         ///                 Column 1 : Unique name ("Bytes", "Title") \n
00222         ///                 Column 2 : translation ("Octets", "Titre")
00223     int Language_Set (const std::string &NewLanguage);
00224         /// @brief Configure language (static)
00225         /// @param Language Description of language (CSV format) \n
00226         ///                 Column 1 : Unique name ("Bytes", "Title") \n
00227         ///                 Column 2 : translation ("Octets", "Titre")
00228     static int Language_Set_Static (const std::string &NewLanguage);
00229         /// @brief Configure custom text
00230         /// @param Language Description of views (CSV format) \n
00231         ///                 Column 1 : code (6 lines : "General", "Video", "Audio", "Text", "Chapters", "Images") \n
00232         ///                 Column 2 : The text to show (exemple : "Audio : %FileName% is at %BitRate_String%")
00233         /// @post See Inform() function
00234     static int Inform_Set (const std::string &NewView);
00235 
00236     //Info
00237         /// @brief Information about what are known unique names for parameters
00238         /// @param CSV false = separated by spaces
00239         ///            true = separated by ;
00240     static std::string Info_Parameters (bool CSV=false);
00241         /// @brief Information about which parameters per format are supported
00242     static std::string Info_Capacities ();
00243         /// @brief Information about which codec is known
00244     static std::string Info_Codecs ();
00245         /// @brief Get the version of MediaInfoLib
00246     static std::string Info_Version ();
00247 
00248 private :
00249     File__Base* Info;
00250 };
00251 
00252 } //NameSpace
00253 #endif

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