DivXNetworks, Inc.
Main Page | Namespace List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals | Related Pages

Settings.h

Go to the documentation of this file.
00001 
00015 #ifndef _Q_Settings_h
00016 #define _Q_Settings_h
00017 
00018 #include "../common/DivXPortable.h"
00019 #include "../common/FourCC.h"
00020 
00021 #include <string.h>
00022 
00023 
00024 
00025 #define SETTINGS_REVISION "$Revision: 4691 $"
00026 
00027 
00054 class Settings
00055 {
00056 protected:
00057     Settings(const Settings& rhs);
00058     Settings();
00059     virtual ~Settings();
00060 public:
00061 
00063     Settings& operator=(const Settings& rhs);
00064 
00065 public:
00066 
00068     typedef enum
00069     {
00070         BOOLEAN, 
00071         INTEGER, 
00072         DOUBLE,  
00073         ENUM,    
00074         STRING,  
00075         DATA     
00076     } 
00077     Type;
00078 
00080     class Name
00081     {
00082     public:
00083         Name(const char* str=0)
00084         {
00085             this->str = str;
00086         }
00087         bool operator==(const Name& rhs) const
00088         {
00089             return !strcmp(this->str, rhs.str);
00090         }
00091         bool operator!=(const Name& rhs) const
00092         {
00093             return !!strcmp(this->str, rhs.str);
00094         }
00095         bool operator<(const Name& rhs) const
00096         {
00097             return strcmp(this->str, rhs.str) > 0;
00098         }
00099         const char* getStr() const
00100         {
00101             return this->str;
00102         }
00103         bool isValid() const
00104         {
00105             return !!this->str;
00106         }
00107     private:
00108         const char* str;
00109     };
00110 
00112     typedef uint32_t Enum;
00113 
00115     class Exception
00116     {
00117     public:
00118         Exception(const char* info)
00119         {
00120             this->info = info;
00121         }
00122         const char* getErrorMessage() const
00123         {
00124             return this->info;
00125         }
00126     private:
00127         const char* info;
00128     };
00129 
00130 public:
00131 
00135     virtual Name getName(int n) const = 0;
00136 
00140     virtual Type getType(Name name) const = 0;
00141 
00145     virtual bool isReadOnly(Name name) const = 0;
00146 
00150     virtual bool isEnabled(Name name) const = 0;
00151 
00155     virtual bool isDefault(Name name) const = 0;
00156 
00160     virtual void setBool(Name name, bool value) = 0;
00161 
00165     virtual bool getBool(Name name) const = 0;
00166 
00170     virtual void setInt(Name name, int value) = 0;
00171 
00175     virtual int getInt(Name name) const = 0;
00176 
00180     virtual int getIntMin(Name name) const = 0;
00181 
00185     virtual int getIntMax(Name name) const = 0;
00186 
00190     virtual void setDouble(Name name, double value) = 0;
00191 
00195     virtual double getDouble(Name name) const = 0;
00196 
00200     virtual double getDoubleMin(Name name) const = 0;
00201 
00205     virtual double getDoubleMax(Name name) const = 0;
00206 
00210     virtual void setEnum(Name name, Enum value) = 0;
00211 
00215     virtual Enum getEnum(Name name) const = 0;
00216 
00220     virtual Enum getEnumMask(Name name) const = 0;
00221 
00226     virtual void setStr(Name name, const char* value) = 0;
00227 
00231     virtual const char* getStr(Name name) const = 0;
00232 
00238     virtual void setData(Name name, const uint8_t* buff, int len) = 0;
00239 
00243     virtual const uint8_t* getData(Name name) const = 0;
00244 
00248     virtual int getDataLen(Name name) const = 0;
00249 
00254     virtual void makeCurrentSettingsDefault() = 0;
00255 
00257     virtual void resetDefaults() = 0;
00258 
00263     virtual int getPrecedence(Settings::Name name) const = 0;
00264 
00265 public:
00266 
00271     static Enum fourCC2Encoder(FourCC fourCC);
00272 
00281     static bool isCorrectHeader(const char* version=SETTINGS_REVISION);
00282 };
00283 
00284 
00285 
00286 /* Encoder modes for "encoder" */
00287 #define ENCODER_IYUV  (Settings::Enum(1<<2))
00288 #define ENCODER_MPEG4 (Settings::Enum(1<<4))
00289 
00290 /* Encoder modes for "profile" */
00291 #define PROFILE_UNCONSTRAINED (Settings::Enum(1<<0))
00292 #define PROFILE_HANDHELD      (Settings::Enum(1<<1))
00293 #define PROFILE_PORTABLE      (Settings::Enum(1<<2))
00294 #define PROFILE_HOME_THEATER  (Settings::Enum(1<<3))
00295 #define PROFILE_HDTV          (Settings::Enum(1<<4))
00296 
00297 /* Performance / quality mode for "performance" */
00298 #define PERFORMANCE_FASTEST   6950
00299 #define PERFORMANCE_FASTER    7110
00300 #define PERFORMANCE_FAST      7270
00301 #define PERFORMANCE_STANDARD  7670
00302 #define PERFORMANCE_SLOW      8100
00303 #define PERFORMANCE_VERYSLOW  8610
00304 
00305 /* Rate control modes for "rcmode" */
00306 #define RCMODE_1PASS_CONSTANT_Q     (Settings::Enum(1<<0)) 
00307 #define RCMODE_VBV_1PASS            (Settings::Enum(1<<1)) 
00308 #define RCMODE_VBV_MULTIPASS_1ST    (Settings::Enum(1<<2)) 
00309 #define RCMODE_VBV_MULTIPASS_NTH    (Settings::Enum(1<<3)) 
00310 #define RCMODE_VBV_1PASS_CQ         (Settings::Enum(1<<4)) 
00312 /* Resize modes for "resize_mode" */
00313 #define RESIZE_MODE_OFF         (Settings::Enum(1<<0))
00314 #define RESIZE_MODE_AUTOHEIGHT  (Settings::Enum(1<<1))
00315 #define RESIZE_MODE_ON          (Settings::Enum(1<<2))
00316 
00317 /* Resize modes for "resize_algorithm" */
00318 #define RESIZE_ALGORITHM_BILINEAR        (Settings::Enum(1<<0))
00319 #define RESIZE_ALGORITHM_BICUBIC_SOFT    (Settings::Enum(1<<1))
00320 #define RESIZE_ALGORITHM_BICUBIC_NORMAL  (Settings::Enum(1<<2))
00321 #define RESIZE_ALGORITHM_BICUBIC_SHARP   (Settings::Enum(1<<3))
00322 #define RESIZE_ALGORITHM_LANCZOS4        (Settings::Enum(1<<5))
00323 
00324 /* Pixel aspect ratio modes */
00325 #define PAR_1_1           (Settings::Enum(1<<1))
00326 #define PAR_12_11         (Settings::Enum(1<<2))
00327 #define PAR_10_11         (Settings::Enum(1<<3))
00328 #define PAR_16_11         (Settings::Enum(1<<4))
00329 #define PAR_40_33         (Settings::Enum(1<<5))
00330 #define PAR_AUTO          (Settings::Enum(1<<6))
00331 #define PAR_AUTO_NOT_EXT  (Settings::Enum(1<<7))
00332 #define PAR_UNKNOWN       (Settings::Enum(1<<8))
00333 
00334 /* Noise reduction filter modes for "filter_mode" */
00335 #define FILTER_MODE_OFF     (Settings::Enum(1<<1))
00336 #define FILTER_MODE_LIGHT   (Settings::Enum(1<<2))
00337 #define FILTER_MODE_NORMAL  (Settings::Enum(1<<3))
00338 #define FILTER_MODE_STRONG  (Settings::Enum(1<<4))
00339 #define FILTER_MODE_EXTREME (Settings::Enum(1<<5))
00340 #define FILTER_MODE_CUSTOM  (Settings::Enum(1<<6))
00341 
00342 /* Quantizer modes for "quantization" */
00343 #define QUANTIZATION_H263       (Settings::Enum(1<<1))
00344 #define QUANTIZATION_H263_OPT   (Settings::Enum(1<<2))
00345 #define QUANTIZATION_MPEG       (Settings::Enum(1<<3))
00346 
00347 /* Psychovisual modes for "psychovisual" */
00348 #define PSYCHOVISUAL_OFF       (Settings::Enum(1<<1))
00349 #define PSYCHOVISUAL_SHAPING   (Settings::Enum(1<<2))
00350 #define PSYCHOVISUAL_MASKING   (Settings::Enum(1<<3))
00351 
00352 /* PSNR computation modes for "psnr_mode" */
00353 #define PSNR_MODE_LUMA         (Settings::Enum(1<<1))
00354 #define PSNR_MODE_LUMA_CHROMA  (Settings::Enum(1<<2))
00355 #define PSNR_MODE_MODULATED    (Settings::Enum(1<<3))
00356 #define PSNR_MODE_OFF          (Settings::Enum(1<<4))
00357 
00358 #endif

Generated on Tue Jan 24 16:43:33 2006 for DivX Codec API Documentation.