Message ID | 20220912130208.2222-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 130483449ebec8fd8d9080d564f7ec5d46e18d39 |
Headers | show |
Series | [FFmpeg-devel] fftools/opt_common: check the return value of av_hwdevice_get_type_name before printing it | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On 9/12/2022 10:02 AM, James Almer wrote: > It may be NULL, as is the case for D3D11VA_VLD. > > Running "ffmpeg -h decoder=h264" on a Windows build > > Before: > Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]: > Supported hardware devices: dxva2 (null) d3d11va cuda > > After: > Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]: > Supported hardware devices: dxva2 d3d11va cuda > > Signed-off-by: James Almer <jamrial@gmail.com> > --- > fftools/opt_common.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fftools/opt_common.c b/fftools/opt_common.c > index 7cd8b1c66e..8a06df82df 100644 > --- a/fftools/opt_common.c > +++ b/fftools/opt_common.c > @@ -335,9 +335,12 @@ static void print_codec(const AVCodec *c) > printf(" Supported hardware devices: "); > for (int i = 0;; i++) { > const AVCodecHWConfig *config = avcodec_get_hw_config(c, i); > + const char *name; > if (!config) > break; > - printf("%s ", av_hwdevice_get_type_name(config->device_type)); > + name = av_hwdevice_get_type_name(config->device_type); > + if (name) > + printf("%s ", name); > } > printf("\n"); > } Applied.
diff --git a/fftools/opt_common.c b/fftools/opt_common.c index 7cd8b1c66e..8a06df82df 100644 --- a/fftools/opt_common.c +++ b/fftools/opt_common.c @@ -335,9 +335,12 @@ static void print_codec(const AVCodec *c) printf(" Supported hardware devices: "); for (int i = 0;; i++) { const AVCodecHWConfig *config = avcodec_get_hw_config(c, i); + const char *name; if (!config) break; - printf("%s ", av_hwdevice_get_type_name(config->device_type)); + name = av_hwdevice_get_type_name(config->device_type); + if (name) + printf("%s ", name); } printf("\n"); }
It may be NULL, as is the case for D3D11VA_VLD. Running "ffmpeg -h decoder=h264" on a Windows build Before: Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]: Supported hardware devices: dxva2 (null) d3d11va cuda After: Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]: Supported hardware devices: dxva2 d3d11va cuda Signed-off-by: James Almer <jamrial@gmail.com> --- fftools/opt_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)