mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
fftools/ffmpeg_hw: inline hwaccel_decode_init() into its caller
The function is now trivial and cannot fail, so all error handling in its caller can be removed.
This commit is contained in:
parent
6c9cbf7507
commit
25d96ab6c0
@ -805,7 +805,7 @@ void hw_device_free_all(void);
|
||||
*/
|
||||
AVBufferRef *hw_device_for_filter(void);
|
||||
|
||||
int hwaccel_decode_init(AVCodecContext *avctx);
|
||||
int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input);
|
||||
|
||||
int dec_open(InputStream *ist);
|
||||
void dec_free(Decoder **pdec);
|
||||
|
@ -538,7 +538,6 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
|
||||
{
|
||||
InputStream *ist = s->opaque;
|
||||
const enum AVPixelFormat *p;
|
||||
int ret;
|
||||
|
||||
for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
|
||||
@ -562,19 +561,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
|
||||
}
|
||||
}
|
||||
if (config && config->device_type == ist->hwaccel_device_type) {
|
||||
ret = hwaccel_decode_init(s);
|
||||
if (ret < 0) {
|
||||
if (ist->hwaccel_id == HWACCEL_GENERIC) {
|
||||
av_log(NULL, AV_LOG_FATAL,
|
||||
"%s hwaccel requested for input stream #%d:%d, "
|
||||
"but cannot be initialized.\n",
|
||||
av_hwdevice_get_type_name(config->device_type),
|
||||
ist->file_index, ist->index);
|
||||
return AV_PIX_FMT_NONE;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
ist->hwaccel_retrieve_data = hwaccel_retrieve_data;
|
||||
ist->hwaccel_pix_fmt = *p;
|
||||
break;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ void hw_device_free_all(void)
|
||||
nb_hw_devices = 0;
|
||||
}
|
||||
|
||||
static int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
|
||||
int hwaccel_retrieve_data(AVCodecContext *avctx, AVFrame *input)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
AVFrame *output = NULL;
|
||||
@ -339,15 +339,6 @@ fail:
|
||||
return err;
|
||||
}
|
||||
|
||||
int hwaccel_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
InputStream *ist = avctx->opaque;
|
||||
|
||||
ist->hwaccel_retrieve_data = &hwaccel_retrieve_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVBufferRef *hw_device_for_filter(void)
|
||||
{
|
||||
// Pick the last hardware device if the user doesn't pick the device for
|
||||
|
Loading…
Reference in New Issue
Block a user