Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Feb 2005 11:53:42 +0100
From:      =?ISO-8859-1?Q?Lluis_L=F3pez?= <cronopiolopez@gmail.com>
To:        freebsd-multimedia@freebsd.org, Edwin Groothuis <edwin@mavetju.org>, John Wehle <john@feith.com>
Subject:   Re: Patch for pvr250/350 (switch between profiles)
Message-ID:  <8f8eb53e0502140253238cd7f6@mail.gmail.com>
In-Reply-To: <8f8eb53e050213185450daa380@mail.gmail.com>
References:  <8f8eb53e050213185450daa380@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
I see that in my last mail some long lines in enclosed files are
cutted. This produce fails in patching. I attached the same files in
this mail. If somebody have any  patch problem (and is interesed) i
send this files in person.
The instructions are de same (see bellow) that the last mail but files
aren't enclosed, are attached (patch_cxm_c,
patch_modules_cxm_cxm_Makefile, ioctl_meteor_compat.c and
pvr250-setprofile.c).
NOTE: If make clean fails rm -rf work/ and starts again.

Regards, Luis López Solé.

On Mon, 14 Feb 2005 03:54:51 +0100, Lluis López <cronopiolopez@gmail.com> wrote:
> Sorry for duplicate (no subject in last mail).
> The application setsize allows switch between 3 profiles (determined
> for format size). Next patch allows switch between 8 profiles using
> hardware ioctl's.
> 
> NOTE: Values for profiles are select for me,  I'm not an expert, if
> somebody have more knowledge (or datasheet of chip) change source it's
> easy (feeback is always welcome and copy of datasheet too). For
> exemple the TS profile don't playback well, some losses in audio and
> video (grab work without aparent problem), but i suposse it's very
> useful for streaming machines. Other example is MPEG1 profile: don't
> playback well, his values are selected for works with dvdauthor (only
> accept 48 Khz audio streams), economize time in work encoding process.
> Or MPEG2 profile select for best quality without losses with mplayer
> playback (with -cache 8192, of course).
> 
> For apply this patch follow next steps:
> 1.-
> #cd /usr/ports/multimedia/pvr250/ && make clean && make extract
> 2.-
> Copy the enclosed files (see bellow)  pvr250-setprofile, patch_cxm_c
> and  patch_modules_cxm_cxm_Makefile in work/ and ioctl_meteor_compat.h
> in work/dev/cxm/
> 3.-
> Apply the patches:
> #patch < work/patch_cxm_c && patch <work/patch_modules_cxm_cxm_Makefile
> 4.-
> Compile with:
> #make
> 
> copy:
> #cp work/modules/cxm/*/*.ko /boot/kernel/
> 
> and unload modules & load new modules:
> # kldunload cxm
> # kldunload cxm_iic
> # kldload cxm_iic
> # kldload cxm
> NOTE: Select a channel the application pvr250-setprofile allows change
> profile in cold or wih channel running, but don't initialize the
> device.
> 5.-
> compille pvr250-setprofile:
> #cc -o /usr/local/bin/pvr250-setprofile work/pvr250-setprofile.c
> 6.-
> Enjoy.
> Regards, Luis López Solé.
> 
> LAST NOTE: Only tested in RELEGN_5 (compiled last weekend).

