[libav-devel] [PATCH] aac: turn off SBR after an overread occurs

2017-04-30 Thread Sean McGovern
Bug-Id: 1047
CC: libav-sta...@libav.org
---
 libavcodec/aacsbr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 99f7b08..d9bbe5e 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -1097,6 +1097,7 @@ int ff_decode_sbr_extension(AACContext *ac, 
SpectralBandReplication *sbr,
 if (bytes_read > cnt) {
 av_log(ac->avctx, AV_LOG_ERROR,
"Expected to read %d SBR bytes actually read %d.\n", cnt, 
bytes_read);
+sbr_turnoff(sbr);
 }
 return cnt;
 }
-- 
2.7.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] doc: Document hwupload, hwdownload and hwmap filters

2017-04-30 Thread Mark Thompson
---
 doc/filters.texi | 98 
 1 file changed, 98 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 947fd7915..f57fbf6c4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1657,6 +1657,104 @@ A floating point number which specifies chroma temporal 
strength. It defaults to
 @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
 @end table
 
+@section hwdownload
+
+Download hardware frames to system memory.
+
+The input must be in hardware frames, and the output a non-hardware format.
+Not all formats will be supported on the output - it may be necessary to insert
+an additional @option{format} filter immediately following in the graph to get
+the output in a supported format.
+
+@section hwmap
+
+Map hardware frames to system memory or to another device.
+
+This filter has several different modes of operation; which is used depends on
+the input and output formats:
+@itemize
+@item
+Hardware frame input, normal frame output
+
+Map the input frames to system memory and give them to the output.  If the
+original hardware frame is later required (for example, after overlaying
+something else on part of it), the @option{hwmap} filter can be used again
+in the next mode to retrieve them.
+@item
+Normal frame input, hardware frame output
+
+If the input is actually a software-mapped hardware frame, then unmap it -
+that is, return the original hardware frame.
+
+Otherwise, a device must be provided.  Create new hardware surfaces on that
+device for the output, then map them back to the software format at the input
+and give those frames to the preceding filter.  This will then act like the
+@option{hwupload} filter, but may be able to avoid an additional copy when
+the input is already in a compatible format.
+@item
+Hardware frame input and output
+
+A device must be supplied for the output, either directly or with the
+@option{derive_device} option.  The input and output devices must be of
+different types and compatible - the exact meaning of this is
+system-dependent, but typically it means that they must refer to the same
+underlying hardware context (for example, refer to the same graphics card).
+
+If the input frames were originally created on the output device, then unmap
+to retrieve the original frames.
+
+Otherwise, map the frames to the output device - create new hardware frames
+on the output corresponding to the frames on the input.
+@end itemize
+
+The following additional parameters are accepted:
+
+@table @option
+@item mode
+Set the frame mapping mode.  Some combination of:
+@table @var
+@item read
+The mapped frame should be readable.
+@item write
+The mapped frame should be writeable.
+@item overwrite
+The mapping will always overwrite the entire frame.
+
+This may improve performance in some cases, as the original contents of the
+frame need not be loaded.
+@item direct
+The mapping must not involve any copying.
+
+Indirect mappings to copies of frames are created in some cases where either
+direct mapping is not possible or it would have unexpected properties.
+Setting this flag ensures that the mapping is direct and will fail if that is
+not possible.
+@end table
+Defaults to @var{read+write} if not specified.
+
+@item derive_device @var{type}
+Rather than using the device supplied at initialisation, instead derive a new
+device of type @var{type} from the device the input frames exist on.
+
+@item reverse
+In a hardware to hardware mapping, map in reverse - create frames in the sink
+and map them back to the source.  This may be necessary in some cases where
+a mapping in one direction is required but only the opposite direction is
+supported by the devices being used.
+
+This option is dangerous - it may break the preceding filter in undefined
+ways if there are any additional constraints on that filter's output.
+Do not use it without fully understanding the implications of its use.
+@end table
+
+@section hwupload
+
+Upload system memory frames to hardware surfaces.
+
+The device to upload to must be supplied when the filter is initialised.  If
+using avconv, select the appropriate device with the @option{-filter_hw_device}
+option.
+
 @section hwupload_cuda
 
 Upload system memory frames to a CUDA device.
-- 
2.11.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] vaapi_encode: Move quality option in common code

2017-04-30 Thread Mark Thompson
Use AVCodecContext.compression_level rather than a private option,
replacing the H.264-specific quality option (which stays only for
compatibility).

