enable bktr(4) support, and enhance the bktr(4) support by:
- adding support for setting the channel set - making it use audio(4) instead of ossaudio(3) - making it explicitly mute the tuner on exit - use the tuner as default video source, as opposed to RCA ok biorn@, robert@
This commit is contained in:
parent
42f4e69897
commit
cc53e054b2
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.94 2005/10/16 21:29:30 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.95 2006/01/17 07:41:58 jakemsr Exp $
|
||||
|
||||
# May not be hard to add more.
|
||||
ONLY_FOR_ARCHS= amd64 i386 powerpc sparc64 arm
|
||||
@ -7,7 +7,7 @@ COMMENT= "Movie player supporting MPEG, DivX, AVI, ASF, MOV & more"
|
||||
|
||||
DISTNAME= MPlayer-1.0pre7
|
||||
DIST_SUBDIR= mplayer
|
||||
PKGNAME= ${DISTNAME:L}p11
|
||||
PKGNAME= ${DISTNAME:L}p12
|
||||
CATEGORIES= x11
|
||||
EXTRACT_SUFX= .tar.bz2
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
$OpenBSD: patch-configure,v 1.36 2005/11/23 00:05:39 biorn Exp $
|
||||
--- configure.orig Wed Apr 13 13:46:35 2005
|
||||
+++ configure Wed Nov 23 00:41:37 2005
|
||||
$OpenBSD: patch-configure,v 1.37 2006/01/17 07:41:58 jakemsr Exp $
|
||||
--- configure.orig Wed Apr 13 04:46:35 2005
|
||||
+++ configure Sun Dec 25 17:31:12 2005
|
||||
@@ -475,6 +475,9 @@ if test -z "$_target" ; then
|
||||
if [ "`$_cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
|
||||
-z "`echo $CFLAGS | grep -- -m32`" ]; then
|
||||
@ -75,6 +75,15 @@ $OpenBSD: patch-configure,v 1.36 2005/11/23 00:05:39 biorn Exp $
|
||||
fi
|
||||
# internal faad: check if our dear gcc is able to compile it...
|
||||
cp "`pwd`/libfaad2/cfft.c" $TMPC
|
||||
@@ -6115,7 +6128,7 @@ if test "$_tv_bsdbt848" = auto ; then
|
||||
if test "$_tv" = yes ; then
|
||||
cat > $TMPC <<EOF
|
||||
#include <sys/types.h>
|
||||
-#if defined(__NetBSD__)
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <dev/ic/bt8xx.h>
|
||||
#else
|
||||
#include <machine/ioctl_bt848.h>
|
||||
@@ -6775,7 +6788,7 @@ CACA_LIB = $_ld_caca
|
||||
# audio output
|
||||
ALSA_LIB = $_ld_alsa
|
||||
|
@ -1,6 +1,24 @@
|
||||
$OpenBSD: patch-libmpdemux_demuxer_c,v 1.2 2005/09/04 23:51:52 espie Exp $
|
||||
--- libmpdemux/demuxer.c.orig Sat Sep 3 14:28:45 2005
|
||||
+++ libmpdemux/demuxer.c Sat Sep 3 14:40:33 2005
|
||||
$OpenBSD: patch-libmpdemux_demuxer_c,v 1.3 2006/01/17 07:41:58 jakemsr Exp $
|
||||
--- libmpdemux/demuxer.c.orig Sun Apr 3 07:08:26 2005
|
||||
+++ libmpdemux/demuxer.c Sun Dec 25 19:45:16 2005
|
||||
@@ -168,7 +168,7 @@ extern int tv_param_on;
|
||||
|
||||
extern int demux_tv_fill_buffer(demuxer_t *demux, demux_stream_t *ds);
|
||||
extern int demux_open_tv(demuxer_t *demuxer);
|
||||
-#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2))
|
||||
+#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2) || defined(HAVE_TV_BSDBT848))
|
||||
extern void demux_close_tv(demuxer_t *demuxer);
|
||||
#endif
|
||||
#endif
|
||||
@@ -199,7 +199,7 @@ void free_demuxer(demuxer_t *demuxer){
|
||||
demux_close_nuv(demuxer); break;
|
||||
case DEMUXER_TYPE_MPEG_TY:
|
||||
demux_close_ty(demuxer); break;
|
||||
-#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2))
|
||||
+#if defined(USE_TV) && (defined(HAVE_TV_V4L) || defined(HAVE_TV_V4L2) || defined(HAVE_TV_BSDBT848))
|
||||
case DEMUXER_TYPE_TV:
|
||||
demux_close_tv(demuxer); break;
|
||||
#endif
|
||||
@@ -1350,7 +1350,12 @@ switch(file_format){
|
||||
|
||||
case DEMUXER_TYPE_MPEG_TY:
|
||||
|
14
x11/mplayer/patches/patch-libmpdemux_tv_c
Normal file
14
x11/mplayer/patches/patch-libmpdemux_tv_c
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-libmpdemux_tv_c,v 1.1 2006/01/17 07:41:58 jakemsr Exp $
|
||||
--- libmpdemux/tv.c.orig Sat Jan 29 04:24:43 2005
|
||||
+++ libmpdemux/tv.c Sun Dec 25 19:34:31 2005
|
||||
@@ -286,6 +286,10 @@ static int open_tv(tvi_handle_t *tvh)
|
||||
mp_msg(MSGT_TV, MSGL_V, "Selected channel list: %s (including %d channels)\n",
|
||||
chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count);
|
||||
|
||||
+#ifdef HAVE_TV_BSDBT848
|
||||
+ funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_CHANLIST, &tvh->chanlist);
|
||||
+#endif
|
||||
+
|
||||
if (tv_param_freq && tv_param_channel)
|
||||
{
|
||||
mp_msg(MSGT_TV, MSGL_WARN, "You can't set frequency and channel simultaneously!\n");
|
11
x11/mplayer/patches/patch-libmpdemux_tv_h
Normal file
11
x11/mplayer/patches/patch-libmpdemux_tv_h
Normal file
@ -0,0 +1,11 @@
|
||||
$OpenBSD: patch-libmpdemux_tv_h,v 1.1 2006/01/17 07:41:58 jakemsr Exp $
|
||||
--- libmpdemux/tv.h.orig Sat Jan 29 04:24:43 2005
|
||||
+++ libmpdemux/tv.h Sun Dec 25 17:32:08 2005
|
||||
@@ -145,6 +145,7 @@ extern char *tv_channel_last_real;
|
||||
#define TVI_CONTROL_TUN_SET_TUNER 0x204 /* update priv->tuner struct for used input */
|
||||
#define TVI_CONTROL_TUN_GET_NORM 0x205
|
||||
#define TVI_CONTROL_TUN_SET_NORM 0x206
|
||||
+#define TVI_CONTROL_TUN_SET_CHANLIST 0x207
|
||||
|
||||
/* AUDIO controls */
|
||||
#define TVI_CONTROL_AUD_GET_FORMAT 0x301
|
338
x11/mplayer/patches/patch-libmpdemux_tvi_bsdbt848_c
Normal file
338
x11/mplayer/patches/patch-libmpdemux_tvi_bsdbt848_c
Normal file
@ -0,0 +1,338 @@
|
||||
$OpenBSD: patch-libmpdemux_tvi_bsdbt848_c,v 1.1 2006/01/17 07:41:58 jakemsr Exp $
|
||||
--- libmpdemux/tvi_bsdbt848.c.orig Mon Dec 27 09:30:14 2004
|
||||
+++ libmpdemux/tvi_bsdbt848.c Mon Jan 16 21:35:44 2006
|
||||
@@ -40,9 +40,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
-#ifdef __NetBSD__
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <dev/ic/bt8xx.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/ioctl.h>
|
||||
#include <sys/audioio.h>
|
||||
+#include <string.h>
|
||||
#elif __FreeBSD_version >= 502100
|
||||
#include <dev/bktr/ioctl_meteor.h>
|
||||
#include <dev/bktr/ioctl_bt848.h>
|
||||
@@ -51,15 +54,17 @@
|
||||
#include <machine/ioctl_bt848.h>
|
||||
#endif
|
||||
|
||||
+#if !defined(__OpenBSD__)
|
||||
#ifdef HAVE_SYS_SOUNDCARD_H
|
||||
#include <sys/soundcard.h>
|
||||
#else
|
||||
-#ifdef HAVE_SOUNDCARD_H
|
||||
+#if defined(HAVE_SOUNDCARD_H)
|
||||
#include <soundcard.h>
|
||||
#else
|
||||
#include <machine/soundcard.h>
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#include "../libaf/af_format.h"
|
||||
#include "../libvo/img_format.h"
|
||||
@@ -126,7 +131,7 @@ typedef struct {
|
||||
int tunerfd;
|
||||
int tunerready;
|
||||
u_long tunerfreq;
|
||||
- struct bktr_chnlset cset;
|
||||
+ int tunertype;
|
||||
|
||||
/* Other */
|
||||
|
||||
@@ -137,10 +142,35 @@ typedef struct {
|
||||
|
||||
#include "tvi_def.h"
|
||||
|
||||
+static int chnlsets[17] = {
|
||||
+ CHNLSET_NABCST, /* us-bcast */
|
||||
+ CHNLSET_CABLEIRC, /* us-cable */
|
||||
+ CHNLSET_CABLEHRC, /* us-cable-hrc */
|
||||
+ CHNLSET_JPNBCST, /* japan-bcast */
|
||||
+ CHNLSET_JPNCABLE, /* japan-cable */
|
||||
+ CHNLSET_WEUROPE, /* europe-west */
|
||||
+ CHNLSET_XUSSR, /* europe-east ? */
|
||||
+ CHNLSET_WEUROPE, /* italy ? */
|
||||
+ CHNLSET_AUSTRALIA, /* newzealand ? */
|
||||
+ CHNLSET_AUSTRALIA, /* australia */
|
||||
+ CHNLSET_WEUROPE, /* ireland ? */
|
||||
+ CHNLSET_FRANCE, /* france */
|
||||
+ CHNLSET_XUSSR, /* china-bcast ? */
|
||||
+ CHNLSET_WEUROPE, /* southafrica ? */
|
||||
+ CHNLSET_WEUROPE, /* argentina ? */
|
||||
+ CHNLSET_XUSSR, /* russia */
|
||||
+ NULL, /* NULL */
|
||||
+};
|
||||
+
|
||||
+static int sources[6] = { METEOR_INPUT_DEV1, METEOR_INPUT_DEV0, METEOR_INPUT_DEV2,
|
||||
+ METEOR_INPUT_DEV3, METEOR_INPUT_DEV_RGB, METEOR_INPUT_DEV_SVIDEO };
|
||||
+
|
||||
static priv_t *G_private=NULL;
|
||||
|
||||
static int getinput(int innumber);
|
||||
|
||||
+static int getsource(int insrc);
|
||||
+
|
||||
static void processframe(int signal)
|
||||
{
|
||||
struct timeval curtime;
|
||||
@@ -209,6 +239,19 @@ static int control(priv_t *priv, int cmd
|
||||
return(TVI_CONTROL_TRUE);
|
||||
}
|
||||
|
||||
+ case TVI_CONTROL_TUN_SET_CHANLIST:
|
||||
+ {
|
||||
+ priv->tunertype = chnlsets[(int)*(void **)arg];
|
||||
+
|
||||
+ if(ioctl(priv->tunerfd, TVTUNER_SETTYPE, &priv->tunertype) < 0)
|
||||
+ {
|
||||
+ perror("SETTYPE:ioctl");
|
||||
+ return(0);
|
||||
+ }
|
||||
+
|
||||
+ return(TVI_CONTROL_TRUE);
|
||||
+ }
|
||||
+
|
||||
case TVI_CONTROL_TUN_GET_TUNER:
|
||||
case TVI_CONTROL_TUN_SET_TUNER:
|
||||
|
||||
@@ -216,23 +259,25 @@ static int control(priv_t *priv, int cmd
|
||||
|
||||
case TVI_CONTROL_SPC_GET_INPUT:
|
||||
{
|
||||
- if(ioctl(priv->btfd, METEORGINPUT, &priv->input) < 0)
|
||||
+ if(ioctl(priv->btfd, METEORGINPUT, &priv->source) < 0)
|
||||
{
|
||||
perror("GINPUT:ioctl");
|
||||
return(TVI_CONTROL_FALSE);
|
||||
}
|
||||
|
||||
+ priv->input = getsource(priv->source);
|
||||
+
|
||||
(int)*(void **)arg = priv->input;
|
||||
return(TVI_CONTROL_TRUE);
|
||||
}
|
||||
|
||||
case TVI_CONTROL_SPC_SET_INPUT:
|
||||
{
|
||||
- priv->input = getinput((int)*(void **)arg);
|
||||
+ priv->source = getinput((int)*(void **)arg);
|
||||
|
||||
- if(ioctl(priv->btfd, METEORSINPUT, &priv->input) < 0)
|
||||
+ if(ioctl(priv->btfd, METEORSINPUT, &priv->source) < 0)
|
||||
{
|
||||
- perror("tunerfreq:ioctl");
|
||||
+ perror("SINPUT:ioctl");
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -259,7 +304,14 @@ static int control(priv_t *priv, int cmd
|
||||
{
|
||||
int dspspeed = (int)*(void **)arg;
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+ audio_info_t audio_if;
|
||||
+ AUDIO_INITINFO(&audio_if);
|
||||
+ audio_if.record.sample_rate = dspspeed;
|
||||
+ if (ioctl(priv->dspfd, AUDIO_SETINFO, &audio_if) == -1)
|
||||
+#else
|
||||
if(ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &dspspeed) == -1)
|
||||
+#endif
|
||||
{
|
||||
perror("invalidaudiorate");
|
||||
return(TVI_CONTROL_FALSE);
|
||||
@@ -470,6 +522,10 @@ static int init(priv_t *priv)
|
||||
int marg;
|
||||
int count;
|
||||
u_short tmp_fps;
|
||||
+int tuner_audio;
|
||||
+#if defined(__OpenBSD__)
|
||||
+audio_info_t audio_if;
|
||||
+#endif
|
||||
|
||||
G_private = priv; /* Oooh, sick */
|
||||
|
||||
@@ -482,7 +538,7 @@ priv->iformat = METEOR_FMT_PAL;
|
||||
priv->maxheight = PAL_HEIGHT;
|
||||
priv->maxwidth = PAL_WIDTH;
|
||||
priv->maxfps = PAL_FPS;
|
||||
-priv->source = METEOR_INPUT_DEV0;
|
||||
+priv->source = METEOR_INPUT_DEV1;
|
||||
priv->fps = priv->maxfps;
|
||||
|
||||
priv->starttime=0;
|
||||
@@ -569,10 +625,26 @@ if(priv->tunerfd < 0)
|
||||
priv->tunerready = FALSE;
|
||||
}
|
||||
|
||||
+if(ioctl(priv->tunerfd, BT848_GAUDIO, &tuner_audio) < 0)
|
||||
+ {
|
||||
+ perror("tuner get audio");
|
||||
+ priv->tunerready = FALSE;
|
||||
+ }
|
||||
+if(tuner_audio & AUDIO_MUTE)
|
||||
+ {
|
||||
+ tuner_audio = AUDIO_UNMUTE;
|
||||
+ if(ioctl(priv->tunerfd, BT848_SAUDIO, &tuner_audio) < 0)
|
||||
+ {
|
||||
+ perror("tuner unmute");
|
||||
+ priv->tunerready = FALSE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
/* Audio Configuration */
|
||||
|
||||
priv->dspready = TRUE;
|
||||
-#ifdef __NetBSD__
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
priv->dspdev = strdup("/dev/sound");
|
||||
#else
|
||||
priv->dspdev = strdup("/dev/dsp");
|
||||
@@ -580,7 +652,11 @@ priv->dspdev = strdup("/dev/dsp");
|
||||
priv->dspsamplesize = 16;
|
||||
priv->dspstereo = 1;
|
||||
priv->dspspeed = 44100;
|
||||
+#if defined (__OpenBSD__)
|
||||
+priv->dspfmt = AUDIO_ENCODING_SLINEAR_LE;
|
||||
+#else
|
||||
priv->dspfmt = AFMT_S16_LE;
|
||||
+#endif
|
||||
priv->dspbytesread = 0;
|
||||
priv->dsprate = priv->dspspeed * priv->dspsamplesize/8*(priv->dspstereo+1);
|
||||
priv->dspframesize = priv->dspspeed*priv->dspsamplesize/8/priv->fps *
|
||||
@@ -594,6 +670,34 @@ if((priv->dspfd = open (priv->dspdev, O_
|
||||
|
||||
marg = (256 << 16) | 12;
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+
|
||||
+ AUDIO_INITINFO(&audio_if);
|
||||
+
|
||||
+ // audio_if.blocksize = 4096;
|
||||
+ // audio_if.hiwat = 256;
|
||||
+
|
||||
+ audio_if.record.precision = priv->dspsamplesize;
|
||||
+ audio_if.record.channels = priv->dspstereo+1;
|
||||
+ audio_if.record.sample_rate = priv->dspspeed;
|
||||
+ audio_if.record.encoding = priv->dspfmt;
|
||||
+
|
||||
+ audio_if.mode = AUMODE_RECORD;
|
||||
+
|
||||
+ audio_if.play.open = 0;
|
||||
+ audio_if.play.pause = 1;
|
||||
+ audio_if.record.open = 1;
|
||||
+ audio_if.record.pause = 0;
|
||||
+
|
||||
+ if (ioctl(priv->dspfd, AUDIO_SETINFO, &audio_if) < 0)
|
||||
+ {
|
||||
+ perror ("AUDIO_SETINFO:ioctl");
|
||||
+ close(priv->dspfd);
|
||||
+ priv->dspready = FALSE;
|
||||
+ }
|
||||
+
|
||||
+#else
|
||||
+
|
||||
if (ioctl(priv->dspfd, SNDCTL_DSP_SETFRAGMENT, &marg ) < 0 )
|
||||
{
|
||||
perror("setfrag");
|
||||
@@ -611,6 +715,8 @@ if((priv->dspready == TRUE) &&
|
||||
priv->dspready = FALSE;
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -655,6 +761,7 @@ return(1);
|
||||
static int uninit(priv_t *priv)
|
||||
{
|
||||
int marg;
|
||||
+int tuner_audio;
|
||||
|
||||
if(priv->videoready == FALSE) return(0);
|
||||
|
||||
@@ -677,6 +784,15 @@ if(ioctl(priv->btfd, METEORCAPTUR, &marg
|
||||
close(priv->btfd);
|
||||
close(priv->dspfd);
|
||||
|
||||
+ tuner_audio = AUDIO_MUTE;
|
||||
+ if(ioctl(priv->tunerfd, BT848_SAUDIO, &tuner_audio) < 0)
|
||||
+ {
|
||||
+ perror("tuner mute");
|
||||
+ priv->tunerready = FALSE;
|
||||
+ }
|
||||
+
|
||||
+close(priv->tunerfd);
|
||||
+
|
||||
priv->dspfd = -1;
|
||||
priv->btfd = -1;
|
||||
|
||||
@@ -799,20 +915,20 @@ return(priv->dspbytesread * 1.0 / priv->
|
||||
static int get_audio_framesize(priv_t *priv)
|
||||
{
|
||||
int bytesavail;
|
||||
-#ifdef __NetBSD__
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
struct audio_info auinf;
|
||||
#endif
|
||||
|
||||
if(priv->dspready == FALSE) return 0;
|
||||
|
||||
-#ifdef __NetBSD__
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if(ioctl(priv->dspfd, AUDIO_GETINFO, &auinf) < 0)
|
||||
{
|
||||
perror("AUDIO_GETINFO");
|
||||
return(TVI_CONTROL_FALSE);
|
||||
}
|
||||
else
|
||||
- bytesavail = auinf.record.seek; /* *priv->dspsamplesize; */
|
||||
+ bytesavail = auinf.record.seek; /* * priv->dspsamplesize/8 * (priv->dspstereo+1); */
|
||||
#else
|
||||
if(ioctl(priv->dspfd, FIONREAD, &bytesavail) < 0)
|
||||
{
|
||||
@@ -824,24 +940,29 @@ if(ioctl(priv->dspfd, FIONREAD, &bytesav
|
||||
/* When mencoder wants audio data, it wants data..
|
||||
it won't go do anything else until it gets it :( */
|
||||
|
||||
-if(bytesavail == 0) return FRAGSIZE;
|
||||
+ // if(bytesavail == 0) return FRAGSIZE;
|
||||
|
||||
return(bytesavail);
|
||||
}
|
||||
|
||||
static int getinput(int innumber)
|
||||
{
|
||||
-switch(innumber)
|
||||
- {
|
||||
- case 0: return METEOR_INPUT_DEV0; /* RCA */
|
||||
- case 1: return METEOR_INPUT_DEV1; /* Tuner */
|
||||
- case 2: return METEOR_INPUT_DEV2; /* In 1 */
|
||||
- case 3: return METEOR_INPUT_DEV3; /* In 2 */
|
||||
- case 4: return METEOR_INPUT_DEV_RGB; /* RGB */
|
||||
- case 5: return METEOR_INPUT_DEV_SVIDEO; /* SVid */
|
||||
- }
|
||||
|
||||
+if (sources[innumber])
|
||||
+ return sources[innumber];
|
||||
+
|
||||
return 0;
|
||||
+}
|
||||
+
|
||||
+static int getsource(int insrc)
|
||||
+{
|
||||
+int i;
|
||||
+
|
||||
+ for (i = 0; sources[i]; i++)
|
||||
+ if (sources[i] == insrc)
|
||||
+ return i;
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
#endif /* USE_TV */
|
Loading…
Reference in New Issue
Block a user