summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/ai_alsa1x.c104
-rw-r--r--stream/ai_oss.c82
-rw-r--r--stream/ai_sndio.c10
-rw-r--r--stream/audio_in.c198
-rw-r--r--stream/cookies.c62
-rw-r--r--stream/dvb_tune.c368
-rw-r--r--stream/dvbin.h76
-rw-r--r--stream/frequencies.c1416
-rw-r--r--stream/frequencies.h108
-rw-r--r--stream/stream_dvb.c1200
-rw-r--r--stream/stream_dvd.c8
-rw-r--r--stream/stream_radio.c2
-rw-r--r--stream/stream_smb.c2
-rw-r--r--stream/stream_vcd.c2
-rw-r--r--stream/tv.c610
-rw-r--r--stream/tv.h136
-rw-r--r--stream/tvi_def.h10
-rw-r--r--stream/tvi_dummy.c70
-rw-r--r--stream/tvi_v4l2.c10
-rw-r--r--stream/vcd_read.h14
-rw-r--r--stream/vcd_read_darwin.h216
-rw-r--r--stream/vcd_read_fbsd.h12
-rw-r--r--stream/vcd_read_win32.h48
23 files changed, 2382 insertions, 2382 deletions
diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c
index c1a7199c71..bf36443dfe 100644
--- a/stream/ai_alsa1x.c
+++ b/stream/ai_alsa1x.c
@@ -40,61 +40,61 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_any(ai->alsa.handle, params);
if (err < 0) {
- MP_ERR(ai, "Broken configuration for this PCM: no configurations available.\n");
- return -1;
+ MP_ERR(ai, "Broken configuration for this PCM: no configurations available.\n");
+ return -1;
}
err = snd_pcm_hw_params_set_access(ai->alsa.handle, params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
+ SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- MP_ERR(ai, "Access type not available.\n");
- return -1;
+ MP_ERR(ai, "Access type not available.\n");
+ return -1;
}
err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
if (err < 0) {
- MP_ERR(ai, "Sample format not available.\n");
- return -1;
+ MP_ERR(ai, "Sample format not available.\n");
+ return -1;
}
err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels);
if (err < 0) {
- snd_pcm_hw_params_get_channels(params, &ai->channels);
- MP_ERR(ai, "Channel count not available - reverting to default: %d\n",
- ai->channels);
+ snd_pcm_hw_params_get_channels(params, &ai->channels);
+ MP_ERR(ai, "Channel count not available - reverting to default: %d\n",
+ ai->channels);
} else {
- ai->channels = ai->req_channels;
+ ai->channels = ai->req_channels;
}
dir = 0;
rate = ai->req_samplerate;
err = snd_pcm_hw_params_set_rate_near(ai->alsa.handle, params, &rate, &dir);
if (err < 0) {
- MP_ERR(ai, "Cannot set samplerate.\n");
+ MP_ERR(ai, "Cannot set samplerate.\n");
}
ai->samplerate = rate;
dir = 0;
ai->alsa.buffer_time = 1000000;
err = snd_pcm_hw_params_set_buffer_time_near(ai->alsa.handle, params,
- &ai->alsa.buffer_time, &dir);
+ &ai->alsa.buffer_time, &dir);
if (err < 0) {
- MP_ERR(ai, "Cannot set buffer time.\n");
+ MP_ERR(ai, "Cannot set buffer time.\n");
}
dir = 0;
ai->alsa.period_time = ai->alsa.buffer_time / 4;
err = snd_pcm_hw_params_set_period_time_near(ai->alsa.handle, params,
- &ai->alsa.period_time, &dir);
+ &ai->alsa.period_time, &dir);
if (err < 0) {
- MP_ERR(ai, "Cannot set period time.\n");
+ MP_ERR(ai, "Cannot set period time.\n");
}
err = snd_pcm_hw_params(ai->alsa.handle, params);
if (err < 0) {
- MP_ERR(ai, "Unable to install hardware parameters: %s", snd_strerror(err));
- snd_pcm_hw_params_dump(params, ai->alsa.log);
- return -1;
+ MP_ERR(ai, "Unable to install hardware parameters: %s", snd_strerror(err));
+ snd_pcm_hw_params_dump(params, ai->alsa.log);
+ return -1;
}
dir = -1;
@@ -102,8 +102,8 @@ int ai_alsa_setup(audio_in_t *ai)
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
ai->alsa.chunk_size = period_size;
if (period_size == buffer_size) {
- MP_ERR(ai, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
- return -1;
+ MP_ERR(ai, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
+ return -1;
}
snd_pcm_sw_params_current(ai->alsa.handle, swparams);
@@ -113,13 +113,13 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_sw_params_set_stop_threshold(ai->alsa.handle, swparams, buffer_size);
if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) {
- MP_ERR(ai, "Unable to install software parameters:\n");
- snd_pcm_sw_params_dump(swparams, ai->alsa.log);
- return -1;
+ MP_ERR(ai, "Unable to install software parameters:\n");
+ snd_pcm_sw_params_dump(swparams, ai->alsa.log);
+ return -1;
}
if (mp_msg_test(ai->log, MSGL_V)) {
- snd_pcm_dump(ai->alsa.handle, ai->alsa.log);
+ snd_pcm_dump(ai->alsa.handle, ai->alsa.log);
}
ai->alsa.bits_per_sample = snd_pcm_format_physical_width(SND_PCM_FORMAT_S16_LE);
@@ -137,14 +137,14 @@ int ai_alsa_init(audio_in_t *ai)
err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
if (err < 0) {
- MP_ERR(ai, "Error opening audio: %s\n", snd_strerror(err));
- return -1;
+ MP_ERR(ai, "Error opening audio: %s\n", snd_strerror(err));
+ return -1;
}
err = snd_output_stdio_attach(&ai->alsa.log, stderr, 0);
if (err < 0) {
- return -1;
+ return -1;
}
err = ai_alsa_setup(ai);
@@ -153,14 +153,14 @@ int ai_alsa_init(audio_in_t *ai)
}
#ifndef timersub
-#define timersub(a, b, result) \
+#define timersub(a, b, result) \
do { \
- (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
- (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
- if ((result)->tv_usec < 0) { \
- --(result)->tv_sec; \
- (result)->tv_usec += 1000000; \
- } \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
} while (0)
#endif
@@ -171,25 +171,25 @@ int ai_alsa_xrun(audio_in_t *ai)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(ai->alsa.handle, status))<0) {
- MP_ERR(ai, "ALSA status error: %s", snd_strerror(res));
- return -1;
+ MP_ERR(ai, "ALSA status error: %s", snd_strerror(res));
+ return -1;
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
- struct timeval now, diff, tstamp;
- gettimeofday(&now, 0);
- snd_pcm_status_get_trigger_tstamp(status, &tstamp);
- timersub(&now, &tstamp, &diff);
- MP_ERR(ai, "ALSA xrun!!! (at least %.3f ms long)\n",
- diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
- if (mp_msg_test(ai->log, MSGL_V)) {
- MP_ERR(ai, "ALSA Status:\n");
- snd_pcm_status_dump(status, ai->alsa.log);
- }
- if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
- MP_ERR(ai, "ALSA xrun: prepare error: %s", snd_strerror(res));
- return -1;
- }
- return 0; /* ok, data should be accepted again */
+ struct timeval now, diff, tstamp;
+ gettimeofday(&now, 0);
+ snd_pcm_status_get_trigger_tstamp(status, &tstamp);
+ timersub(&now, &tstamp, &diff);
+ MP_ERR(ai, "ALSA xrun!!! (at least %.3f ms long)\n",
+ diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
+ if (mp_msg_test(ai->log, MSGL_V)) {
+ MP_ERR(ai, "ALSA Status:\n");
+ snd_pcm_status_dump(status, ai->alsa.log);
+ }
+ if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
+ MP_ERR(ai, "ALSA xrun: prepare error: %s", snd_strerror(res));
+ return -1;
+ }
+ return 0; /* ok, data should be accepted again */
}
MP_ERR(ai, "ALSA read/write error");
return -1;
diff --git a/stream/ai_oss.c b/stream/ai_oss.c
index 8672d13fc0..b7a7988bde 100644
--- a/stream/ai_oss.c
+++ b/stream/ai_oss.c
@@ -56,28 +56,28 @@ int ai_oss_set_channels(audio_in_t *ai)
if (ai->req_channels > 2)
{
- ioctl_param = ai->req_channels;
- MP_VERBOSE(ai, "ioctl dsp channels: %d\n",
- err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_CHANNELS, &ioctl_param));
- if (err < 0) {
- MP_ERR(ai, "Unable to set channel count: %d\n",
- ai->req_channels);
- return -1;
- }
- ai->channels = ioctl_param;
+ ioctl_param = ai->req_channels;
+ MP_VERBOSE(ai, "ioctl dsp channels: %d\n",
+ err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_CHANNELS, &ioctl_param));
+ if (err < 0) {
+ MP_ERR(ai, "Unable to set channel count: %d\n",
+ ai->req_channels);
+ return -1;
+ }
+ ai->channels = ioctl_param;
}
else
{
- ioctl_param = (ai->req_channels == 2);
- MP_VERBOSE(ai, "ioctl dsp stereo: %d (req: %d)\n",
- err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_STEREO, &ioctl_param),
- ioctl_param);
- if (err < 0) {
- MP_ERR(ai, "Unable to set stereo: %d\n",
- ai->req_channels == 2);
- return -1;
- }
- ai->channels = ioctl_param ? 2 : 1;
+ ioctl_param = (ai->req_channels == 2);
+ MP_VERBOSE(ai, "ioctl dsp stereo: %d (req: %d)\n",
+ err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_STEREO, &ioctl_param),
+ ioctl_param);
+ if (err < 0) {
+ MP_ERR(ai, "Unable to set stereo: %d\n",
+ ai->req_channels == 2);
+ return -1;
+ }
+ ai->channels = ioctl_param ? 2 : 1;
}
return 0;
}
@@ -90,65 +90,65 @@ int ai_oss_init(audio_in_t *ai)
ai->oss.audio_fd = open(ai->oss.device, O_RDONLY | O_CLOEXEC);
if (ai->oss.audio_fd < 0)
{
- MP_ERR(ai, "Unable to open '%s': %s\n",
- ai->oss.device, strerror(errno));
- return -1;
+ MP_ERR(ai, "Unable to open '%s': %s\n",
+ ai->oss.device, strerror(errno));
+ return -1;
}
ioctl_param = 0 ;
MP_VERBOSE(ai, "ioctl dsp getfmt: %d\n",
- ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param));
+ ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETFMTS, &ioctl_param));
MP_VERBOSE(ai, "Supported formats: %x\n", ioctl_param);
if (!(ioctl_param & AFMT_S16_LE))
- MP_ERR(ai, "unsupported format\n");
+ MP_ERR(ai, "unsupported format\n");
ioctl_param = AFMT_S16_LE;
MP_VERBOSE(ai, "ioctl dsp setfmt: %d\n",
- err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param));
+ err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param));
if (err < 0) {
- MP_ERR(ai, "Unable to set audio format.");
- return -1;
+ MP_ERR(ai, "Unable to set audio format.");
+ return -1;
}
if (ai_oss_set_channels(ai) < 0) return -1;
ioctl_param = ai->req_samplerate;
MP_VERBOSE(ai, "ioctl dsp speed: %d\n",
- err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param));
+ err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param));
if (err < 0) {
- MP_ERR(ai, "Unable to set samplerate: %d\n",
- ai->req_samplerate);
- return -1;
+ MP_ERR(ai, "Unable to set samplerate: %d\n",
+ ai->req_samplerate);
+ return -1;
}
ai->samplerate = ioctl_param;
MP_VERBOSE(ai, "ioctl dsp trigger: %d\n",
- ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETTRIGGER, &ioctl_param));
+ ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETTRIGGER, &ioctl_param));
MP_VERBOSE(ai, "trigger: %x\n", ioctl_param);
ioctl_param = PCM_ENABLE_INPUT;
MP_VERBOSE(ai, "ioctl dsp trigger: %d\n",
- err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETTRIGGER, &ioctl_param));
+ err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETTRIGGER, &ioctl_param));
if (err < 0) {
- MP_ERR(ai, "Unable to set trigger: %d\n",
- PCM_ENABLE_INPUT);
+ MP_ERR(ai, "Unable to set trigger: %d\n",
+ PCM_ENABLE_INPUT);
}
ai->blocksize = 0;
MP_VERBOSE(ai, "ioctl dsp getblocksize: %d\n",
- err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETBLKSIZE, &ai->blocksize));
+ err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETBLKSIZE, &ai->blocksize));
if (err < 0) {
- MP_ERR(ai, "Unable to get block size!\n");
+ MP_ERR(ai, "Unable to get block size!\n");
}
MP_VERBOSE(ai, "blocksize: %d\n", ai->blocksize);
// correct the blocksize to a reasonable value
if (ai->blocksize <= 0) {
- ai->blocksize = 4096*ai->channels*2;
- MP_ERR(ai, "Audio block size is zero, setting to %d!\n", ai->blocksize);
+ ai->blocksize = 4096*ai->channels*2;
+ MP_ERR(ai, "Audio block size is zero, setting to %d!\n", ai->blocksize);
} else if (ai->blocksize < 4096*ai->channels*2) {
- ai->blocksize *= 4096*ai->channels*2/ai->blocksize;
- MP_ERR(ai, "Audio block size too low, setting to %d!\n", ai->blocksize);
+ ai->blocksize *= 4096*ai->channels*2/ai->blocksize;
+ MP_ERR(ai, "Audio block size too low, setting to %d!\n", ai->blocksize);
}
ai->samplesize = 16;
diff --git a/stream/ai_sndio.c b/stream/ai_sndio.c
index 3cd68e5ee1..dc3c66279d 100644
--- a/stream/ai_sndio.c
+++ b/stream/ai_sndio.c
@@ -18,11 +18,11 @@ int ai_sndio_setup(audio_in_t *ai)
par.le = 1;
par.rchan = ai->req_channels;
par.rate = ai->req_samplerate;
- par.appbufsz = ai->req_samplerate; /* 1 sec */
+ par.appbufsz = ai->req_samplerate; /* 1 sec */
if (!sio_setpar(ai->sndio.hdl, &par) || !sio_getpar(ai->sndio.hdl, &par)) {
- MP_ERR(ai, "could not configure sndio audio");
- return -1;
+ MP_ERR(ai, "could not configure sndio audio");
+ return -1;
}
ai->channels = par.rchan;
@@ -39,8 +39,8 @@ int ai_sndio_init(audio_in_t *ai)
int err;
if ((ai->sndio.hdl = sio_open(ai->sndio.device, SIO_REC, 0)) == NULL) {
- MP_ERR(ai, "could not open sndio audio");
- return -1;
+ MP_ERR(ai, "could not open sndio audio");
+ return -1;
}
err = ai_sndio_setup(ai);
diff --git a/stream/audio_in.c b/stream/audio_in.c
index 6592735aa9..8e956630b7 100644
--- a/stream/audio_in.c
+++ b/stream/audio_in.c
@@ -43,25 +43,25 @@ int audio_in_init(audio_in_t *ai, struct mp_log *log, int type)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- ai->alsa.handle = NULL;
- ai->alsa.log = NULL;
- ai->alsa.device = strdup("default");
- return 0;
+ ai->alsa.handle = NULL;
+ ai->alsa.log = NULL;
+ ai->alsa.device = strdup("default");
+ return 0;
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- ai->oss.audio_fd = -1;
- ai->oss.device = strdup("/dev/dsp");
- return 0;
+ ai->oss.audio_fd = -1;
+ ai->oss.device = strdup("/dev/dsp");
+ return 0;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
- ai->sndio.hdl = NULL;
- ai->sndio.device = strdup("default");
- return 0;
+ ai->sndio.hdl = NULL;
+ ai->sndio.device = strdup("default");
+ return 0;
#endif
default:
- return -1;
+ return -1;
}
}
@@ -71,24 +71,24 @@ int audio_in_setup(audio_in_t *ai)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- if (ai_alsa_init(ai) < 0) return -1;
- ai->setup = 1;
- return 0;
+ if (ai_alsa_init(ai) < 0) return -1;
+ ai->setup = 1;
+ return 0;
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- if (ai_oss_init(ai) < 0) return -1;
- ai->setup = 1;
- return 0;
+ if (ai_oss_init(ai) < 0) return -1;
+ ai->setup = 1;
+ return 0;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
- if (ai_sndio_init(ai) < 0) return -1;
- ai->setup = 1;
- return 0;
+ if (ai_sndio_init(ai) < 0) return -1;
+ ai->setup = 1;
+ return 0;
#endif
default:
- return -1;
+ return -1;
}
}
@@ -97,27 +97,27 @@ int audio_in_set_samplerate(audio_in_t *ai, int rate)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- ai->req_samplerate = rate;
- if (!ai->setup) return 0;
- if (ai_alsa_setup(ai) < 0) return -1;
- return ai->samplerate;
+ ai->req_samplerate = rate;
+ if (!ai->setup) return 0;
+ if (ai_alsa_setup(ai) < 0) return -1;
+ return ai->samplerate;
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- ai->req_samplerate = rate;
- if (!ai->setup) return 0;
- if (ai_oss_set_samplerate(ai) < 0) return -1;
- return ai->samplerate;
+ ai->req_samplerate = rate;
+ if (!ai->setup) return 0;
+ if (ai_oss_set_samplerate(ai) < 0) return -1;
+ return ai->samplerate;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
- ai->req_samplerate = rate;
- if (!ai->setup) return 0;
- if (ai_sndio_setup(ai) < 0) return -1;
- return ai->samplerate;
+ ai->req_samplerate = rate;
+ if (!ai->setup) return 0;
+ if (ai_sndio_setup(ai) < 0) return -1;
+ return ai->samplerate;
#endif
default:
- return -1;
+ return -1;
}
}
@@ -126,17 +126,17 @@ int audio_in_set_channels(audio_in_t *ai, int channels)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- ai->req_channels = channels;
- if (!ai->setup) return 0;
- if (ai_alsa_setup(ai) < 0) return -1;
- return ai->channels;
+ ai->req_channels = channels;
+ if (!ai->setup) return 0;
+ if (ai_alsa_setup(ai) < 0) return -1;
+ return ai->channels;
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- ai->req_channels = channels;
- if (!ai->setup) return 0;
- if (ai_oss_set_channels(ai) < 0) return -1;
- return ai->channels;
+ ai->req_channels = channels;
+ if (!ai->setup) return 0;
+ if (ai_oss_set_channels(ai) < 0) return -1;
+ return ai->channels;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
@@ -146,7 +146,7 @@ int audio_in_set_channels(audio_in_t *ai, int channels)
return ai->channels;
#endif
default:
- return -1;
+ return -1;
}
}
@@ -159,19 +159,19 @@ int audio_in_set_device(audio_in_t *ai, char *device)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- free(ai->alsa.device);
- ai->alsa.device = strdup(device);
- /* mplayer cannot handle colons in arguments */
- for (i = 0; i < (int)strlen(ai->alsa.device); i++) {
- if (ai->alsa.device[i] == '.') ai->alsa.device[i] = ':';
- }
- return 0;
+ free(ai->alsa.device);
+ ai->alsa.device = strdup(device);
+ /* mplayer cannot handle colons in arguments */
+ for (i = 0; i < (int)strlen(ai->alsa.device); i++) {
+ if (ai->alsa.device[i] == '.') ai->alsa.device[i] = ':';
+ }
+ return 0;
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- free(ai->oss.device);
- ai->oss.device = strdup(device);
- return 0;
+ free(ai->oss.device);
+ ai->oss.device = strdup(device);
+ return 0;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
@@ -180,29 +180,29 @@ int audio_in_set_device(audio_in_t *ai, char *device)
return 0;
#endif
default:
- return -1;
+ return -1;
}
}
int audio_in_uninit(audio_in_t *ai)
{
if (ai->setup) {
- switch (ai->type) {
+ switch (ai->type) {
#if HAVE_ALSA
- case AUDIO_IN_ALSA:
- if (ai->alsa.log)
- snd_output_close(ai->alsa.log);
- if (ai->alsa.handle) {
- snd_pcm_close(ai->alsa.handle);
- }
- ai->setup = 0;
- return 0;
+ case AUDIO_IN_ALSA:
+ if (ai->alsa.log)
+ snd_output_close(ai->alsa.log);
+ if (ai->alsa.handle) {
+ snd_pcm_close(ai->alsa.handle);
+ }
+ ai->setup = 0;
+ return 0;
#endif
#if HAVE_OSS_AUDIO
- case AUDIO_IN_OSS:
- close(ai->oss.audio_fd);
- ai->setup = 0;
- return 0;
+ case AUDIO_IN_OSS:
+ close(ai->oss.audio_fd);
+ ai->setup = 0;
+ return 0;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
@@ -211,7 +211,7 @@ int audio_in_uninit(audio_in_t *ai)
ai->setup = 0;
return 0;
#endif
- }
+ }
}
return -1;
}
@@ -221,11 +221,11 @@ int audio_in_start_capture(audio_in_t *ai)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- return snd_pcm_start(ai->alsa.handle);
+ return snd_pcm_start(ai->alsa.handle);
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- return 0;
+ return 0;
#endif
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
@@ -234,7 +234,7 @@ int audio_in_start_capture(audio_in_t *ai)
return 0;
#endif
default:
- return -1;
+ return -1;
}
}
@@ -245,27 +245,27 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
switch (ai->type) {
#if HAVE_ALSA
case AUDIO_IN_ALSA:
- ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
- if (ret != ai->alsa.chunk_size) {
- if (ret < 0) {
- MP_ERR(ai, "\nError reading audio: %s\n", snd_strerror(ret));
- if (ret == -EPIPE) {
- if (ai_alsa_xrun(ai) == 0) {
- MP_ERR(ai, "Recovered from cross-run, some frames may be left out!\n");
- } else {
- MP_ERR(ai, "Fatal error, cannot recover!\n");
- }
- }
- } else {
- MP_ERR(ai, "\nNot enough audio samples!\n");
- }
- return -1;
- }
- return ret;
+ ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
+ if (ret != ai->alsa.chunk_size) {
+ if (ret < 0) {
+ MP_ERR(ai, "\nError reading audio: %s\n", snd_strerror(ret));
+ if (ret == -EPIPE) {
+ if (ai_alsa_xrun(ai) == 0) {
+ MP_ERR(ai, "Recovered from cross-run, some frames may be left out!\n");
+ } else {
+ MP_ERR(ai, "Fatal error, cannot recover!\n");
+ }
+ }
+ } else {
+ MP_ERR(ai, "\nNot enough audio samples!\n");
+ }
+ return -1;
+ }
+ return ret;
#endif
#if HAVE_OSS_AUDIO
case AUDIO_IN_OSS:
- ret = read(ai->oss.audio_fd, buffer, ai->blocksize);
+ ret = read(ai->oss.audio_fd, buffer, ai->blocksize);
if (ret != ai->blocksize) {
if (ret < 0) {
MP_ERR(ai, "\nError reading audio: %s\n", strerror(errno));
@@ -280,17 +280,17 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
#if HAVE_SNDIO
case AUDIO_IN_SNDIO:
ret = sio_read(ai->sndio.hdl, buffer, ai->blocksize);
- if (ret != ai->blocksize) {
- if (ret < 0) {
- MP_ERR(ai, "\nError reading audio: %s\n", strerror(errno));
- } else {
- MP_ERR(ai, "\nNot enough audio samples!\n");
- }
- return -1;
- }
- return ret;
+ if (ret != ai->blocksize) {
+ if (ret < 0) {
+ MP_ERR(ai, "\nError reading audio: %s\n", strerror(errno));
+ } else {
+ MP_ERR(ai, "\nNot enough audio samples!\n");
+ }
+ return -1;
+ }
+ return ret;
#endif
default:
- return -1;
+ return -1;
}
}
diff --git a/stream/cookies.c b/stream/cookies.c
index a12122f0ac..f8bc852259 100644
--- a/stream/cookies.c
+++ b/stream/cookies.c
@@ -55,7 +55,7 @@ static char *col_dup(void *talloc_ctx, const char *src)
{
int length = 0;
while (src[length] > 31)
- length++;
+ length++;
return talloc_strndup(talloc_ctx, src, length);
}
@@ -67,13 +67,13 @@ static int parse_line(char **ptr, char *cols[7])
cols[0] = *ptr;
for (col = 1; col < 7; col++) {
- for (; (**ptr) > 31; (*ptr)++);
- if (**ptr == 0)
- return 0;
- (*ptr)++;
- if ((*ptr)[-1] != 9)
- return 0;
- cols[col] = (*ptr);
+ for (; (**ptr) > 31; (*ptr)++);
+ if (**ptr == 0)
+ return 0;
+ (*ptr)++;
+ if ((*ptr)[-1] != 9)
+ return 0;
+ cols[col] = (*ptr);
}
return 1;
@@ -89,32 +89,32 @@ static char *load_file(struct mp_log *log, const char *filename, int64_t * lengt
fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
- mp_verbose(log, "Could not open");
- goto err_out;
+ mp_verbose(log, "Could not open");
+ goto err_out;
}
*length = lseek(fd, 0, SEEK_END);
if (*length < 0) {
- mp_verbose(log, "Could not find EOF");
- goto err_out;
+ mp_verbose(log, "Could not find EOF");
+ goto err_out;
}
if (*length > SIZE_MAX - 1) {
- mp_verbose(log, "File too big, could not malloc.");
- goto err_out;
+ mp_verbose(log, "File too big, could not malloc.");
+ goto err_out;
}
lseek(fd, 0, SEEK_SET);
if (!(buffer = malloc(*length + 1))) {
- mp_verbose(log, "Could not malloc.");
- goto err_out;
+ mp_verbose(log, "Could not malloc.");
+ goto err_out;
}
if (read(fd, buffer, *length) != *length) {
- mp_verbose(log, "Read is behaving funny.");
- goto err_out;
+ mp_verbose(log, "Read is behaving funny.");
+ goto err_out;
}
close(fd);
buffer[*length] = 0;
@@ -137,22 +137,22 @@ static struct cookie_list_type *load_cookies_from(void *ctx,
ptr = file = load_file(log, filename, &length);
if (!ptr)
- return NULL;
+ return NULL;
struct cookie_list_type *list = NULL;
while (*ptr) {
- char *cols[7];
- if (parse_line(&ptr, cols)) {
- struct cookie_list_type *new;
- new = talloc_zero(ctx, cookie_list_t);
- new->name = col_dup(new, cols[5]);
- new->value = col_dup(new, cols[6]);
- new->path = col_dup(new, cols[2]);
- new->domain = col_dup(new, cols[0]);
- new->secure = (*(cols[3]) == 't') || (*(cols[3]) == 'T');
- new->next = list;
- list = new;
- }
+ char *cols[7];
+ if (parse_line(&ptr, cols)) {
+ struct cookie_list_type *new;
+ new = talloc_zero(ctx, cookie_list_t);
+ new->name = col_dup(new, cols[5]);
+ new->value = col_dup(new, cols[6]);
+ new->path = col_dup(new, cols[2]);
+ new->domain = col_dup(new, cols[0]);
+ new->secure = (*(cols[3]) == 't') || (*(cols[3]) == 'T');
+ new->next = list;
+ list = new;
+ }
}
free(file);
return list;
diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c
index 0cf19a8fba..7065a77aa3 100644
--- a/stream/dvb_tune.c
+++ b/stream/dvb_tune.c
@@ -52,225 +52,225 @@ int dvb_get_tuner_type(int fe_fd, struct mp_log *log)
res = ioctl(fe_fd, FE_GET_INFO, &fe_info);
if(res < 0)
{
- mp_err(log, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd);
- return 0;
+ mp_err(log, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd);
+ return 0;
}
switch(fe_info.type)
{
- case FE_OFDM:
+ case FE_OFDM:
mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-T\n");
- return TUNER_TER;
+ return TUNER_TER;
- case FE_QPSK:
+ case FE_QPSK:
mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-S\n");
- return TUNER_SAT;
+ return TUNER_SAT;
- case FE_QAM:
+ case FE_QAM:
mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-C\n");
- return TUNER_CBL;
+ return TUNER_CBL;
#ifdef DVB_ATSC
- case FE_ATSC:
+ case FE_ATSC:
mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
- return TUNER_ATSC;
+ return TUNER_ATSC;
#endif
- default:
- mp_err(log, "UNKNOWN TUNER TYPE\n");
- return 0;
+ default:
+ mp_err(log, "UNKNOWN TUNER TYPE\n");
+ return 0;
}
}
int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt)
{
- int i;
- char frontend_dev[32], dvr_dev[32], demux_dev[32];
-
- sprintf(frontend_dev, "/dev/dvb/adapter%d/frontend0", n);
- sprintf(dvr_dev, "/dev/dvb/adapter%d/dvr0", n);
- sprintf(demux_dev, "/dev/