changeset 159:7d698c3213a0 libavformat

tv standard selection support for dv1394 and grab (v4l)
author al3x
date Wed, 25 Jun 2003 10:21:45 +0000
parents 700b69d00b27
children 9bde37b1a5ce
files avformat.h dv1394.c grab.c
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/avformat.h	Fri Jun 20 18:21:58 2003 +0000
+++ b/avformat.h	Wed Jun 25 10:21:45 2003 +0000
@@ -86,6 +86,7 @@
     struct AVImageFormat *image_format;
     int channel; /* used to select dv channel */
     const char *device; /* video4linux, audio or DV device */
+    const char *standard; /* tv standard, NTSC, PAL, SECAM */
 } AVFormatParameters;
 
 #define AVFMT_NOFILE        0x0001 /* no file should be opened */
--- a/dv1394.c	Fri Jun 20 18:21:58 2003 +0000
+++ b/dv1394.c	Wed Jun 25 10:21:45 2003 +0000
@@ -91,8 +91,10 @@
         return -ENOMEM;
     }
 
-    /* FIXME: Need a format change parameter */
-    dv->format = DV1394_NTSC;
+    if (ap->standard && !strcasecmp(ap->standard, "pal"))
+	dv->format = DV1394_PAL;
+    else
+	dv->format = DV1394_NTSC;
 
     if (ap->channel)
         dv->channel = ap->channel;
--- a/grab.c	Fri Jun 20 18:21:58 2003 +0000
+++ b/grab.c	Wed Jun 25 10:21:45 2003 +0000
@@ -62,6 +62,7 @@
     int video_fd, frame_size;
     int ret, frame_rate, frame_rate_base;
     int desired_palette;
+    struct video_tuner tuner;
     struct video_audio audio;
     const char *video_device;
 
@@ -109,6 +110,17 @@
     } else if (st->codec.pix_fmt == PIX_FMT_BGR24) {
         desired_palette = VIDEO_PALETTE_RGB24;
     }    
+
+    /* set tv standard */
+    if (ap->standard && !ioctl(video_fd, VIDIOCGTUNER, &tuner)) {
+	if (!strcasecmp(ap->standard, "pal"))
+	    tuner.mode = VIDEO_MODE_PAL;
+	else if (!strcasecmp(ap->standard, "secam"))
+	    tuner.mode = VIDEO_MODE_SECAM;
+	else
+	    tuner.mode = VIDEO_MODE_NTSC;
+	ioctl(video_fd, VIDIOCSTUNER, &tuner);
+    }
     
     /* unmute audio */
     audio.audio = 0;