Commit Graph

78 Commits

Author SHA1 Message Date
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Jim Broadus d3d6c1ff3c Fix UNC paths.
The fix-up for URLs for files that that begin with // no longer works since the
QUrl class determines that these modifications are invalid, resulting in an
empty string when converted. Instead of attempting to modify the QUrl, add a
utility function that makes the correction on the encoded byte array at time of
usage.
2020-01-29 00:38:43 -08:00
Jonas Kvinge 1a2274bd2b Merge branch 'master' into qt5-update 2019-07-21 14:20:59 +02:00
Jim Broadus 55edcf5321 Fix MoodbarPipeline crash on gstreamer error.
As reported in issue 6302, playing a stream that causes gstreamer to error at
start can cause a crash. The problem occurs when the MoodbarPipeline receives a
pad-added signal after it has handled an error callback. In the error callback,
the builder_ is freed. In the pad-added handler (NewPadCallback), this object
is accessed.

This change adds a running_ flag that is set when the pipeline is started and
cleared on an error, end of stream, or object destruction. We check this flag at
the beginning of NewPadCallback. For sanity sake, we also check the builder_
pointer before dereferencing. Note that checking the state of the pipeline
wasn't an option since the pipeline is in the process of changing states during
the pad-added callback and gst_element_get_state wants to block during a state
change.

This solution is not complete as there are still some syncronization issues.
With this specific situation, the error and new pad callbacks appear to always
occur on the same thread, but that's probably not true for all error conditions.
The object is also destroyed by a different thread, so it may be possible that a
callback can occur at the wrong time during or after the deletion of the object.

See https://github.com/clementine-player/Clementine/issues/6302
2019-03-17 22:26:01 -07:00
Chocobozzz fc517ce7a5 Merge remote-tracking branch 'upstream/master' into qt5 2017-06-05 21:28:05 +02:00
Santiago Gil 30e3fdb9cc Fix overflow in MoodbarProxyStyle (fixes #5638) (#5643) 2017-03-02 13:10:21 +00:00
Chocobozzz e6e189967d Merge remote-tracking branch 'upstream/master' into qt5 2016-02-29 18:03:02 +01:00
Simon Marchi 725e1d8f0d moodbar: check QSlider max/min before using them in division
When switching playback from an item for which the moodbar is not
displayed (e.g. an internet stream), to an item for which it is
displayed (e.g. a local mp3 file), Clementine sometimes crashes.

This happens because the slider_opt->maximum and slider_opt->minimum
have the value 0 (their default value), and the difference is used as a
divisor.  This gives a division by 0, and a SIGFPE.

This problem has been fixed in commit af42cce.  However, when a9f9b0e
reverted 3f79fa5, a little to much was reverted and we lost what af42cce
did.  This patch re-introduces the fix.

Fixes #5261

moodbar: Add comment
2016-02-18 09:15:44 -05:00
v-fox a9f9b0ef72 Avoiding usage of pixelMetric because it breaks on non-Oxygen styling
Partial revertion for commit "3f79fa5c651f23e48faf1af6ca56dbff9e5660ab" because of
https://github.com/clementine-player/Clementine/issues/4770
2015-12-14 07:16:30 +05:00
Chocobozzz ff7026c9fe Merge remote-tracking branch 'upstream/master' into qt5 2015-12-13 20:05:12 +01:00
John Maguire f300946c81 Remove most usages of QFutureWatcher 2015-11-27 14:28:12 +00:00
Chocobozzz 631a6cdabd Merge branch 'master' into qt5 2015-09-16 17:40:54 +02:00
Santi 47d667934e Include windows.h 2015-08-11 15:15:26 -03:00
Santi 5779385c8b Change warning message 2015-08-08 16:57:28 -03:00
Santi 3cd7641f2e Set mood file as hidden on Windows 2015-08-08 16:54:30 -03:00
Chocobozzz f4ca305fd7 remove useless qhash_qurl 2015-06-04 10:37:34 +02:00
Chocobozzz 42aafd247a Update optional components to qt5 2015-04-15 18:26:09 +02:00
Arnaud Bienner 9cb2a17f37 Sort children is recursive and will mess up services' children (e.g. search
result item not the first item anymore) so we should call it only once at
the beginning.
And instead of sorting all items everytime, we just insert them at the correct
position.
2014-12-27 00:33:23 +01:00
Mark Furneaux a4be57414a Don't load the moodbar if the song was stopped
When an async moodbar load completes, it checks to see if the song is still playing and should update the UI.
It however failed to check if the song was stopped, so it would load a moodbar when no song is playing.
It now checks the player state before emitting a change.
2014-12-22 16:53:58 -05:00
Mark Furneaux 3886f3d1e4 Fix socket leak in moodbarpipeline
Fixes #4663
When tearing down the pipeline, there was a leak of a GstBus which holds a socketpair open.
Eventually the OS runs out of file descriptors and terminates Clementine.
2014-12-22 16:13:44 -05:00
Chocobozzz 50b7b7d889 Make format after update to avoid conflicts 2014-10-15 21:57:57 +02:00
Chocobozzz 8279f21251 Revert "Make format"
This reverts commit 17b1e9fbe6.
2014-10-15 21:55:03 +02:00
Chocobozzz 17b1e9fbe6 Make format 2014-10-15 20:55:24 +02:00
Pasi Saarinen 1ecee037c7 Fix moodbar segfault when playing broken mp3
When playing a broken mp3 (eg empty file) clementine crashed if moodbar
was enabled.
2014-10-06 15:40:10 +02:00
David Sansome a2408f7c0e Merge branch 'master' into gstreamer-1.2
Conflicts:
	src/moodbar/moodbarloader.cpp
