Skip to content

Commit

Permalink
Merge branch 'master' into mythtv-rec2
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kristjansson committed Jul 28, 2011
2 parents fcce6b6 + 82d4f5e commit 16afdc6
Show file tree
Hide file tree
Showing 29 changed files with 127 additions and 20 deletions.
1 change: 1 addition & 0 deletions mythplugins/mythgallery/mythgallery/main.cpp
Expand Up @@ -20,6 +20,7 @@
#ifdef DCRAW_SUPPORT
Q_IMPORT_PLUGIN(dcrawplugin)
#endif // DCRAW_SUPPORT
void runRandomSlideshow(void);

static int run(MythMediaDevice *dev = NULL, bool startRandomShow = false)
{
Expand Down
31 changes: 28 additions & 3 deletions mythplugins/mythmusic/mythmusic/musicplayer.cpp
Expand Up @@ -271,7 +271,10 @@ void MusicPlayer::play(void)


if (!m_output)
openOutputDevice();
{
if (!openOutputDevice())
return;
}

if (!getDecoderHandler())
setupDecoderHandler();
Expand All @@ -297,7 +300,7 @@ void MusicPlayer::stopDecoder(void)
m_currentMetadata = NULL;
}

void MusicPlayer::openOutputDevice(void)
bool MusicPlayer::openOutputDevice(void)
{
QString adevice, pdevice;

Expand All @@ -309,12 +312,32 @@ void MusicPlayer::openOutputDevice(void)
pdevice = gCoreContext->GetNumSetting("PassThruDeviceOverride", false) ?
gCoreContext->GetSetting("PassThruOutputDevice") : "auto";

// TODO: Error checking that device is opened correctly!
m_output = AudioOutput::OpenAudio(
adevice, pdevice, FORMAT_S16, 2, 0, 44100,
AUDIOOUTPUT_MUSIC, true, false,
gCoreContext->GetNumSetting("MusicDefaultUpmix", 0) + 1);

if (!m_output)
{
LOG(VB_GENERAL, LOG_ERR,
QString("MusicPlayer: Cannot open audio output device: %1").arg(adevice));

return false;
}

if (!m_output->GetError().isEmpty())
{
LOG(VB_GENERAL, LOG_ERR,
QString("MusicPlayer: Cannot open audio output device: %1").arg(adevice));
LOG(VB_GENERAL, LOG_ERR,
QString("Error was: %1").arg(m_output->GetError()));

delete m_output;
m_output = NULL;

return false;
}

m_output->setBufferSize(256 * 1024);

m_output->addListener(this);
Expand All @@ -333,6 +356,8 @@ void MusicPlayer::openOutputDevice(void)
{
m_output->addListener(*it);
}

return true;
}

void MusicPlayer::next(void)
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/musicplayer.h
Expand Up @@ -167,7 +167,7 @@ class MusicPlayer : public QObject, public MythObservable

