AVPKit
com::avpkit::core::IContainerFormat Class Referenceabstract

Specifies format information than can be used to configure an IContainer for input or output. More...

#include <IContainerFormat.h>

Inheritance diagram for com::avpkit::core::IContainerFormat:
Collaboration diagram for com::avpkit::core::IContainerFormat:

Public Types

enum  Flags {
  FLAG_NOFILE =0x0001 , FLAG_NEEDNUMBER = 0x0002 , FLAG_SHOW_IDS =0x0008 , FLAG_RAWPICTURE =0x0020 ,
  FLAG_GLOBALHEADER =0x0040 , FLAG_NOTIMESTAMPS =0x0080 , FLAG_GENERIC_INDEX =0x0100 , FLAG_TS_DISCONT =0x0200
}
 

Public Member Functions

virtual int32_t setInputFormat (const char *shortName)=0
 Sets the input format for this container. More...
 
virtual int32_t setOutputFormat (const char *shortName, const char *url, const char *mimeType)=0
 Sets the output format for this container. More...
 
virtual const char * getInputFormatShortName ()=0
 Get the short name for the input format. More...
 
virtual const char * getInputFormatLongName ()=0
 Get the long name for the input format. More...
 
virtual const char * getOutputFormatShortName ()=0
 Get the short name for the output format. More...
 
virtual const char * getOutputFormatLongName ()=0
 Get the long name for the output format. More...
 
virtual const char * getOutputFormatMimeType ()=0
 Get the mime type for the output format. More...
 
virtual int32_t getInputFlags ()=0
 Get the input flags associated with this object. More...
 
virtual void setInputFlags (int32_t newFlags)=0
 Set the input flags to use with this object. More...
 
virtual bool getInputFlag (Flags flag)=0
 Get the input setting for the specified flag. More...
 
virtual void setInputFlag (Flags flag, bool value)=0
 Set the input flag. More...
 
virtual int32_t getOutputFlags ()=0
 Get the output flags associated with this object. More...
 
virtual void setOutputFlags (int32_t newFlags)=0
 Set the output flags to use with this object. More...
 
virtual bool getOutputFlag (Flags flag)=0
 Get the output setting for the specified flag. More...
 
virtual void setOutputFlag (Flags flag, bool value)=0
 Set the output flag. More...
 
virtual bool isOutput ()=0
 Is this an output container format? More...
 
virtual bool isInput ()=0
 Is this an input container format? More...
 
virtual const char * getOutputExtensions ()=0
 Get the filename extensions that this output format prefers (most common first). More...
 
virtual ICodec::ID getOutputDefaultAudioCodec ()=0
 Get the default audio codec this container prefers, if known. More...
 
virtual ICodec::ID getOutputDefaultVideoCodec ()=0
 Get the default video codec this container prefers, if known. More...
 
virtual ICodec::ID getOutputDefaultSubtitleCodec ()=0
 Get the default subtitle codec this container prefers, if known. More...
 
virtual int32_t getOutputNumCodecsSupported ()=0
 Gets the number of different codecs this container can include for encoding. More...
 
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 ContainerFormat. More...
 
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 ContainerFormat. More...
 
virtual int32_t getOutputCodecTag (ICodec::ID id)=0
 Get the 4-byte tag the container would output for the given codec id. More...
 
virtual bool isCodecSupportedForOutput (ICodec::ID id)=0
 Returns true if this container format can output media encoded with the given codec. More...
 
- Public Member Functions inherited from com::avpkit::ferry::RefCounted
virtual int32_t acquire ()
 Internal Only. More...
 
virtual int32_t release ()
 Internal Only. More...
 
virtual RefCountedcopyReference ()
 Create a new Java object that refers to the same native object. More...
 
virtual int32_t getCurrentRefCount ()
 Return the current reference count on this object. More...
 
void setJavaAllocator (void *allocator)
 This method is public but not part of the standard API. More...
 
void * getJavaAllocator ()
 This method is public but not part of the standard API. More...
 

Static Public Member Functions

static IContainerFormatmake ()
 Create a new IContainerFormat object. More...
 
static int32_t getNumInstalledInputFormats ()
 Get the number of input formats this install can demultiplex (read) from. More...
 
