![]() |
SCTC
the soundcloud.com terminal client
|
#include "_hard_config.h"#include "sound.h"#include <ao/ao.h>#include <mpg123.h>#include "cache.h"#include "helper.h"#include "http.h"#include "log.h"#include "network/network.h"#include "soundcloud.h"#include "track.h"#include "tui.h"#include "state.h"Macros | |
| #define | BUFFER_SIZE 256 * 1024 * 1024 |
| #define | SEEKPOS_NONE ((unsigned int) ~0) |
| #define | SEM_SET_TO_ZERO(S) {int sval; while(!sem_getvalue(&S, &sval) && sval) {sem_wait(&S);}} |
Functions | |
| static char * | ao_strerror (int err) |
| static mpg123_handle * | mpg123_reinit (mpg123_handle *mh) |
| Reinitialize libmpg123. More... | |
| static void * | _thread_io_function (void *unused) |
| main function for IO thread. More... | |
| static void * | _thread_play_function (void *unused) |
| main function for playback thread. More... | |
| bool | sound_init (void(*_time_callback)(int)) |
| Global initialization of sound. More... | |
| bool | sound_finalize () |
| bool | sound_stop () |
| Stop playback of current track. More... | |
| unsigned int | sound_get_current_pos () |
| void | sound_seek (unsigned int pos) |
| bool | sound_play (struct track *_track) |
| Start playback of track. More... | |
Variables | |
| static sem_t | sem_io |
| static sem_t | sem_play |
| static sem_t | sem_stopped |
| static pthread_t | thread_io |
| static pthread_t | thread_play |
| static sem_t | sem_data_available |
| static mpg123_handle * | mh = NULL |
| static volatile int | buffer_pos = 0 |
| static volatile char * | buffer = NULL |
| static volatile struct track * | track = NULL |
| static volatile unsigned int | current_pos = 0 |
| static volatile unsigned int | seek_to_pos = SEEKPOS_NONE |
| static volatile size_t | track_size = 0 |
| static volatile bool | stopped = false |
| static volatile bool | terminate = false |
| static void(* | time_callback )(int) |
| #define BUFFER_SIZE 256 * 1024 * 1024 |
| #define SEEKPOS_NONE ((unsigned int) ~0) |
| #define SEM_SET_TO_ZERO | ( | S | ) | {int sval; while(!sem_getvalue(&S, &sval) && sval) {sem_wait(&S);}} |
|
static |
main function for IO thread.
| unused | Unused parameter (never read), required due to pthread interface |
|
static |
main function for playback thread.
| unused | Unused parameter (never read), required due to pthread interface |
|
static |
|
static |
Reinitialize libmpg123.
| mh | The old handle to close (may be NULL) |
| bool sound_finalize | ( | ) |
| unsigned int sound_get_current_pos | ( | ) |
| bool sound_init | ( | void(*)(int) | time_callback | ) |
Global initialization of sound.
This function is required to be called prior to the first call sound_play() and does several internal initializations.
| time_callback | callback function receiving the elapsed seconds as parameter |
| bool sound_play | ( | struct track * | track | ) |
Start playback of track.
This function is required to be called prior to the first call sound_play() and does several internal initializations.
| track | the track to play |
| void sound_seek | ( | unsigned int | pos | ) |
| bool sound_stop | ( | ) |
Stop playback of current track.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
The amount of data for the whole track. As soon as we reach this position during playback the end of track has been reached
1.8.9.1