summaryrefslogtreecommitdiff
path: root/src/player.c
AgeCommit message (Collapse)AuthorFilesLines
2018-04-16Remove deprecated header avfiltergraph.hLars-Dominik Braun1-1/+0
Has been merged into avfilter.h. Closes #660.
2018-04-07Add network timeouts and retriesLars-Dominik Braun1-1/+9
All network operations can time out now. API requests are retried up to three times (default). Replaces setting max_player_errors with max_retries, which is used for player and API. Adds timeout setting. Partially reverts 436a1d4012553a2f33d0e3a5180b3b5ae0378bdd and fixes (at least) issue #657. Thanks to @exarkun for testing.
2018-03-15Properly protect player struct with mutexLars-Dominik Braun1-14/+72
The volatile keyword neither guarantees atomic access nor memory visibility[1]. Although this is usually not a problem on x86, it is incorrect to rely on this. Use mutex locks to protect all shared player variables and enforce memory visibility. [1] https://wiki.sei.cmu.edu/confluence/display/c/CON02-C.+Do+not+use+volatile+as+a+synchronization+primitive
2017-03-24Replace deprecated avcodec_decode_audio4Lars-Dominik Braun1-63/+71
Use new send_packet/receive_frame API. Bumps libav and ffmpeg version requirements. Revert this commit if you need an older version.
2017-03-14Added gain_mul setting to soften effect of replaygain.Sean Greenslade1-2/+2
2016-10-15Turn off ffmpeg’s error messagesLars-Dominik Braun1-0/+1
See #577.
2016-03-05Quit upon reception of two SIGINTLars-Dominik Braun1-4/+9
If player is running one SIGINT restarts current track request, two SIGINT (or more) quit pianobar. Idle main loop (i.e. no player or submenu) quits on SIGINT. Fixes issue #564.
2015-10-23Interruptible requestsLars-Dominik Braun1-31/+9
^C now works as expected: It interrupts API requests, input prompts and audio streaming. Timeouts have been removed.
2015-09-06player: Fix strange volume bugLars-Dominik Braun1-1/+1
On one of my machines the first song plays fine, but every track thereafter fails playing with the following error message: [volume @ 0x7f6b1c0a1200] [Eval @ 0x7f6b21ab6b60] Invalid chars '.0' at the end of expression '1.0' [volume @ 0x7f6b1c0a1200] Error when evaluating the volume expression '1.0' /!\ create_filter volume (Das Argument ist ungültig) I’m not sure why this fixes the issue, but it might be a bug in ffmpeg.
2015-09-06player: Replace deprecated ffmpeg API callsLars-Dominik Braun1-17/+7
A few changes were made to AVFrame and the buffersink. Should be compatible with ffmpeg >= 2.1 and libav >= 10. Version 1.2/9 do not work at this point.
2015-08-10Move feature test macros to config.hLars-Dominik Braun1-2/+2
I removed most of the *BSD-related stuff, because I can’t test these. If this breaks your build, send me a patch please.
2015-03-11player: Fix initial track volumeLars-Dominik Braun1-1/+1
The initial volume setup was ignored as well. Introduced by previous commit 310900e4be52d11388792d776d9f6b89380bbecd. See https://github.com/PromyLOPh/pianobar/commit/310900e4be52d11388792d776d9f6b89380bbecd
2015-03-07player: Ignore volume change before playback startedLars-Dominik Braun1-2/+8
Fixes issue #508.
2015-01-05Use default channel layout if zeroCody1-0/+7
libav 11 reports an invalid channel layout for mp3 files. This is a work-around. The problem is fixed with libav 11.1.
2014-09-19Improve player pause/quitLars-Dominik Braun1-10/+8
Skipping/quitting while pausing does not play the current packet any more. Avoid unneccessary calls to av_read_(play|pause).
2014-07-21Fix player retry logicLars-Dominik Braun1-1/+2
If retry is triggered once and openStream fails after that retry is never set to false, resulting in an infinite loop that cannot be interrupted by the user.
2014-07-21Refactor audio player, add retry timeoutLars-Dominik Braun1-103/+173
Fixes #442.
2014-06-07Fix autodetection of ffmpeg 2.2Lars-Dominik Braun1-2/+1
Drop minor version check, assuming this workaround is required for all future versions. See 0a64272db65201fc2ecb3406b89d895966933b99. Fixes issue #456.
2014-06-02libav* autodetectionLars-Dominik Braun1-0/+20
I’ll give it another shot. ffmpeg’s doc/developer.texi states their micro version always starts at 100 for this very reason. Use that to detect ffmpeg and guess its version by looking at major and minor version numbers. Let’s hope this works.
2014-04-22player: Add missing header for ffmpeg1.2Lars-Dominik Braun1-0/+4
Closes #441.
2014-04-18player: Fix state-machineLars-Dominik Braun1-0/+1
Song timer was shown without song playing.
2014-04-11Fix volume controlLars-Dominik Braun1-1/+1
Commit 8012d6cb4bb65a858105ef878c5b98d91b24e1cd was broken in several ways. Since auto-detection did not work correctly it was replaced by a user-editable variable. See #439.
2014-04-07ffmpeg compatibilityLars-Dominik Braun1-12/+28
Adds support for ffmpeg 2.2 and 1.2. Right now the maintenance overhead of supporting both libav implementations is not that big. Fixes #437 and #435.
2014-04-07player: discard unused streamnsLars-Dominik Braun1-0/+6
Shouldn’t make a difference right now. Just in case…
2014-03-31Use libav/ffmpeg for audio decodingLars-Dominik Braun1-458/+232
libav 9.12 and ffmpeg 2.2 have been tested. Here’s why: My mp4 “parser” *cough* never was a mp4 parser in the sense that it actually understood the file format. Instead it grepped the input stream for “magic” strings (section identifiers). That alone should be sufficient to throw away the code and rewrite it. Additionally libfaad2 has not been updated for ages. I guess it was abandoned in favor of libav/ffmpeg. With libav/ffmpeg, which we support both as long as the API’s don’t diverge too much, pianobar gains fast and reliable AAC and MP3 decoding without bothering too much about the details. Most users will have it installed already. On my own machine libav consumes about 2/3 CPU time compared to the previous solution when playing AAC. Unfortunately memory usage doubled and my attempts to disable unused protocols/formats/codec failed due to libav’s API limitations. While cleaning up a small detail regarding the eventcmd API has changed too: Song duration and position are measured in seconds instead of milliseconds now. Since libav/ffmpeg keeps track of accurate timing the precision pianobar keeps track of can be reduced, while still being sufficient for most users.
2014-01-31Switch to clang for debugging build + fix issuesLars-Dominik Braun1-2/+2
2013-05-13Permit multiple HTTP errors in a rowLars-Dominik Braun1-5/+4
1) Make sure that multiple bad playlists in a row don’t result in a temporary ban 2) Ignore songs skipped because the playlist timed out after pausing for too long
2013-04-17Fix player state for unsupported audio file formatsLars-Dominik Braun1-4/+6
Player thread now sets its status correctly. Closes #360.
2013-03-31Ignore HTTP status 400Lars-Dominik Braun1-1/+3
Workaround for #355, fixes commit 2c516503d2cb81dd156afc24677ac4bf3caefceb.
2013-03-09Stop playback if audio file is not accessibleLars-Dominik Braun1-0/+6
See #352.
2013-02-26Add play and pause commandsAdam Simpkins1-19/+35
Add commands that always play and always pause, in addition to the current toggle pause command. Closes #342.
2012-11-17player: Fix insane typecastLars-Dominik Braun1-6/+13
2012-10-28player: Recover from AAC decoding errorLars-Dominik Braun1-9/+23
Decoding errors are usually not fatal, so we can recover by skipping the broken frame. This also fixes invalid memory reads caused by sampleSizeCurr >= sampleSizeN. See issue #304.
2012-06-09piano: Select quality instead of audio formatLars-Dominik Braun1-4/+0
Pandora limited the audio formats we can request explicitly. Don’t rely on this and use the formats available with the given partner credentials. Closes #271.
2012-05-26Move mutex initalization to main threadLars-Dominik Braun1-3/+1
Closes #250.
2012-05-26Revert "Remove pause mutex/add pthread cleanup function"Lars-Dominik Braun1-74/+61
This reverts commit 7df9371491e96a99c1e463f7787aede352ac5a37.
2012-05-26Revert "Fix player thread teardown/signals on OS X"Lars-Dominik Braun1-10/+0
This reverts commit f6dffd1822404522b8354ac453a911a0d98bfc61.
2012-05-17Fix player thread teardown/signals on OS XLars-Dominik Braun1-0/+10
1) Realtime signals don’t exist in OS X 2) libao apparently locks a mutex in ao_play, which is locked again in ao_close and causes a deadlock Closes #256, although I’m considering the option of partially reverting 7df9371491e96a99c1e463f7787aede352ac5a37, as this introduces more nasty behavior than it solves.
2012-05-14Remove pause mutex/add pthread cleanup functionLars-Dominik Braun1-61/+74
No more mutex locking/checking for quit condition. Should (slightly) increase responsiveness of the player thread. Closes #250.
2012-05-04Lofi AAC supportLars-Dominik Braun1-0/+2
32kbit/s. Closes #233.
2012-02-22Minor player cleanupLars-Dominik Braun1-25/+30
Move player buffer to heap, a few const’s here and there, increase header buffer size, fix comments.
2011-11-09waitress: support chunked encodingLars-Dominik Braun1-1/+1
as requested by rfc 2616
2011-05-18Configureable format stringsLars-Dominik Braun1-8/+12
Closes #88
2010-12-27Change my email addressLars-Dominik Braun1-1/+1
Again. And hopefully the last time.
2010-12-27Software volume controlLars-Dominik Braun1-2/+1
2010-12-19Fix wrong assumption about endianess of audio framesLars-Dominik Braun1-2/+2
Fixes issue #66 (audio playback on big-endian machines).
2010-08-09Support for big endian machinesLars-Dominik Braun1-4/+4
A few byteswaps replaced by conditional byteswaps. Thanks to Andrew Peng for providing access to a powerpc machine.
2010-04-07libao 1.0.0 compatibilityLars-Dominik Braun1-0/+2
Fixes bug #16. ao_sample_format structure has been updated, matrix must be NULL.
2010-03-16Use SHRT_MAX for short intLars-Dominik Braun1-4/+4
2010-03-16Replace player return value magicLars-Dominik Braun1-5/+3