Unified · Split
| @@ -55,7 +55,6 @@ struct dshow_ctx { · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | enum PixelFormat pixel_format; |
| 57 | 57 | enum AVCodecID video_codec_id; |
| 58 | − char *video_size; | |
| 59 | 58 | char *framerate; |
| 60 | 59 | |
| 61 | 60 | int requested_width; |
| @@ -409,7 +408,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, · 347 unmodified lines | ||
| 409 | 408 | goto next; |
| 410 | 409 | *fr = framerate; |
| 411 | 410 | } |
| 412 | − if (ctx->video_size) { | |
| 411 | + if (ctx->requested_width && ctx->requested_height) { | |
| 413 | 412 | if (ctx->requested_width > vcaps->MaxOutputSize.cx || |
| 414 | 413 | ctx->requested_width < vcaps->MinOutputSize.cx || |
| 415 | 414 | ctx->requested_height > vcaps->MaxOutputSize.cy || |
| @@ -534,7 +533,8 @@ dshow_cycle_pins(AVFormatContext *avctx, enum dshowDeviceType devtype, · 118 unmodified lines | ||
| 534 | 533 | const GUID *mediatype[2] = { &MEDIATYPE_Video, &MEDIATYPE_Audio }; |
| 535 | 534 | const char *devtypename = (devtype == VideoDevice) ? "video" : "audio"; |
| 536 | 535 | |
| 537 | − int set_format = (devtype == VideoDevice && (ctx->video_size || ctx->framerate || | |
| 536 | + int set_format = (devtype == VideoDevice && (ctx->framerate || | |
| 537 | + (ctx->requested_width && ctx->requested_height) || | |
| 538 | 538 | ctx->pixel_format != PIX_FMT_NONE || |
| 539 | 539 | ctx->video_codec_id != AV_CODEC_ID_RAWVIDEO)) |
| 540 | 540 | || (devtype == AudioDevice && (ctx->channels || ctx->sample_rate)); |
| @@ -886,13 +886,6 @@ static int dshow_read_header(AVFormatContext *avctx) · 345 unmodified lines | ||
| 886 | 886 | goto error; |
| 887 | 887 | } |
| 888 | 888 | } |
| 889 | − if (ctx->video_size) { | |
| 890 | − r = av_parse_video_size(&ctx->requested_width, &ctx->requested_height, ctx->video_size); | |
| 891 | − if (r < 0) { | |
| 892 | − av_log(avctx, AV_LOG_ERROR, "Could not parse video size '%s'.\n", ctx->video_size); | |
| 893 | − goto error; | |
| 894 | − } | |
| 895 | − } | |
| 896 | 889 | if (ctx->framerate) { |
| 897 | 890 | r = av_parse_video_rate(&ctx->requested_framerate, ctx->framerate); |
| 898 | 891 | if (r < 0) { |
| @@ -1024,7 +1017,7 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt) · 125 unmodified lines | ||
| 1024 | 1017 | #define OFFSET(x) offsetof(struct dshow_ctx, x) |
| 1025 | 1018 | #define DEC AV_OPT_FLAG_DECODING_PARAM |
| 1026 | 1019 | static const AVOption options[] = { |
| 1027 | − { "video_size", "set video size given a string such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, | |
| 1020 | + { "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 }, | |
| 1028 | 1021 | { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.str = NULL}, 0, 0, DEC }, |
| 1029 | 1022 | { "framerate", "set video frame rate", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, |
| 1030 | 1023 | { "sample_rate", "set audio sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC }, |