private:
void stopDecoder(void);
void openOutputDevice(void);
bool openOutputDevice(void);
QString getFilenameFromID(int id);
void updateLastplay(void);
void sendVolumeChangedEvent(void);
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmyth/mythmediamonitor.h
Expand Up @@ -24,6 +24,7 @@ class MonitorThread : public QThread
{
public:
MonitorThread(MediaMonitor* pMon, unsigned long interval);
~MonitorThread() { wait(); m_Monitor = NULL; }
void setMonitor(MediaMonitor* pMon) { m_Monitor = pMon; }
virtual void run(void);

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmyth/netgrabbermanager.cpp
Expand Up @@ -40,6 +40,7 @@ GrabberScript::GrabberScript(const QString& title, const QString& image,

GrabberScript::~GrabberScript()
{
wait();
}

void GrabberScript::run()
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbase/libmythbase.pro
Expand Up @@ -15,7 +15,7 @@ HEADERS += mythbaseexp.h mythdbcon.h mythdb.h mythdbparams.h oldsettings.h
HEADERS += verbosedefs.h mythversion.h compat.h mythconfig.h
HEADERS += mythobservable.h mythevent.h httpcomms.h mcodecs.h
HEADERS += mythtimer.h mythsignalingtimer.h mythdirs.h exitcodes.h
HEADERS += lcddevice.h mythstorage.h remotefile.h logging.h loggingdefs.h
HEADERS += lcddevice.h mythstorage.h remotefile.h logging.h
HEADERS += mythcorecontext.h mythsystem.h mythlocale.h storagegroup.h
HEADERS += mythcoreutil.h mythdownloadmanager.h mythtranslation.h
HEADERS += unzip.h unzip_p.h zipentry_p.h iso639.h iso3166.h mythmedia.h
Expand Down Expand Up @@ -55,7 +55,7 @@ inc.files += compat.h mythversion.h mythconfig.h mythconfig.mak version.h
inc.files += mythobservable.h mythevent.h httpcomms.h mcodecs.h verbosedefs.h
inc.files += mythtimer.h lcddevice.h exitcodes.h mythdirs.h mythstorage.h
inc.files += mythsocket.h mythsocket_cb.h msocketdevice.h mythlogging.h
inc.files += mythcorecontext.h mythsystem.h storagegroup.h loggingdefs.h
inc.files += mythcorecontext.h mythsystem.h storagegroup.h
inc.files += mythcoreutil.h mythlocale.h mythdownloadmanager.h
inc.files += mythtranslation.h iso639.h iso3166.h mythmedia.h util.h
inc.files += mythcdrom.h autodeletedeque.h dbutil.h mythhttppool.h mythdeque.h
Expand Down
5 changes: 2 additions & 3 deletions mythtv/libs/libmythbase/logging.cpp
Expand Up @@ -228,7 +228,6 @@ bool FileLogger::logmsg(LoggingItem_t *item)
char line[MAX_STRING_LENGTH];
char usPart[9];
char timestamp[TIMESTAMP_MAX];
int length;
char *threadName = NULL;
pid_t pid = getpid();
pid_t tid = 0;
Expand All @@ -240,8 +239,6 @@ bool FileLogger::logmsg(LoggingItem_t *item)
(const struct tm *)&item->tm );
snprintf( usPart, 9, ".%06d", (int)(item->usec) );
strcat( timestamp, usPart );
length = strlen( timestamp );

char shortname;

{
Expand Down Expand Up @@ -970,6 +967,8 @@ void logStart(QString logfile, int progress, int quiet, int facility,
sigaction( SIGHUP, &sa, NULL );
#endif

(void)logger;

logThread.start();
}

Expand Down
9 changes: 5 additions & 4 deletions mythtv/libs/libmythbase/mythcommandlineparser.cpp
Expand Up @@ -892,11 +892,12 @@ void MythCommandLineParser::addVersion(void)
void MythCommandLineParser::addWindowed(bool def)
{
if (def)
add(QStringList( QStringList() << "-nw" << "--no-windowed" ), false,
"notwindowed", "Prevent application from running in window.", "");
add(QStringList( QStringList() << "-nw" << "--no-windowed" ),
"notwindowed", false,
"Prevent application from running in window.", "");
else
add(QStringList( QStringList() << "-w" << "--windowed" ), false,
"windowed", "Force application to run in a window.", "");
add(QStringList( QStringList() << "-w" << "--windowed" ), "windowed",
false, "Force application to run in a window.", "");
}

void MythCommandLineParser::addDaemon(void)
Expand Down
4 changes: 4 additions & 0 deletions mythtv/libs/libmythbase/mythdbcon.cpp
Expand Up @@ -71,6 +71,10 @@ MSqlDatabase::MSqlDatabase(const QString &name)
LOG(VB_GENERAL, LOG_ERR, "Unable to init db connection.");
return;
}
QString connectOptions("MYSQL_OPT_RECONNECT=1");
LOG(VB_GENERAL, LOG_DEBUG, QString("Setting connect options: %1")
.arg(connectOptions));
m_db.setConnectOptions(connectOptions);
m_lastDBKick = QDateTime::currentDateTime().addSecs(-60);
}

Expand Down
9 changes: 5 additions & 4 deletions mythtv/libs/libmythbase/mythdownloadmanager.cpp
Expand Up @@ -665,6 +665,7 @@ bool MythDownloadManager::downloadNow(MythDownloadInfo *dlInfo, bool deleteInfo)

