AVPKit
ContainerFormat.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 CONTAINERFORMAT_H_
21 #define CONTAINERFORMAT_H_
22 
23 #include <com/avpkit/core/IContainerFormat.h>
24 #include <com/avpkit/core/FfmpegIncludes.h>
25 
26 namespace com { namespace avpkit { namespace core
27 {
28 
30  {
31  VS_JNIUTILS_REFCOUNTED_OBJECT(ContainerFormat)
32  public:
33 
34  // IContainerFormat implementation
35  virtual int32_t setInputFormat(const char *shortName);
36  virtual int32_t setOutputFormat(const char*shortName,
37  const char*url,
38  const char* mimeType);
39 
40  virtual const char* getInputFormatShortName();
41  virtual const char* getInputFormatLongName();
42 
43  virtual const char* getOutputFormatShortName();
44  virtual const char* getOutputFormatLongName();
45  virtual const char* getOutputFormatMimeType();
46 
47 
48  AVInputFormat* getInputFormat();
49  AVOutputFormat* getOutputFormat();
50  void setInputFormat(AVInputFormat*);
51  void setOutputFormat(AVOutputFormat*);
52 
53  virtual int32_t getInputFlags();
54  virtual void setInputFlags(int32_t newFlags);
55  virtual bool getInputFlag(Flags flag);
56  virtual void setInputFlag(Flags flag, bool value);
57 
58  virtual int32_t getOutputFlags();
59  virtual void setOutputFlags(int32_t newFlags);
60  virtual bool getOutputFlag(Flags flag);
61  virtual void setOutputFlag(Flags flag, bool value);
62 
63 
64  virtual bool isOutput();
65  virtual bool isInput();
66 
67  virtual const char *getOutputExtensions();
71  virtual int32_t getOutputNumCodecsSupported();
72  virtual ICodec::ID getOutputCodecID(int32_t index);
73  virtual int32_t getOutputCodecTag(int32_t index);
74  virtual int32_t getOutputCodecTag(ICodec::ID id);
75  virtual bool isCodecSupportedForOutput(ICodec::ID id);
76  protected:
78  virtual ~ContainerFormat();
79 
80  private:
81  AVInputFormat *mInputFormat;
82  AVOutputFormat *mOutputFormat;
83  };
84 
85 }}}
86 
87 #endif /*CONTAINERFORMAT_H_*/
virtual int32_t getOutputNumCodecsSupported()
Gets the number of different codecs this container can include for encoding.
virtual const char * getOutputFormatLongName()
Get the long name for the output format.
virtual ICodec::ID getOutputDefaultSubtitleCodec()
Get the default subtitle codec this container prefers, if known.
virtual bool isCodecSupportedForOutput(ICodec::ID id)
Returns true if this container format can output media encoded with the given codec.
virtual int32_t getOutputCodecTag(int32_t index)
Queries for a supported codec tag from the list of codecs that can be encoded into this ContainerForm...
virtual int32_t setInputFormat(const char *shortName)
Sets the input format for this container.
virtual int32_t setOutputFormat(const char *shortName, const char *url, const char *mimeType)
Sets the output format for this container.
virtual bool isInput()
Is this an input container format?
virtual const char * getOutputFormatMimeType()
Get the mime type for the output format.
virtual bool isOutput()
Is this an output container format?
virtual const char * getInputFormatLongName()
Get the long name for the input format.
virtual bool getInputFlag(Flags flag)
Get the input setting for the specified flag.
virtual void setInputFlag(Flags flag, bool value)
Set the input flag.
virtual int32_t getInputFlags()
Get the input flags associated with this object.
virtual bool getOutputFlag(Flags flag)
Get the output setting for the specified flag.
virtual const char * getOutputExtensions()
Get the filename extensions that this output format prefers (most common first).
virtual ICodec::ID getOutputDefaultAudioCodec()
Get the default audio codec this container prefers, if known.
virtual ICodec::ID getOutputDefaultVideoCodec()
Get the default video codec this container prefers, if known.
virtual void setOutputFlag(Flags flag, bool value)
Set the output flag.
virtual const char * getInputFormatShortName()
Get the short name for the input format.
virtual ICodec::ID getOutputCodecID(int32_t index)
Queries for a supported codec id from the list of codecs that can be encoded into this ContainerForma...
virtual int32_t getOutputFlags()
Get the output flags associated with this object.
virtual const char * getOutputFormatShortName()
Get the short name for the output format.
virtual void setInputFlags(int32_t newFlags)
Set the input flags to use with this object.
virtual void setOutputFlags(int32_t newFlags)
Set the output flags to use with this object.
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.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...