试图将旧补丁编译为新版本的MythTV。此修补程序是为了添加R5000支持,这是一种特殊的USB硬件记录器。我不明白这里出了什么问题:

...
cache g++ -c -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -march=core2 -DNDEBUG -fomit-frame-pointer -fPIC -pthread -g -Wall -Wpointer-arith -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -fvisibility-inlines-hidden -Wmissing-declarations -Wno-switch -Woverloaded-virtual -funit-at-a-time -I/usr/include/freetype2 -fvisibility=hidden -D_REENTRANT -fPIC -DQT_WEBKIT -DMMX -Dusing_libcec -D_GNU_SOURCE -DUSING_LIBCRYPTO -DUSING_CRYSTALHD -DUSING_LIBASS -DFFTW3_SUPPORT -DUSING_X11 -DUSING_XV -DUSING_VDPAU -DUSING_OPENGL -DUSING_OPENGL_VIDEO -DUSING_VAAPI -DUSING_GLVAAPI -DUSING_AIRPLAY -DUSING_MHEG -DUSING_FRONTEND -DUSING_FFMPEG_THREADS -DUSING_ALSA -DUSING_V4L2 -DUSING_IPTV -DUSING_IVTV -DUSING_DVB -DUSING_R5000 -DUSING_BACKEND -DMTV_API -DQT_SQL_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/local -I/usr/include/libxml2 -I../../external/qjson/include -I../../external/zeromq/include -I../../external/nzmqt/include/nzmqt -I.. -I../.. -I../../external/FFmpeg -I. -I../libmyth -I../libmyth/audio -I../libmythbase -I../libmythdvdnav -Impeg -Ichannelscan -Ivisualisations -Irecorders -Irecorders/dvbdev -Irecorders/rtp -Irecorders/vbitext -Irecorders/HLS -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../libmythbase -I../libmythui -I../libmythupnp -I../libmythservicecontracts -I/usr/include -I../libmythdvdnav -I../../external/libmythbluray -I/usr/X11R6/include -I. -o dvbci.o recorders/dvbdev/dvbci.cpp
ccache g++ -c -m64 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -march=core2 -DNDEBUG -fomit-frame-pointer -fPIC -pthread -g -Wall -Wpointer-arith -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -fvisibility-inlines-hidden -Wmissing-declarations -Wno-switch -Woverloaded-virtual -funit-at-a-time -I/usr/include/freetype2 -fvisibility=hidden -D_REENTRANT -fPIC -DQT_WEBKIT -DMMX -Dusing_libcec -D_GNU_SOURCE -DUSING_LIBCRYPTO -DUSING_CRYSTALHD -DUSING_LIBASS -DFFTW3_SUPPORT -DUSING_X11 -DUSING_XV -DUSING_VDPAU -DUSING_OPENGL -DUSING_OPENGL_VIDEO -DUSING_VAAPI -DUSING_GLVAAPI -DUSING_AIRPLAY -DUSING_MHEG -DUSING_FRONTEND -DUSING_FFMPEG_THREADS -DUSING_ALSA -DUSING_V4L2 -DUSING_IPTV -DUSING_IVTV -DUSING_DVB -DUSING_R5000 -DUSING_BACKEND -DMTV_API -DQT_SQL_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/local -I/usr/include/libxml2 -I../../external/qjson/include -I../../external/zeromq/include -I../../external/nzmqt/include/nzmqt -I.. -I../.. -I../../external/FFmpeg -I. -I../libmyth -I../libmyth/audio -I../libmythbase -I../libmythdvdnav -Impeg -Ichannelscan -Ivisualisations -Irecorders -Irecorders/dvbdev -Irecorders/rtp -Irecorders/vbitext -Irecorders/HLS -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../libmythbase -I../libmythui -I../libmythupnp -I../libmythservicecontracts -I/usr/include -I../libmythdvdnav -I../../external/libmythbluray -I/usr/X11R6/include -I. -o r5000channel.o recorders/r5000channel.cpp
In file included from recorders/r5000channel.h:12:0,
             from recorders/r5000channel.cpp:10:
recorders/dtvchannel.h:53:18: warning: ‘virtual bool DTVChannel::Tune(const     IPTVTuningData&)’ was hidden [-Woverloaded-virtual]
 virtual bool Tune(const IPTVTuningData&) { return false; }
              ^
In file included from recorders/r5000channel.cpp:10:0:
recorders/r5000channel.h:28:18: warning:   by ‘virtual bool R5000Channel::Tune(const DTVMultiplex&, QString)’ [-Woverloaded-virtual]
 virtual bool Tune(const DTVMultiplex &/*tuning*/, QString /*inputname*/)
              ^
In file included from recorders/r5000channel.h:12:0,
             from recorders/r5000channel.cpp:10:
recorders/dtvchannel.h:65:18: warning: ‘virtual bool DTVChannel::Tune(const QString&, int)’ was hidden [-Woverloaded-virtual]
 virtual bool Tune(const QString &freqid, int finetune)
              ^
In file included from recorders/r5000channel.cpp:10:0:
recorders/r5000channel.h:28:18: warning:   by ‘virtual bool R5000Channel::Tune(const     DTVMultiplex&, QString)’ [-Woverloaded-virtual]
 virtual bool Tune(const DTVMultiplex &/*tuning*/, QString /*inputname*/)
              ^
In file included from recorders/r5000channel.h:12:0,
             from recorders/r5000channel.cpp:10:
recorders/dtvchannel.h:71:18: warning: ‘virtual bool DTVChannel::Tune(uint64_t, QString)’ was hidden [-Woverloaded-virtual]
 virtual bool Tune(uint64_t frequency, QString inputname)
              ^
In file included from recorders/r5000channel.cpp:10:0:
recorders/r5000channel.h:28:18: warning:   by ‘virtual bool R5000Channel::Tune(const     DTVMultiplex&, QString)’ [-Woverloaded-virtual]
 virtual bool Tune(const DTVMultiplex &/*tuning*/, QString /*inputname*/)
              ^
recorders/r5000channel.cpp: In member function ‘virtual bool         R5000Channel::SetChannelByString(const QString&)’:
recorders/r5000channel.cpp:90:39: error: ‘usleep’ was not declared in this scope
         usleep(tuning_delay * 1000);
                                   ^
make[2]: *** [r5000channel.o] Error 1
make[2]: Leaving directory `/usr/local/src/mythtv.0.27.patched-Nov13/mythtv/libs/libmythtv'
make[1]: *** [sub-libmythtv-make_default] Error 2
make[1]: Leaving directory `/usr/local/src/mythtv.0.27.patched-Nov13/mythtv/libs'
make: *** [libs] Error 2
#


这是r5000channel.h:

/**
*  R5000Channel
*  Copyright (c) 2008 by Alan Nisota
*  Copyright (c) 2005 by Jim Westfall and Dave Abrahams
*  Distributed under GPL v2 and later.
*/

#ifndef _R5000CHANNEL_H_
#define _R5000CHANNEL_H_

#include "tv_rec.h"
#include "dtvchannel.h"
#include "r5000device.h"

class R5000Channel : public DTVChannel
{
public:
R5000Channel(TVRec *parent, const QString &videodevice,
                const QString &_r5ktype, bool pocc);
~R5000Channel() { Close(); }

// Commands
virtual bool Open(void);
virtual void Close(void);

virtual bool TuneMultiplex(uint /*mplexid*/, QString /*inputname*/)
    { return false; }
virtual bool Tune(const DTVMultiplex &/*tuning*/, QString /*inputname*/)
    { return false; }
virtual bool Retune(void);

// Sets
virtual bool SetChannelByString(const QString &chan);
virtual bool SetChannelByNumber(const QString &channel, int mpeg_prog);
virtual bool SetPowerState(bool on);
void SetSlowTuning(uint how_slow_in_ms)
    { tuning_delay = how_slow_in_ms; }

// Gets
virtual bool IsOpen(void) const { return isopen; }
virtual R5000Device::PowerState GetPowerState(void) const;
virtual QString GetDevice(void) const;
virtual R5000Device *GetR5000Device(void) { return device; }

  protected:
QString            videodevice;
FireWireDBOptions  fw_opts;
bool               power_on_channel_change;
R5000Device        *device;
QString            current_channel;
uint               current_mpeg_prog;
bool               isopen;
uint               tuning_delay;///< Extra delay to add
};

#endif // _R5000CHANNEL_H_


这是r5000channel.cpp:

/**
*  R5000Channel
*  Copyright (c) 2005 by Jim Westfall, Dave Abrahams
*  Copyright (c) 2006 by Daniel Kristjansson
*  Distributed as part of MythTV under GPL v2 and later.
*/

#include "mythcontext.h"
#include "tv_rec.h"
#include "r5000channel.h"

#define LOC QString("R5kChan(%1): ").arg(GetDevice())
#define LOC_WARN QString("R5kChan(%1), Warning: ").arg(GetDevice())
#define LOC_ERR QString("R5kChan(%1), Error: ").arg(GetDevice())

R5000Channel::R5000Channel(TVRec *parent, const QString &_videodevice,const QString &_r5ktype, bool pocc) :
DTVChannel(parent),
videodevice(_videodevice),
power_on_channel_change(pocc),
device(NULL),
current_channel(""),
current_mpeg_prog(0),
isopen(false),
tuning_delay(0)
{
int type = R5000Device::GetDeviceType(_r5ktype);
device = new R5000Device(type, videodevice);

InitializeInputs();
}

