Compile Crash with Unknown Cause

Trying to compile a patch to MythTV, but it's giving a crash I don't understand.:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 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


As I can't attach it, here is r5000channel.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
 *  R5000Channel
 *  Copyright (c) 2008 by Alan Nisota
 *  Copyright (c) 2005 by Jim Westfall and Dave Abrahams
 *  Distributed as part of MythTV 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_ 



Any guidance is appreciated.
Last edited on

r5000channel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/**
 *  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;
}

Anyone here?
Well, the only thing which I can get from that is this error, where usleep is not found. How to solve it I don't know. Perhaps that function is declared in a particular file which has not been included.
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);
Last edited on
Thanks, searching on usleep I found in the man page I needed to add #include <unistd.h>
Topic archived. No new replies allowed.