diff options
author | Mark Thompson <sw@jkqxz.net> | 2020-04-13 16:33:20 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2020-04-26 18:38:25 +0100 |
commit | 8abd3b202821e9c491f44d097686402aafdda7c5 (patch) | |
tree | 6439bf7128bee3479d5c74b044f472800f8ef089 /fftools/ffmpeg.c | |
parent | e2542124059f5960ac2bbd94183012814263f20d (diff) |
ffmpeg: Use hardware config metadata with encoders
This can support encoders which want frames and/or device contexts. For
the device case, it currently picks the first initialised device of the
desired type to give to the encoder - a new option would be needed if it
were necessary to choose between multiple devices of the same type.
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r-- | fftools/ffmpeg.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d896b14a14..2287af59f0 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3476,21 +3476,14 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len) !av_dict_get(ost->encoder_opts, "ab", NULL, 0)) av_dict_set(&ost->encoder_opts, "b", "128000", 0); - if (ost->filter && av_buffersink_get_hw_frames_ctx(ost->filter->filter) && - ((AVHWFramesContext*)av_buffersink_get_hw_frames_ctx(ost->filter->filter)->data)->format == - av_buffersink_get_format(ost->filter->filter)) { - ost->enc_ctx->hw_frames_ctx = av_buffer_ref(av_buffersink_get_hw_frames_ctx(ost->filter->filter)); - if (!ost->enc_ctx->hw_frames_ctx) - return AVERROR(ENOMEM); - } else { - ret = hw_device_setup_for_encode(ost); - if (ret < 0) { - snprintf(error, error_len, "Device setup failed for " - "encoder on output stream #%d:%d : %s", + ret = hw_device_setup_for_encode(ost); + if (ret < 0) { + snprintf(error, error_len, "Device setup failed for " + "encoder on output stream #%d:%d : %s", ost->file_index, ost->index, av_err2str(ret)); - return ret; - } + return ret; } + if (ist && ist->dec->type == AVMEDIA_TYPE_SUBTITLE && ost->enc->type == AVMEDIA_TYPE_SUBTITLE) { int input_props = 0, output_props = 0; AVCodecDescriptor const *input_descriptor = |