I'm currently implementing the improvements to EPG that I mentioned
earlier. Here are the main enhancements:
a) Pressing "C" in the EPG will toggle the Input.
This will update the channel list as well as the preview video.
b) Pressing "Y" in the EPG will switch the card (if you have more than one)
This will update the channel list as well as the preview video.
c) the EPG will ONLY show the channels available for your current card and input
Today, the EPG displays either all channels, or just your
favorites. It seems like the correct thing would be to filter it also
by the current source when it's being accessed by Live TV. (Schedule
Recordings->Program Guide will continue to show all channels)
d) *would like to implement* Have the channel guide navigate to the
correct channel when you switch inputs. If you are on input 1 with
channel 5 and switch to input 2 with channel 230, it will
automatically jump the guide to 230.
I've got some working code that I'm attaching as a diff, but I'm not
ready to submit it as a patch yet. I still have some testing to do and
some code cleanup after I get everything in a working satte. While I
was testing, I found that I get a segmentation fault when there is an
error thrown. Here are the steps to reproduce:
1. Open MythFrontend
2. Watch Live TV
3. Go into the program guide.
4. Press "Y" to switch inputs. If your second input has an error (mine
errors out because my slave backend is on a different protocol
version), it will pop up a box telling you the error.
5. press OK, then Escape. Mythfrontend segfaults at this point.
It is dying when it's trying to call m_parent->detach(this). I've been
wracking my brain (and the debugger), but I don't think I understand
the code enough to figure out what's wrong. Does anyone have any
insights? When you switch input in regular live tv and get the same
error, somehow it can throw you back to the menu correctly without
segfaulting. I can't figure out why that works though.
Below is the gdb stack trace. Any help would be greatly appreciated.
Please also find the diff file attached to this email.
--Harvard
2005-05-05 03:51:54.479 Changing from WatchingLiveTV to None
2005-05-05 03:51:54.504 Protocol version mismatch (frontend=16,backend=15)
ASSERT: "i <= nodes" in /usr/lib64/qt-3.3/include/qvaluelist.h (372)
ASSERT: "i <= nodes" in /usr/lib64/qt-3.3/include/qvaluelist.h (372)
2005-05-05 03:51:55.871 TV::HandleStateChange() Error, failed to start
RingBuffer on backend. Aborting.
2005-05-05 03:51:55.871 Unknown state transition: 0 to 0
2005-05-05 03:51:55.875 Changing from None to None
[Thread 1094719840 (LWP 22194) exited]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1147169120 (LWP 22203)]
0x0000000000000000 in ?? ()
(gdb) back
#0 0x0000000000000000 in ?? ()
#1 0x00002aaaabadc092 in MythMainWindow::detach (this=0x6e9dd0,
child=0x806b00) at mythdialogs.cpp:348
#2 0x00002aaaabadfe75 in ~MythDialog (this=0x806b00) at mythdialogs.cpp:893
#3 0x00002aaaaae36dd5 in ~GuideGrid (this=0x806b00) at guidegrid.cpp:280
#4 0x00002aaaaae323c8 in RunProgramGuide (startchannel=
{static null = {static null = <same as static member of an
already seen type>, d = 0x641e20, static shared_null = 0x641e20}, d =
0x9e6970, static shared_null = 0x641e20}, thread=true,
player=0x7389d0, allowsecondaryepg=true)
at guidegrid.cpp:64
#5 0x00002aaaaaf0b476 in TV::doLoadMenu (this=0x7389d0) at tv_play.cpp:3184
#6 0x00002aaaaaf0b6ab in TV::MenuHandler (param=0x7389d0) at tv_play.cpp:3209
#7 0x0000003418c060aa in start_thread () from /lib64/tls/libpthread.so.0
#8 0x00000034181c53d3 in clone () from /lib64/tls/libc.so.6
#9 0x0000000000000000 in ?? ()
Index: libs/libmythtv/guidegrid.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/guidegrid.cpp,v
retrieving revision 1.173
diff -u -r1.173 guidegrid.cpp
--- libs/libmythtv/guidegrid.cpp 4 May 2005 06:31:57 -0000 1.173
+++ libs/libmythtv/guidegrid.cpp 5 May 2005 10:58:08 -0000
@@ -411,6 +411,10 @@
toggleChannelFavorite();
else if (action == "CHANUPDATE")
channelUpdate();
+ else if (action == "SWITCHCARDS")
+ switchCards();
+ else if (action == "TOGGLEINPUTS")
+ toggleInputs();
else
handled = false;
}
@@ -540,13 +544,41 @@
m_channelInfos.clear();
QString queryfav;
-
+
MSqlQuery query(MSqlQuery::InitCon());
+ QString sourceID; // should be initialized to null
+ // Query the database to determine which source is being used currently.
+ // set the EPG so that it only displays the channels of the current source
+ if (m_player) {
+ QString inputname = "";
+ m_player->GetInputName(inputname);
+ int recordernum = m_player->GetLastRecorderNum ();
+ // We need to get the correct source id
+ QString queryInput = "SELECT I.sourceid FROM cardinput I LEFT JOIN "
+ "capturecard C on I.cardid = C.cardid WHERE "
+ "I.cardid = " + QString::number(recordernum) + " AND "
+ "I.inputname = '" + inputname + "';";
+ query.prepare(queryInput);
+ query.exec();
+ if (query.isActive() && query.size() > 0) {
+ if (query.next ()) {
+ sourceID = query.value(0).toString();
+ }
+ }
+ }
+
+ // If we didn't find a source, or the m_player isn't on (like in
+ // the schedule recording page), we display all channels we find.
+ QString strAdditionalWhereClause = "";
+ if (!sourceID.isEmpty ()) {
+ strAdditionalWhereClause = "AND sourceid = " + sourceID + " ";
+ }
QString queryall = "SELECT channel.channum, channel.callsign, "
"channel.icon, channel.chanid, favorites.favid, "
"channel.name FROM channel LEFT JOIN favorites ON "
"favorites.chanid = channel.chanid WHERE visible = 1 "
+ + strAdditionalWhereClause +
"GROUP BY channum, callsign "
"ORDER BY " + channelOrdering + ";";
@@ -556,6 +588,7 @@
"channel.icon, channel.chanid, favorites.favid, "
"channel.name FROM favorites, channel WHERE "
"channel.chanid = favorites.chanid and visible = 1 "
+ + strAdditionalWhereClause +
"ORDER BY " + channelOrdering + ";";
query.prepare(queryfav);
@@ -1725,6 +1758,48 @@
m_player->EPGChannelUpdate(m_channelInfos[chanNum].chanstr);
}
+void GuideGrid::toggleInputs(void)
+{
+ if (!m_player)
+ return;
+
+ // call ToggleInputs on m_player
+ m_player->EPGToggleInputs();
+ generateListings ();
+
+ repaint(fullRect, false);
+}
+
+void GuideGrid::switchCards(void)
+{
+ if (!m_player)
+ return;
+
+ m_player->EPGSwitchCards();
+ switchCardsTimeout ();
+}
+
+void GuideGrid::switchCardsTimeout ()
+{
+ if (m_player->IsSwitchingCards ()) {
+ QTimer * timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(switchCardsTimeout()));
+ timer->start( 500, TRUE ); // single-shot timer
+ return;
+ }
+
+ if (!m_player->IsPlaying () &&
+ !m_player->IsRecording ()) {
+ // For some reason, the player isn't working correctly.
+ m_player->StopEmbeddingOutput ();
+ return;
+ }
+
+ generateListings ();
+
+ repaint(fullRect, false);
+}
+
//
// jumpToChannel - Jason Parekh <[EMAIL PROTECTED]> - 06/23/2004
//
Index: libs/libmythtv/guidegrid.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/guidegrid.h,v
retrieving revision 1.61
diff -u -r1.61 guidegrid.h
--- libs/libmythtv/guidegrid.h 4 May 2005 06:31:57 -0000 1.61
+++ libs/libmythtv/guidegrid.h 5 May 2005 10:58:08 -0000
@@ -66,6 +66,9 @@
void showProgFinder();
void channelUpdate();
+ void toggleInputs();
+ void switchCards();
+ void switchCardsTimeout();
void quickRecord();
void editRecording();
Index: libs/libmythtv/tv_play.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.cpp,v
retrieving revision 1.266
diff -u -r1.266 tv_play.cpp
--- libs/libmythtv/tv_play.cpp 5 May 2005 02:51:15 -0000 1.266
+++ libs/libmythtv/tv_play.cpp 5 May 2005 10:58:11 -0000
@@ -127,6 +127,8 @@
"Left");
REG_KEY("TV Frontend", "UPCOMING", "List upcoming episodes", "O");
REG_KEY("TV Frontend", "DETAILS", "Show program details", "U");
+ REG_KEY("TV Frontend", "TOGGLEINPUTS", "Toggle inputs", "C");
+ REG_KEY("TV Frontend", "SWITCHCARDS", "Switch Capture Cards", "Y");
REG_KEY("TV Playback", "CLEAROSD", "Clear OSD", "Backspace");
REG_KEY("TV Playback", "PAUSE", "Pause", "P");
@@ -2465,6 +2467,13 @@
}
}
+void TV::GetInputName(QString & inputname)
+{
+ if (activerecorder) {
+ activerecorder->GetInputName (inputname);
+ }
+}
+
void TV::ToggleInputs(void)
{
if (activenvp == nvp)
@@ -3468,6 +3477,16 @@
}
}
+void TV::EPGToggleInputs(void)
+{
+ ToggleInputs ();
+}
+
+void TV::EPGSwitchCards(void)
+{
+ SwitchCards();
+}
+
void TV::KeyRepeatOK(void)
{
keyRepeat = true;
Index: libs/libmythtv/tv_play.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/tv_play.h,v
retrieving revision 1.88
diff -u -r1.88 tv_play.h
--- libs/libmythtv/tv_play.h 7 Apr 2005 15:33:50 -0000 1.88
+++ libs/libmythtv/tv_play.h 5 May 2005 10:58:11 -0000
@@ -77,7 +77,10 @@
void EmbedOutput(WId wid, int x, int y, int w, int h);
void StopEmbeddingOutput(void);
void EPGChannelUpdate(QString chanstr);
-
+ void EPGToggleInputs(void);
+ void EPGSwitchCards(void);
+ void GetInputName(QString & inputname);
+
bool getRequestDelete(void) { return requestDelete; }
bool getEndOfRecording(void) { return endOfRecording; }
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev