22 #include <wels/codec_api.h> 23 #include <wels/codec_ver.h> 53 SDecodingParam param = { 0 };
56 WelsTraceCallback callback_function;
61 if (WelsCreateDecoder(&s->
decoder)) {
67 log_level = WELS_LOG_DETAIL;
69 (*s->
decoder)->SetOption(s->
decoder, DECODER_OPTION_TRACE_LEVEL, &log_level);
70 (*s->
decoder)->SetOption(s->
decoder, DECODER_OPTION_TRACE_CALLBACK, (
void *)&callback_function);
71 (*s->
decoder)->SetOption(s->
decoder, DECODER_OPTION_TRACE_CALLBACK_CONTEXT, (
void *)&avctx);
73 #if !OPENH264_VER_AT_LEAST(1, 6) 74 param.eOutputColorFormat = videoFormatI420;
76 param.eEcActiveIdc = ERROR_CON_DISABLE;
77 param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
79 if ((*s->
decoder)->Initialize(s->
decoder, ¶m) != cmResultSuccess) {
93 SBufferInfo info = { 0 };
100 if (state != dsErrorFree) {
104 if (info.iBufferStatus != 1) {
109 ret =
ff_set_dimensions(avctx, info.UsrData.sSystemBuffer.iWidth, info.UsrData.sSystemBuffer.iHeight);
119 linesize[0] = info.UsrData.sSystemBuffer.iStride[0];
120 linesize[1] = linesize[2] = info.UsrData.sSystemBuffer.iStride[1];
123 avframe->
pts = avpkt->
pts;
136 .
name =
"libopenh264",
149 .bsfs =
"h264_mp4toannexb",
150 .wrapper_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)
This structure describes decoded (raw) audio or video data.
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)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#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 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).
#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.
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.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
a very simple circular buffer FIFO implementation
#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
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...
This structure stores compressed data.
#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...