From 7e38b1aefb5997932c1012a3ed8487a64800ffad Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 7 Aug 2003 12:24:35 +0000 Subject: v4l2 support git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10538 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/Makefile | 2 +- libmpdemux/ai_alsa.c | 2 +- libmpdemux/ai_alsa1x.c | 2 +- libmpdemux/ai_oss.c | 2 +- libmpdemux/audio_in.c | 2 +- libmpdemux/tv.c | 25 +++++++++++++++++++++++-- libmpdemux/tv.h | 5 ++++- 7 files changed, 32 insertions(+), 8 deletions(-) (limited to 'libmpdemux') diff --git a/libmpdemux/Makefile b/libmpdemux/Makefile index 555cde8d53..06074416d1 100644 --- a/libmpdemux/Makefile +++ b/libmpdemux/Makefile @@ -3,7 +3,7 @@ LIBNAME = libmpdemux.a include ../config.mak -SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c +SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c ifeq ($(XMMS_PLUGINS),yes) SRCS += demux_xmms.c endif diff --git a/libmpdemux/ai_alsa.c b/libmpdemux/ai_alsa.c index 45abb14bc9..715c99a82e 100644 --- a/libmpdemux/ai_alsa.c +++ b/libmpdemux/ai_alsa.c @@ -4,7 +4,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) && defined(HAVE_ALSA9) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(HAVE_ALSA9) #include #include "audio_in.h" diff --git a/libmpdemux/ai_alsa1x.c b/libmpdemux/ai_alsa1x.c index 45abb14bc9..715c99a82e 100644 --- a/libmpdemux/ai_alsa1x.c +++ b/libmpdemux/ai_alsa1x.c @@ -4,7 +4,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) && defined(HAVE_ALSA9) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(HAVE_ALSA9) #include #include "audio_in.h" diff --git a/libmpdemux/ai_oss.c b/libmpdemux/ai_oss.c index 372005f66d..fb9402c28b 100644 --- a/libmpdemux/ai_oss.c +++ b/libmpdemux/ai_oss.c @@ -3,7 +3,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) && defined(USE_OSS_AUDIO) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) && defined(USE_OSS_AUDIO) #include /* strerror */ #include diff --git a/libmpdemux/audio_in.c b/libmpdemux/audio_in.c index 54ba446dfc..4c35df97d0 100644 --- a/libmpdemux/audio_in.c +++ b/libmpdemux/audio_in.c @@ -4,7 +4,7 @@ #include "config.h" -#if defined(USE_TV) && defined(HAVE_TV_V4L) +#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2)) #include "audio_in.h" #include "mp_msg.h" diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c index f212252581..b4d78e48cd 100644 --- a/libmpdemux/tv.c +++ b/libmpdemux/tv.c @@ -45,6 +45,9 @@ int tv_param_immediate = 0; char *tv_param_freq = NULL; char *tv_param_channel = NULL; char *tv_param_norm = "pal"; +#ifdef HAVE_TV_V4L2 +int tv_param_normid = -1; +#endif char *tv_param_chanlist = "europe-east"; char *tv_param_device = NULL; char *tv_param_driver = "dummy"; @@ -54,7 +57,7 @@ int tv_param_input = 0; /* used in v4l and bttv */ char *tv_param_outfmt = "yv12"; float tv_param_fps = -1.0; char **tv_param_channels = NULL; -#ifdef HAVE_TV_V4L +#if defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2) int tv_param_amode = -1; int tv_param_audio_id = 0; int tv_param_volume = 60000; @@ -179,6 +182,9 @@ static int open_tv(tvi_handle_t *tvh) /* set some params got from cmdline */ funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); +#ifdef HAVE_TV_V4L2 + if (strcmp(tv_param_driver, "v4l2") != 0) { +#endif /* select video norm */ tvh->norm = norm_from_string(tv_param_norm); @@ -187,7 +193,17 @@ static int open_tv(tvi_handle_t *tvh) mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n"); return 0; } - +#ifdef HAVE_TV_V4L2 + } else { + if (tv_param_normid >= 0) { + mp_msg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", tv_param_normid); + if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tv_param_normid) != TVI_CONTROL_TRUE) { + mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n"); + return 0; + } + } + } +#endif #ifdef HAVE_TV_V4L if ( tv_param_mjpeg ) @@ -582,6 +598,7 @@ int demux_close_tv(demuxer_t *demuxer) /* ================== STREAM_TV ===================== */ tvi_handle_t *tvi_init_dummy(char *device); tvi_handle_t *tvi_init_v4l(char *device, char *adevice); +tvi_handle_t *tvi_init_v4l2(char *device, char *adevice); tvi_handle_t *tvi_init_bsdbt848(char *device); tvi_handle_t *tv_begin(void) @@ -592,6 +609,10 @@ tvi_handle_t *tv_begin(void) if (!strcmp(tv_param_driver, "v4l")) return tvi_init_v4l(tv_param_device, tv_param_adevice); #endif +#ifdef HAVE_TV_V4L2 + if (!strcmp(tv_param_driver, "v4l2")) + return tvi_init_v4l2(tv_param_device, tv_param_adevice); +#endif #ifdef HAVE_TV_BSDBT848 if (!strcmp(tv_param_driver, "bsdbt848")) return tvi_init_bsdbt848(tv_param_device); diff --git a/libmpdemux/tv.h b/libmpdemux/tv.h index fcacf3adb3..a6627c0d9c 100644 --- a/libmpdemux/tv.h +++ b/libmpdemux/tv.h @@ -13,6 +13,9 @@ extern char *tv_param_freq; extern char *tv_param_channel; extern char *tv_param_chanlist; extern char *tv_param_norm; +#ifdef HAVE_TV_V4L2 +extern int tv_param_normid; +#endif extern char *tv_param_device; extern char *tv_param_driver; extern int tv_param_width; @@ -24,7 +27,7 @@ extern char **tv_param_channels; extern int tv_param_noaudio; extern int tv_param_immediate; extern int tv_param_audiorate; -#ifdef HAVE_TV_V4L +#if defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2) extern int tv_param_amode; extern int tv_param_audio_id; extern int tv_param_volume; -- cgit v1.2.3