if (!dlInfo->m_done)
{
dlInfo->m_data = NULL; // Prevent downloadFinished() from updating
dlInfo->m_syncMode = false; // Let downloadFinished() cleanup for us
if ((dlInfo->m_reply) &&
(dlInfo->m_errorCode == QNetworkReply::NoError))
Expand Down Expand Up @@ -713,8 +714,8 @@ void MythDownloadManager::downloadError(QNetworkReply::NetworkError errorCode)
{
QNetworkReply *reply = (QNetworkReply*)sender();

LOG(VB_FILE, LOG_DEBUG, LOC + QString("downloadError(%1) (for reply %2)")
.arg(errorCode).arg((long long)reply));
LOG(VB_FILE, LOG_DEBUG, LOC + QString("downloadError %1 ")
.arg(errorCode) + reply->errorString() );

QMutexLocker locker(m_infoLock);
if (!m_downloadReplies.contains(reply))
Expand Down Expand Up @@ -891,8 +892,8 @@ void MythDownloadManager::downloadFinished(MythDownloadInfo *dlInfo)
args << dlInfo->m_url;
args << dlInfo->m_outFile;
args << QString::number(dlInfo->m_bytesTotal);
args << QString(); // placeholder for error string
args << QString::number((int)dlInfo->m_errorCode);
args << (reply ? reply->errorString() : QString()); // placeholder for error string
args << QString::number((int)(reply ? reply->error() : dlInfo->m_errorCode));

QCoreApplication::postEvent(dlInfo->m_caller,
new MythEvent("DOWNLOAD_FILE FINISHED", args));
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythbase/mythsignalingtimer.cpp
Expand Up @@ -31,6 +31,7 @@ MythSignalingTimer::MythSignalingTimer(
MythSignalingTimer::~MythSignalingTimer()
{
stop();
wait();
}

void MythSignalingTimer::start(int msec)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythbase/mythsocketthread.h
Expand Up @@ -15,6 +15,7 @@ class MythSocketThread : public QThread
{
public:
MythSocketThread();
virtual ~MythSocketThread() { wait(); }

virtual void run(void);

Expand Down
3 changes: 3 additions & 0 deletions mythtv/libs/libmythbase/storagegroup.cpp
Expand Up @@ -50,6 +50,9 @@ StorageGroup::StorageGroup(const QString group, const QString hostname,
m_hostname.detach();
m_dirlist.clear();

if (getenv("MYTHTV_NOSGFALLBACK"))
m_allowFallback = false;

Init(m_groupname, m_hostname, m_allowFallback);
}

Expand Down
3 changes: 3 additions & 0 deletions mythtv/libs/libmythbase/system-unix.h
Expand Up @@ -24,6 +24,7 @@ class MythSystemIOHandler: public QThread
{
public:
MythSystemIOHandler(bool read);
~MythSystemIOHandler() { wait(); }
void run(void);

void insert(int fd, QBuffer *buff);
Expand All @@ -49,6 +50,7 @@ class MythSystemManager : public QThread
{
public:
MythSystemManager();
~MythSystemManager() { wait(); }
void run(void);
void append(MythSystemUnix *);
void jumpAbort(void);
Expand All @@ -63,6 +65,7 @@ class MythSystemSignalManager : public QThread
{
public:
MythSystemSignalManager();
~MythSystemSignalManager() { wait(); }
void run(void);
private:
};
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythbase/system-windows.cpp
Expand Up @@ -215,6 +215,7 @@ MythSystemManager::~MythSystemManager()
{
if (m_children)
free( m_children );
wait();
}

void MythSystemManager::run(void)
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythbase/system-windows.h
Expand Up @@ -22,6 +22,7 @@ class MythSystemIOHandler: public QThread
{
public:
MythSystemIOHandler(bool read);
~MythSystemIOHandler() { wait(); }
void run(void);

void insert(HANDLE h, QBuffer *buff);
Expand Down Expand Up @@ -65,6 +66,7 @@ class MythSystemSignalManager : public QThread
{
public:
MythSystemSignalManager();
~MythSystemSignalManager() { wait(); }
void run(void);
private:
};
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -87,6 +87,7 @@ class DecoderThread : public QThread
public:
DecoderThread(MythPlayer *mp, bool start_paused)
: QThread(NULL), m_mp(mp), m_start_paused(start_paused) { }
~DecoderThread() { wait(); }

protected:
virtual void run(void);
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/previewgenerator.cpp
Expand Up @@ -78,6 +78,7 @@ PreviewGenerator::PreviewGenerator(const ProgramInfo *pginfo,
PreviewGenerator::~PreviewGenerator()
{
TeardownAll();
wait();
}

void PreviewGenerator::SetOutputFilename(const QString &fileName)
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/previewgeneratorqueue.cpp
Expand Up @@ -55,6 +55,8 @@ PreviewGeneratorQueue::~PreviewGeneratorQueue()
if ((*it).gen)
(*it).gen->deleteLater();
}
locker.unlock();
wait();
}

void PreviewGeneratorQueue::run(void)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recordingrule.cpp
Expand Up @@ -16,8 +16,8 @@
RecordingRule::RecordingRule()
: m_recordID(-1), m_parentRecID(0),
m_isInactive(false),
m_episode(0),
m_season(0),
m_episode(0),
m_starttime(QTime::currentTime()),
m_startdate(QDate::currentDate()),
m_endtime(QTime::currentTime()),
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/ringbuffer.cpp
Expand Up @@ -235,6 +235,8 @@ RingBuffer::~RingBuffer(void)
}

rwlock.unlock();

wait();
}

/** \fn RingBuffer::Reset(bool, bool, bool)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/signalmonitor.cpp
Expand Up @@ -200,6 +200,7 @@ SignalMonitor::SignalMonitor(int _capturecardnum, ChannelBase *_channel,
SignalMonitor::~SignalMonitor()
{
Stop();
wait();
}

void SignalMonitor::AddFlags(uint64_t _flags)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -8402,7 +8402,7 @@ void TV::customEvent(QEvent *e)

PlayerContext *mctx = GetPlayerReadLock(0, __FILE__, __LINE__);
OSD *osd = GetOSDLock(mctx);
if (osd && osd->IsWindowVisible("program_info"))
if (osd && !osd->IsWindowVisible(OSD_WIN_INTERACT))
{
for (uint i = 0; mctx && (i < player.size()); i++)
{
Expand Down
3 changes: 3 additions & 0 deletions mythtv/programs/mythbackend/config_backend_general.xml
Expand Up @@ -296,6 +296,9 @@
<option display="30" data="30" />
<option display="60" data="60" />
<option display="120" data="120" />
<option display="180" data="180" />
<option display="240" data="240" />
<option display="300" data="300" />
</setting>
<setting data_type="select" value="StartupSecsBeforeRecording"
label="Startup before recording (seconds)"
Expand Down
3 changes: 3 additions & 0 deletions mythtv/programs/mythbackend/scheduler.cpp
Expand Up @@ -134,6 +134,9 @@ Scheduler::~Scheduler()
delete worklist.back();
worklist.pop_back();
}

locker.unlock();
wait();
}

void Scheduler::SetMainServer(MainServer *ms)
Expand Down
1 change: 1 addition & 0 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Expand Up @@ -1281,6 +1281,7 @@ static HostComboBox *PlayBoxEpisodeSort()
HostComboBox *gc = new HostComboBox("PlayBoxEpisodeSort");
gc->setLabel(QObject::tr("Sort episodes"));
gc->addSelection(QObject::tr("Record date"), "Date");
gc->addSelection(QObject::tr("Season/Episode"), "Season");
gc->addSelection(QObject::tr("Original air date"), "OrigAirDate");
gc->addSelection(QObject::tr("Program ID"), "Id");
gc->setHelpText(QObject::tr("Selects how to sort a shows episodes"));
Expand Down
3 changes: 3 additions & 0 deletions mythtv/programs/mythfrontend/main.cpp
Expand Up @@ -1257,6 +1257,8 @@ static void setDebugShowNames(void)
GetMythMainWindow()->GetMainStack()->GetTopScreen()->SetRedraw();
}

// If adding a new jump point, remember to also add a line to clear it in
// ReloadJumpPoints(), below
static void InitJumpPoints(void)
{
REG_JUMP(QT_TRANSLATE_NOOP("MythControls", "Reload Theme"),
Expand Down Expand Up @@ -1340,6 +1342,7 @@ static void ReloadJumpPoints(void)
mainWindow->ClearJump("Play Disc");
mainWindow->ClearJump("Toggle Show Widget Borders");
mainWindow->ClearJump("Toggle Show Widget Names");
mainWindow->ClearJump("Reset All Keys");
InitJumpPoints();
}

Expand Down

0 comments on commit 16afdc6

Please sign in to comment.