static IContainerFormatgetInstalledInputFormat (int32_t index)
 Return an object for the input format at the given index. More...
 
static int32_t getNumInstalledOutputFormats ()
 Get the number of output formats this install can multiplex (write) to. More...
 
static IContainerFormatgetInstalledOutputFormat (int32_t index)
 Return an object for the output format at the given index. More...
 

Additional Inherited Members

- Protected Member Functions inherited from com::avpkit::ferry::RefCounted
virtual void destroy ()
 This method is called by RefCounted objects when their Ref Count reaches zero and they are about to be destroyed.
 
- Protected Attributes inherited from com::avpkit::ferry::RefCounted
AtomicIntegermRefCount
 This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe.
 
void * mAllocator
 Not part of public API.
 

Detailed Description

Specifies format information than can be used to configure an IContainer for input or output.

Often times AVPKIT can guess the correct formats to put into a given IContainer object, but sometimes it needs help. You can allocate an IContainerFormat object and specify information about input or output containers, and then pass this to IContainer.open(...) to help us guess.

Definition at line 40 of file IContainerFormat.h.

Member Function Documentation

◆ getInputFlag()

virtual bool com::avpkit::core::IContainerFormat::getInputFlag ( Flags  flag)
pure virtual

Get the input setting for the specified flag.

Parameters
flagThe flag you want to find the setting for
Returns
0 for false; non-zero for true

Implemented in com::avpkit::core::ContainerFormat.

◆ getInputFlags()

virtual int32_t com::avpkit::core::IContainerFormat::getInputFlags ( )
pure virtual

Get the input flags associated with this object.

Returns
The (compacted) value of all flags set.

Implemented in com::avpkit::core::ContainerFormat.

◆ getInputFormatLongName()

virtual const char* com::avpkit::core::IContainerFormat::getInputFormatLongName ( )
pure virtual

Get the long name for the input format.

Returns
The long name for the input format, or null if none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getInputFormatShortName()

virtual const char* com::avpkit::core::IContainerFormat::getInputFormatShortName ( )
pure virtual

Get the short name for the input format.

Returns
The short name for the input format, or null if none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getInstalledInputFormat()

IContainerFormat * com::avpkit::core::IContainerFormat::getInstalledInputFormat ( int32_t  index)
static

Return an object for the input format at the given index.

Parameters
indexan index for the input format list we maintain
Returns
a format object for that input or null if unknown, index < 0 or index >= getNumInstalledInputFormats()

Definition at line 52 of file IContainerFormat.cpp.

53  {
54  Global::init();
55  int i = 0;
56  for(AVInputFormat* f = 0;
57  (f = av_iformat_next(f))!=0;
58  ++i)
59  if (i == index) {
60  ContainerFormat * retval = ContainerFormat::make();
61  if (retval)
62  retval->setInputFormat(f);
63  return retval;
64  }
65  return 0;
66  }
static void init()
Internal Only.
Definition: Global.cpp:157
static IContainerFormat * make()
Create a new IContainerFormat object.

References com::avpkit::core::Global::init(), make(), and com::avpkit::core::ContainerFormat::setInputFormat().

◆ getInstalledOutputFormat()

IContainerFormat * com::avpkit::core::IContainerFormat::getInstalledOutputFormat ( int32_t  index)
static

Return an object for the output format at the given index.

Parameters
indexan index for the output format list we maintain
Returns
a format object for that output or null if unknown, index < 0 or index >= getNumInstalledOutputFormats()

Definition at line 81 of file IContainerFormat.cpp.

82  {
83  Global::init();
84  int i = 0;
85  for(AVOutputFormat* f = 0;
86  (f = av_oformat_next(f))!=0;
87  ++i)
88  if (i == index)
89  {
90  ContainerFormat* retval =ContainerFormat::make();
91  if (retval)
92  retval->setOutputFormat(f);
93  return retval;
94  }
95  return 0;
96  }

References com::avpkit::core::Global::init(), make(), and com::avpkit::core::ContainerFormat::setOutputFormat().

◆ getNumInstalledInputFormats()

int32_t com::avpkit::core::IContainerFormat::getNumInstalledInputFormats ( )
static

Get the number of input formats this install can demultiplex (read) from.