This now works with the H.265 encoder in the i965 driver, as well as
the existing cases with the H.264 encoder.
---
 doc/encoders.texi  |  9 ++---
 libavcodec/vaapi_encode.c  | 33 +
 libavcodec/vaapi_encode.h  |  6 ++
 libavcodec/vaapi_encode_h264.c | 25 ++---
 4 files changed, 47 insertions(+), 26 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 7cebe39c1..c369e03bf 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -948,7 +948,13 @@ The following standard libavcodec options are used:
 @item
 @option{rc_init_occupancy} / @option{rc_initial_buffer_occupancy}
 @item
+@option{compression_level}
+
+Speed / quality tradeoff: higher values are faster / worse quality.
+@item
 @option{q} / @option{global_quality}
+
+Size / quality tradeoff: higher values are smaller / worse quality.
 @item
 @option{qmin}
 (only: @option{qmax} is not supported)
@@ -969,9 +975,6 @@ The following standard libavcodec options are used:
 @option{level} sets the value of @emph{level_idc}.
 
 @table @option
-@item quality
-Set the local encoding quality/speed tradeoff (range 1-8, higher values are 
faster; not all
-systems implement all levels).
 @item low_power
 Use low-power encoding mode.
 @end table
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 620518419..5e5177a5d 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1423,6 +1423,39 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
 goto fail;
 }
 
+if (avctx->compression_level >= 0) {
+#if VA_CHECK_VERSION(0, 36, 0)
+VAConfigAttrib attr = { VAConfigAttribEncQualityRange };
+
+vas = vaGetConfigAttributes(ctx->hwctx->display,
+ctx->va_profile,
+ctx->va_entrypoint,
+, 1);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_WARNING, "Failed to query quality "
+   "attribute: will use default compression level.\n");
+} else if (avctx->compression_level > attr.value) {
+av_log(avctx, AV_LOG_ERROR, "Invalid compression level: "
+   "valid range is 0-%d.\n", attr.value);
+err = AVERROR(EINVAL);
+goto fail;
+} else {
+ctx->quality_params.misc.type =
+VAEncMiscParameterTypeQualityLevel;
+ctx->quality_params.quality.quality_level =
+avctx->compression_level;
+
+ctx->global_params[ctx->nb_global_params] =
+>quality_params.misc;
+ctx->global_params_size[ctx->nb_global_params++] =
+sizeof(ctx->quality_params);
+}
+#else
+av_log(avctx, AV_LOG_WARNING, "The encode compression level "
+   "option is not supported with this VAAPI version.\n");
+#endif
+}
+
 ctx->input_order  = 0;
 ctx->output_delay = avctx->max_b_frames;
 ctx->decode_delay = 1;
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index fc6236514..1b0fed80e 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -159,6 +159,12 @@ typedef struct VAAPIEncodeContext {
 VAEncMiscParameterBuffer misc;
 VAEncMiscParameterFrameRate fr;
 } fr_params;
+#if VA_CHECK_VERSION(0, 36, 0)
+struct {
+VAEncMiscParameterBuffer misc;
+VAEncMiscParameterBufferQualityLevel quality;
+} quality_params;
+#endif
 
 // Per-sequence parameter structure (VAEncSequenceParameterBuffer*).
 void   *codec_sequence_params;
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 0c3ac3441..9013207f9 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -154,14 +154,6 @@ typedef struct VAAPIEncodeH264Context {
 
 // Rate control configuration.
 int send_timing_sei;
-
-#if VA_CHECK_VERSION(0, 36, 0)
-// Speed-quality tradeoff setting.
-struct {
-VAEncMiscParameterBuffer misc;
-VAEncMiscParameterBufferQualityLevel quality;
-} quality_params;
-#endif
 } VAAPIEncodeH264Context;
 
 typedef struct VAAPIEncodeH264Options {
@@ -1141,21 +1133,8 @@ static av_cold int 
vaapi_encode_h264_configure(AVCodecContext *avctx)
 av_assert0(0 && "Invalid RC mode.");
 }
 
