22 #include <wels/codec_api.h>
23 #include <wels/codec_ver.h>
66 SDecodingParam param = { 0 };
69 WelsTraceCallback callback_function;
78 if (WelsCreateDecoder(&s->
decoder)) {
84 log_level = WELS_LOG_DETAIL;
86 (*s->
decoder)->SetOption(s->
decoder, DECODER_OPTION_TRACE_LEVEL, &log_level);
87 (*s->
decoder)->SetOption(s->
decoder, DECODER_OPTION_TRACE_CALLBACK, (
void *)&callback_function);
88 (*s->
decoder)->SetOption(s->
decoder, DECODER_OPTION_TRACE_CALLBACK_CONTEXT, (
void *)&avctx);
90 #if !OPENH264_VER_AT_LEAST(1, 6)
91 param.eOutputColorFormat = videoFormatI420;
93 param.eEcActiveIdc = ERROR_CON_DISABLE;
94 param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
96 if ((*s->
decoder)->Initialize(s->
decoder, ¶m) != cmResultSuccess) {
142 SBufferInfo info = { 0 };
147 DECODING_STATE
state;
167 while (!*got_frame) {
174 return avpkt->
size ? avpkt->
size : 0;
194 if (state != dsErrorFree) {
198 if (info.iBufferStatus != 1) {
203 ret =
ff_set_dimensions(avctx, info.UsrData.sSystemBuffer.iWidth, info.UsrData.sSystemBuffer.iHeight);
213 linesize[0] = info.UsrData.sSystemBuffer.iStride[0];
214 linesize[1] = linesize[2] = info.UsrData.sSystemBuffer.iStride[1];
231 .
name =
"libopenh264",
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
void ff_libopenh264_trace_callback(void *ctx, int level, const char *msg)
void av_bsf_free(AVBSFContext **ctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static int init_bsf(AVCodecContext *avctx)
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.
static av_cold int init(AVCodecContext *avctx)
The bitstream filter state.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int(*func)(void *, void *, int))
Feed data from a user-supplied callback to an AVFifoBuffer.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx)
Allocate a context for a given bitstream filter.
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
static av_cold int svc_decode_close(AVCodecContext *avctx)
static int svc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int av_fifo_space(const AVFifoBuffer *f)
Return the amount of space in bytes in the AVFifoBuffer, that is the amount of data you can write int...
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, uint8_t clip)
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
void av_fifo_free(AVFifoBuffer *f)
Free an AVFifoBuffer.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int svc_decode_init(AVCodecContext *avctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void(*func)(void *, void *, int))
Feed data from an AVFifoBuffer to a user-supplied callback.
AVRational time_base_in
The timebase used for the timestamps of the input packets.
const char * name
Name of the codec implementation.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
int width
picture width / height.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
Libavcodec external API header.
int av_fifo_size(const AVFifoBuffer *f)
Return the amount of data in bytes in the AVFifoBuffer, that is the amount of data you can read from ...
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
Resize an AVFifoBuffer.
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
a very simple circular buffer FIFO implementation
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
AVFifoBuffer * packet_fifo
#define FF_CODEC_CAP_SETS_PKT_DTS
Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set AVFrame.pkt_dts manually.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
attribute_deprecated int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
AVCodec ff_libopenh264_decoder
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
common internal and external API header
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define FF_ENABLE_DEPRECATION_WARNINGS
AVFifoBuffer * av_fifo_alloc(unsigned int size)
Initialize an AVFifoBuffer.
int ff_libopenh264_check_version(void *logctx)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...