Returns
the number of formats

Definition at line 40 of file IContainerFormat.cpp.

41  {
42  Global::init();
43  int i = 0;
44  for(AVInputFormat* f = 0;
45  (f = av_iformat_next(f))!=0;
46  ++i)
47  ;
48  return i;
49  }

References com::avpkit::core::Global::init().

◆ getNumInstalledOutputFormats()

int32_t com::avpkit::core::IContainerFormat::getNumInstalledOutputFormats ( )
static

Get the number of output formats this install can multiplex (write) to.

Returns
the number of formats

Definition at line 69 of file IContainerFormat.cpp.

70  {
71  Global::init();
72  int i = 0;
73  for(AVOutputFormat* f = 0;
74  (f = av_oformat_next(f))!=0;
75  ++i)
76  ;
77  return i;
78  }

References com::avpkit::core::Global::init().

◆ getOutputCodecID()

virtual ICodec::ID com::avpkit::core::IContainerFormat::getOutputCodecID ( int32_t  index)
pure virtual

Queries for a supported codec id from the list of codecs that can be encoded into this ContainerFormat.

Parameters
indexThe index in our lookup table. Index >= 0 and < getOutputNumCodecsSupported(). Index values may change between releases, so always query.
Returns
The codec id at this position, or ICodec.ID#CODEC_ID_NONE if there is none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputCodecTag() [1/2]

virtual int32_t com::avpkit::core::IContainerFormat::getOutputCodecTag ( ICodec::ID  id)
pure virtual

Get the 4-byte tag the container would output for the given codec id.

Parameters
idthe codec you are about
Returns
the 4-byte codec tag, or 0 if that id is not supported.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputCodecTag() [2/2]

virtual int32_t com::avpkit::core::IContainerFormat::getOutputCodecTag ( int32_t  index)
pure virtual

Queries for a supported codec tag from the list of codecs that can be encoded into this ContainerFormat.

Tags are 4-byte values that are often used as markers in a container format for a codec type.

Parameters
indexThe index in our lookup table. Index >= 0 and < getOutputNumCodecsSupported(). Index values may change between releases, so always query.
Returns
The codec id tag this position, or 0 if there is none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputDefaultAudioCodec()

virtual ICodec::ID com::avpkit::core::IContainerFormat::getOutputDefaultAudioCodec ( )
pure virtual

Get the default audio codec this container prefers, if known.

Returns
the default audio codec id, or ICodec.ID#CODEC_ID_NONE if unknown.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputDefaultSubtitleCodec()

virtual ICodec::ID com::avpkit::core::IContainerFormat::getOutputDefaultSubtitleCodec ( )
pure virtual

Get the default subtitle codec this container prefers, if known.

Returns
the default subtitle codec id, or ICodec.ID#CODEC_ID_NONE if unknown.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputDefaultVideoCodec()

virtual ICodec::ID com::avpkit::core::IContainerFormat::getOutputDefaultVideoCodec ( )
pure virtual

Get the default video codec this container prefers, if known.

Returns
the default video codec id, or ICodec.ID#CODEC_ID_NONE if unknown.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputExtensions()

virtual const char* com::avpkit::core::IContainerFormat::getOutputExtensions ( )
pure virtual

Get the filename extensions that this output format prefers (most common first).

Returns
a command separated string of output extensions, or null if none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputFlag()

virtual bool com::avpkit::core::IContainerFormat::getOutputFlag ( Flags  flag)
pure virtual

Get the output setting for the specified flag.

Parameters
flagThe flag you want to find the setting for
Returns
0 for false; non-zero for true

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputFlags()

virtual int32_t com::avpkit::core::IContainerFormat::getOutputFlags ( )
pure virtual

Get the output flags associated with this object.

Returns
The (compacted) value of all flags set.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputFormatLongName()

virtual const char* com::avpkit::core::IContainerFormat::getOutputFormatLongName ( )
pure virtual

Get the long name for the output format.

Returns
The long name for the output format, or null if none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputFormatMimeType()

virtual const char* com::avpkit::core::IContainerFormat::getOutputFormatMimeType ( )
pure virtual

Get the mime type for the output format.

Returns
The mime type for the output format, or null if none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputFormatShortName()