2014-09-21 19:39:27 +10:00
David Sansome d24eaef2e5 Don't crash if we can't write to the moodbar cache 2014-09-21 19:38:14 +10:00
David Sansome 50551d987a Rewrite moodbar stuff for gstreamer-1.0:
- Rewrite gstspectrum (1.0) to use FFTW (2x faster) and emit raw magnitude
  values (not log scaled).
- Rewrite the moodbar generation code to be somewhat understandable, and
  do it in Clementine instead of gstreamer.
2014-09-21 19:38:13 +10:00
John Maguire d9572bdcdd Be more forgiving of broken permissions on the cache directory. 2014-08-19 11:13:06 +02:00
Arnaud Bienner 47108a9a68 Add a message in CMake to notify that ccache has been found and will be used (+ some minor, unrelated things). 2014-08-06 20:05:41 +02:00
David Sansome 6bb81328e8 Merge branch 'master' into gstreamer-1.2
Conflicts:
	ext/clementine-spotifyblob/mediapipeline.cpp
	gst/moodbar/gstfftwspectrum.c
	src/core/songloader.cpp
	src/core/songloader.h
	src/engines/gstengine.cpp
	src/engines/gstenginepipeline.cpp
	src/moodbar/moodbarpipeline.cpp
	src/musicbrainz/chromaprinter.cpp
	src/transcoder/transcoder.cpp
	src/ui/mainwindow.cpp
	src/visualisations/projectmvisualisation.cpp
2014-06-09 16:20:24 +10:00
Mark Furneaux af42ccea38 Fix dbz possibility in moodbar
Took me forever to find this. Randomly happens when changing tracks.
2014-05-25 00:16:12 -04:00
David Sansome c217450d0c Fix some bad sizeof -> arraysize changes from revision 41e9c15248. 2014-05-23 21:31:50 +10:00
John Maguire 24a4cff807 Merge pull request #4288 from sundrythoughts/rating-optimization
Increase performance of mass rating changes.
2014-05-20 12:42:39 +01:00
John Maguire 41e9c15248 Add arraysize macro from Chromium 2014-04-29 14:11:52 +02:00
Joseph Freeman fe4a80b2d5 Removed commented-out code and ran make format. 2014-04-25 19:41:04 -04:00
Arnaud Bienner d49d818b37 Very minor style change 2014-04-23 00:40:06 +02:00
Arnaud Bienner 3f79fa5c65 Try to make the slider more accurate when moodbar is activated.
Previously, the slide wasn't displayed at the exact position where the user clicked, and the moodbar's width was equal to the slider's width, while it should have been as long as long the groove.
2014-04-23 00:03:30 +02:00
Sebastian J. Mielke e73450cf43 Moodbar-Trackslider uses the full available height
When determining the next state (for rendering the change), the slider widgets vertical SizePolicy is changed from Fixed to MinimumExpanding (same thing works the other way around).
2014-03-11 16:08:24 +01:00
John Maguire 192b60d965 Use nullptr as parent parameter default everywhere 2014-02-10 16:03:54 +01:00
John Maguire 3323c2d094 Convert all instances of foreach() to a C++11 for
find ext src -name '*.cpp' -exec \
    sed -i -e 's/foreach(\([^,]\+\),/for (\1 :/' {} \;
2014-02-10 14:43:32 +01:00
John Maguire bebd781fdf Reformat all non-3rd-party C/C++/Objective-C++.
Command line:
find src ext -regex '.*\.\(h\|cpp\|mm\)' -exec clang-format -i
 -style='{BasedOnStyle: Google, DerivePointerBinding: false}' {} \;
2014-02-07 16:34:20 +01:00
John Maguire 71893e4847 Use nullptr instead of NULL everywhere. 2014-02-06 17:29:59 +01:00
John Maguire d309d4ab27 Use c++11 instead of boost where possible. 2014-02-06 16:51:39 +01:00
John Maguire 56c949815b First pass at Gstreamer 1.0 porting.
This at least compiles against gstreamer 1.2.
Things that work:
* Playing audio
* Automatically completing tags

Things that don't work
* Spotify
* Moodbar

Things I haven't tested
* Transcoding
2013-09-26 17:49:24 +02:00
Arnaud Bienner d3295f083b Revert "Update issue 3682: deactivate moodbar generation for wma files on Windows until we find a proper way to fix this issue."
This is not needed anymore now issue 3682 is fixed.

This reverts commit c9be07f508.
2013-09-07 00:23:56 +02:00
Arnaud Bienner c9be07f508 Update issue 3682: deactivate moodbar generation for wma files on Windows until we find a proper way to fix this issue. 2013-08-28 22:55:59 +02:00
Andreas bd528a47cd Fix divide by zero error in MoodbarRenderer. Fixes issue 3823. 2013-08-24 21:07:44 +02:00
David Sansome 4b0a7ae70b Oops, make that actually compile 2013-08-18 13:07:32 +10:00
David Sansome 534f216de2 Ensure we don't read past the end of the color vector when rendering a moodbar.
Fixes issue 3811.
2013-08-18 13:05:12 +10:00
David Sansome a3f927cde2 Run moodbar pipeline threads at idle CPU and IO priority. Fixes issue 3644. 2013-05-04 22:48:11 +10:00