Ticket #5566: mythmusic-uninit.2.patch

File mythmusic-uninit.2.patch, 7.6 KB (added by Erik Hovland <erik@…>, 16 years ago)

some more classes with ctor initialization issues (especially Decoder classes)

  • mythplugins/mythmusic/mythmusic/avfdecoder.cpp

    Fixes initialization defects in mythmusic
    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     mythplugins/mythmusic/mythmusic/avfdecoder.cpp    |   44 ++++++++++-----------
     mythplugins/mythmusic/mythmusic/cddecoder.cpp     |   44 +++++++++++----------
     mythplugins/mythmusic/mythmusic/cdrip.cpp         |   11 ++---
     mythplugins/mythmusic/mythmusic/cdrip.h           |    6 ++-
     mythplugins/mythmusic/mythmusic/flacdecoder.cpp   |   31 ++++++---------
     mythplugins/mythmusic/mythmusic/vorbisdecoder.cpp |   27 +++++--------
     6 files changed, 74 insertions(+), 89 deletions(-)
    
    diff --git a/mythplugins/mythmusic/mythmusic/avfdecoder.cpp b/mythplugins/mythmusic/mythmusic/avfdecoder.cpp
    index eb047b7..d68f2fe 100644
    a b using namespace std; 
    3333
    3434avfDecoder::avfDecoder(const QString &file, DecoderFactory *d, QIODevice *i,
    3535                       AudioOutput *o)
    36           : Decoder(d, i, o)
     36    : Decoder(d, i, o),
     37      inited(false),   user_stop(false),
     38      stat(0),         output_buf(NULL),
     39      output_bytes(0), output_at(0),
     40      bks(0),          done(false),
     41      finish(false),   len(0),
     42      freq(0),         bitrate(0),
     43      chan(0),         output_size(0),
     44      totalTime(0.0),  seekTime(-1.0),
     45      devicename(""),  start(0),
     46      end(0),          fmt(0),
     47      ifmt(NULL),      ap(&params),
     48      oc(NULL),        ic(NULL),
     49      enc_st(NULL),    dec_st(NULL),
     50      codec(NULL),     enc_codec(NULL),
     51      audio_enc(NULL), audio_dec(NULL),
     52      pkt(&pkt1),      errcode(0),
     53      ptr(NULL),       dec_len(0),
     54      data_size(0)
    3755{
    38     filename = file;
    39     inited = FALSE;
    40     user_stop = FALSE;
    41     stat = 0;
    42     bks = 0;
    43     done = FALSE;
    44     finish = FALSE;
    45     len = 0;
    46     freq = 0;
    47     bitrate = 0;
    48     seekTime = -1.0;
    49     totalTime = 0.0;
    50     chan = 0;
    51     output_buf = 0;
    52     output_bytes = 0;
    53     output_at = 0;
    54 
    55     ic = NULL;
    56     oc = NULL;
    57     ifmt = NULL;
    58     ap = &params;
    59     pkt = &pkt1;
     56    setFilename(file);
     57    bzero(samples, sizeof(samples));
    6058}
    6159
    6260avfDecoder::~avfDecoder(void)
  • mythplugins/mythmusic/mythmusic/cddecoder.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/cddecoder.cpp b/mythplugins/mythmusic/mythmusic/cddecoder.cpp
    index 2efc054..633aa73 100644
    a b using namespace std; 
    1717
    1818CdDecoder::CdDecoder(const QString &file, DecoderFactory *d, QIODevice *i,
    1919                     AudioOutput *o)
    20          : Decoder(d, i, o)
     20    : Decoder(d, i, o),
     21      inited(false),   user_stop(false),
     22      devicename(""),
     23#ifdef CONFIG_DARWIN
     24      m_diskID(0),     m_firstTrack(0),
     25      m_lastTrack(0),  m_leadout(0),
     26      m_lengthInSecs(0.0)
     27#endif
     28      stat(0),         output_buf(NULL),
     29      output_bytes(0), output_at(0),
     30      bks(0),          done(false),
     31      finish(false),   len(0),
     32      freq(0),         bitrate(0),
     33      chan(0),         output_size(0),
     34      totalTime(0.0),  seekTime(-1.0),
     35      settracknum(-1), tracknum(0),
     36#ifdef __linux__
     37      device(NULL),    paranoia(NULL),
     38#endif
     39      start(0),        end(0),
     40      curpos(0)
    2141{
    22     filename = file;
    23     inited = FALSE;
    24     user_stop = FALSE;
    25     stat = 0;
    26     bks = 0;
    27     done = FALSE;
    28     finish = FALSE;
    29     len = 0;
    30     freq = 0;
    31     bitrate = 0;
    32     seekTime = -1.0;
    33     totalTime = 0.0;
    34     chan = 0;
    35     output_buf = 0;
    36     output_bytes = 0;
    37     output_at = 0;
    38 
    39     device = NULL;
    40     paranoia = NULL;
    41 
    42     settracknum = -1;
     42    setFilename(file);
    4343}
    4444
    4545CdDecoder::~CdDecoder(void)
  • mythplugins/mythmusic/mythmusic/cdrip.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/cdrip.cpp b/mythplugins/mythmusic/mythmusic/cdrip.cpp
    index be8db23..96257bd 100644
    a b static void paranoia_cb(long inpos, int function) 
    114114
    115115CDRipperThread::CDRipperThread(RipStatus *parent,  QString device,
    116116                               vector<RipTrack*> *tracks, int quality)
     117    : m_parent(parent),   m_quit(false),
     118      m_CDdevice(device), m_quality(quality),
     119      m_tracks(tracks),   m_totalTracks(m_tracks->size()),
     120      m_totalSectors(0),  m_totalSectorsDone(0),
     121      m_lastTrackPct(0),  m_lastOverallPct(0)
    117122{
    118     m_parent = parent;
    119     m_tracks = tracks;
    120     m_quality = quality;
    121     m_quit = false;
    122     m_totalTracks = m_tracks->size();
    123     m_CDdevice = device;
    124123}
    125124
    126125CDRipperThread::~CDRipperThread(void)
  • mythplugins/mythmusic/mythmusic/cdrip.h

    diff --git a/mythplugins/mythmusic/mythmusic/cdrip.h b/mythplugins/mythmusic/mythmusic/cdrip.h
    index 9348413..9a4946f 100644
    a b class RipStatusEvent : public QEvent 
    162162        ST_ENCODER_ERROR
    163163    };
    164164
    165     RipStatusEvent(Type t, int val) : QEvent((QEvent::Type)t) { value=val; }
    166     RipStatusEvent(Type t, const QString &val) : QEvent((QEvent::Type)t) { text=val; }
     165    RipStatusEvent(Type t, int val)
     166        : QEvent((QEvent::Type)t), text(   ), value(val) {}
     167    RipStatusEvent(Type t, const QString &val)
     168        : QEvent((QEvent::Type)t), text(val), value( -1) {}
    167169    ~RipStatusEvent() {}
    168170
    169171    QString text;
  • mythplugins/mythmusic/mythmusic/flacdecoder.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/flacdecoder.cpp b/mythplugins/mythmusic/mythmusic/flacdecoder.cpp
    index c9fc835..6a515af 100644
    a b static void flacerror(const StreamDecoder *decoder, FLAC__StreamDecoderErrorStat 
    170170
    171171FlacDecoder::FlacDecoder(const QString &file, DecoderFactory *d, QIODevice *i,
    172172                         AudioOutput *o)
    173              : Decoder(d, i, o)
     173    : Decoder(d, i, o),
     174      inited(false), user_stop(false),
     175      stat(0), output_buf(NULL),
     176      output_bytes(0), output_at(0),
     177      decoder(NULL), bks(0),
     178      done(false), finish(false),
     179      len(0), freq(0),
     180      bitrate(0), chan(0),
     181      bitspersample(0),
     182      totalTime(0.0), seekTime(-1.0),
     183      totalsamples(0)
    174184{
    175     filename = file;
    176     inited = FALSE;
    177     user_stop = FALSE;
    178     stat = 0;
    179     output_buf = 0;
    180     output_bytes = 0;
    181     output_at = 0;
    182     bks = 0;
    183     done = FALSE;
    184     finish = FALSE;
    185     len = 0;
    186     freq = 0;
    187     bitrate = 0;
    188     seekTime = -1.0;
    189     totalTime = 0.0;
    190     chan = 0;
    191 
    192     decoder = 0;
     185    setFilename(file);
    193186}
    194187
    195188FlacDecoder::~FlacDecoder(void)
  • mythplugins/mythmusic/mythmusic/vorbisdecoder.cpp

    diff --git a/mythplugins/mythmusic/mythmusic/vorbisdecoder.cpp b/mythplugins/mythmusic/mythmusic/vorbisdecoder.cpp
    index 63b8daf..9b0de80 100644
    a b static long oggtell(void *src) 
    6767
    6868VorbisDecoder::VorbisDecoder(const QString &file, DecoderFactory *d,
    6969                             QIODevice *i, AudioOutput *o)
    70              : Decoder(d, i, o)
     70    : Decoder(d, i, o),
     71      inited(false),   user_stop(false),
     72      stat(0),         output_buf(NULL),
     73      output_bytes(0), output_at(0),
     74      bks(0),          done(false),
     75      finish(false),   len(0),
     76      freq(0),         bitrate(0),
     77      chan(0),         output_size(0),
     78      totalTime(0.0),  seekTime(-1.0)
    7179{
    72     filename = file;
    73     inited = FALSE;
    74     user_stop = FALSE;
    75     stat = 0;
    76     output_buf = 0;
    77     output_bytes = 0;
    78     output_at = 0;
    79     bks = 0;
    80     done = FALSE;
    81     finish = FALSE;
    82     len = 0;
    83     freq = 0;
    84     bitrate = 0;
    85     seekTime = -1.0;
    86     totalTime = 0.0;
    87     chan = 0;
     80    setFilename(file);
    8881}
    8982
    9083VorbisDecoder::~VorbisDecoder(void)