---
This is now needed independently of hwaccel setup because it has to happen
before avcodec_open2().
avconv.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/avconv.c b/avconv.c
index 94b6da2..0536e72 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1703,6 +1703,13 @@ static int init_input_stream(int ist_index, char *error,
int error_len)
if (!av_dict_get(ist->decoder_opts, "threads", NULL, 0))
av_dict_set(&ist->decoder_opts, "threads", "auto", 0);
+
+ if (hw_device_ctx) {
+ ist->dec_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
+ if (!ist->dec_ctx->hw_device_ctx)
+ return AVERROR(ENOMEM);
+ }
+
if ((ret = avcodec_open2(ist->dec_ctx, codec, &ist->decoder_opts)) <
0) {
char errbuf[128];
if (ret == AVERROR_EXPERIMENTAL)
@@ -2039,6 +2046,12 @@ static int init_output_stream(OutputStream *ost, char
*error, int error_len)
if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0))
av_dict_set(&ost->encoder_opts, "threads", "auto", 0);
+ if (hw_device_ctx) {
+ ost->enc_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
+ if (!ost->enc_ctx->hw_device_ctx)
+ return AVERROR(ENOMEM);
+ }
+
if (ost->filter && ost->filter->filter->inputs[0]->hw_frames_ctx &&
((AVHWFramesContext*)ost->filter->filter->inputs[0]->hw_frames_ctx->data)->format
==
ost->filter->filter->inputs[0]->format) {
--
2.7.4
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel