Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8406 closed task (fixed)

ProgramInfo refactor

Reported by: danielk Owned by: danielk
Priority: minor Milestone: 0.24
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

The idea is to clean up the types used, decrease the number of different ways ProgramInfo? is initialized, shrink it's memory and serialization footprint, implement a more useful naming scheme for the methods and functions in the class, and standardize on one way to do things like construct a QString key from the chanid and recstartts and other redundancies in use.

So far the patch addresses the type issue and does some shrinking of the memory and serialization footprint. The initializer problem hasn't really been addressed other than to replace most ad-hock initialization with ctors so we get a clearer picture of how it is being initialized currently.

Attachments (12)

programinfo-refactor-v7.patch.bz2 (104.7 KB) - added by danielk 10 years ago.
python.pginfo.patch (4.5 KB) - added by Raymond Wagner 10 years ago.
updated patch for python bindings
programinfo-refactor-v9.patch.bz2 (108.9 KB) - added by danielk 10 years ago.
Updated patch, include python binding patch
programinfo-refactor-v14.patch.bz2 (130.4 KB) - added by danielk 10 years ago.
Updated patch, things are broken, but so far no segfaults.
programinfo-refactor-v16.patch.bz2 (131.0 KB) - added by danielk 10 years ago.
Fixes GuideGrid? loading & layout.
programinfo-refactor-v17.patch.bz2 (131.1 KB) - added by danielk 10 years ago.
Updated patch, handles programs with the DELETEPENDING flag more appropriately.
programinfo-refactor-v19.patch.bz2 (133.3 KB) - added by danielk 10 years ago.
Updated patch
programinfo-refactor-v20.patch.bz2 (134.1 KB) - added by danielk 10 years ago.
Updated patch, fixes recording delete availability checking
programinfo-refactor-v21.patch.bz2 (134.0 KB) - added by danielk 10 years ago.
Updates patch to apply to latest svn (reverts programinfo part of 24484)
programinfo-refactor-v31.patch.bz2 (138.7 KB) - added by danielk 10 years ago.
Updated patch, fixes all known new issues and most existing bugs discovered during refactor
programinfo-refactor-v32.patch.bz2 (138.7 KB) - added by danielk 10 years ago.
Updated patch to apply to latest trunk
programinfo-refactor-v34.patch.bz2 (140.6 KB) - added by danielk 10 years ago.
Updated patch, fixes bookmark handling in PlaybackBox?

Download all attachments as: .zip

Change History (25)

Changed 10 years ago by danielk

Changed 10 years ago by Raymond Wagner

Attachment: python.pginfo.patch added

updated patch for python bindings

Changed 10 years ago by danielk

Updated patch, include python binding patch

Changed 10 years ago by danielk

Updated patch, things are broken, but so far no segfaults.

Changed 10 years ago by danielk

Fixes GuideGrid? loading & layout.

Changed 10 years ago by danielk

Updated patch, handles programs with the DELETEPENDING flag more appropriately.

Changed 10 years ago by danielk

Updated patch

Changed 10 years ago by danielk

Updated patch, fixes recording delete availability checking

Changed 10 years ago by danielk

Updates patch to apply to latest svn (reverts programinfo part of 24484)

Changed 10 years ago by danielk

Updated patch, fixes all known new issues and most existing bugs discovered during refactor

Changed 10 years ago by danielk

Updated patch to apply to latest trunk

Changed 10 years ago by danielk

Updated patch, fixes bookmark handling in PlaybackBox?

comment:1 Changed 10 years ago by danielk

(In [24694]) Refs #8406. ProgramInfo? refactor. Step 2.

You will need to distclean and recompile both mythtv and the plugins.

This continues the ProgramInfo? refactor started prior to 0.23. I held this back at the time because it was to risky to apply just prior to that release. It is a large patch that touches on many parts of MythTV. It reduces the in core requirements of ProgramInfo? as well as removing a large number of redundant bits of code and standardizing the way we handle things like generating a QString key for a recording. This also centralizes the loading of ProgramInfo? to programinfo.cpp, we had about three dozen places in the code loading these, all with different levels of metadata which produced some strange bugs.

This also starts to address the problem of containers for ProgramInfo? based clases with the AutoDeleteDeque?, but this will be addressed more completely in later patches. AutoDeleteDeque? simply lets us get rid of the old ProgramList? and RecordingList? which were copy and pastes of each other (a maintenance nightmare.)

There are still a number of problems remaining, we don't have any way currently to debug when someone tries to access data that has not been loaded, so it's difficult to track down such bugs. ProgramInfo? now uses accessors so it is possible to add such checking to the debug build. There are a number of algorithms that have inserted their own private data into ProgramInfo?, these have not all been addressed, but these members have been labeled. It will be easier to inherit from ProgramInfo? to add private data once the containter problem has been addressed. RecordingInfo? has not been refactored in this pass, there are a number of issues there.

