AVPKit
IVideoResampler.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 IVIDEORESAMPLER_H_
21 #define IVIDEORESAMPLER_H_
22 
23 #include <com/avpkit/ferry/RefCounted.h>
24 #include <com/avpkit/core/AVPKit.h>
25 #include <com/avpkit/core/IPixelFormat.h>
26 #include <com/avpkit/core/IVideoPicture.h>
27 #include <com/avpkit/core/IProperty.h>
28 
29 namespace com { namespace avpkit { namespace core
30  {
31 
36  class VS_API_AVPKIT IVideoResampler : public com::avpkit::ferry::RefCounted
37  {
38  public:
39 
43  typedef enum {
44  FEATURE_IMAGERESCALING,
45  FEATURE_COLORSPACECONVERSION,
46  } Feature;
47 
51  virtual int32_t getInputWidth()=0;
52 
56  virtual int32_t getInputHeight()=0;
57 
63 
68  virtual int32_t getOutputWidth()=0;
69 
74  virtual int32_t getOutputHeight()=0;
75 
81 
94  virtual int32_t resample(IVideoPicture *outVideoPicture, IVideoPicture *inVideoPicture)=0;
95 
96  /*
97  * Added for 1.19
98  */
99 
105  virtual int32_t getNumProperties()=0;
106 
114  virtual IProperty *getPropertyMetaData(int32_t propertyNo)=0;
115 
123  virtual IProperty *getPropertyMetaData(const char *name)=0;
124 
135  virtual int32_t setProperty(const char *name, const char* value)=0;
136 
137 
147  virtual int32_t setProperty(const char* name, double value)=0;
148 
158  virtual int32_t setProperty(const char* name, int64_t value)=0;
159 
169  virtual int32_t setProperty(const char* name, bool value)=0;
170 
180  virtual int32_t setProperty(const char* name, IRational *value)=0;
181 
182 #ifdef SWIG
183  %newobject getPropertyAsString(const char*);
184  %typemap(newfree) char * "free($1);";
185 #endif
197  virtual char * getPropertyAsString(const char* name)=0;
198 
206  virtual double getPropertyAsDouble(const char* name)=0;
207 
215  virtual int64_t getPropertyAsLong(const char* name)=0;
216 
224  virtual IRational *getPropertyAsRational(const char* name)=0;
225 
233  virtual bool getPropertyAsBoolean(const char* name)=0;
234 
246  static IVideoResampler* make(
247  int32_t outputWidth, int32_t outputHeight,
248  IPixelFormat::Type outputFmt,
249  int32_t inputWidth, int32_t inputHeight,
250  IPixelFormat::Type inputFmt);
251 
258  static bool isSupported(Feature feature);
259 
263  virtual int32_t setProperty(IMetaData* valuesToSet, IMetaData* valuesNotFound)=0;
264  protected:
265  IVideoResampler();
266  virtual ~IVideoResampler();
267  };
268 
269  }}}
270 
271 #endif /*IVIDEORESAMPLER_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
This class wraps represents a Rational number for the AVPKit.
Definition: IRational.h:43
Represents one raw (undecoded) picture in a video stream, plus a timestamp for when to display that v...
Definition: IVideoPicture.h:40
Converts IVideoPicture objects of a given width, height and format to a new width,...
virtual double getPropertyAsDouble(const char *name)=0
Gets the value of this property, and returns as a double;.
virtual int64_t getPropertyAsLong(const char *name)=0
Gets the value of this property, and returns as an long;.
virtual int32_t setProperty(const char *name, const char *value)=0
Sets a property on this Object.
virtual int32_t setProperty(const char *name, IRational *value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual IProperty * getPropertyMetaData(int32_t propertyNo)=0
Returns the name of the numbered property.
virtual IProperty * getPropertyMetaData(const char *name)=0
Returns the name of the numbered property.
virtual char * getPropertyAsString(const char *name)=0
Gets a property on this Object.
virtual int32_t getNumProperties()=0
Returns the total number of settable properties on this object.
virtual int32_t getInputHeight()=0
Get the height in pixels we expect on the input frame to the resampler.
virtual int32_t setProperty(const char *name, double value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual int32_t setProperty(const char *name, bool value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual int32_t getOutputHeight()=0
Get the output height, in pixels.
virtual int32_t getOutputWidth()=0
Get the output width, in pixels.
virtual bool getPropertyAsBoolean(const char *name)=0
Gets the value of this property, and returns as a boolean.
virtual IPixelFormat::Type getInputPixelFormat()=0
Get the input pixel format.
virtual int32_t resample(IVideoPicture *outVideoPicture, IVideoPicture *inVideoPicture)=0
Resample in to out based on the resampler parameters.
virtual int32_t getInputWidth()=0
Get the width in pixels we expect on the input frame to the resampler.
virtual int32_t setProperty(const char *name, int64_t value)=0
Looks up the property 'name' and sets the value of the property to 'value'.
virtual int32_t setProperty(IMetaData *valuesToSet, IMetaData *valuesNotFound)=0
Feature
Features that the VideoResampler may optionally support.
virtual IPixelFormat::Type getOutputPixelFormat()=0
Get the output pixel format.
virtual IRational * getPropertyAsRational(const char *name)=0
Gets the value of this property, and returns as an IRational;.
Parent of all Ferry objects – it mains reference counts in native code.
Definition: RefCounted.h:85
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...