X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavdevice%2Fdshow.c;h=9485af6586ae1ea74b52f9e248f11fbf9c8e1956;hb=de7c95d551881a01cd24885f23bd180fcecc5c07;hp=3bd90b0c6fe6da782fd66198eb071eab4f961b73;hpb=7ca97b6b3c9250c77fc5b6f5f9938589e2e18499;p=ffmpeg diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 3bd90b0c6fe..9485af6586a 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -929,20 +929,18 @@ static int dshow_read_header(AVFormatContext *avctx) } if (ctx->device_name[VideoDevice]) { - ret = dshow_open_device(avctx, devenum, VideoDevice); - if (ret < 0) - goto error; - ret = dshow_add_device(avctx, VideoDevice); - if (ret < 0) + if ((r = dshow_open_device(avctx, devenum, VideoDevice)) < 0 || + (r = dshow_add_device(avctx, VideoDevice)) < 0) { + ret = r; goto error; + } } if (ctx->device_name[AudioDevice]) { - ret = dshow_open_device(avctx, devenum, AudioDevice); - if (ret < 0) - goto error; - ret = dshow_add_device(avctx, AudioDevice); - if (ret < 0) + if ((r = dshow_open_device(avctx, devenum, AudioDevice)) < 0 || + (r = dshow_add_device(avctx, AudioDevice)) < 0) { + ret = r; goto error; + } } ctx->mutex = CreateMutex(NULL, 0, NULL); @@ -1018,7 +1016,7 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt) #define DEC AV_OPT_FLAG_DECODING_PARAM static const AVOption options[] = { { "video_size", "set video size given a string such as 640x480 or hd720.", OFFSET(requested_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC }, - { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.str = NULL}, 0, 0, DEC }, + { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, AV_PIX_FMT_NB-1, DEC }, { "framerate", "set video frame rate", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, { "sample_rate", "set audio sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC }, { "sample_size", "set audio sample size", OFFSET(sample_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 16, DEC },