[FFmpeg-devel] [PATCH] examples/hw_decode: Use hw-config information to find pixfmt

Moritz Barsnick barsnick at gmx.net
Wed Nov 29 16:17:12 EET 2017


On Wed, Nov 29, 2017 at 13:41:29 +0100, Timo Rothenpieler wrote:
> Am 29.11.2017 um 13:22 schrieb Moritz Barsnick:
> > On Wed, Nov 29, 2017 at 00:34:03 +0000, Mark Thompson wrote:
> >> +    if (type == AV_HWDEVICE_TYPE_NONE) {
> >> +        fprintf(stderr, "Device type %s is not supported.\n", argv[1]);
> >> +        fprintf(stderr, "Available device types:");
> >> +        type = AV_HWDEVICE_TYPE_NONE;
> >> +        while((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE)
> >> +            fprintf(stderr, " %s", av_hwdevice_get_type_name(type));
> > 
> > I see what you're trying to do with "type = AV_HWDEVICE_TYPE_NONE"
> > (initialize the iterator), but the assignment is redundant.
> [...]
> I fail to see how the assignment is redundant?
> Without the assignment, that would be an infinite loop.

if (type == AV_HWDEVICE_TYPE_NONE) {
    // do something not affecting any variable
    type = AV_HWDEVICE_TYPE_NONE;

Unless something else (what?) modifies the variable "type" in the
meantime, its value was already guaranteed to be AV_HWDEVICE_TYPE_NONE.

What am I missing?

(I didn't mean "(type = av_hwdevice_iterate_types(type)) !=
AV_HWDEVICE_TYPE_NONE", that's why I explicitly quoted the assignment I
meant.)

Moritz


More information about the ffmpeg-devel mailing list