AVPKit
Property.h
1 /*******************************************************************************
2  * Copyright (c) 2024, 2026, Olivier Ayache. All rights reserved.
3  *
4  * This file is part of AVPKit.
5  *
6  * AVPKit is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * AVPKit is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with AVPKit. If not, see <http://www.gnu.org/licenses/>.
18  *******************************************************************************/
19 
20 #ifndef PROPERTY_H_
21 #define PROPERTY_H_
22 
23 #include <com/avpkit/core/IProperty.h>
24 #include <com/avpkit/core/IRational.h>
25 
26 extern "C" {
27 #include "FfmpegIncludes.h"
28 }
29 
30 namespace com { namespace avpkit { namespace core {
31 
36  {
37  VS_JNIUTILS_REFCOUNTED_OBJECT_PRIVATE_MAKE(Property);
38  public:
39  static Property *make(const AVOption *start, const AVOption *option);
40 
41  public:
45  virtual const char *getName();
46  virtual const char *getHelp();
47  virtual const char *getUnit();
48  virtual Type getType();
49  virtual int64_t getDefault();
50  virtual double getDefaultAsDouble();
51  virtual int32_t getFlags();
52  virtual int32_t getNumFlagSettings();
53  virtual IProperty *getFlagConstant(int32_t position);
54  virtual IProperty *getFlagConstant(const char* name);
55 
56 
65  static int32_t getNumProperties(void *context);
66 
78  static IProperty *getPropertyMetaData(void *context, int32_t propertyNo);
79 
88  static IProperty *getPropertyMetaData(void *context, const char* name);
89 
100  static int32_t setProperty(void * context, const char* name, const char* value);
101 
112  static int32_t setProperty(void * context, const char* name, double value);
113 
124  static int32_t setProperty(void * context, const char* name, int64_t value);
125 
136  static int32_t setProperty(void * context, const char* name, bool value);
137 
148  static int32_t setProperty(void * context, const char* name, IRational *value);
149 
161  static char * getPropertyAsString(void * context, const char* name);
162 
171  static double getPropertyAsDouble(void * context, const char* name);
172 
181  static int64_t getPropertyAsLong(void * context, const char* name);
182 
191  static IRational *getPropertyAsRational(void * context, const char* name);
192 
201  static bool getPropertyAsBoolean(void * context, const char* name);
202 
214  static int32_t setProperty(void *context, IMetaData* valuesToSet, IMetaData* valuesNotFound);
215 
216  protected:
217  Property();
218  virtual
219  ~Property();
220  private:
221  const AVOption *mOption;
222  const AVOption *mOptionStart;
223  };
224 
225 }}}
226 #endif /* PROPERTY_H_ */
Get MetaData about a IContainer or IStream.
Definition: IMetaData.h:51
Represents settable properties that effect how AVPKit objects operate.
Definition: IProperty.h:37
Type
The different type of options that are supported by AVPKit.
Definition: IProperty.h:44
This class wraps represents a Rational number for the AVPKit.
Definition: IRational.h:43
A wrapper for an FFMPEG AVOption value.
Definition: Property.h:36
virtual const char * getHelp()
Get the (English) help string for this property.
Definition: Property.cpp:78
static int32_t setProperty(void *context, const char *name, const char *value)
Looks up the property 'name' in 'context' and sets the value of the property to 'value'.
Definition: Property.cpp:201
virtual int32_t getFlags()
Get any set flags (a bitmask) for this option.
Definition: Property.cpp:108
virtual int64_t getDefault()
Get the default setting this flag would have it not set.
Definition: Property.cpp:96
static int32_t getNumProperties(void *context)
For internal use.
Definition: Property.cpp:114
virtual IProperty * getFlagConstant(int32_t position)
If this IProperty is of the type Type#PROPERTY_FLAGS, this method will give you another IProperty rep...
Definition: Property.cpp:332
static int64_t getPropertyAsLong(void *context, const char *name)
Gets the value of this property, and returns as an long;.
Definition: Property.cpp:446
virtual Type getType()
Get the underlying native type of this property.
Definition: Property.cpp:90
static IRational * getPropertyAsRational(void *context, const char *name)
Gets the value of this property, and returns as an IRational;.
Definition: Property.cpp:467
static IProperty * getPropertyMetaData(void *context, int32_t propertyNo)
Returns the metadata for the numbered property.
Definition: Property.cpp:133
virtual int32_t getNumFlagSettings()
If this IProperty is of the type Type#PROPERTY_FLAGS, this method will tell you how many different fl...
Definition: Property.cpp:292
static double getPropertyAsDouble(void *context, const char *name)
Gets the value of this property, and returns as a double;.
Definition: Property.cpp:422
static bool getPropertyAsBoolean(void *context, const char *name)
Gets the value of this property, and returns as a boolean.
Definition: Property.cpp:491
static char * getPropertyAsString(void *context, const char *name)
Gets the value of this property, and returns as a new[]ed string.
Definition: Property.cpp:238
virtual double getDefaultAsDouble()
Get the default setting this flag would have it not set.
Definition: Property.cpp:102
virtual const char * getName()
IProperty implementation.
Definition: Property.cpp:72
virtual const char * getUnit()
Get any sub-unit this option or constant belongs to.
Definition: Property.cpp:84
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...