virtual const char* com::avpkit::core::IContainerFormat::getOutputFormatShortName ( )
pure virtual

Get the short name for the output format.

Returns
The short name for the output format, or null if none.

Implemented in com::avpkit::core::ContainerFormat.

◆ getOutputNumCodecsSupported()

virtual int32_t com::avpkit::core::IContainerFormat::getOutputNumCodecsSupported ( )
pure virtual

Gets the number of different codecs this container can include for encoding.

This can be used as an upper bound when using the getOutputCodecID(int) and getOutputCodecTag(int) methods to dynamically query the actual codecs.

Returns
The total number of different codec types that can be encoded into this container format.

Implemented in com::avpkit::core::ContainerFormat.

◆ isCodecSupportedForOutput()

virtual bool com::avpkit::core::IContainerFormat::isCodecSupportedForOutput ( ICodec::ID  id)
pure virtual

Returns true if this container format can output media encoded with the given codec.

Parameters
idthe codec you care about.
Returns
true if the codec can be put in this output container; false otherwise.

Implemented in com::avpkit::core::ContainerFormat.

◆ isInput()

virtual bool com::avpkit::core::IContainerFormat::isInput ( )
pure virtual

Is this an input container format?

Returns
true if input; false it not

Implemented in com::avpkit::core::ContainerFormat.

◆ isOutput()

virtual bool com::avpkit::core::IContainerFormat::isOutput ( )
pure virtual

Is this an output container format?

Returns
true if output; false it not

Implemented in com::avpkit::core::ContainerFormat.

◆ make()

IContainerFormat * com::avpkit::core::IContainerFormat::make ( )
static

Create a new IContainerFormat object.

Returns
a new object, or null on error.

Definition at line 33 of file IContainerFormat.cpp.

34  {
35  Global::init();
36  return ContainerFormat::make();
37  }

References com::avpkit::core::Global::init().

Referenced by getInstalledInputFormat(), and getInstalledOutputFormat().

◆ setInputFlag()

virtual void com::avpkit::core::IContainerFormat::setInputFlag ( Flags  flag,
bool  value 
)
pure virtual

Set the input flag.

Parameters
flagThe flag to set
valueThe value to set it to (true or false)

Implemented in com::avpkit::core::ContainerFormat.

◆ setInputFlags()

virtual void com::avpkit::core::IContainerFormat::setInputFlags ( int32_t  newFlags)
pure virtual

Set the input flags to use with this object.

All values must be ORed (|) together.

See also
Flags
Parameters
newFlagsThe new set flags for this codec.

Implemented in com::avpkit::core::ContainerFormat.

◆ setInputFormat()

virtual int32_t com::avpkit::core::IContainerFormat::setInputFormat ( const char *  shortName)
pure virtual

Sets the input format for this container.

Parameters
shortNameThe short name for this container (using FFMPEG's short name).
Returns
>= 0 on success. < 0 if shortName cannot be found.

Implemented in com::avpkit::core::ContainerFormat.

◆ setOutputFlag()

virtual void com::avpkit::core::IContainerFormat::setOutputFlag ( Flags  flag,
bool  value 
)
pure virtual

Set the output flag.

Parameters
flagThe flag to set
valueThe value to set it to (true or false)

Implemented in com::avpkit::core::ContainerFormat.

◆ setOutputFlags()

virtual void com::avpkit::core::IContainerFormat::setOutputFlags ( int32_t  newFlags)
pure virtual

Set the output flags to use with this object.

All values must be ORed (|) together.

See also
Flags
Parameters
newFlagsThe new set flags for this codec.

Implemented in com::avpkit::core::ContainerFormat.

◆ setOutputFormat()

virtual int32_t com::avpkit::core::IContainerFormat::setOutputFormat ( const char *  shortName,
const char *  url,
const char *  mimeType 
)
pure virtual

Sets the output format for this container.

We'll look at the shortName, url and mimeType and try to guess a valid output container format.

Parameters
shortNameThe short name for this container (using FFMPEG's short name).
urlThe URL for this container.
mimeTypeThe mime type for this container.
Returns
>= 0 on success. < 0 if we cannot find a good container.

Implemented in com::avpkit::core::ContainerFormat.


The documentation for this class was generated from the following files: