diff --git a/ffmpeg.c b/ffmpeg.c index 2a7038ba3fe544fa385d1a55ee10a22aae74d9b9..40d7cc80fa5fe27eb09e1245ecfefb8f37602ad6 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -160,6 +160,7 @@ static int video_stream_copy = 0; static char *video_grab_format = "video4linux"; static char *video_device = NULL; +static int video_channel = 0; static char *audio_grab_format = "audio_device"; static char *audio_device = NULL; @@ -1872,6 +1873,11 @@ void opt_video_device(const char *arg) video_device = strdup(arg); } +void opt_video_channel(const char *arg) +{ + video_channel = strtol(arg, NULL, 0); +} + void opt_audio_device(const char *arg) { audio_device = strdup(arg); @@ -2463,8 +2469,8 @@ void prepare_grab(void) if (has_video) { AVInputFormat *fmt1; fmt1 = av_find_input_format(video_grab_format); - vp->device = video_device; - /* XXX: set DV video channel ? */ + vp->device = video_device; + vp->channel = video_channel; if (av_open_input_file(&ic, "", fmt1, 0, vp) < 0) { fprintf(stderr, "Could not find video grab device\n"); exit(1); @@ -2723,6 +2729,7 @@ const OptionDef options[] = { { "minrate", HAS_ARG, {(void*)opt_video_bitrate_min}, "set min video bitrate tolerance (in kbit/s)", "bitrate" }, { "bufsize", HAS_ARG, {(void*)opt_video_buffer_size}, "set ratecontrol buffere size (in kbit)", "size" }, { "vd", HAS_ARG | OPT_EXPERT, {(void*)opt_video_device}, "set video grab device", "device" }, + { "vc", HAS_ARG | OPT_EXPERT, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" }, { "dv1394", OPT_EXPERT, {(void*)opt_dv1394}, "set DV1394 grab", "" }, { "vcodec", HAS_ARG | OPT_EXPERT, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" }, { "me", HAS_ARG | OPT_EXPERT, {(void*)opt_motion_estimation}, "set motion estimation method", diff --git a/libavformat/dv1394.c b/libavformat/dv1394.c index f0b5e8d5ee68544db0ecf0c42742c8998501a18f..2c708270077227cc8857a4b5c87c8590041245ee 100644 --- a/libavformat/dv1394.c +++ b/libavformat/dv1394.c @@ -84,7 +84,11 @@ static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap dv->width = DV1394_WIDTH; dv->height = DV1394_HEIGHT; - dv->channel = ap->channel; + + if (ap->channel) + dv->channel = ap->channel; + else + dv->channel = DV1394_DEFAULT_CHANNEL; dv->frame_rate = 30;