[mythtv] ivtv settings patch
Chris B
news at semperpax.com
Fri Aug 29 13:38:40 EDT 2003
Skipped content of type multipart/alternative-------------- next part --------------
? .directory
? libs/libmythtv/.directory
? programs/menutest/Makefile
? programs/menutest/menutest
? setup/$outfile
Index: settings.pro
===================================================================
RCS file: /var/lib/mythcvs/mythtv/settings.pro,v
retrieving revision 1.35
diff -u -r1.35 settings.pro
--- settings.pro 29 Aug 2003 07:52:27 -0000 1.35
+++ settings.pro 29 Aug 2003 09:45:59 -0000
@@ -29,9 +29,14 @@
#DEFINES += USING_DVB
#INCLUDEPATH += /usr/src/linux/include/linux/dvb/
+# IVTV stuff
+CONFIG += using_ivtv
+DEFINES += USING_IVTV
+INCLUDEPATH += /usr/src/ivtv/ivtv/utils/
+
# Native lirc support
-#CONFIG += using_lirc
-#EXTRA_LIBS += -llirc_client
+CONFIG += using_lirc
+EXTRA_LIBS += -llirc_client
# XvMC support, modify as necessary. Do not enable this.
#CONFIG += using_xvmc
Index: libs/libmythtv/mpegrecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/mpegrecorder.cpp,v
retrieving revision 1.19
diff -u -r1.19 mpegrecorder.cpp
--- libs/libmythtv/mpegrecorder.cpp 29 Aug 2003 06:26:28 -0000 1.19
+++ libs/libmythtv/mpegrecorder.cpp 29 Aug 2003 09:46:03 -0000
@@ -40,6 +40,17 @@
keyframedist = 15;
gopset = false;
+
+ ivtvbitrate = 8000000;
+ ivtvmaxbitrate = 16000000;
+ ivtvstreamtype = 0;
+ ivtvframerate = 1;
+ ivtvaspectratio = 2;
+ ivtvaudtype = 2;
+ ivtvaudsamplerate = 1;
+ ivtvaudbitrate = 14;
+ ivtvaudvolume = 52428;
+
}
MpegRecorder::~MpegRecorder()
@@ -56,7 +67,27 @@
width = value;
else if (opt == "height")
height = value;
- else
+#ifdef USING_IVTV
+ else if (opt == "ivtvbitrate")
+ ivtvbitrate = value * 1000;
+ else if (opt == "ivtvmaxbitrate")
+ ivtvmaxbitrate = value * 1000;
+ else if (opt == "ivtvstreamtype")
+ ivtvstreamtype = value;
+ else if (opt == "ivtvframerate")
+ ivtvframerate = value;
+ else if (opt == "ivtvaspectratio")
+ ivtvaspectratio = value;
+ else if (opt == "ivtvaudtype")
+ ivtvaudtype = value;
+ else if (opt == "ivtvaudsamplerate")
+ ivtvaudsamplerate = value;
+ else if (opt == "ivtvaudbitrate")
+ ivtvaudbitrate = value;
+ else if (opt == "ivtvaudvolume")
+ ivtvaudvolume = 65536 / 100 * value;
+#endif
+ else
RecorderBase::SetOption(opt, value);
}
@@ -90,6 +121,43 @@
return;
}
+#ifdef USING_IVTV
+ struct ivtv_ioctl_codec ivtvcodec;
+ memset(&ivtvcodec, 0, sizeof(ivtvcodec));
+
+ if (ioctl(chanfd, IVTV_IOC_G_CODEC, &ivtvcodec) < 0)
+ {
+ cerr << "Error getting codec params\n";
+ perror("IVTV_IOC_G_CODEC:");
+ return;
+ }
+
+ ivtvcodec.aspect = ivtvaspectratio;
+ ivtvcodec.audio_bitmask = ivtvaudsamplerate + (ivtvaudtype << 2) + (ivtvaudbitrate << 4);
+ ivtvcodec.bitrate = ivtvbitrate;
+ ivtvcodec.bitrate_peak = ivtvmaxbitrate;
+ ivtvcodec.framerate = ivtvframerate;
+ ivtvcodec.stream_type = ivtvstreamtype;
+
+ if (ioctl(chanfd, IVTV_IOC_S_CODEC, &ivtvcodec) < 0)
+ {
+ cerr << "Error setting codec params\n";
+ perror("IVTV_IOC_S_CODEC:");
+ return;
+ }
+
+ struct v4l2_control ctrl;
+ ctrl.id = V4L2_CID_AUDIO_VOLUME;
+ ctrl.value = ivtvaudvolume;
+
+ if (ioctl(chanfd, VIDIOC_S_CTRL, &ctrl) < 0)
+ {
+ cerr << "Error setting codec params\n";
+ perror("VIDIOC_S_CTRL:");
+ return;
+ }
+
+
readfd = open(videodevice.ascii(), O_RDWR);
if (readfd <= 0)
{
@@ -97,6 +165,7 @@
perror("open video:");
return;
}
+#endif
unsigned char buffer[256001];
int ret;
Index: libs/libmythtv/mpegrecorder.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/mpegrecorder.h,v
retrieving revision 1.7
diff -u -r1.7 mpegrecorder.h
--- libs/libmythtv/mpegrecorder.h 18 Jul 2003 20:10:58 -0000 1.7
+++ libs/libmythtv/mpegrecorder.h 29 Aug 2003 09:46:03 -0000
@@ -51,7 +51,12 @@
long long framesWritten;
int width, height;
-
+#ifdef USING_IVTV
+ int ivtvbitrate, ivtvmaxbitrate, ivtvstreamtype,ivtvframerate, ivtvaspectratio;
+ int ivtvaudtype, ivtvaudsamplerate, ivtvaudbitrate;
+ int ivtvaudvolume;
+#endif
+
int chanfd;
int readfd;
Index: libs/libmythtv/recordingprofile.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/recordingprofile.cpp,v
retrieving revision 1.37
diff -u -r1.37 recordingprofile.cpp
--- libs/libmythtv/recordingprofile.cpp 19 Jun 2003 06:19:59 -0000 1.37
+++ libs/libmythtv/recordingprofile.cpp 29 Aug 2003 09:46:05 -0000
@@ -71,6 +71,68 @@
};
};
+#ifdef USING_IVTV
+class IVTVaudSampleRate: public CodecParam, public ComboBoxSetting {
+public:
+ IVTVaudSampleRate(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvaudsamplerate") {
+ setLabel("Sampling rate");
+ addSelection("32000", "2");
+ addSelection("44100", "0");
+ addSelection("48000", "1");
+ setHelpText("Sets the audio sampling rate for your PVR. ");
+ };
+};
+
+class IVTVaudType: public CodecParam, public ComboBoxSetting {
+public:
+ IVTVaudType(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvaudtype") {
+ setLabel("Type");
+
+ addSelection("Layer I", "1");
+ addSelection("Layer II", "2");
+ setHelpText("Sets the audio type");
+ };
+};
+
+class IVTVaudBitrate: public CodecParam, public ComboBoxSetting {
+public:
+ IVTVaudBitrate(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvaudbitrate") {
+ setLabel("Bitrate (typeI/type II)");
+
+ addSelection("32 kbps/32 kbps", "1");
+ addSelection("64 kbps/48 kbps", "2");
+ addSelection("96 kbps/56 kbps", "3");
+ addSelection("128 kbps/64 kbps", "4");
+ addSelection("160 kbps/80 kbps", "5");
+ addSelection("192 kbps/96 kbps", "6");
+ addSelection("224 kbps/112 kbps", "7");
+ addSelection("256 kbps/128 kbps", "8");
+ addSelection("288 kbps/160 kbps", "9");
+ addSelection("320 kbps/192 kbps", "10");
+ addSelection("352 kbps/224 kbps", "11");
+ addSelection("384 kbps/256 kbps", "12");
+ addSelection("416 kbps/320 kbps", "13");
+ addSelection("448 kbps/384 kbps", "14");
+ setHelpText("Sets the audio bitrate");
+ };
+};
+
+class IVTVaudVolume: public CodecParam, public SliderSetting {
+public:
+ IVTVaudVolume(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvaudvolume"),
+ SliderSetting(0,100,5) {
+
+ setLabel("Volume (%)");
+ setValue(80);
+ setHelpText("Volume of the recording ");
+ };
+};
+#endif
+
class AudioCompressionSettings: public VerticalConfigurationGroup,
public TriggeredConfigurationGroup {
public:
@@ -84,13 +146,28 @@
addChild(codecName);
setTrigger(codecName);
- ConfigurationGroup* params = new VerticalConfigurationGroup();
+ ConfigurationGroup* params = new VerticalConfigurationGroup(false);
params->setLabel("MP3");
+ params->addChild(new SampleRate(parent));
params->addChild(new MP3Quality(parent));
addTarget("MP3", params);
codecName->addSelection("MP3");
- addTarget("Uncompressed", new VerticalConfigurationGroup());
+#ifdef USING_IVTV
+ params = new VerticalConfigurationGroup(false);
+ params->setLabel("iTVC1x/CX2431x Hardware MPEG");
+ params->addChild(new IVTVaudType(parent));
+ params->addChild(new IVTVaudSampleRate(parent));
+ params->addChild(new IVTVaudBitrate(parent));
+ params->addChild(new IVTVaudVolume(parent));
+ addTarget("iTVC1x/CX2431x Hardware MPEG", params);
+ codecName->addSelection("iTVC1x/CX2431x Hardware MPEG");
+#endif
+
+ params = new VerticalConfigurationGroup(false);
+ params->setLabel("Uncompressed");
+ params->addChild(new SampleRate(parent));
+ addTarget("Uncompressed", params);
codecName->addSelection("Uncompressed");
};
};
@@ -103,6 +180,78 @@
};
};
+#ifdef USING_IVTV
+class IVTVbitrate: public CodecParam, public SliderSetting {
+public:
+ IVTVbitrate(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvbitrate"),
+ SliderSetting(1000,12000,500) {
+
+ setLabel("Bitrate");
+ setValue(4000);
+ setHelpText("Bitrate in kilobits/second. 2200Kbps is "
+ "approximately 1 Gigabyte per hour.");
+ };
+};
+
+class IVTVmaxBitrate: public CodecParam, public SliderSetting {
+public:
+ IVTVmaxBitrate(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvmaxbitrate"),
+ SliderSetting(1000,12000,500) {
+
+ setLabel("Max. Bitrate");
+ setValue(8000);
+ setHelpText("Maximum Bitrate in kilobits/second. 2200Kbps is "
+ "approximately 1 Gigabyte per hour.");
+ };
+};
+
+class IVTVstreamType: public CodecParam, public ComboBoxSetting {
+public:
+ IVTVstreamType(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvstreamtype") {
+ setLabel("Stream Type");
+
+ addSelection("MPEG-2 PS", "0");
+ addSelection("MPEG-2 TS", "1");
+ addSelection("MPEG-1 VCD", "2");
+ addSelection("PES AV", "3");
+ addSelection("PES V", "5");
+ addSelection("PES A", "7");
+ addSelection("DVD", "10");
+ setHelpText("Sets the type of stream generated by your PVR. "
+ );
+ };
+};
+
+class IVTVaspectRatio: public CodecParam, public ComboBoxSetting {
+public:
+ IVTVaspectRatio(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvaspectratio") {
+ setLabel("Aspect Ratio");
+
+ addSelection("Square", "1");
+ addSelection("4:3", "2");
+ addSelection("16:9", "3");
+ addSelection("2.21:1", "4");
+ setHelpText("Sets the aspect ratio of stream generated by your PVR. "
+ );
+ };
+};
+
+class IVTVframerate: public CodecParam, public ComboBoxSetting {
+public:
+ IVTVframerate(const RecordingProfile& parent):
+ CodecParam(parent, "ivtvframerate") {
+ setLabel("Framerate");
+ addSelection("25 fps", "1");
+ addSelection("30 fps", "0");
+ setHelpText("Sets the framerate for your PVR. ");
+ };
+};
+#endif
+
class RTjpegQuality: public CodecParam, public SliderSetting {
public:
RTjpegQuality(const RecordingProfile& parent):
@@ -301,6 +450,19 @@
addTarget("Hardware MJPEG", params);
codecName->addSelection("Hardware MJPEG");
+
+#ifdef USING_IVTV
+ params = new VerticalConfigurationGroup(false);
+ params->setLabel("iTVC1x/CX2431x Hardware MPEG Parameters");
+ params->addChild(new IVTVstreamType(parent));
+ params->addChild(new IVTVaspectRatio(parent));
+ params->addChild(new IVTVframerate(parent));
+ params->addChild(new IVTVbitrate(parent));
+ params->addChild(new IVTVmaxBitrate(parent));
+
+ addTarget("iTVC1x/CX2431x Hardware MPEG", params);
+ codecName->addSelection("iTVC1x/CX2431x Hardware MPEG");
+#endif
}
};
@@ -362,12 +524,7 @@
addChild(new ImageSize(*this, tvFormat));
addChild(new VideoCompressionSettings(*this));
-
- ConfigurationGroup* audioquality = new VerticalConfigurationGroup(false);
- audioquality->setLabel("Audio Quality");
- audioquality->addChild(new SampleRate(*this));
- audioquality->addChild(new AudioCompressionSettings(*this));
- addChild(audioquality);
+ addChild(new AudioCompressionSettings(*this));
};
void RecordingProfile::loadByID(QSqlDatabase* db, int profileId) {
Index: libs/libmythtv/tv_rec.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_rec.cpp,v
retrieving revision 1.104
diff -u -r1.104 tv_rec.cpp
--- libs/libmythtv/tv_rec.cpp 27 Aug 2003 15:41:50 -0000 1.104
+++ libs/libmythtv/tv_rec.cpp 29 Aug 2003 09:46:11 -0000
@@ -500,7 +500,28 @@
nvr->SetOption("tvformat", gContext->GetSetting("TVFormat"));
nvr->SetOption("vbiformat", gContext->GetSetting("VbiFormat"));
- SetOption(profile, "width");
+ QString setting = profile.byName("videocodec")->getValue();
+
+ if (setting == "iTVC1x/CX2431x Hardware MPEG")
+ {
+ SetOption(profile, "ivtvbitrate");
+ SetOption(profile, "ivtvmaxbitrate");
+ SetOption(profile, "ivtvstreamtype");
+ SetOption(profile, "ivtvaspectratio");
+ SetOption(profile, "ivtvframerate");
+ }
+
+ setting = profile.byName("audiocodec")->getValue();
+
+ if (setting == "iTVC1x/CX2431x Hardware MPEG")
+ {
+ SetOption(profile, "ivtvaudtype");
+ SetOption(profile, "ivtvaudsamplerate");
+ SetOption(profile, "ivtvaudbitrate");
+ SetOption(profile, "ivtvaudvolume");
+ }
+
+ SetOption(profile, "width");
SetOption(profile, "height");
if (ispip)
Index: libs/libmythtv/videodev_myth.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videodev_myth.h,v
retrieving revision 1.2
diff -u -r1.2 videodev_myth.h
--- libs/libmythtv/videodev_myth.h 1 Aug 2003 15:00:19 -0000 1.2
+++ libs/libmythtv/videodev_myth.h 29 Aug 2003 09:46:13 -0000
@@ -12,6 +12,10 @@
*/
# define HAVE_V4L2 1
# include "videodev2_myth.h"
+# ifdef USING_IVTV
+# define uint32_t unsigned int
+# include "ivtv-ext-api.h"
+# endif
#else
# undef HAVE_V4L2
#endif
More information about the mythtv-dev
mailing list