AVPKit
VideoResampler.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 VIDEORESAMPLER_H_
21 #define VIDEORESAMPLER_H_
22 
23 #include <com/avpkit/core/IVideoResampler.h>
24 
25 
26 /*
27  * Do not include anything from the swscale library here.
28  *
29  * We're just keeping an opaque pointer here.
30  */
31 struct SwsContext;
32 
33 namespace com { namespace avpkit { namespace core
34  {
35 
37  {
38  private:
39  VS_JNIUTILS_REFCOUNTED_OBJECT_PRIVATE_MAKE(VideoResampler)
40  public:
41  virtual int32_t getInputWidth();
42  virtual int32_t getInputHeight();
44 
45  virtual int32_t getOutputWidth();
46  virtual int32_t getOutputHeight();
48 
49  virtual int32_t resample(IVideoPicture *pOutFrame, IVideoPicture *pInFrame);
50 
51  /*
52  * Added for 1.19
53  */
54  virtual int32_t getNumProperties();
55  virtual IProperty* getPropertyMetaData(int32_t propertyNo);
56  virtual IProperty* getPropertyMetaData(const char *name);
57 
58  virtual int32_t setProperty(const char* name, const char* value);
59  virtual int32_t setProperty(const char* name, double value);
60  virtual int32_t setProperty(const char* name, int64_t value);
61  virtual int32_t setProperty(const char* name, bool value);
62  virtual int32_t setProperty(const char* name, IRational *value);
63 
64  virtual char * getPropertyAsString(const char* name);
65  virtual double getPropertyAsDouble(const char* name);
66  virtual int64_t getPropertyAsLong(const char* name);
67  virtual IRational *getPropertyAsRational(const char* name);
68  virtual bool getPropertyAsBoolean(const char* name);
69 
70  static VideoResampler* make(
71  int32_t outputWidth, int32_t outputHeight,
72  IPixelFormat::Type outputFmt,
73  int32_t inputWidth, int32_t inputHeight,
74  IPixelFormat::Type inputFmt);
75  virtual int32_t setProperty(IMetaData* valuesToSet, IMetaData* valuesNotFound);
76  protected:
78  virtual ~VideoResampler();
79  private:
80  int32_t mIHeight;
81  int32_t mIWidth;
82  int32_t mOHeight;
83  int32_t mOWidth;
84  IPixelFormat::Type mIPixelFmt;
85  IPixelFormat::Type mOPixelFmt;
86 
87  SwsContext* mContext;
88  };
89 
90  }}}
91 
92 #endif /*VIDEORESAMPLER_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 bool getPropertyAsBoolean(const char *name)
Gets the value of this property, and returns as a boolean.
virtual int32_t getNumProperties()
Returns the total number of settable properties on this object.
virtual IPixelFormat::Type getOutputPixelFormat()
Get the output pixel format.
virtual char * getPropertyAsString(const char *name)
Gets a property on this Object.
virtual IProperty * getPropertyMetaData(int32_t propertyNo)
Returns the name of the numbered property.
virtual int32_t getInputHeight()
Get the height in pixels we expect on the input frame to the resampler.
virtual int32_t resample(IVideoPicture *pOutFrame, IVideoPicture *pInFrame)
Resample in to out based on the resampler parameters.
virtual IPixelFormat::Type getInputPixelFormat()
Get the input pixel format.
virtual int64_t getPropertyAsLong(const char *name)
Gets the value of this property, and returns as an long;.
virtual IRational * getPropertyAsRational(const char *name)
Gets the value of this property, and returns as an IRational;.
virtual double getPropertyAsDouble(const char *name)
Gets the value of this property, and returns as a double;.
virtual int32_t getInputWidth()
Get the width in pixels we expect on the input frame to the resampler.
virtual int32_t getOutputHeight()
Get the output height, in pixels.
virtual int32_t getOutputWidth()
Get the output width, in pixels.
virtual int32_t setProperty(const char *name, const char *value)
Sets a property on this Object.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...