bool R5000Channel::SetChannelByString(const QString &channum)
{
QString loc = LOC + QString("SetChannelByString(%1)").arg(channum);
bool ok = false;
LOG(VB_CHANNEL, LOG_DEBUG, LOC);

InputMap::const_iterator it = m_inputs.find(m_currentInputID);
if (it == m_inputs.end())
    return false;

QString tvformat, modulation, freqtable, freqid, dtv_si_std;
int finetune;
uint64_t frequency;
int mpeg_prog_num;
uint atsc_major, atsc_minor, mplexid, tsid, netid;
if (!ChannelUtil::GetChannelData(
    (*it)->sourceid, channum,
    tvformat, modulation, freqtable, freqid,
    finetune, frequency,
    dtv_si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
    mplexid, m_commfree))
{
    LOG(VB_GENERAL, LOG_DEBUG, LOC + " " + QString(
                "Requested channel '%1' is on input '%2' "
                "which is in a busy input group")
            .arg(channum).arg(m_currentInputID));

    return false;
}
uint mplexid_restriction;
if (!IsInputAvailable(m_currentInputID, mplexid_restriction))
{
    LOG(VB_GENERAL, LOG_DEBUG, LOC + " " + QString(
                "Requested channel '%1' is on input '%2' "
                "which is in a busy input group")
            .arg(channum).arg(m_currentInputID));

    return false;
}

if (!(*it)->externalChanger.isEmpty())
{
    ok = ChangeExternalChannel((*it)->externalChanger, freqid);
    // -1 resets any state without executing a channel change
    device->SetChannel(fw_opts.model, 0, mpeg_prog_num);
    SetSIStandard("mpeg");
    SetDTVInfo(0,0,0,0,1);
}
else
{
    ok = isopen && SetChannelByNumber(freqid, mpeg_prog_num);
}

if (ok)
{
    if (tuning_delay) {
        LOG(VB_CHANNEL, LOG_DEBUG, LOC + " " + QString(
                "Adding additional delay: %1ms").arg(tuning_delay));
        usleep(tuning_delay * 1000);
    }
    // Set the current channum to the new channel's channum
    QString tmp = channum;
    tmp.detach();
    m_curchannelname = tmp;
    tmp.detach();
    (*it)->startChanNum = tmp;
}

LOG(VB_CHANNEL, LOG_DEBUG, LOC + " " + ((ok) ? "success" : "failure"));

return ok;
}

bool R5000Channel::Open(void)
{
LOG(VB_CHANNEL, LOG_DEBUG, LOC + "Open()");

if (m_inputs.find(m_currentInputID) == m_inputs.end())
    return false;

if (!device)
    return false;

if (isopen)
    return true;

if (!device->OpenPort())
    return false;

isopen = true;

return true;
}

void R5000Channel::Close(void)
{
LOG(VB_CHANNEL, LOG_DEBUG, LOC + "Close()");
if (isopen)
{
    device->ClosePort();
    isopen = false;
}
}

QString R5000Channel::GetDevice(void) const
{
return videodevice;
}

bool R5000Channel::SetPowerState(bool on)
{
if (!isopen)
{
    LOG(VB_GENERAL, LOG_DEBUG, LOC_ERR +
            "SetPowerState() called on closed R5000Channel.");

    return false;
}
if (power_on_channel_change)
    return R5000Device::kAVCPowerOn;

return device->SetPowerState(on);
}

R5000Device::PowerState R5000Channel::GetPowerState(void) const
{
if (!isopen)
{
    LOG(VB_GENERAL, LOG_DEBUG, LOC_ERR +
            "GetPowerState() called on closed R5000Channel.");

    return R5000Device::kAVCPowerQueryFailed;
}

if (power_on_channel_change)
    return R5000Device::kAVCPowerOn;

return device->GetPowerState();
}

bool R5000Channel::Retune(void)
{
LOG(VB_CHANNEL, LOG_DEBUG, LOC + "Retune()");

if (! power_on_channel_change && R5000Device::kAVCPowerOff == GetPowerState())
{
    LOG(VB_GENERAL, LOG_DEBUG, LOC_ERR +
            "STB is turned off, must be on to retune.");

    return false;
}

if (current_channel.length())
    return SetChannelByNumber(current_channel, current_mpeg_prog);

return false;
}

bool R5000Channel::SetChannelByNumber(const QString &channel, int mpeg_prog)
{
LOG(VB_CHANNEL, LOG_DEBUG, QString("SetChannelByNumber(%1)").arg(channel));
current_channel = channel;
current_mpeg_prog = mpeg_prog;

if (! power_on_channel_change && R5000Device::kAVCPowerOff == GetPowerState())
{
    LOG(VB_GENERAL, LOG_DEBUG, LOC_WARN +
            "STB is turned off, must be on to set channel.");

    SetSIStandard("mpeg");
    SetDTVInfo(0,0,0,0,1);

    return true; // signal monitor will call retune later...
}

QString tmpchan = (power_on_channel_change ? "P" : "") + channel;
if (! device->SetChannel(fw_opts.model, tmpchan, mpeg_prog))
    return false;

SetSIStandard("mpeg");
SetDTVInfo(0,0,0,0,1);

return true;
}

最佳答案

错误消息很清楚:


  错误:在此范围内未声明“ usleep”


如果您在Google上搜索“ usleep”,则会发现此man page告诉您:

#include <unistd.h>

关于c++ - C++编译原因不明的崩溃-MythTV补丁,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20200667/

10-11 16:55