Attempts to fix any defects found in mythmusic
From: Erik Hovland <erik@hovland.org>
---
mythplugins/mythmusic/mythmusic/bumpscope.cpp | 37 ++++++++----------
mythplugins/mythmusic/mythmusic/filescanner.cpp | 1
mythplugins/mythmusic/mythmusic/goom/mythgoom.cpp | 8 +---
.../mythmusic/mythmusic/libvisualplugin.cpp | 25 +++++-------
mythplugins/mythmusic/mythmusic/libvisualplugin.h | 4 +-
mythplugins/mythmusic/mythmusic/main.cpp | 1
mythplugins/mythmusic/mythmusic/mainvisual.cpp | 13 ++----
mythplugins/mythmusic/mythmusic/mainvisual.h | 2 -
mythplugins/mythmusic/mythmusic/playlist.cpp | 10 ++---
mythplugins/mythmusic/mythmusic/synaesthesia.cpp | 20 ++++------
mythplugins/mythmusic/mythmusic/visualize.cpp | 41 ++++++--------------
mythplugins/mythmusic/mythmusic/visualize.h | 3 +
12 files changed, 67 insertions(+), 98 deletions(-)
diff --git a/mythplugins/mythmusic/mythmusic/bumpscope.cpp b/mythplugins/mythmusic/mythmusic/bumpscope.cpp
index eeba733..00be273 100644
a
|
b
|
|
19 | 19 | using namespace std; |
20 | 20 | |
21 | 21 | BumpScope::BumpScope(long int winid) |
| 22 | : VisualBase(15), surface(NULL) |
| 23 | , m_color(0x7ACCFF) |
| 24 | , m_x(0), m_y(0) |
| 25 | , m_width(800), m_height(600) |
| 26 | , m_phongrad(800), color_cycle(true) |
| 27 | , moving_light(true), diamond(false) |
| 28 | , bpl(0), rgb_buf(NULL) |
| 29 | , iangle(0) |
| 30 | , ixo(0), iyo(0) |
| 31 | , ixd(0), iyd(0) |
| 32 | , ilx(0), ily(0) |
| 33 | , was_moving(0), was_color(0) |
| 34 | , ih(0.0f), is(0.0f) |
| 35 | , iv(0.0f), isd(0.0f) |
| 36 | , ihd(0), icolor(0) |
22 | 37 | { |
23 | | fps = 15; |
24 | | |
25 | | surface = NULL; |
26 | | |
| 38 | memset(intense1, 0, sizeof(intense1)); |
| 39 | memset(intense2, 0, sizeof(intense2)); |
27 | 40 | static char SDL_windowhack[32]; |
28 | 41 | sprintf(SDL_windowhack, "SDL_WINDOWID=%ld", winid); |
29 | 42 | putenv(SDL_windowhack); |
… |
… |
BumpScope::BumpScope(long int winid) |
35 | 48 | } |
36 | 49 | |
37 | 50 | SDL_ShowCursor(0); |
38 | | |
39 | | rgb_buf = NULL; |
40 | | bpl = 0; |
41 | | |
42 | | color_cycle = true; |
43 | | moving_light = true; |
44 | | diamond = false; |
45 | | m_color = 0x7ACCFF; |
46 | | m_phongrad = 800; |
47 | | m_width = 800; |
48 | | m_height = 600; |
49 | | |
50 | | was_moving = 0; |
51 | | was_color = 0; |
52 | | isd = 0; |
53 | | ihd = 0; |
54 | 51 | } |
55 | 52 | |
56 | 53 | BumpScope::~BumpScope() |
diff --git a/mythplugins/mythmusic/mythmusic/filescanner.cpp b/mythplugins/mythmusic/mythmusic/filescanner.cpp
index dcc69ec..40ceacf 100644
a
|
b
|
|
22 | 22 | #include "metadata.h" |
23 | 23 | |
24 | 24 | FileScanner::FileScanner () |
| 25 | : m_decoder(0) |
25 | 26 | { |
26 | 27 | MSqlQuery query(MSqlQuery::InitCon()); |
27 | 28 | |
diff --git a/mythplugins/mythmusic/mythmusic/goom/mythgoom.cpp b/mythplugins/mythmusic/mythmusic/goom/mythgoom.cpp
index 96ac25e..83c4c06 100644
a
|
b
|
using namespace std; |
20 | 20 | #include <mythtv/mythcontext.h> |
21 | 21 | |
22 | 22 | Goom::Goom(long int winid) |
| 23 | : VisualBase(20), surface(NULL) |
| 24 | , buffer(NULL), scalew(0) |
| 25 | , scaleh(0) |
23 | 26 | { |
24 | | fps = 20; |
25 | | |
26 | | surface = NULL; |
27 | | buffer = NULL; |
28 | | |
29 | 27 | char SDL_windowhack[32]; |
30 | 28 | //char SDL_windowhack[sizeof(long int)]; |
31 | 29 | sprintf(SDL_windowhack, "%ld", winid); |
diff --git a/mythplugins/mythmusic/mythmusic/libvisualplugin.cpp b/mythplugins/mythmusic/mythmusic/libvisualplugin.cpp
index 7ad759e..4284b5e 100644
a
|
b
|
using namespace std; |
11 | 11 | |
12 | 12 | static char AppName[] = "mythmusic"; |
13 | 13 | |
14 | | LibVisualPlugin::LibVisualPlugin(MainVisual *parent, long int winid, const QString &pluginName) |
| 14 | LibVisualPlugin::LibVisualPlugin(MainVisual *parent, long int winid) |
| 15 | : VisualBase(20), m_parent(parent) |
| 16 | , m_currentPlugin(0), m_pVisBin(0) |
| 17 | , m_pVisVideo(0), m_pSurface(0) |
| 18 | , m_paused(false) |
15 | 19 | { |
16 | | fps = 30; |
17 | | m_parent = parent; |
18 | | m_pVisBin = 0; |
19 | | m_pVisVideo = 0; |
20 | | m_pSurface = 0; |
21 | | m_paused = false; |
22 | | |
23 | 20 | // SDL initialisation |
24 | 21 | char SDL_windowhack[32]; |
25 | 22 | sprintf(SDL_windowhack, "%ld", winid); |
… |
… |
LibVisualPlugin::LibVisualPlugin(MainVisual *parent, long int winid, const QStri |
53 | 50 | while( (plugin = visual_actor_get_next_by_name( plugin )) ) |
54 | 51 | m_pluginList << plugin; |
55 | 52 | |
56 | | m_currentPlugin = 0; |
57 | | if (pluginName != "" && (m_pluginList.find(pluginName) != m_pluginList.end())) |
58 | | switchToPlugin(pluginName); |
59 | | else |
60 | | switchToPlugin(m_pluginList[0]); |
| 53 | switchPlugins(); |
61 | 54 | } |
62 | 55 | |
63 | 56 | void LibVisualPlugin::handleKeyPress(const QString &action) |
… |
… |
void LibVisualPlugin::handleKeyPress(const QString &action) |
93 | 86 | } |
94 | 87 | } |
95 | 88 | |
96 | | void LibVisualPlugin::switchToPlugin(const QString &pluginName) |
| 89 | void LibVisualPlugin::switchPlugins() |
97 | 90 | { |
98 | 91 | if (m_pVisVideo) |
99 | 92 | { |
… |
… |
static class LibVisualFactory : public VisFactory |
362 | 355 | |
363 | 356 | VisualBase *create(MainVisual *parent, long int winid, const QString &pluginName) const |
364 | 357 | { |
365 | | return new LibVisualPlugin(parent, winid, pluginName); |
| 358 | (void)pluginName; // VisFactory::create() requires pluginName, |
| 359 | // but libvisual doesn't need it |
| 360 | return new LibVisualPlugin(parent, winid); |
366 | 361 | } |
367 | 362 | }LibVisualFactory; |
368 | 363 | |
diff --git a/mythplugins/mythmusic/mythmusic/libvisualplugin.h b/mythplugins/mythmusic/mythmusic/libvisualplugin.h
index 23d6f8a..ce8aed0 100644
a
|
b
|
extern "C" |
14 | 14 | class LibVisualPlugin : public VisualBase |
15 | 15 | { |
16 | 16 | public: |
17 | | LibVisualPlugin(MainVisual *parent, long int winid, const QString &pluginName); |
| 17 | LibVisualPlugin(MainVisual *parent, long int winid); |
18 | 18 | virtual ~LibVisualPlugin(); |
19 | 19 | |
20 | 20 | void resize(const QSize &size); |
… |
… |
class LibVisualPlugin : public VisualBase |
26 | 26 | |
27 | 27 | private: |
28 | 28 | static int AudioCallback(VisInput *input, VisAudio *audio, void *priv); |
29 | | void switchToPlugin(const QString &pluginName); |
| 29 | void switchPlugins(); |
30 | 30 | bool createScreen(int width, int height); |
31 | 31 | |
32 | 32 | private: |
diff --git a/mythplugins/mythmusic/mythmusic/main.cpp b/mythplugins/mythmusic/mythmusic/main.cpp
index f4c99db..a1385e7 100644
a
|
b
|
void CheckFreeDBServerFile(void) |
76 | 76 | struct cddb_host proxy_host; |
77 | 77 | |
78 | 78 | memset(&cddbconf, 0, sizeof(cddbconf)); |
| 79 | memset(&proxy_host, 0, sizeof(proxy_host)); |
79 | 80 | |
80 | 81 | cddbconf.conf_access = CDDB_ACCESS_REMOTE; |
81 | 82 | list.list_len = 1; |
diff --git a/mythplugins/mythmusic/mythmusic/mainvisual.cpp b/mythplugins/mythmusic/mythmusic/mainvisual.cpp
index 67f1022..130d153 100644
a
|
b
|
using namespace std; |
43 | 43 | |
44 | 44 | VisFactory* VisFactory::g_pVisFactories = 0; |
45 | 45 | |
46 | | VisualBase::VisualBase(bool screensaverenable) |
47 | | : xscreensaverenable(screensaverenable) |
| 46 | VisualBase::VisualBase(int setfps, bool screensaverenable) |
| 47 | : fps(setfps), xscreensaverenable(screensaverenable) |
48 | 48 | { |
49 | 49 | if (!xscreensaverenable) |
50 | 50 | GetMythUI()->DoDisableScreensaver(); |
… |
… |
void InfoWidget::paintEvent( QPaintEvent * ) |
507 | 507 | } |
508 | 508 | |
509 | 509 | StereoScope::StereoScope() |
| 510 | : VisualBase(45), startColor(Qt::green) |
| 511 | , targetColor(Qt::red), rubberband(false) |
| 512 | , falloff(1.0f) |
510 | 513 | { |
511 | | fps = 45; |
512 | | rubberband = false; |
513 | | falloff = 1.0; |
514 | | |
515 | | startColor = Qt::green; |
516 | | targetColor = Qt::red; |
517 | 514 | } |
518 | 515 | |
519 | 516 | StereoScope::~StereoScope() |
diff --git a/mythplugins/mythmusic/mythmusic/mainvisual.h b/mythplugins/mythmusic/mythmusic/mainvisual.h
index 3171ffb..0363660 100644
a
|
b
|
public: |
56 | 56 | class VisualBase |
57 | 57 | { |
58 | 58 | public: |
59 | | VisualBase(bool screensaverenable = false); |
| 59 | VisualBase(int setfps, bool screensaverenable = false); |
60 | 60 | virtual ~VisualBase(void); |
61 | 61 | |
62 | 62 | // return true if the output should stop |
diff --git a/mythplugins/mythmusic/mythmusic/playlist.cpp b/mythplugins/mythmusic/mythmusic/playlist.cpp
index c6a78d8..6fc7d7c 100644
a
|
b
|
void PlaylistsContainer::describeYourself() |
383 | 383 | } |
384 | 384 | |
385 | 385 | Playlist::Playlist(AllMusic *all_music_ptr) |
| 386 | // fallback values |
| 387 | : playlistid(0), name(QObject::tr("oops")) |
| 388 | , raw_songlist(""), all_available_music(all_music_ptr) |
| 389 | , parent(NULL), changed(false) |
386 | 390 | { |
387 | | // fallback values |
388 | | playlistid = 0; |
389 | | name = QObject::tr("oops"); |
390 | | raw_songlist = ""; |
391 | 391 | songs.setAutoDelete(true); // mine! |
392 | | all_available_music = all_music_ptr; |
393 | | changed = false; |
394 | 392 | } |
395 | 393 | |
396 | 394 | void Track::putYourselfOnTheListView(UIListGenericTree *a_listviewitem) |
diff --git a/mythplugins/mythmusic/mythmusic/synaesthesia.cpp b/mythplugins/mythmusic/mythmusic/synaesthesia.cpp
index c680274..ab12b7d 100644
a
|
b
|
using namespace std; |
30 | 30 | #include <mythtv/mythverbose.h> |
31 | 31 | |
32 | 32 | Synaesthesia::Synaesthesia(long int winid) |
| 33 | : VisualBase(29), maxStarRadius(0) |
| 34 | , fadeMode(Stars), pointsAreDiamonds(true) |
| 35 | , brightnessTwiddler(0.3f), starSize(0.5f) |
| 36 | , outWidth(0), outHeight(0) |
| 37 | , outputImage(NULL) |
| 38 | , fgRedSlider(0.0f), fgGreenSlider(0.5f) |
| 39 | , bgRedSlider(0.75f), bgGreenSlider(0.4f) |
| 40 | , energy_avg(80.0f) |
33 | 41 | { |
34 | | fps = 29; |
35 | | fadeMode = Stars; |
36 | | pointsAreDiamonds = true; |
37 | | energy_avg = 80.0; |
38 | | |
39 | 42 | coreInit(); |
40 | | starSize = 0.5; |
41 | 43 | setStarSize(starSize); |
42 | | brightnessTwiddler = 0.3; |
43 | | outputImage = NULL; |
44 | | fgRedSlider = 0.0; |
45 | | fgGreenSlider = 0.5; |
46 | | bgRedSlider = 0.75; |
47 | | bgGreenSlider = 0.4; |
48 | 44 | |
49 | 45 | #ifdef SDL_SUPPORT |
50 | 46 | surface = NULL; |
diff --git a/mythplugins/mythmusic/mythmusic/visualize.cpp b/mythplugins/mythmusic/mythmusic/visualize.cpp
index 5e848de..cba922f 100644
a
|
b
|
void av_free(void *ptr); |
41 | 41 | } |
42 | 42 | |
43 | 43 | Spectrum::Spectrum() |
| 44 | // Setup the "magical" audio data transformations |
| 45 | // provided by the Fast Fourier Transforms library |
| 46 | : VisualBase(20), startColor(0, 0, 255) |
| 47 | , targetColor(255, 0, 0), scaleFactor(2.0) |
| 48 | , falloff(3.0), analyzerBarWidth(6) |
44 | 49 | #if defined(FFTW3_SUPPORT) || defined(FFTW2_SUPPORT) |
45 | | : lin(NULL), rin(NULL), lout(NULL), rout(NULL) |
| 50 | , lin(NULL), rin(NULL), lout(NULL), rout(NULL) |
46 | 51 | #endif |
47 | 52 | { |
48 | | // Setup the "magical" audio data transformations |
49 | | // provided by the Fast Fourier Transforms library |
50 | | analyzerBarWidth = 6; |
51 | | scaleFactor = 2.0; |
52 | | falloff = 3.0; |
53 | | fps = 20; |
54 | 53 | |
55 | 54 | #ifdef FFTW3_SUPPORT |
56 | 55 | lin = (myth_fftw_float*) av_malloc(sizeof(myth_fftw_float)*FFTW_N); |
… |
… |
Spectrum::Spectrum() |
70 | 69 | |
71 | 70 | plan = rfftw_create_plan(FFTW_N, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE); |
72 | 71 | #endif // FFTW2_SUPPORT |
73 | | |
74 | | startColor = QColor(0,0,255); |
75 | | targetColor = QColor(255,0,0); |
76 | 72 | } |
77 | 73 | |
78 | 74 | Spectrum::~Spectrum() |
… |
… |
static class SpectrumFactory : public VisFactory |
308 | 304 | }SpectrumFactory; |
309 | 305 | |
310 | 306 | AlbumArt::AlbumArt(MainVisual *parent) |
| 307 | : VisualBase(1), m_pParent(parent) |
311 | 308 | { |
312 | | m_pParent = parent; |
313 | | |
314 | 309 | findFrontCover(); |
315 | 310 | |
316 | 311 | Decoder *dec = m_pParent->decoder(); |
317 | 312 | if (dec) |
318 | 313 | m_filename = dec->getFilename(); |
319 | | |
320 | | fps = 1; |
321 | 314 | } |
322 | 315 | |
323 | 316 | void AlbumArt::findFrontCover(void) |
… |
… |
static class AlbumArtFactory : public VisFactory |
456 | 449 | }AlbumArtFactory; |
457 | 450 | |
458 | 451 | Blank::Blank() |
459 | | : VisualBase(true) |
| 452 | : VisualBase(20, true) |
460 | 453 | { |
461 | | fps = 20; |
462 | 454 | } |
463 | 455 | |
464 | 456 | Blank::~Blank() |
… |
… |
static GLfloat view_rotx=20.0, view_rotz=0.0; |
739 | 731 | static GLint gear1, gear2, gear3; |
740 | 732 | |
741 | 733 | Gears::Gears(QWidget *parent, const char *name) |
742 | | : QGLWidget(parent, name) |
| 734 | : QGLWidget(parent, name), VisualBase(60) |
| 735 | , startColor(0, 0, 255), targetColor(255, 0, 0) |
| 736 | , scaleFactor(1.0f), falloff(4.0f) |
| 737 | , analyzerBarWidth(10), angle(0.0f) |
| 738 | , view_roty(30.0f) |
743 | 739 | { |
744 | | falloff = 4.0; |
745 | | analyzerBarWidth = 10; |
746 | | fps = 60; |
747 | | |
748 | 740 | // Slightly trick bit: This *is* a Qt Qidget |
749 | 741 | // (unlike spectrum, above) so we just use |
750 | 742 | // the Qt GL class. |
… |
… |
Gears::Gears(QWidget *parent, const char *name) |
757 | 749 | //setGeometry(0, 0, 400, 300); |
758 | 750 | //setFixedSize(QSize(screenwidth, screenheight)); |
759 | 751 | |
760 | | angle = 0.0; |
761 | | view_roty = 30.0; |
762 | | |
763 | 752 | #ifdef FFTW3_SUPPORT |
764 | 753 | lin = (myth_fftw_float*) av_malloc(sizeof(myth_fftw_float)*FFTW_N); |
765 | 754 | rin = (myth_fftw_float*) av_malloc(sizeof(myth_fftw_float)*FFTW_N); |
… |
… |
Gears::Gears(QWidget *parent, const char *name) |
779 | 768 | plan = rfftw_create_plan(FFTW_N, FFTW_REAL_TO_COMPLEX, FFTW_ESTIMATE); |
780 | 769 | #endif // FFTW2_SUPPORT |
781 | 770 | |
782 | | |
783 | | startColor = QColor(0,0,255); |
784 | | targetColor = QColor(255,0,0); |
785 | | |
786 | 771 | show(); |
787 | 772 | } |
788 | 773 | |
diff --git a/mythplugins/mythmusic/mythmusic/visualize.h b/mythplugins/mythmusic/mythmusic/visualize.h
index 9b67e10..128d95c 100644
a
|
b
|
class AlbumArt : public VisualBase |
95 | 95 | bool needsUpdate(void); |
96 | 96 | void findFrontCover(void); |
97 | 97 | |
| 98 | MainVisual *m_pParent; |
| 99 | |
98 | 100 | QSize m_size, m_cursize; |
99 | 101 | QString m_filename; |
100 | 102 | ImageType m_currImageType; |
101 | | MainVisual *m_pParent; |
102 | 103 | QImage m_image; |
103 | 104 | }; |
104 | 105 | |