[-- Attachment #2 --]
--- work/dev/cxm/cxm.c.ORIGINAL	Wed Feb  9 03:37:21 2005
+++ work/dev/cxm/cxm.c	Mon Feb 14 00:55:06 2005
@@ -69,6 +69,7 @@
 #  include <dev/bktr/ioctl_bt848.h>
 #endif
 
+
 #include <sys/bus.h>
 #include <sys/rman.h>
 
@@ -81,7 +82,7 @@
 #endif
 
 #include <dev/cxm/cxm.h>
-
+#include <dev/cxm/ioctl_meteor_compat.h>
 
 /*
  * Various supported device vendors/types and their names.
@@ -292,6 +293,240 @@
 	0xe9
 };
 
+static struct cxm_codec_profile mpeg2_ntsc_profile = {
+	"MPEG-2 NTSC video and MPEG audio",
+	CXM_FW_STREAM_TYPE_MPEG2_PROGRAM,
+	30,
+	720, 480, 480,
+	{ 10, 12, 21 },
+	2,
+	0,
+	/*
+	 * 8 Mb/s (size of BLOCKDEVICE)the best quality for realtime playback
+	 * without losses and default cache size for mplayer and xine. 
+	 */
+	{ 0, 8000000, 8192000 },
+	{ 1, 15, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 384 kb/s */
+	0xe9
+};
+
+static struct cxm_codec_profile mpeg2_pal_profile = {
+	"MPEG-2 PAL video and MPEG audio",
+	CXM_FW_STREAM_TYPE_MPEG2_PROGRAM,
+	25,
+	720, 576, 576,
+	{ 6, 17, 22 },
+	2,
+	0,
+	/*
+	 * 8 Mb/s (size of BLOCKDEVICE)the best quality for realtime playback
+	 * without losses and default cache size for mplayer and xine. 
+	 */
+	{ 0, 8000000, 8192000 },
+	{ 1, 12, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 384 kb/s */
+	0xe9
+};
+
+static struct cxm_codec_profile mpeg1_ntsc_profile = {
+	"MPEG-1 NTSC video and MPEG audio",
+	CXM_FW_STREAM_TYPE_MPEG1,
+	30,
+	352, 240, 480,
+	{ 10, 12, 21 },
+	12,
+	0,
+	/* For store 6 h in DVD5 and 12 h in DVD9 -Ideal for series-*/
+	{ 1, 2048000, 0 },
+	{ 1, 15, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/*
+	 * 48 Khz, (with 44.1 Khz dvdauthor reports WARNINGS and sync problems) 
+	 * MPEG-1 Layer II, 224 kb/s PROBLEMS: don't works in realtime playback,
+	 * but is the only profile that works for store MPEG1 streams in DVD.	
+	 */
+	0xb9
+};
+
+static struct cxm_codec_profile mpeg1_pal_profile = {
+	"MPEG-1 PAL video and MPEG audio",
+	CXM_FW_STREAM_TYPE_MPEG1,
+	25,
+	352, 288, 576,
+	{ 6, 17, 22 },
+	8,
+	0,
+	/* For store 6 h in DVD5 and 12 h in DVD9 -Ideal for series-*/
+	{ 1, 2048000, 0 },
+	{ 1, 12, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/*
+	 * 48 Khz, (with 44.1 Khz dvdauthor reports WARNINGS and sync problems) 
+	 * MPEG-1 Layer II, 224 kb/s PROBLEMS: don't works in realtime playback,
+	 * but is the only profile that works for store MPEG1 streams in DVD.	
+	 */
+	0xb9
+};
+
+static struct cxm_codec_profile dvd_s1_ntsc_profile = {
+	"MPEG-2 DVD_S1 NTSC video and MPEG audio",
+	CXM_FW_STREAM_TYPE_DVD_S1,
+	30,
+	720, 480, 480,
+	{ 10, 12, 21 },
+	2,
+	0,
+	/* 4 Mb/s ~2Gb/h - Ideal for DVD5 -140 min. aprox. -*/
+	{ 0, 4000000, 4096000 },
+	{ 1, 15, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 384 kb/s */
+	0xe9
+};
+
+static struct cxm_codec_profile dvd_s1_pal_profile = {
+	"MPEG-2 DVD PAL video and MPEG audio",
+	CXM_FW_STREAM_TYPE_DVD_S1,
+	25,
+	720, 576, 576,
+	{ 6, 17, 22 },
+	2,
+	0,
+	/* 4 Mb/s ~2Gb/h - Ideal for DVD5 -140 min. aprox. -*/
+	{ 0, 4000000, 4096000 },
+	{ 1, 12, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 384 kb/s */
+	0xe9
+};
+
+static struct cxm_codec_profile dvd_s2_ntsc_profile = {
+	"MPEG-2 DVD_S2 NTSC video and MPEG audio",
+	CXM_FW_STREAM_TYPE_DVD_S2,
+	30,
+	720, 480, 480,
+	{ 10, 12, 21 },
+	2,
+	0,
+	/*
+     * 2 Mb/s peak ~1Gb/h For store 6 h in DVD5 and 12 h in DVD9 -Ideal for series-
+	 */
+	{ 0, 2000000, 2048000 },
+	{ 1, 15, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 224 kb/s */
+	0xb9
+};
+
+static struct cxm_codec_profile dvd_s2_pal_profile = {
+	"MPEG-2 DVD PAL video and MPEG audio",
+	CXM_FW_STREAM_TYPE_DVD_S2,
+	25,
+	720, 576, 576,
+	{ 6, 17, 22 },
+	2,
+	0,
+	/*
+     * 2 Mb/s peak ~1Gb/h For store 6 h in DVD5 and 12 h in DVD9 -Ideal for series-
+	 */
+	{ 0, 2000000, 2048000 },
+	{ 1, 12, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 224 kb/s */
+	0xb9
+};
+
+static struct cxm_codec_profile mpeg2_ts_ntsc_profile = {
+	"MPEG-2 NTSC video and MPEG audio",
+	CXM_FW_STREAM_TYPE_MPEG2_TS,
+	30,
+	720, 480, 480,
+	{ 10, 12, 21 },
+	2,
+	0,
+	/*
+	 * Unknow good values. I don't have the datasheet.
+	 * ONLY FOR TEST. 
+	 */
+	{ 0, 6000000, 6144000 },
+	{ 1, 15, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 384 kb/s */
+	0xe9
+};
+
+static struct cxm_codec_profile mpeg2_ts_pal_profile = {
+	"MPEG-2 PAL video and MPEG audio",
+	CXM_FW_STREAM_TYPE_MPEG2_TS,
+	25,
+	720, 576, 576,
+	{ 6, 17, 22 },
+	2,
+	0,
+	/*
+	 * Unknow good values. I don't have the datasheet.
+	 * ONLY FOR TEST. 
+	 */
+	{ 0, 6000000, 6144000 },
+	{ 1, 12, 3},
+	/*
+	 * Spatial filter = Manual, Temporal filter = Manual
+	 * Median filter = Horizontal / Vertical
+	 * Spatial filter value = 1, Temporal filter value = 4
+	 */
+	{ 0, 3, 1, 4 },
+	/* 48 Khz, MPEG-1 Layer II, 384 kb/s */
+	0xe9
+};
+
 static const struct cxm_codec_profile
 *codec_profiles[] = {
 	&vcd_ntsc_profile,
@@ -299,7 +534,17 @@
 	&svcd_ntsc_profile,
 	&svcd_pal_profile,
 	&dvd_ntsc_profile,
-	&dvd_pal_profile
+	&dvd_pal_profile,
+	&mpeg2_ntsc_profile,
+	&mpeg2_pal_profile,
+	&mpeg1_ntsc_profile,
+	&mpeg1_pal_profile,
+	&dvd_s1_ntsc_profile,
+	&dvd_s1_pal_profile,
+	&dvd_s2_ntsc_profile,
+	&dvd_s2_pal_profile,
+	&mpeg2_ts_ntsc_profile,
+	&mpeg2_ts_pal_profile
 };
 
 
@@ -801,7 +1046,8 @@
 
 		for (i = 0; i < NUM_ELEMENTS(codec_profiles); i++)
 			if (codec_profiles[i]->fps == fps
-			    && codec_profiles[i]->width == sc->profile->width)
+			    && codec_profiles[i]->width == sc->profile->width
+				&& codec_profiles[i]->stream_type == sc->profile->stream_type)
 				break;
 
 		if (i >= NUM_ELEMENTS(codec_profiles))
@@ -2278,6 +2524,7 @@
 	enum cxm_source	source;
 	struct bktr_capture_area *cap;
 	struct bktr_remote *remote;
+	struct meteor_geomet *my_oformat;
 	intrmask_t	s;
 
 	unit = UNIT( minor(dev) );
@@ -2848,6 +3095,42 @@
 		remote = (struct bktr_remote *)arg;
 		if (cxm_ir_key(sc, (char *)remote, sizeof(*remote)) < 0)
 			return ENXIO;
+		break;
+		
+
+/* My ioctl's for switch between profiles*/		
+	case METEORGETGEO:
+		my_oformat = (struct meteor_geomet *)arg;
+		memset (my_oformat, 0, sizeof (*my_oformat));
+		my_oformat->rows = 0;
+		my_oformat->columns = 0;
+		my_oformat->frames = 0;
+		my_oformat->oformat = sc->profile->stream_type;
+		break;
+		
+	case METEORSETGEO:
+		if (sc->encoding)
+			return EBUSY;
+
+		
+		my_oformat = (struct meteor_geomet *)arg;
+				if (my_oformat->rows || my_oformat->columns
+		    || my_oformat->frames)
+			return EINVAL;
+
+		/*
+		 * Setting the  stream type has the side effect of
+		 * chosing between the VCD, SVCD, and DVD profiles.
+		 */
+
+		for (i = 0; i < NUM_ELEMENTS(codec_profiles); i++)
+			if (codec_profiles[i]->stream_type == my_oformat->oformat)
+				break;
+
+		if (i >= NUM_ELEMENTS(codec_profiles))
+			return EINVAL;
+
+		sc->profile = codec_profiles[i];
 		break;
 
 	default:

[-- Attachment #3 --]
--- work/modules/cxm/cxm/Makefile.ORIGINAL	Sun Feb  6 01:38:54 2005
+++ work/modules/cxm/cxm/Makefile	Wed Feb  9 05:17:27 2005
@@ -1,7 +1,7 @@
 .PATH:	${.CURDIR}/../../../dev/cxm
 KMOD	= cxm
 SRCS	= cxm.c cxm.h cxm_dec_fw.c cxm_enc_fw.c cxm_audio.c cxm_eeprom.c \
-	  cxm_ir.c cxm_tuner.c cxm_video.c opt_cxm.h \
+	  cxm_ir.c cxm_tuner.c cxm_video.c ioctl_meteor_compat.h opt_cxm.h \
 	  bus_if.h device_if.h iicbb_if.h pci_if.h vnode_if.h
 
 .include <bsd.kmod.mk>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8f8eb53e0502140253238cd7f6>