diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-11-28 08:03:23 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-11-28 08:03:23 -0200 |
commit | 05222402b72fa35a14adb35db4e51e55d3b72f2f (patch) | |
tree | ce5a78e12fb23de330787a3d4d440433af1f6f78 /v4l2-apps/util | |
parent | 87fc384f35e1ee563498df696b57b908a215a499 (diff) | |
parent | 080a587ad1c509488047ab48c14f424b3e3c2cd9 (diff) | |
download | mediapointer-dvb-s2-05222402b72fa35a14adb35db4e51e55d3b72f2f.tar.gz mediapointer-dvb-s2-05222402b72fa35a14adb35db4e51e55d3b72f2f.tar.bz2 |
merge: http://linuxtv.org/hg/~mkrufky/lgdt330x
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l2-apps/util')
-rw-r--r-- | v4l2-apps/util/qv4l2/general-tab.cpp | 2 | ||||
-rw-r--r-- | v4l2-apps/util/qv4l2/general-tab.h | 1 | ||||
-rw-r--r-- | v4l2-apps/util/v4l2-ctl.cpp | 71 | ||||
-rwxr-xr-x | v4l2-apps/util/v4l_rec.pl | 74 |
4 files changed, 114 insertions, 34 deletions
diff --git a/v4l2-apps/util/qv4l2/general-tab.cpp b/v4l2-apps/util/qv4l2/general-tab.cpp index a19cf911b..87a0f520d 100644 --- a/v4l2-apps/util/qv4l2/general-tab.cpp +++ b/v4l2-apps/util/qv4l2/general-tab.cpp @@ -295,7 +295,7 @@ void GeneralTab::updateStandard() tvStandard->setCurrentItem(vs.index); what.sprintf("TV Standard (0x%llX)\n" "Frame period: %f (%d/%d)\n" - "Frame lines: %d\n", std, + "Frame lines: %d\n", (long long int)std, (double)vs.frameperiod.numerator / vs.frameperiod.denominator, vs.frameperiod.numerator, vs.frameperiod.denominator, vs.framelines); diff --git a/v4l2-apps/util/qv4l2/general-tab.h b/v4l2-apps/util/qv4l2/general-tab.h index 44003fd40..110632014 100644 --- a/v4l2-apps/util/qv4l2/general-tab.h +++ b/v4l2-apps/util/qv4l2/general-tab.h @@ -21,6 +21,7 @@ #ifndef GENERAL_TAB_H #define GENERAL_TAB_H +#include <sys/time.h> #include <linux/videodev2.h> #include <qgrid.h> diff --git a/v4l2-apps/util/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp index a90dd76eb..7dabb3969 100644 --- a/v4l2-apps/util/v4l2-ctl.cpp +++ b/v4l2-apps/util/v4l2-ctl.cpp @@ -51,10 +51,8 @@ In general the lower case is used to set something and the upper case is used to retrieve a setting. */ enum Option { - OptGetAudioInput = 'A', - OptSetAudioInput = 'a', - OptGetAudioOutput = 'B', - OptSetAudioOutput = 'b', + OptGetSlicedVbiFormat = 'B', + OptSetSlicedVbiFormat = 'b', OptGetCtrl = 'C', OptSetCtrl = 'c', OptSetDevice = 'd', @@ -70,8 +68,6 @@ enum Option { OptListInputs = 'n', OptGetOutput = 'O', OptSetOutput = 'o', - OptListAudioOutputs = 'Q', - OptListAudioInputs = 'q', OptGetStandard = 'S', OptSetStandard = 's', OptGetTuner = 'T', @@ -79,9 +75,7 @@ enum Option { OptGetVideoFormat = 'V', OptSetVideoFormat = 'v', - OptGetSlicedVbiFormat = 128, - OptSetSlicedVbiFormat, - OptGetSlicedVbiOutFormat, + OptGetSlicedVbiOutFormat = 128, OptSetSlicedVbiOutFormat, OptGetOverlayFormat, //OptSetOverlayFormat, TODO @@ -102,6 +96,12 @@ enum Option { OptGetSlicedVbiOutCap, OptGetVideoCrop, OptSetVideoCrop, + OptGetAudioInput, + OptSetAudioInput, + OptGetAudioOutput, + OptSetAudioOutput, + OptListAudioOutputs, + OptListAudioInputs, OptLast = 256 }; @@ -199,15 +199,18 @@ static struct option long_options[] = { static void usage(void) { printf("Usage:\n"); + printf("Common options:\n"); printf(" --all display all information available\n"); - printf(" -A, --get-audio-input\n"); - printf(" query the audio input [VIDIOC_G_AUDIO]\n"); - printf(" -a, --set-audio-input=<num>\n"); - printf(" set the audio input to <num> [VIDIOC_S_AUDIO]\n"); - printf(" -B, --get-audio-output\n"); - printf(" query the audio output [VIDIOC_G_AUDOUT]\n"); - printf(" -b, --set-audio-output=<num>\n"); - printf(" set the audio output to <num> [VIDIOC_S_AUDOUT]\n"); + printf(" -B, --get-fmt-sliced-vbi\n"); + printf(" query the sliced VBI capture format [VIDIOC_G_FMT]\n"); + printf(" -b, --set-fmt-sliced-vbi=<mode>\n"); + printf(" set the sliced VBI capture format to <mode> [VIDIOC_S_FMT]\n"); + printf(" <mode> is a comma separated list of:\n"); + printf(" off: turn off sliced VBI (cannot be combined with other modes)\n"); + printf(" teletext: teletext (PAL/SECAM)\n"); + printf(" cc: closed caption (NTSC)\n"); + printf(" wss: widescreen signal (PAL/SECAM)\n"); + printf(" vps: VPS (PAL/SECAM)\n"); printf(" -C, --get-ctrl=<ctrl>[,<ctrl>...]\n"); printf(" get the value of the controls [VIDIOC_G_EXT_CTRLS]\n"); printf(" -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...]\n"); @@ -252,30 +255,19 @@ static void usage(void) printf(" query the video capture format [VIDIOC_G_FMT]\n"); printf(" -v, --set-fmt-video=width=<x>,height=<y>\n"); printf(" set the video capture format [VIDIOC_S_FMT]\n"); + printf(" --verbose turn on verbose ioctl error reporting.\n"); + printf("\n"); + printf("Uncommon options:\n"); printf(" --get-fmt-video-out\n"); printf(" query the video output format [VIDIOC_G_FMT]\n"); printf(" --set-fmt-video-out=width=<x>,height=<y>\n"); printf(" set the video output format [VIDIOC_S_FMT]\n"); printf(" --get-fmt-overlay\n"); printf(" query the video overlay format [VIDIOC_G_FMT]\n"); - printf(" --get-crop-video\n"); - printf(" query the video capture crop window [VIDIOC_G_CROP]\n"); - printf(" --set-crop-video=top=<x>,left=<y>,width=<w>,height=<h>\n"); - printf(" set the video capture crop window [VIDIOC_S_CROP]\n"); printf(" --get-sliced-vbi-cap\n"); printf(" query the sliced VBI capture capabilities [VIDIOC_G_SLICED_VBI_CAP]\n"); printf(" --get-sliced-vbi-out-cap\n"); printf(" query the sliced VBI output capabilities [VIDIOC_G_SLICED_VBI_CAP]\n"); - printf(" --get-fmt-sliced-vbi\n"); - printf(" query the sliced VBI capture format [VIDIOC_G_FMT]\n"); - printf(" --set-fmt-sliced-vbi=<mode>\n"); - printf(" set the sliced VBI capture format to <mode> [VIDIOC_S_FMT]\n"); - printf(" <mode> is a comma separated list of:\n"); - printf(" off: turn off sliced VBI (cannot be combined with other modes)\n"); - printf(" teletext: teletext (PAL/SECAM)\n"); - printf(" cc: closed caption (NTSC)\n"); - printf(" wss: widescreen signal (PAL/SECAM)\n"); - printf(" vps: VPS (PAL/SECAM)\n"); printf(" --get-fmt-sliced-vbi-out\n"); printf(" query the sliced VBI output format [VIDIOC_G_FMT]\n"); printf(" --set-fmt-sliced-vbi-out=<mode>\n"); @@ -288,7 +280,20 @@ static void usage(void) printf(" vps: VPS (PAL/SECAM)\n"); printf(" --get-fmt-vbi query the VBI capture format [VIDIOC_G_FMT]\n"); printf(" --get-fmt-vbi-out query the VBI output format [VIDIOC_G_FMT]\n"); - printf(" --verbose turn on verbose ioctl error reporting.\n"); + printf(" --get-crop-video\n"); + printf(" query the video capture crop window [VIDIOC_G_CROP]\n"); + printf(" --set-crop-video=top=<x>,left=<y>,width=<w>,height=<h>\n"); + printf(" set the video capture crop window [VIDIOC_S_CROP]\n"); + printf(" --get-audio-input query the audio input [VIDIOC_G_AUDIO]\n"); + printf(" --set-audio-input=<num>\n"); + printf(" set the audio input to <num> [VIDIOC_S_AUDIO]\n"); + printf(" --get-audio-output query the audio output [VIDIOC_G_AUDOUT]\n"); + printf(" --set-audio-output=<num>\n"); + printf(" set the audio output to <num> [VIDIOC_S_AUDOUT]\n"); + printf(" --list-audio-outputs\n"); + printf(" display audio outputs [VIDIOC_ENUMAUDOUT]\n"); + printf(" --list-audio-inputs\n"); + printf(" display audio inputs [VIDIOC_ENUMAUDIO]\n"); printf("\n"); printf("Expert options:\n"); printf(" --streamoff turn the stream off [VIDIOC_STREAMOFF]\n"); @@ -404,7 +409,7 @@ static std::string flags2s(unsigned val, const flag_def *def) static void print_sliced_vbi_cap(struct v4l2_sliced_vbi_cap &cap) { -// printf("\tType : %s\n", buftype2s(vfmt.type).c_str()); + printf("\tType : %s\n", buftype2s(cap.type).c_str()); printf("\tService Set : %s\n", flags2s(cap.service_set, service_def).c_str()); for (int i = 0; i < 24; i++) { diff --git a/v4l2-apps/util/v4l_rec.pl b/v4l2-apps/util/v4l_rec.pl new file mode 100755 index 000000000..b533af097 --- /dev/null +++ b/v4l2-apps/util/v4l_rec.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl +use strict; + +# This is a very simple script to record a v4l program with ffmpeg or mencode +# Currenlty, works only with PAL-M or NTSC with ntsc-cable freqs +# +# mencode is easier due to usage of ALSA + +my $station = shift or die "Usage: $0 <station> [standard] [device]"; +my $dev; +my $std; + +# Parameters with optional values + +$std=shift or $std='PAL-M'; +$dev=shift or $dev="/dev/video1"; + +############################################## +# Those stuff bellow are currently "hardcoded" + +my $acard=0; +my $rec_ctrl="Aux,0"; +my $file="out.mpg"; +my $vbitrate=1500; +my $abitrate=224; + +############################################## +# Those stuff bellow are NTSC / PAL-M specific + +my $list="/usr/share/xawtv/ntsc-cable.list"; +my $fps=30000/1001; +my $width=640; +my $height=480; +############################################## + +my $on=0; +my $freq; + +open IN,$list or die "$list not found"; + +while (<IN>) { + if ($on) { + if (m/freq\s*=\s*(\d+)(\d..)/) { + $freq="$1.$2"; + $on=0; + } + }; + + if (m/[\[]($station)[\]]/) { + $on=1; + } +} + +close IN; + +if ( !$freq ) { + printf "Can't find station $station\n"; + exit; +} + +printf "setting to channel $station, standard $std, freq=$freq on device $dev\n"; +system "v4l2-ctl -d $dev -f $freq -s $std"; + +printf "Programming alsa to capture on $rec_ctrl at hw $acard\n"; +system "amixer -c $acard sset $rec_ctrl 80% unmute cap"; +system "amixer -c $acard sset Capture 15%"; + +printf "recording with ffmpeg on device $dev\n"; + +my $encode="/usr/bin/mencoder -tv driver=v4l2:device=$dev:norm=$std:width=$width:height=$height:input=0:alsa:adevice=hw.".$acard.":amode=1:forceaudio:fps=$fps tv:// -o $file -oac mp3lame -lameopts cbr:br=$abitrate -ovc lavc -lavcopts dia=-2:vcodec=mpeg4:vbitrate=$vbitrate -noodml"; +#my $encode="ffmpeg -ad /dev/dsp".$acard." -vd $dev -tvstd $std -s ".$width."x".$height." -vcodec mpeg2video -f mpeg test.mpg"; + +print "$encode\n"; +exec $encode; |