AVPKit
IContainerFormat.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 ICONTAINERFORMAT_H_
21 #define ICONTAINERFORMAT_H_
22 
23 #include <com/avpkit/ferry/RefCounted.h>
24 #include <com/avpkit/core/AVPKit.h>
25 #include <com/avpkit/core/ICodec.h>
26 
27 namespace com { namespace avpkit { namespace core
28 {
40  class VS_API_AVPKIT IContainerFormat : public com::avpkit::ferry::RefCounted
41  {
42  public:
50  virtual int32_t setInputFormat(const char *shortName)=0;
51 
64  virtual int32_t setOutputFormat(const char*shortName,
65  const char*url,
66  const char* mimeType)=0;
67 
72  virtual const char* getInputFormatShortName()=0;
73 
78  virtual const char* getInputFormatLongName()=0;
79 
84  virtual const char* getOutputFormatShortName()=0;
85 
90  virtual const char* getOutputFormatLongName()=0;
91 
96  virtual const char* getOutputFormatMimeType()=0;
97 
103  static IContainerFormat* make();
104 
105  /*
106  * Added for 1.19
107  */
108  typedef enum {
109  FLAG_NOFILE=0x0001,
110  FLAG_NEEDNUMBER = 0x0002,
111  FLAG_SHOW_IDS=0x0008,
112  FLAG_RAWPICTURE=0x0020,
113  FLAG_GLOBALHEADER=0x0040,
114  FLAG_NOTIMESTAMPS=0x0080,
115  FLAG_GENERIC_INDEX=0x0100,
116  FLAG_TS_DISCONT=0x0200
117  } Flags;
118 
124  virtual int32_t getInputFlags()=0;
125 
134  virtual void setInputFlags(int32_t newFlags) = 0;
135 
143  virtual bool getInputFlag(Flags flag) = 0;
144 
152  virtual void setInputFlag(Flags flag, bool value) = 0;
153 
159  virtual int32_t getOutputFlags()=0;
160 
169  virtual void setOutputFlags(int32_t newFlags) = 0;
170 
178  virtual bool getOutputFlag(Flags flag) = 0;
179 
187  virtual void setOutputFlag(Flags flag, bool value) = 0;
188 
194  virtual bool isOutput()=0;
195 
201  virtual bool isInput()=0;
202 
203  /*
204  * Added for 2.1
205  */
206 
215  virtual const char *getOutputExtensions()=0;
216 
225 
234 
243 
257  virtual int32_t getOutputNumCodecsSupported()=0;
258 
273  virtual ICodec::ID getOutputCodecID(int32_t index)=0;
274 
290  virtual int32_t getOutputCodecTag(int32_t index)=0;
291 
292 
303  virtual int32_t getOutputCodecTag(ICodec::ID id)=0;
304 
316 
323  static int32_t getNumInstalledInputFormats();
324 
333  static IContainerFormat* getInstalledInputFormat(int32_t index);
334 
341  static int32_t getNumInstalledOutputFormats();
342 
351  static IContainerFormat* getInstalledOutputFormat(int32_t index);
352 
353  protected:
354  virtual ~IContainerFormat()=0;
355 
356  };
357 }}}
358 #endif /*ICONTAINERFORMAT_H_*/
ID
These are the codecs this library currently supports.
Definition: ICodec.h:61
Specifies format information than can be used to configure an IContainer for input or output.
virtual bool getOutputFlag(Flags flag)=0
Get the output setting for the specified flag.
virtual const char * getInputFormatShortName()=0
Get the short name for the input format.
virtual void setInputFlag(Flags flag, bool value)=0
Set the input flag.
virtual const char * getOutputFormatMimeType()=0
Get the mime type for the output format.
virtual int32_t setInputFormat(const char *shortName)=0
Sets the input format for this container.
virtual void setInputFlags(int32_t newFlags)=0
Set the input flags to use with this object.
virtual int32_t getOutputCodecTag(ICodec::ID id)=0
Get the 4-byte tag the container would output for the given codec id.
virtual int32_t getOutputFlags()=0
Get the output flags associated with this object.
virtual ICodec::ID getOutputDefaultVideoCodec()=0
Get the default video codec this container prefers, if known.
virtual ICodec::ID getOutputDefaultAudioCodec()=0
Get the default audio codec this container prefers, if known.
virtual const char * getOutputFormatShortName()=0
Get the short name for the output format.
virtual int32_t getOutputCodecTag(int32_t index)=0
Queries for a supported codec tag from the list of codecs that can be encoded into this ContainerForm...
virtual const char * getOutputExtensions()=0
Get the filename extensions that this output format prefers (most common first).
virtual int32_t setOutputFormat(const char *shortName, const char *url, const char *mimeType)=0
Sets the output format for this container.
virtual bool isInput()=0
Is this an input container format?
virtual ICodec::ID getOutputCodecID(int32_t index)=0
Queries for a supported codec id from the list of codecs that can be encoded into this ContainerForma...
virtual bool getInputFlag(Flags flag)=0
Get the input setting for the specified flag.
virtual int32_t getInputFlags()=0
Get the input flags associated with this object.
virtual void setOutputFlags(int32_t newFlags)=0
Set the output flags to use with this object.
virtual bool isOutput()=0
Is this an output container format?
virtual const char * getInputFormatLongName()=0
Get the long name for the input format.
virtual ICodec::ID getOutputDefaultSubtitleCodec()=0
Get the default subtitle codec this container prefers, if known.
virtual const char * getOutputFormatLongName()=0
Get the long name for the output format.
virtual int32_t getOutputNumCodecsSupported()=0
Gets the number of different codecs this container can include for encoding.
virtual bool isCodecSupportedForOutput(ICodec::ID id)=0
Returns true if this container format can output media encoded with the given codec.
virtual void setOutputFlag(Flags flag, bool value)=0
Set the output flag.
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...