History

lavd/dshow: use AV_OPT_TYPE_IMAGE_SIZE

Ramiro Polla committed 14 years ago

Commit dc5fcdb1 parent 37a0db51 file · +4 −11Browse files

Unified · Split

libavdevice/dshow.c+4−11
@@ -55,7 +55,6 @@ struct dshow_ctx { · 54 unmodified lines
5555
5656 enum PixelFormat pixel_format;
5757 enum AVCodecID video_codec_id;
58− char *video_size;
5958 char *framerate;
6059
6160 int requested_width;
@@ -409,7 +408,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, · 347 unmodified lines
409408 goto next;
410409 *fr = framerate;
411410 }
412− if (ctx->video_size) {
411+ if (ctx->requested_width && ctx->requested_height) {
413412 if (ctx->requested_width > vcaps->MaxOutputSize.cx ||
414413 ctx->requested_width < vcaps->MinOutputSize.cx ||
415414 ctx->requested_height > vcaps->MaxOutputSize.cy ||
@@ -534,7 +533,8 @@ dshow_cycle_pins(AVFormatContext *avctx, enum dshowDeviceType devtype, · 118 unmodified lines
534533 const GUID *mediatype[2] = { &MEDIATYPE_Video, &MEDIATYPE_Audio };
535534 const char *devtypename = (devtype == VideoDevice) ? "video" : "audio";
536535
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) ||
538538 ctx->pixel_format != PIX_FMT_NONE ||
539539 ctx->video_codec_id != AV_CODEC_ID_RAWVIDEO))
540540 || (devtype == AudioDevice && (ctx->channels || ctx->sample_rate));
@@ -886,13 +886,6 @@ static int dshow_read_header(AVFormatContext *avctx) · 345 unmodified lines
886886 goto error;
887887 }
888888 }
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− }
896889 if (ctx->framerate) {
897890 r = av_parse_video_rate(&ctx->requested_framerate, ctx->framerate);
898891 if (r < 0) {
@@ -1024,7 +1017,7 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt) · 125 unmodified lines
10241017 #define OFFSET(x) offsetof(struct dshow_ctx, x)
10251018 #define DEC AV_OPT_FLAG_DECODING_PARAM
10261019 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 },
10281021 { "pixel_format", "set video pixel format", OFFSET(pixel_format), AV_OPT_TYPE_PIXEL_FMT, {.str = NULL}, 0, 0, DEC },
10291022 { "framerate", "set video frame rate", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
10301023 { "sample_rate", "set audio sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t