summaryrefslogtreecommitdiff
path: root/src/player.h
AgeCommit message (Collapse)AuthorFilesLines
2022-03-31player: Add missing include for ffmpeg 5.0Lars-Dominik Braun1-0/+1
Fixes #730.
2018-09-15Implement audio bufferingedward-p1-3/+3
Prevent stuttering on low-power devices like Android phones by moving playback to its own thread and decoupling it from decoding through a reasonably sized buffer. Fixes #665.
2018-04-16Remove deprecated header avfiltergraph.hLars-Dominik Braun1-1/+0
Has been merged into avfilter.h. Closes #660.
2018-03-15Properly protect player struct with mutexLars-Dominik Braun1-24/+30
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-25Switch to #pragma onceLars-Dominik Braun1-3/+1
2017-03-24Replace deprecated avcodec_decode_audio4Lars-Dominik Braun1-0/+1
Use new send_packet/receive_frame API. Bumps libav and ffmpeg version requirements. Revert this commit if you need an older version.
2015-10-23Interruptible requestsLars-Dominik Braun1-3/+2
^C now works as expected: It interrupts API requests, input prompts and audio streaming. Timeouts have been removed.
2015-08-10Move feature test macros to config.hLars-Dominik Braun1-1/+0
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-04-06Switch back to libcurlLars-Dominik Braun1-1/+0
Drops libwaitress. Adds the new dependency libcurl and drops gnutls. I wouldn’t say writing my own HTTP library was a mistake – it was not and the experience gained was worth it. Instead I have to acknowledge that libcurl is just better than my own implementation. Sure, it does a lot more than HTTP – one could call that bloat. Yet if you just want to get the job done™ reusing code is the way to go. See #512 and #513.
2015-03-07player: Ignore volume change before playback startedLars-Dominik Braun1-2/+6
Fixes issue #508.
2014-11-22player: Remove unused variableLars-Dominik Braun1-1/+0
2014-07-21Refactor audio player, add retry timeoutLars-Dominik Braun1-4/+19
Fixes #442.
2014-04-22Fix include guardsLars-Dominik Braun1-3/+3
Macros starting with _ are reserved (see http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html). Fixes #440.
2014-04-07ffmpeg compatibilityLars-Dominik Braun1-1/+3
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-03-31Use libav/ffmpeg for audio decodingLars-Dominik Braun1-63/+21
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.
2013-05-13Permit multiple HTTP errors in a rowLars-Dominik Braun1-1/+1
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-02-26Add play and pause commandsAdam Simpkins1-2/+4
Add commands that always play and always pause, in addition to the current toggle pause command. Closes #342.
2012-05-26Revert "Remove pause mutex/add pthread cleanup function"Lars-Dominik Braun1-8/+5
This reverts commit 7df9371491e96a99c1e463f7787aede352ac5a37.
2012-05-26Revert "Fix player thread teardown/signals on OS X"Lars-Dominik Braun1-2/+2
This reverts commit f6dffd1822404522b8354ac453a911a0d98bfc61.
2012-05-17Fix player thread teardown/signals on OS XLars-Dominik Braun1-2/+2
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-5/+8
No more mutex locking/checking for quit condition. Should (slightly) increase responsiveness of the player thread. Closes #250.
2012-02-22Minor player cleanupLars-Dominik Braun1-3/+5
Move player buffer to heap, a few const’s here and there, increase header buffer size, fix comments.
2011-12-24Avoid struct padding where possibleLars-Dominik Braun1-20/+18
Pointed out by -Wpadding. Does not decrease memory usage/binary size though.
2011-11-09waitress: move large allocations to heapLars-Dominik Braun1-1/+1
2011-05-18Configureable format stringsLars-Dominik Braun1-0/+4
Closes #88
2011-04-12Added missing include for FreeBSDLars-Dominik Braun1-0/+2
See issue #103.
2010-12-27Change my email addressLars-Dominik Braun1-1/+1
Again. And hopefully the last time.
2010-12-27Software volume controlLars-Dominik Braun1-0/+1
2010-03-16Replace player return value magicLars-Dominik Braun1-0/+2
2010-03-16Fix player race conditionLars-Dominik Braun1-4/+11
Pressing any key before the player thread set mode to PLAYER_INITIALIZED lead to a song skip and spawning of another player thread. The two player threads were operating on the same variables/memory area, resulting in a crash. Adding a new player state (PLAYER_STARTING) and setting it _before_ invoking pthread_start should resolve this, 'cause the "if PLAYER_FREED-branch" is not taken any more, ergo no second player thread is started.
2010-01-30Fix libao error detectionLars-Dominik Braun1-0/+1
Under certain circumstances (fast station switching e.g.) a new playlist was not fetched, because the player thread returned 0x1 (== libao error) and the main thread NULLed curStation.
2010-01-21It's 2010 now.Lars-Dominik Braun1-1/+1
2009-05-03Switch to libwaitressLars-Dominik Braun1-5/+4
2009-02-05Time display for mp3 playbackLars-Dominik Braun1-3/+7
Time is now counted in milliseconds, not aac frames. Calculations seem to be inaccurate sometimes (about +-2 seconds).
2009-02-01mp3 playback supportLars-Dominik Braun1-7/+38
Now libfaad and/or libmad are used for playback. There's currently no remaining time displayed for mp3 playback.
2009-01-31Use pthread mutex to block player in pause stateLars-Dominik Braun1-1/+2
2009-01-20It's 2009 nowLars-Dominik Braun1-1/+2
Update copyright notices, add my email address, but don't change libwardrobe (I'm not maintaining it anymore)
2008-10-17Resume aborted song transferLars-Dominik Braun1-0/+1
This fixes those my-favorite-song-suddenly-aborted-"bugs", as well as the pause mode, which was more like a stop mode, because pandora *always* aborted the transfer after a few minutes.
2008-08-19Allow key shortcut configuration via config fileLars-Dominik Braun1-0/+4
Some code restructuring was made, too: - Move UI functions to ui.c and ui_act.c - Change default keys for loving and banning to + and -
2008-07-24Reduce cpu load produced by replaygainLars-Dominik Braun1-0/+1
It's not necessary to re-compute the scale factor as it will be the same every time.
2008-07-24Initial ReplayGain work (including anti-clipping)Lars-Dominik Braun1-0/+1
Could be tuned...
2008-06-28client: Use mode instead of finishedPlayback in playerLars-Dominik Braun1-3/+4
Smarter solution than commit 8421cfd9886ec5ee19cde18b48853c2f9ea60c29.
2008-06-23client: Use function prefix "Bar"Lars-Dominik Braun1-1/+1
2008-06-21client: Some cleanupLars-Dominik Braun1-0/+1
Now unneeded header, linebreaks
2008-06-21client: Read stsz atom containing frame sizesLars-Dominik Braun1-0/+51
This has two advantages: 1) We can pass the correct amount of bytes to NeAACDecDecode (). This should fix some decoding error messages. And 2) We can show the length of the song and the remaining (or already played time) to the user. Cool, eh?