-if (opt->quality > 0) {
-#if VA_CHECK_VERSION(0, 36, 0)
-priv->quality_params.misc.type =
-VAEncMiscParameterTypeQualityLevel;
-priv->quality_params.quality.quality_level = opt->quality;
-
-ctx->global_params[ctx->nb_global_params] =
->quality_params.misc;
-ctx->global_params_size[ctx->nb_global_params++] =
-sizeof(priv->quality_params);
-#else
-   

[libav-devel] [PATCH 2/2] hevcdec: move SEI message parsing into a separate header

2017-04-30 Thread James Almer
It doesn't depend on hevcdec anymore.

Signed-off-by: James Almer 
---
The two patches could be squashed into one, but i figured this way would be
easier to read/review.

 libavcodec/hevc_sei.c | 37 +++---
 libavcodec/hevc_sei.h | 88 +++
 libavcodec/hevcdec.h  | 29 +
 3 files changed, 94 insertions(+), 60 deletions(-)
 create mode 100644 libavcodec/hevc_sei.h

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index bb4980085..0e7f0ccb0 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -23,35 +23,8 @@
  */
 
 #include "golomb_legacy.h"
-#include "hevcdec.h"
-
-enum HEVC_SEI_TYPE {
-SEI_TYPE_BUFFERING_PERIOD = 0,
-SEI_TYPE_PICTURE_TIMING   = 1,
-SEI_TYPE_PAN_SCAN_RECT= 2,
-SEI_TYPE_FILLER_PAYLOAD   = 3,
-SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35   = 4,
-SEI_TYPE_USER_DATA_UNREGISTERED   = 5,
-SEI_TYPE_RECOVERY_POINT   = 6,
-SEI_TYPE_SCENE_INFO   = 9,
-SEI_TYPE_FULL_FRAME_SNAPSHOT  = 15,
-SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
-SEI_TYPE_PROGRESSIVE_REFINEMENT_SEGMENT_END   = 17,
-SEI_TYPE_FILM_GRAIN_CHARACTERISTICS   = 19,
-SEI_TYPE_POST_FILTER_HINT = 22,
-SEI_TYPE_TONE_MAPPING_INFO= 23,
-SEI_TYPE_FRAME_PACKING= 45,
-SEI_TYPE_DISPLAY_ORIENTATION  = 47,
-SEI_TYPE_SOP_DESCRIPTION  = 128,
-SEI_TYPE_ACTIVE_PARAMETER_SETS= 129,
-SEI_TYPE_DECODING_UNIT_INFO   = 130,
-SEI_TYPE_TEMPORAL_LEVEL0_INDEX= 131,
-SEI_TYPE_DECODED_PICTURE_HASH = 132,
-SEI_TYPE_SCALABLE_NESTING = 133,
-SEI_TYPE_REGION_REFRESH_INFO  = 134,
-SEI_TYPE_MASTERING_DISPLAY_INFO   = 137,
-SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144,
-};
+#include "hevc.h"
+#include "hevc_sei.h"
 
 static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
GetBitContext *gb,
void *logctx)
@@ -123,10 +96,10 @@ static int decode_nal_sei_prefix(GetBitContext *gb, void 
*logctx, HEVCSEIContext
 switch (type) {
 case 256:  // Mismatched value from HM 8.1
 return decode_nal_sei_decoded_picture_hash(>picture_hash, gb, 
logctx);
-case SEI_TYPE_FRAME_PACKING:
+case HEVC_SEI_TYPE_FRAME_PACKING:
 return decode_nal_sei_frame_packing_arrangement(>frame_packing,
 gb, logctx);
-case SEI_TYPE_DISPLAY_ORIENTATION:
+case HEVC_SEI_TYPE_DISPLAY_ORIENTATION:
 return decode_nal_sei_display_orientation(>display_orientation,
   gb, logctx);
 default:
@@ -140,7 +113,7 @@ static int decode_nal_sei_suffix(GetBitContext *gb, void 
*logctx, HEVCSEIContext
  int type, int size)
 {
 switch (type) {
-case SEI_TYPE_DECODED_PICTURE_HASH:
+case HEVC_SEI_TYPE_DECODED_PICTURE_HASH:
 return decode_nal_sei_decoded_picture_hash(>picture_hash, gb, 
logctx);
 default:
 av_log(logctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
new file mode 100644
index 0..c2bc4f9f0
--- /dev/null
+++ b/libavcodec/hevc_sei.h
@@ -0,0 +1,88 @@
+/*
+ * HEVC Supplementary Enhancement Information messages
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_HEVC_SEI_H
+#define AVCODEC_HEVC_SEI_H
+
+#include 
+
+#include "libavutil/md5.h"
+#include "get_bits.h"
+
+/**
+ * SEI message types
+ */
+typedef enum {
+HEVC_SEI_TYPE_BUFFERING_PERIOD = 0,
+HEVC_SEI_TYPE_PICTURE_TIMING   = 1,
+HEVC_SEI_TYPE_PAN_SCAN_RECT= 2,
+HEVC_SEI_TYPE_FILLER_PAYLOAD   = 3,
+HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35   = 4,
+

[libav-devel] [PATCH 1/2] hevcdec: remove HEVCContext usage from hevc_sei

2017-04-30 Thread James Almer
Based on the H264 SEI implementation.

This will be mainly useful once support for SEI messages that can be
used by the hevc parser are implemented, like Picture Timing.

Signed-off-by: James Almer 
---
 libavcodec/hevc_sei.c | 77 +--
 libavcodec/hevcdec.c  | 49 +---
 libavcodec/hevcdec.h  | 44 ++---
 3 files changed, 92 insertions(+), 78 deletions(-)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 1f8554ad5..bb4980085 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -53,10 +53,10 @@ enum HEVC_SEI_TYPE {
 SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO = 144,
 };
 
-static int decode_nal_sei_decoded_picture_hash(HEVCContext *s)
+static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
GetBitContext *gb,
+   void *logctx)
 {
 int cIdx, i;
-GetBitContext *gb = >HEVClc.gb;
 uint8_t hash_type = get_bits(gb, 8);
 
 for (cIdx = 0; cIdx < 3; cIdx++) {
@@ -75,15 +75,15 @@ static int decode_nal_sei_decoded_picture_hash(HEVCContext 
*s)
 return 0;
 }
 
-static int decode_nal_sei_frame_packing_arrangement(HEVCContext *s)
+static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s,
+GetBitContext *gb,
+void *logctx)
 {
-GetBitContext *gb = >HEVClc.gb;
-
 get_ue_golomb(gb);  // frame_packing_arrangement_id
-s->sei_frame_packing_present = !get_bits1(gb);
+s->present = !get_bits1(gb);
 
-if (s->sei_frame_packing_present) {
-s->frame_packing_arrangement_type = get_bits(gb, 7);
+if (s->present) {
+s->arrangement_type   = get_bits(gb, 7);
 s->quincunx_subsampling   = get_bits1(gb);
 s->content_interpretation_type= get_bits(gb, 6);
 
@@ -92,7 +92,7 @@ static int 
decode_nal_sei_frame_packing_arrangement(HEVCContext *s)
 // frame0_self_contained_flag frame1_self_contained_flag
 skip_bits(gb, 6);
 
-if (!s->quincunx_subsampling && s->frame_packing_arrangement_type != 5)
+if (!s->quincunx_subsampling && s->arrangement_type != 5)
 skip_bits(gb, 16);  // frame[01]_grid_position_[xy]
 skip_bits(gb, 8);   // frame_packing_arrangement_reserved_byte
 skip_bits1(gb); // frame_packing_arrangement_persistence_flag
@@ -101,63 +101,61 @@ static int 
decode_nal_sei_frame_packing_arrangement(HEVCContext *s)
 return 0;
 }
 
-static int decode_nal_sei_display_orientation(HEVCContext *s)
+static int decode_nal_sei_display_orientation(HEVCSEIDisplayOrientation *s, 
GetBitContext *gb,
+  void *logctx)
 {
-GetBitContext *gb = >HEVClc.gb;
-
-s->sei_display_orientation_present = !get_bits1(gb);
+s->present = !get_bits1(gb);
 
-if (s->sei_display_orientation_present) {
-s->sei_hflip = get_bits1(gb); // hor_flip
-s->sei_vflip = get_bits1(gb); // ver_flip
+if (s->present) {
+s->hflip = get_bits1(gb); // hor_flip
+s->vflip = get_bits1(gb); // ver_flip
 
-s->sei_anticlockwise_rotation = get_bits(gb, 16);
+s->anticlockwise_rotation = get_bits(gb, 16);
 skip_bits1(gb); // display_orientation_persistence_flag
 }
 
 return 0;
 }
 
-static int decode_nal_sei_prefix(HEVCContext *s, int type, int size)
+static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, 
HEVCSEIContext *s,
+ int type, int size)
 {
-GetBitContext *gb = >HEVClc.gb;
-
 switch (type) {
 case 256:  // Mismatched value from HM 8.1
-return decode_nal_sei_decoded_picture_hash(s);
+return decode_nal_sei_decoded_picture_hash(>picture_hash, gb, 
logctx);
 case SEI_TYPE_FRAME_PACKING:
-return decode_nal_sei_frame_packing_arrangement(s);
+return decode_nal_sei_frame_packing_arrangement(>frame_packing,
+gb, logctx);
 case SEI_TYPE_DISPLAY_ORIENTATION:
-return decode_nal_sei_display_orientation(s);
+return decode_nal_sei_display_orientation(>display_orientation,
+  gb, logctx);
 default:
-av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
+av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
 skip_bits_long(gb, 8 * size);
 return 0;
 }
 }
 
-static int decode_nal_sei_suffix(HEVCContext *s, int type, int size)
+static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, 
HEVCSEIContext *s,
+ int type, int size)
 {
-GetBitContext *gb = >HEVClc.gb;
-
 switch (type) {
 case SEI_TYPE_DECODED_PICTURE_HASH:
-return 

Re: [libav-devel] [PATCH] avconv_hw: Add implicit device creation with default parameters

2017-04-30 Thread Mark Thompson
On 30/04/17 14:56, wm4 wrote:
> On Sun, 30 Apr 2017 14:19:02 +0100
> Mark Thompson  wrote:
> 
>> If -hwaccel foo is supplied without any other device options, and the
>> foo hwaccel is meant to have a device, try to make such a device with
>> default parameters for the hwaccel to use.
>> ---
>> This was intended to be the behaviour all along, but, as noted by wm4, the 
>> implementation wasn't actually there.
>>
>> The return value is not checked, because we only care about the dev argument 
>> which is set on success.
>>
>>
>>  avtools/avconv_hw.c | 4 
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/avtools/avconv_hw.c b/avtools/avconv_hw.c
>> index fd1618389..94be72330 100644
>> --- a/avtools/avconv_hw.c
>> +++ b/avtools/avconv_hw.c
>> @@ -287,6 +287,10 @@ int hw_device_setup_for_decode(InputStream *ist)
>>  type = hw_device_match_type_in_name(ist->dec->name);
>>  if (type != AV_HWDEVICE_TYPE_NONE) {
>>  dev = hw_device_get_by_type(type);
>> +if (!dev) {
>> +hw_device_init_from_string(av_hwdevice_get_type_name(type),
>> +   );
>> +}
>>  } else {
>>  // No device required.
>>  return 0;
> 
> I think I've also tested this one confirmed working on Friday.

Yep, it's the same one.  I'll push it soon.

Thanks,

- Mark
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] avconv_hw: Add implicit device creation with default parameters

2017-04-30 Thread wm4
On Sun, 30 Apr 2017 14:19:02 +0100
Mark Thompson  wrote:

> If -hwaccel foo is supplied without any other device options, and the
> foo hwaccel is meant to have a device, try to make such a device with
> default parameters for the hwaccel to use.
> ---
> This was intended to be the behaviour all along, but, as noted by wm4, the 
> implementation wasn't actually there.
> 
> The return value is not checked, because we only care about the dev argument 
> which is set on success.
> 
> 
>  avtools/avconv_hw.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/avtools/avconv_hw.c b/avtools/avconv_hw.c
> index fd1618389..94be72330 100644
> --- a/avtools/avconv_hw.c
> +++ b/avtools/avconv_hw.c
> @@ -287,6 +287,10 @@ int hw_device_setup_for_decode(InputStream *ist)
>  type = hw_device_match_type_in_name(ist->dec->name);
>  if (type != AV_HWDEVICE_TYPE_NONE) {
>  dev = hw_device_get_by_type(type);
> +if (!dev) {
> +hw_device_init_from_string(av_hwdevice_get_type_name(type),
> +   );
> +}
>  } else {
>  // No device required.
>  return 0;

I think I've also tested this one confirmed working on Friday.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] avconv_hw: Add implicit device creation with default parameters

2017-04-30 Thread Luca Barbato
On 4/30/17 3:19 PM, Mark Thompson wrote:
> This was intended to be the behaviour all along, but, as noted by
> wm4, the implementation wasn't actually there.

Seems fine.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] avconv_hw: Add implicit device creation with default parameters

2017-04-30 Thread Mark Thompson
If -hwaccel foo is supplied without any other device options, and the
foo hwaccel is meant to have a device, try to make such a device with
default parameters for the hwaccel to use.
---
This was intended to be the behaviour all along, but, as noted by wm4, the 
implementation wasn't actually there.

The return value is not checked, because we only care about the dev argument 
which is set on success.


 avtools/avconv_hw.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/avtools/avconv_hw.c b/avtools/avconv_hw.c
index fd1618389..94be72330 100644
--- a/avtools/avconv_hw.c
+++ b/avtools/avconv_hw.c
@@ -287,6 +287,10 @@ int hw_device_setup_for_decode(InputStream *ist)
 type = hw_device_match_type_in_name(ist->dec->name);
 if (type != AV_HWDEVICE_TYPE_NONE) {
 dev = hw_device_get_by_type(type);
+if (!dev) {
+hw_device_init_from_string(av_hwdevice_get_type_name(type),
+   );
+}
 } else {
 // No device required.
 return 0;
-- 
2.11.0

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel