44#include <libswscale/swscale.h>
70#define MOD_NAME "[lavd] "
93 struct SwsContext *
ctx;
116 av_frame_free(&s->
frame);
118 av_packet_free(&s->
pkt);
125 sws_freeContext(s->
sws.
ctx);
142ADD_TO_PARAM(
"lavd-thread-count",
"* lavd-thread-count=<thread_count>[F][S][n][d]\n"
143 " Use <thread_count> decoding threads (0 is usually auto).\n"
144 " Flag 'F' enables frame parallelism (disabled by default), 'S' slice based, can be both (default slice), 'n' for none; 'd' - disable low delay\n");
147 int thread_count = 0;
148 int req_thread_type = 0;
149 bool req_low_delay =
true;
151 if (thread_count_opt != NULL) {
154 long val = strtol(thread_count_opt, &endptr, 0);
155 if (errno == 0 && thread_count_opt[0] !=
'\0' &&
val >= 0 &&
val <= INT_MAX && (*endptr ==
'\0' || toupper(*endptr) ==
'F' || toupper(*endptr) ==
'S')) {
158 switch (toupper(*endptr)) {
159 case 'F': req_thread_type |= FF_THREAD_FRAME;
break;
160 case 'S': req_thread_type |= FF_THREAD_SLICE;
break;
161 case 'n': req_thread_type = -1;
break;
162 case 'd': req_low_delay =
false;
break;
171 s->
codec_ctx->thread_count = thread_count;
173 if (req_thread_type == 0) {
174 req_thread_type = FF_THREAD_SLICE;
175 }
if (req_thread_type == -1) {
178 if ((req_thread_type & FF_THREAD_FRAME) != 0U) {
179 if (s->
codec_ctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) {
180 s->
codec_ctx->thread_type |= FF_THREAD_FRAME;
185 if ((req_thread_type & FF_THREAD_SLICE) != 0U) {
186 if (s->
codec_ctx->codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) {
187 s->
codec_ctx->thread_type |= FF_THREAD_SLICE;
194 s->
codec_ctx->flags |= req_low_delay ? AV_CODEC_FLAG_LOW_DELAY : 0;
195 s->
codec_ctx->flags2 |= AV_CODEC_FLAG2_FAST;
202 if (strstr(s->
codec_ctx->codec->name,
"cuvid") != NULL) {
212 "will use full-scale YUV.\n");
238 {
H264, AV_CODEC_ID_H264, NULL, { NULL } },
239 {
H265, AV_CODEC_ID_HEVC, NULL, { NULL } },
242 {
J2K, AV_CODEC_ID_JPEG2000, NULL, { NULL } },
243 {
J2KR, AV_CODEC_ID_JPEG2000, NULL, { NULL } },
244 {
VP8, AV_CODEC_ID_VP8, NULL, { NULL } },
245 {
VP9, AV_CODEC_ID_VP9, NULL, { NULL } },
246 {
HFYU, AV_CODEC_ID_HUFFYUV, NULL, { NULL } },
247 {
FFV1, AV_CODEC_ID_FFV1, NULL, { NULL } },
248 {
AV1, AV_CODEC_ID_AV1, NULL, {
"libdav1d" } },
249 {
PRORES_4444, AV_CODEC_ID_PRORES, NULL, { NULL } },
252 {
PRORES_422, AV_CODEC_ID_PRORES, NULL, { NULL } },
255 {
CFHD, AV_CODEC_ID_CFHD, NULL, { NULL } }
262 const AVCodec *usable_decoders[
static DEC_LEN])
264 unsigned int codec_index = 0;
268 char *
val = alloca(strlen(
param) + 1);
271 char *save_ptr = NULL;
272 while ((
item = strtok_r(
val,
":", &save_ptr))) {
274 const AVCodec *
codec =
275 avcodec_find_decoder_by_name(
item);
279 "Forced decoder not found: %s\n",
288 "Forced decoder not valid for codec: %s\n",
293 usable_decoders[codec_index++] =
codec;
298 while (*preferred_decoders_it) {
299 const AVCodec *
codec =
300 avcodec_find_decoder_by_name(*preferred_decoders_it);
303 "[lavd] Decoder not available: %s\n",
304 *preferred_decoders_it);
305 preferred_decoders_it++;
309 preferred_decoders_it++;
313 const AVCodec *default_decoder = avcodec_find_decoder(
avcodec_id);
314 if (default_decoder == NULL) {
316 "[lavd] No decoder found for the input codec "
317 "(libavcodec perhaps compiled without any)!\n"
318 "Use \"--param force-lavd-decoder=<d> to select a "
319 "different decoder than libavcodec if there is "
322 usable_decoders[codec_index++] = default_decoder;
324 usable_decoders[codec_index] = NULL;
328ADD_TO_PARAM(
"force-lavd-decoder",
"* force-lavd-decoder=<decoder>[:<decoder2>...]\n"
329 " Forces specified Libavcodec decoder. If more need to be specified, use colon as a delimiter.\n"
330 " Use '-c libavcodec:help' to see available decoders.\n");
333 " Try to use hardware accelerated decoding with lavd "
334 "(NVDEC/VAAPI/VDPAU/VideoToolbox).\n"
335 " Optionally with enforced API option.\n");
355 if (dec->codec_callback) {
356 dec->codec_callback();
360 const AVCodec *usable_decoders[
DEC_LEN] = { NULL };
367 const AVCodec **codec_it = usable_decoders;
370 s->
codec_ctx = avcodec_alloc_context3(*codec_it);
376 s->
codec_ctx->extradata = malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
377 memcpy(s->
codec_ctx->extradata, extradata, extradata_size);
378 s->
codec_ctx->extradata_size = extradata_size;
386 if (avcodec_open2(s->
codec_ctx, *codec_it, NULL) < 0) {
394 (*codec_it)->name, (*codec_it)->capabilities, s->
codec_ctx->thread_type, s->
codec_ctx->thread_count);
404 s->
frame = av_frame_alloc();
411 s->
pkt = av_packet_alloc();
421 if (hwaccel == NULL) {
424#if !defined HWACC_COMMON_IMPL
425 MSG(FATAL,
"HW acceleration not compiled in!\n");
429 if (strlen(hwaccel) == 0 ||
433 if (strcmp(hwaccel,
"help") == 0) {
437 MSG(ERROR,
"Wrong HW acceleration specified: %s\n", hwaccel);
453#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58, 9, 100)
456 avcodec_register_all();
489#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 75, 100)
496 AVBufferRef *ref = NULL;
497 int ret = create_hw_device_ctx(AV_HWDEVICE_TYPE_DRM, &ref);
501 s->hw_device_ctx = ref;
503 state->tmp_frame = av_frame_alloc();
504 if(!
state->tmp_frame){
505 av_buffer_unref(&ref);
512#if defined HWACC_COMMON_IMPL && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 39, 100)
513static int vulkan_init(
struct AVCodecContext *s,
519 AVBufferRef *device_ref = NULL;
520 int ret = create_hw_device_ctx(AV_HWDEVICE_TYPE_VULKAN, &device_ref);
524 state->tmp_frame = av_frame_alloc();
525 if(!
state->tmp_frame){
530 s->hw_device_ctx = device_ref;
536 av_frame_free(&
state->tmp_frame);
537 av_buffer_unref(&device_ref);
542#ifdef HWACC_COMMON_IMPL
547 AVBufferRef *device_ref = NULL;
548 int ret = create_hw_device_ctx(AV_HWDEVICE_TYPE_CUDA, &device_ref);
552 state->tmp_frame = av_frame_alloc();
553 if(!
state->tmp_frame){
558 s->hw_device_ctx = device_ref;
565 av_frame_free(&
state->tmp_frame);
566 av_buffer_unref(&device_ref);
571#ifdef HWACC_COMMON_IMPL
573check_pixfmt_hw_eligibility(
enum AVPixelFormat sw_pix_fmt)
575 const char *fmt_name = av_get_pix_fmt_name(sw_pix_fmt);
576 const int depth = av_pix_fmt_desc_get(sw_pix_fmt)->comp[0].depth;
579 "HW acceleration requested "
580 "but incoming video has %d bit depth (%s), which is more "
582 "universally supported 8b.\n",
587 "[lavd] Hw. acceleration requested "
588 "but incoming video has not 4:2:0 subsampling (format "
590 "which is usually not supported by hw. accelerators\n",
598#define SELECT_PIXFMT(pixfmt) { log_msg(LOG_LEVEL_INFO, MOD_NAME "Selected pixel format: %s\n", av_get_pix_fmt_name(pixfmt)); return pixfmt; }
599 MSG(VERBOSE,
"Available output pixel formats: %s\n",
604#ifdef HWACC_COMMON_IMPL
608 enum AVPixelFormat pix_fmt;
611#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 39, 100)
617 {AV_PIX_FMT_CUDA, hwacc_cuda_init},
624#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(55, 75, 100)
627 {AV_PIX_FMT_NONE, NULL}
630 if (hwaccel != NULL) {
632 check_pixfmt_hw_eligibility(s->sw_pix_fmt);
636 for(
const enum AVPixelFormat *it =
fmt; *it != AV_PIX_FMT_NONE; it++){
637 for(
unsigned i = 0; i <
sizeof(accels) /
sizeof(accels[0]); i++){
638 if (*it != accels[i].pix_fmt ||
647 int ret = accels[i].init_func(s, &
state->hwaccel,
state->out_codec);
657 return AV_PIX_FMT_NONE;
661 return AV_PIX_FMT_NONE;
674 if (f != AV_PIX_FMT_NONE) {
680 for (
const enum AVPixelFormat *fmt_it =
fmt; *fmt_it != AV_PIX_FMT_NONE; fmt_it++) {
681 const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(*fmt_it);
682 if (fmt_desc && (fmt_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) == 0U) {
688 return AV_PIX_FMT_NONE;
692static bool lavd_sws_convert_reconfigure(
struct state_libavcodec_decompress_sws *
sws,
enum AVPixelFormat sws_in_codec,
693 enum AVPixelFormat sws_out_codec,
int width,
int height)
699 av_get_pix_fmt_name(sws_in_codec), av_get_pix_fmt_name(sws_out_codec));
700 sws_freeContext(
sws->
ctx);
705 sws->
ctx = getSwsContext(width, height, sws_in_codec,
706 width, height, sws_out_codec,
729 sws->in_codec = sws_in_codec;
735static void lavd_sws_convert(
struct state_libavcodec_decompress_sws *
sws, AVFrame *in_frame)
738 (
const uint8_t *
const *) in_frame->data,
748static void lavd_sws_convert_to_buffer(
struct state_libavcodec_decompress_sws *
sws,
749 AVFrame *in_frame,
char *out_buffer)
751 struct AVFrame *out = av_frame_alloc();
754 buf_get_planes(sws->frame->width, sws->frame->height, ug_out_pixfmt, out_buffer, (
char **) out->data);
757 out->data[0] = (
unsigned char *) out_buffer;
762 (
const uint8_t *
const *) in_frame->data,
773 assert(av_codec != AV_PIX_FMT_NONE);
794 if (!sws_out_codec) {
796 av_get_pix_fmt_name(av_codec), av_codec);
799 if (!lavd_sws_convert_reconfigure(&s->
sws, av_codec, sws_out_codec, width, height)) {
824 codec_t out_codec,
int width,
int height,
int pitch,
825 int rgb_shift[
static restrict 3],
826 struct state_libavcodec_decompress_sws *sws)
838 lavd_sws_convert_to_buffer(sws,
frame, (
char *) dst);
842 lavd_sws_convert(sws,
frame);
869 log_msg(
LOG_LEVEL_WARNING,
MOD_NAME "No SPS found, starting decode, anyway. Please report a bug to " PACKAGE_BUGREPORT
" if decoding succeeds from now.\n");
874 const unsigned char *
const nal =
879 const int nalu_type =
887 MOD_NAME "Received %s NALU, decoding begins.\n",
892 MOD_NAME "Waiting for first SPS/VPS NALU...\n");
903 TIME_SLOT_PERC_MAX = 66
906 tpf *= TIME_SLOT_PERC_MAX / 100.;
909 duration_total_sec) /
917 if (now < s->duration_warn_last_print +
NS_IN_SEC * REPEAT_INT_SEC) {
922 "Avg decompress time of last %d frames is %.2f ms which exceeds %.2f "
923 "ms (%d%% of TPF)!\n",
926 const char *hint = NULL;
927 if ((s->
codec_ctx->thread_type & FF_THREAD_FRAME) == 0 &&
928 (s->
codec_ctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) !=
930 hint =
"\"--param lavd-thread-count=<n>FS\" option with small <n> or 0 (nr of logical cores)";
932 hint =
"\"--param lavd-thread-count=<n>\" option with small <n> or 0 (nr of logical cores)";
936 "Consider adding %s to increase throughput at the expense "
940 if ((s->
codec_ctx->flags & AV_CODEC_FLAG_LOW_DELAY) != 0) {
942 "Consider %sdisabling low delay decode using 'd' flag.\n",
943 hint != NULL ?
"also " :
"");
946 bool in_rgb = av_pix_fmt_desc_get(s->
convert_in)->flags & AV_PIX_FMT_FLAG_RGB;
949 "Consider adding \"--conv-policy cds\" to prevent color space conversion.\n", duration_pixfmt_change_sec / 1000.0);
958 if(ret == AVERROR(EIO)){
962 " blacklisting hw. accelerator...\n");
967 }
else if (ret == AVERROR(EAGAIN) && strcmp(s->
codec_ctx->codec->name,
"hevc_qsv") == 0) {
970 "Try disabling intra refresh on encoder: `-c libavcodec:encoder=libx265:disable_intra_refresh`\n");
977 unsigned int src_len,
struct pixfmt_desc *internal_props)
979 if (compress ==
H264) {
981 if (src_len <
sizeof expected_prefix + 2 || memcmp(src + src_len -
sizeof expected_prefix - 2, expected_prefix,
sizeof expected_prefix) != 0) {
984 }
else if (compress ==
H265) {
986 if (src_len <
sizeof expected_prefix + 2 || memcmp(src + src_len -
sizeof expected_prefix - 2, expected_prefix,
sizeof expected_prefix) != 0) {
992 unsigned format = src[src_len - 2];
993 internal_props->
depth = 8 + (format >> 4) * 2;
994 int subs_a = ((format >> 2) & 0x3) + 1;
995 int subs_b = ((format >> 1) & 0x1) * subs_a;
996 internal_props->
subsampling = 4000 + subs_a * 100 + subs_b * 10;
997 internal_props->
rgb = format & 0x1;
1006 bool frame_decoded =
false;
1008 s->
pkt->size = src_len;
1010 if (ret != 0 && ret != AVERROR(EAGAIN)) {
1017 if (frame_decoded) {
1019 MOD_NAME "Multiple frames decoded at once!\n");
1021 frame_decoded =
true;
1024 if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
1027 return frame_decoded;
1048 int extradata_size = *(uint32_t *)(
void *) src;
1055 src += extradata_size +
sizeof(uint32_t);
1056 src_len -= extradata_size +
sizeof(uint32_t);
1069 s->
frame->opaque = callbacks;
1070#ifdef HWACC_COMMON_IMPL
1090 MOD_NAME "Probed output pixel format: %s (%s)\n",
1091 av_get_pix_fmt_name(s->
codec_ctx->pix_fmt),
1092 av_get_pix_fmt_name(s->
codec_ctx->sw_pix_fmt));
1104 "* lavd-accept-corrupted[=no]\n"
1105 " Pass corrupted frames to decoder. If decoder isn't error-resilient,\n"
1106 " may crash! Use \"no\" to disable even if enabled by default.\n");
1115 if (*
len <
sizeof(
int)) {
1118 *(
int *)
val =
false;
1120 *(
int *)
val =
true;
1158 const AVCodec *
const decoder =
1159 avcodec_find_decoder(
decoders[i].avcodec_id);
1160 if (decoder != NULL) {
1164 "Codec %s supported by lavd but "
1165 "not compiled in FFmpeg build.\n",
1188 if (internal.depth == 0) {
struct video_frame * frame
int vc_get_linesize(unsigned int width, codec_t codec)
const char * get_codec_name(codec_t codec)
static audio_channel * libavcodec_decompress(void *, audio_channel *)
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_NOTICE
information that may be interesting
#define LOG_LEVEL_INFO
normal reporting
#define debug_file_dump(key, serialize, data)
#define LOG_LEVEL_ERROR
general errors
#define LOG_LEVEL_VERBOSE
#define LOG_LEVEL_WARNING
less severe errors
av_to_uv_convert_t * get_av_to_uv_conversion(int av_codec, codec_t uv_codec)
enum AVPixelFormat lavd_get_av_to_ug_codec(const enum AVPixelFormat *fmt, codec_t c, bool use_hwaccel)
codec_t get_best_ug_codec_to_av(const enum AVPixelFormat *fmt, bool use_hwaccel)
void av_to_uv_conversion_destroy(av_to_uv_convert_t **s)
enum AVPixelFormat pick_av_convertible_to_ug(codec_t color_spec, av_to_uv_convert_t **av_conv)
void av_to_uv_convert(const av_to_uv_convert_t *convert, char *dst, AVFrame *in, int width, int height, int pitch, const int rgb_shift[3])
#define DECOMPRESS_PROPERTY_ACCEPTS_CORRUPTED_FRAME
@ DECODER_GOT_CODEC
Internal pixel format was determined.
@ DECODER_UNSUPP_PIXFMT
Decoder can't decode to selected out_codec.
@ VDEC_PRIO_NA
decoder cannot handle the codec in any way
@ VDEC_PRIO_NOT_PREFERRED
const char * get_commandline_param(const char *key)
unsigned int cuda_devices[MAX_CUDA_DEVICES]
#define ADD_TO_PARAM(param, doc)
enum hw_accel_type hw_accel_from_pixfmt(enum AVPixelFormat pixfmt)
void hwaccel_state_init(struct hw_accel_state *hwaccel)
Initializes hw_accel_state structure.
enum hw_accel_type hw_accel_from_str(const char *str)
void hwaccel_state_reset(struct hw_accel_state *hwaccel)
Uninitializes existing acceleration and resets hw_accel_state to initial state.
codec_t hw_accel_to_ug_pixfmt(enum hw_accel_type type)
This file contains functions related to hw acceleration.
int vaapi_init(struct AVCodecContext *s, struct hw_accel_state *state, codec_t out_codec)
This file contains functions related to hw acceleration.
int vdpau_init(struct AVCodecContext *s, struct hw_accel_state *state, codec_t out_codec)
This file contains functions related to hw acceleration.
const char * lavc_thread_type_to_str(int thread_type)
void print_decoder_error(const char *mod_name, int rc)
struct pixfmt_desc av_pixfmt_get_desc(enum AVPixelFormat pixfmt)
void lavd_flush(AVCodecContext *codec_ctx)
const char * get_avpixfmts_names(const enum AVPixelFormat *pixfmts)
void ug_set_av_logging()
Sets specified log level either given explicitly or from UG-wide log_level.
int av_pixfmt_get_subsampling(enum AVPixelFormat fmt)
void printf_libav_error(int verbosity, int rc, const char *msg,...)
bool libav_codec_has_extradata(codec_t codec)
#define AV_CODEC_CAP_OTHER_THREADS
#define AV_PIX_FMT_VULKAN
void serialize_video_avframe(const void *f, FILE *out)
@ LIBRARY_CLASS_VIDEO_DECOMPRESS
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
static const struct decoder_item decoders[]
#define NALU_HDR_GET_TYPE(nal, is_hevc)
const char * get_nalu_name(int type)
const unsigned char * rtpenc_get_first_nal(const unsigned char *src, long src_len, bool hevc)
#define H264_NAL_SEI_PREFIX
#define UG_ORIG_FORMAT_ISO_IEC_11578_GUID
custom orig format byte syntax - highest 1 bit zero, next 2 bits (depth-8)/2, next 3 bits subsampling...
#define HEVC_NAL_SEI_PREFIX
void(* codec_callback)(void)
enum AVCodecID avcodec_id
const char * preferred_decoders[MAX_PREFERED+1]
bool copy
Specifies whether to use the copy mode.
int depth
bit depth; 0 means that whole struct is undefined
enum hw_accel_type accel_type
int subsampling
in 'JabA' format, eg. '4444'
enum AVPixelFormat in_codec out_codec
struct state_libavcodec_decompress::state_libavcodec_decompress_sws sws
long long consecutive_failed_decodes
time_ns_t duration_warn_last_print
enum AVPixelFormat convert_in
_Bool sps_vps_found
to avoid initial error flood, start decoding after SPS (H.264) or VPS (HEVC) was received
struct hw_accel_state hwaccel
av_to_uv_convert_t * convert
bool block_accel[HWACCEL_COUNT]
AVCodecContext * codec_ctx
double mov_avg_comp_duration
unsigned int width
width of every tile (!)
unsigned int height
height of every tile (!)
Struct containing callbacks of a video_frame.
static time_ns_t get_time_in_ns()
@ PRORES_422_LT
Apple ProRes 422 (LT)
@ R10k
RGB 10-bit packed - RGBX, big-endian (2 bit padding)
@ RGB
RGB 8-bit (packed into 24-bit word)
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
@ VIDEO_CODEC_NONE
dummy color spec
@ PRORES
abstract Apple ProRes, must not be used in transmit
@ PRORES_422_PROXY
Apple ProRes 422 (Proxy)
@ HW_VDPAU
VDPAU hardware surface.
@ RG48
16-bit RGB little-endian (RlRhGl...)
@ Y416
interleaved little-endian YCbCr 4444 16-bit - UYVA
@ PRORES_422_HQ
Apple ProRes 422 (HQ)
@ PRORES_4444
Apple ProRes 4444.
@ JPEG
JPEG image, restart intervals may be used. Compatible with GPUJPEG.
@ MJPG
JPEG image, without restart intervals.
@ R12L
RGB 12-bit packed, little-endian.
@ PRORES_422
Apple ProRes 422.
@ DRM_PRIME
DRM Prime buffer, data contains struct drm_prime_frame.
@ PRORES_4444_XQ
Apple ProRes 4444 (XQ)
@ RGBA
RGBA 8-bit, big-endian.
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
enum AVPixelFormat get_ug_to_av_pixfmt(codec_t ug_codec)
codec_t get_av_to_ug_pixfmt(enum AVPixelFormat av_pixfmt)
This is an umbrella header for video functions.
bool codec_is_a_rgb(codec_t codec)
Returns TRUE if specified pixelformat is some form of RGB (not YUV).
uint32_t get_fourcc(codec_t codec)
bool codec_is_planar(codec_t codec)
static void deconfigure(struct state_libavcodec_decompress *s)
static int libavcodec_decompress_reconfigure(void *state, struct video_desc desc, int rshift, int gshift, int bshift, int pitch, codec_t out_codec)
#define SELECT_PIXFMT(pixfmt)
static void libavcodec_decompress_done(void *state)
static enum AVPixelFormat get_format_callback(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
static void change_pixfmt(AVFrame *frame, unsigned char *dst, av_to_uv_convert_t *convert, codec_t out_codec, int width, int height, int pitch, int rgb_shift[static restrict 3], struct state_libavcodec_decompress_sws *sws)
static _Bool check_first_sps_vps(struct state_libavcodec_decompress *s, unsigned char *src, unsigned int src_len)
static bool read_forced_pixfmt(codec_t compress, const unsigned char *src, unsigned int src_len, struct pixfmt_desc *internal_props)
static int libavcodec_decompress_get_property(void *state, int property, void *val, size_t *len)
static bool get_usable_decoders(enum AVCodecID avcodec_id, const char *const preferred_decoders[static MAX_PREFERED+1], const AVCodec *usable_decoders[static DEC_LEN])
static void check_duration(struct state_libavcodec_decompress *s, double duration_total_sec, double duration_pixfmt_change_sec)
print hint to improve performance if not making it
static int drm_prime_init(struct AVCodecContext *s, struct hw_accel_state *state, codec_t out_codec)
static void * libavcodec_decompress_init(void)
static _Bool reconfigure_convert_if_needed(struct state_libavcodec_decompress *s, enum AVPixelFormat av_codec, codec_t out_codec, int width, int height)
static bool decode_frame(struct state_libavcodec_decompress *s, unsigned char *src, int src_len)
static void set_codec_context_params(struct state_libavcodec_decompress *s)
static bool validate_hwacc_param(void)
static int check_av_opt_set(void *state, const char *key, const char *val)
static void jpeg_callback(void)
static const struct video_decompress_info libavcodec_info
static void handle_lavd_error(const char *prefix, struct state_libavcodec_decompress *s, int ret)
static int libavcodec_decompress_get_priority(codec_t compression, struct pixfmt_desc internal, codec_t ugc)
static bool configure_with(struct state_libavcodec_decompress *s, struct video_desc desc, void *extradata, int extradata_size)
API for video decompress drivers.
#define VIDEO_DECOMPRESS_ABI_VERSION
void buf_get_linesizes(int width, codec_t color_spec, int *linesize)
void buf_get_planes(int width, int height, codec_t color_spec, char *data, char **planes)