avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
codecparameters.h
Go to the documentation of this file.
1#pragma once
2
9
10#include "averror.h"
11#include "ffmpeg.h"
12#include "avutils.h"
13#include "codec.h"
14
15extern "C" {
16// codec_par.h included if needed
17#include <libavcodec/avcodec.h>
18}
19
20namespace av {
21
28enum class Direction
29{
31 Invalid = -1,
36};
37
43class CodecParametersView : public FFWrapperPtr<AVCodecParameters>
44{
45public:
53 CodecParametersView(AVCodecParameters *codecpar = nullptr);
59 bool isValid() const;
60
74 void copyTo(CodecParametersView dst, OptionalErrorCode ec = throws()) const;
75
82 void copyFrom(const class CodecContext2& src, OptionalErrorCode ec = throws());
89 void copyTo(class CodecContext2& dst, OptionalErrorCode ec = throws()) const;
90
99 int getAudioFrameDuration(int frame_bytes) const;
100
101 // Getters & Setters
102
108 AVMediaType codecType() const;
114 void codecType(AVMediaType codec_type);
115
123 AVMediaType mediaType() const;
129 void mediaType(AVMediaType media_type);
130
136 AVCodecID codecId() const;
142 void codecId(AVCodecID codec_id);
143
156
162 uint32_t codecTag() const;
169 void codecTag(uint32_t codec_tag);
170
171 // TBD
172};
173
181class CodecParameters : public CodecParametersView, public noncopyable
182{
183public:
192};
193
194} // namespace av
Error codes, error categories and the OptionalErrorCode convention.
Common helpers: comparisons, value lookup, non-copyable base, string utilities.
Base class for audio and video codec contexts.
Definition codeccontext.h:64
void copyFrom(const class CodecContext2 &src, OptionalErrorCode ec=throws())
Copy parameters from a codec context.
void mediaType(AVMediaType media_type)
Set the media type.
Codec encodingCodec() const
Encoder for this codec identifier.
void codecId(AVCodecID codec_id)
Set the codec identifier.
int getAudioFrameDuration(int frame_bytes) const
Duration of one audio frame of the given size.
Codec decodingCodec() const
Decoder for this codec identifier.
CodecParametersView(AVCodecParameters *codecpar=nullptr)
Wrap FFmpeg codec parameters.
void copyTo(class CodecContext2 &dst, OptionalErrorCode ec=throws()) const
Copy these parameters into a codec context.
uint32_t codecTag() const
Four-character code of the codec inside the container.
void codecType(AVMediaType codec_type)
Set the media type.
AVMediaType mediaType() const
Media type of the parameters.
void copyFrom(CodecParametersView src, OptionalErrorCode ec=throws())
Copy parameters into this view from another view.
void copyTo(CodecParametersView dst, OptionalErrorCode ec=throws()) const
Copy these parameters into another view.
void codecTag(uint32_t codec_tag)
Set the container codec tag.
bool isValid() const
Whether the view refers to parameters.
AVCodecID codecId() const
Identifier of the codec.
AVMediaType codecType() const
Media type the codec handles.
~CodecParameters()
Free the owned parameters.
CodecParameters()
Allocate empty parameters.
Codec descriptor.
Definition codec.h:32
Carries the caller's choice between exceptions and error codes.
Definition averror.h:96
Codec descriptors and lookup by name or id.
FFmpeg types re-exported for the public API and small value wrappers.
Root namespace of the library.
Definition audioresampler.h:19
Direction
Direction a codec or a stream is used in.
Definition codecparameters.h:29
@ Encoding
Compressing frames into packets.
Definition codecparameters.h:33
@ Invalid
Not a direction; the default state of a context that has none.
Definition codecparameters.h:31
@ Decoding
Decompressing packets into frames.
Definition codecparameters.h:35