Loading additional metadata for the UI or other uses has not been addressed in a systematic way. I have some ideas on this but want to do this in a seperate pass as this patch is already very large.

I've been running versions of this changeset on my production systems for a week and there have been no showstoppers, only small bugs that were easily fixed. However, I do not use every feature of MythTV so I'm sure some bugs will turn up. Please note them on ticket #8406.

comment:2 Changed 10 years ago by bradd@…

This breaks compiling on Mac OS X. Here is the error:

g++ -c -pipe -fomit-frame-pointer -O3 -m32 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -DSTDC_CONSTANT_MACROS -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include/freetype2 -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include -F/System/Library/Frameworks/{AGL,ApplicationServices?,Carbon,Cocoa,OpenGL,QuickTime?,IOKit,IOKit}.framework/Frameworks -F/System/Library/PrivateFrameworks/{DVD}.framework/Frameworks -F/Developer/FireWireSDK26/Examples/Framework -arch i386 -DPIC -fPIC -DUSING_APPLEREMOTE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DUSING_MHEG -DUSING_FRONTEND -DUSING_FFMPEG_THREADS -DUSING_OSX_FIREWIRE -DUSING_FIREWIRE -DUSING_IPTV -DUSING_HDHOMERUN -DUSING_BACKEND -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/mkspecs/macx-g++ -I. -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include/QtCore -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include/QtNetwork -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include/QtGui -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include/QtXml -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include/QtSql -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build/include -I/Users/bradd/mythtv_build_qt4.6/.osx-packager/build -I.. -I../.. -I. -I../libmyth -I../libavcodec -I../libavformat -I../libavutil -I../libswscale -I../libmythmpeg2 -I../libmythdb -I../libmythhdhomerun -I../libmythdvdnav -I../libmythbdnav -Idvbdev -Impeg -Iiptv -Ichannelscan -I../libmythlivemedia/BasicUsageEnvironment/include -I../libmythlivemedia/BasicUsageEnvironment -I../libmythlivemedia/groupsock/include -I../libmythlivemedia/groupsock -I../libmythlivemedia/liveMedia/include -I../libmythlivemedia/liveMedia -I../libmythlivemedia/UsageEnvironment/include -I../libmythlivemedia/UsageEnvironment -I../libmythdb -I../libmythui -I/usr/include -I. -o textsubtitleparser.o textsubtitleparser.cpp NuppelVideoPlayer?.cpp: In member function 'bool NuppelVideoPlayer::TranscodeGetNextFrame?(QMap<long long unsigned int, MarkTypes?>::iterator&, int&, bool&, bool)': NuppelVideoPlayer?.cpp:5958: error: 'INT64_C' was not declared in this scope make[2]: * [NuppelVideoPlayer?.o] Error 1 make[2]: * Waiting for unfinished jobs.... make[1]: * [sub-libmythtv-make_default] Error 2 make: * [sub-libs-make_default-ordered] Error 2

comment:3 Changed 10 years ago by bradd@…

mythweb also appears to be broken after this commit. this is the apache error:

[Sun May 16 12:09:43 2010] [error] [client x.x.x.x] PHP Fatal error: Cannot redeclare Program::$filesize in /var/www/html/mythweb/modules/tv/classes/Program.php on line 101, referer: https://x.x.x.x/mythweb/

comment:4 Changed 10 years ago by anonymous

Live tv is also broken with this stack:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb12dfa70 (LWP 10284)]
0xb7016c39 in ProgramInfo::SetIgnoreBookmark (this=0x0, ignore=false)
    at ../libmyth/programinfo.h:475
475	        programflags &= ~FL_IGNOREBOOKMARK;
(gdb) where
#0  0xb7016c39 in ProgramInfo::SetIgnoreBookmark (this=0x0, ignore=false)
    at ../libmyth/programinfo.h:475
#1  0xb70126af in TV::StartTV (tvrec=0x0, flags=0) at tv_play.cpp:207
#2  0x0807912b in startTVNormal () at main.cpp:475
#3  0x08082f9d in TVMenuCallback (data=0x8334830, selection=@0x8662a0c) at main.cpp:502
#4  0xb5e9285b in MythThemedMenu::handleAction (this=0x86628e8, action=@0x83a00ac, 
    password=@0xbf9948a0) at myththemedmenu.cpp:881
#5  0xb5e92c21 in MythThemedMenu::buttonAction (this=0x86628e8, item=0x8675a48, skipPass=false)
    at myththemedmenu.cpp:743
