Go to the documentation of this file.
22 #include <wels/codec_api.h>
23 #include <wels/codec_ver.h>
46 WelsDestroyDecoder(
s->decoder);
54 SDecodingParam param = { 0 };
57 WelsTraceCallback callback_function;
62 if (WelsCreateDecoder(&
s->decoder)) {
68 log_level = WELS_LOG_DETAIL;
70 (*
s->decoder)->SetOption(
s->decoder, DECODER_OPTION_TRACE_LEVEL, &log_level);
71 (*
s->decoder)->SetOption(
s->decoder, DECODER_OPTION_TRACE_CALLBACK, (
void *)&callback_function);
72 (*
s->decoder)->SetOption(
s->decoder, DECODER_OPTION_TRACE_CALLBACK_CONTEXT, (
void *)&avctx);
74 #if !OPENH264_VER_AT_LEAST(1, 6)
75 param.eOutputColorFormat = videoFormatI420;
77 param.eEcActiveIdc = ERROR_CON_DISABLE;
78 param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
80 if ((*
s->decoder)->Initialize(
s->decoder, ¶m) != cmResultSuccess) {
94 SBufferInfo
info = { 0 };
95 uint8_t *ptrs[4] = {
NULL };
98 #if OPENH264_VER_AT_LEAST(1, 7)
103 #if OPENH264_VER_AT_LEAST(1, 9)
105 (*
s->decoder)->SetOption(
s->decoder, DECODER_OPTION_END_OF_STREAM, &
end_of_stream);
106 state = (*
s->decoder)->FlushFrame(
s->decoder, ptrs, &
info);
111 info.uiInBsTimeStamp = avpkt->
pts;
112 #if OPENH264_VER_AT_LEAST(1, 4)
117 state = (*
s->decoder)->DecodeFrameNoDelay(
s->decoder, avpkt->
data, avpkt->
size, ptrs, &
info);
122 if (
state != dsErrorFree) {
126 if (
info.iBufferStatus != 1) {
141 linesize[0] =
info.UsrData.sSystemBuffer.iStride[0];
142 linesize[1] = linesize[2] =
info.UsrData.sSystemBuffer.iStride[1];
147 avframe->
pts =
info.uiOutYuvTimeStamp;
149 #if OPENH264_VER_AT_LEAST(1, 7)
150 (*
s->decoder)->GetOption(
s->decoder, DECODER_OPTION_PROFILE, &opt);
152 (*
s->decoder)->GetOption(
s->decoder, DECODER_OPTION_LEVEL, &opt);
161 .
p.
name =
"libopenh264",
172 .bsfs =
"h264_mp4toannexb",
173 .p.wrapper_name =
"libopenh264",
int ff_libopenh264_check_version(void *logctx)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static av_cold int svc_decode_init(AVCodecContext *avctx)
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static int svc_decode_frame(AVCodecContext *avctx, AVFrame *avframe, int *got_frame, AVPacket *avpkt)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVCodec p
The public AVCodec.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_CODEC_DECODE_CB(func)
int(* init)(AVBSFContext *ctx)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define CODEC_LONG_NAME(str)
const FFCodec ff_libopenh264_decoder
static int FUNC() end_of_stream(CodedBitstreamContext *ctx, RWContext *rw, H264RawNALUnitHeader *current)
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
int level
Encoding level descriptor.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static av_cold int svc_decode_close(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
const char * name
Name of the codec implementation.
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
main external API structure.
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg)
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AVERROR_DECODER_NOT_FOUND
Decoder not found.
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...