#6  0xb5f6ea4b in MythThemedMenu::qt_metacall (this=0x86628e8, _c=QMetaObject::InvokeMetaMethod, 
    _id=2, _a=0xbf9949d0) at moc_myththemedmenu.cpp:79
#7  0xb31539e5 in QMetaObject::metacall () from /usr/lib/libQtCore.so.4
#8  0xb31624b7 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#9  0xb5f709b5 in MythUIButtonList::itemClicked (this=0x8678958, _t1=0x8675a48)
    at moc_mythuibuttonlist.cpp:102
#10 0xb5eac7a7 in MythUIButtonList::keyPressEvent (this=0x8678958, e=0xbf9950a8)
    at mythuibuttonlist.cpp:2158
#11 0xb5e9350a in MythThemedMenu::keyPressEvent (this=0x86628e8, event=0xbf9950a8)
    at myththemedmenu.cpp:215
#12 0xb5e006b5 in MythMainWindow::eventFilter (this=0x836c470, e=0xbf9950a8)
    at mythmainwindow.cpp:1583
#13 0xb314d9aa in QCoreApplicationPrivate::sendThroughObjectEventFilters ()
   from /usr/lib/libQtCore.so.4
#14 0xb34d1529 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#15 0xb34d9369 in QApplication::notify () from /usr/lib/libQtGui.so.4
#16 0xb314e68b in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#17 0xb60279f8 in QCoreApplication::sendEvent (receiver=0x836c470, event=0xbf9950a8)
    at /usr/include/QtCore/qcoreapplication.h:215
#18 0xb5e06e7a in MythMainWindow::customEvent (this=0x836c470, ce=0x83ffb10)
    at mythmainwindow.cpp:1793
#19 0xb315f474 in QObject::event () from /usr/lib/libQtCore.so.4
#20 0xb352f6a0 in QWidget::event () from /usr/lib/libQtGui.so.4
#21 0xb5e07f93 in MythMainWindow::event (this=0x836c470, e=0x83ffb10) at mythmainwindow.cpp:856
#22 0xb34d154c in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#23 0xb34d8ba7 in QApplication::notify () from /usr/lib/libQtGui.so.4
#24 0xb314e68b in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
---Type <return> to continue, or q <return> to quit---
#25 0xb314f5bf in QCoreApplicationPrivate::sendPostedEvents () from /usr/lib/libQtCore.so.4
#26 0xb314f76d in QCoreApplication::sendPostedEvents () from /usr/lib/libQtCore.so.4
#27 0xb317aa0f in ?? () from /usr/lib/libQtCore.so.4
#28 0xb13a9ab0 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#29 0xb13aca5b in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#30 0xb13acbdf in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#31 0xb317a521 in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#32 0xb358d7d5 in ?? () from /usr/lib/libQtGui.so.4
#33 0xb314ccda in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#34 0xb314d122 in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#35 0xb314f839 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#36 0xb34d15e7 in QApplication::exec () from /usr/lib/libQtGui.so.4
#37 0x08080b08 in main (argc=5, argv=0xbf996114) at main.cpp:1472
(gdb) quit

comment:5 Changed 10 years ago by danielk

(In [24697]) Refs #8406. Update program_line_number in mythweb.

comment:6 Changed 10 years ago by danielk

(In [24698]) Refs #8406. More mythweb fixes for ProgramInfo? refactor.

comment:7 Changed 10 years ago by Janne Grunau

(In [24700]) fix segfault at live tv start post ProgramInfo? refactor, Refs #8406

comment:8 Changed 10 years ago by sphery

(In [24701]) Update the array indices for data in the ProgramInfo? after the ProgramInfo? refactor. Refs #8406.

comment:9 Changed 10 years ago by sphery

(In [24703]) Fix a few places in MythWeb affected by the ProgramInfo? refactor. Refs #8406.

This simplifies Program.php, and fixes the recorded.php page (which also parses some ProgramInfo? data). Initial patch by Daniel K, with some modifications by me. I removed the attempt to reuse the Program object's parsing of ProgramInfo? data because I couldn't get it to work. That can be modified later, in a separate change, but this at least gets the page working, again (the same way it worked before).

comment:10 Changed 10 years ago by danielk

Resolution: fixed
Status: newclosed

I will open a new ticket for any additional refactoring.

comment:11 Changed 10 years ago by sphery

(In [24806]) Fix Deleting recordings in MythWeb after the ProgramInfo? refactor. Fixes #8481. Refs #8406.

comment:12 Changed 10 years ago by sphery

(In [24808]) Fix program listings in MythWeb after ProgramInfo? refactor. Refs #8406.

comment:13 Changed 10 years ago by xris

(In [24853]) fix an index missed in [24701], refs #8406

Note: See TracTickets for help on using tickets.