From 78128bddda4bcea1f256fc13cc33fa2652ed277c Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 13 Apr 2014 18:00:51 +0200 Subject: Kill all tabs I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces). --- stream/ai_alsa1x.c | 104 ++-- stream/ai_oss.c | 82 +-- stream/ai_sndio.c | 10 +- stream/audio_in.c | 198 +++---- stream/cookies.c | 62 +- stream/dvb_tune.c | 368 ++++++------ stream/dvbin.h | 76 +-- stream/frequencies.c | 1416 +++++++++++++++++++++++----------------------- stream/frequencies.h | 108 ++-- stream/stream_dvb.c | 1200 +++++++++++++++++++-------------------- stream/stream_dvd.c | 8 +- stream/stream_radio.c | 2 +- stream/stream_smb.c | 2 +- stream/stream_vcd.c | 2 +- stream/tv.c | 610 ++++++++++---------- stream/tv.h | 136 ++--- stream/tvi_def.h | 10 +- stream/tvi_dummy.c | 70 +-- stream/tvi_v4l2.c | 10 +- stream/vcd_read.h | 14 +- stream/vcd_read_darwin.h | 216 +++---- stream/vcd_read_fbsd.h | 12 +- stream/vcd_read_win32.h | 48 +- 23 files changed, 2382 insertions(+), 2382 deletions(-) (limited to 'stream') 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/dvb/adapter%d/demux0", n); - priv->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); - if(priv->fe_fd < 0) - { - MP_ERR(priv, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno); - return 0; - } - priv->demux_fds_cnt = 0; - MP_VERBOSE(priv, "DVB_OPEN_DEVICES(%d)\n", demux_cnt); - for(i = 0; i < demux_cnt; i++) - { - priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); - if(priv->demux_fds[i] < 0) - { - MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno); - return 0; - } - else - { - MP_VERBOSE(priv, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev, priv->demux_fds[i], priv->demux_fds_cnt); - priv->demux_fds_cnt++; - } - } - - - priv->dvr_fd = open(dvr_dev, O_RDONLY| O_NONBLOCK | O_CLOEXEC); - if(priv->dvr_fd < 0) - { - MP_ERR(priv, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno); - return 0; - } - - return 1; + 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/dvb/adapter%d/demux0", n); + priv->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); + if(priv->fe_fd < 0) + { + MP_ERR(priv, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno); + return 0; + } + priv->demux_fds_cnt = 0; + MP_VERBOSE(priv, "DVB_OPEN_DEVICES(%d)\n", demux_cnt); + for(i = 0; i < demux_cnt; i++) + { + priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); + if(priv->demux_fds[i] < 0) + { + MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno); + return 0; + } + else + { + MP_VERBOSE(priv, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev, priv->demux_fds[i], priv->demux_fds_cnt); + priv->demux_fds_cnt++; + } + } + + + priv->dvr_fd = open(dvr_dev, O_RDONLY| O_NONBLOCK | O_CLOEXEC); + if(priv->dvr_fd < 0) + { + MP_ERR(priv, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno); + return 0; + } + + return 1; } int dvb_fix_demuxes(dvb_priv_t *priv, int cnt) { - int i; - char demux_dev[32]; - - sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", priv->card); - MP_VERBOSE(priv, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); - if(priv->demux_fds_cnt >= cnt) - { - for(i = priv->demux_fds_cnt-1; i >= cnt; i--) - { - MP_VERBOSE(priv, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]); - close(priv->demux_fds[i]); - } - priv->demux_fds_cnt = cnt; - } - else if(priv->demux_fds_cnt < cnt) - { - for(i = priv->demux_fds_cnt; i < cnt; i++) - { - priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); - MP_VERBOSE(priv, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]); - if(priv->demux_fds[i] < 0) - { - MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno); - return 0; - } - else - priv->demux_fds_cnt++; - } - } - - return 1; + int i; + char demux_dev[32]; + + sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", priv->card); + MP_VERBOSE(priv, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt); + if(priv->demux_fds_cnt >= cnt) + { + for(i = priv->demux_fds_cnt-1; i >= cnt; i--) + { + MP_VERBOSE(priv, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]); + close(priv->demux_fds[i]); + } + priv->demux_fds_cnt = cnt; + } + else if(priv->demux_fds_cnt < cnt) + { + for(i = priv->demux_fds_cnt; i < cnt; i++) + { + priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); + MP_VERBOSE(priv, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]); + if(priv->demux_fds[i] < 0) + { + MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno); + return 0; + } + else + priv->demux_fds_cnt++; + } + } + + return 1; } int dvb_set_ts_filt(dvb_priv_t *priv, int fd, uint16_t pid, dmx_pes_type_t pestype) { - int i; - struct dmx_pes_filter_params pesFilterParams; - - pesFilterParams.pid = pid; - pesFilterParams.input = DMX_IN_FRONTEND; - pesFilterParams.output = DMX_OUT_TS_TAP; - pesFilterParams.pes_type = pestype; - pesFilterParams.flags = DMX_IMMEDIATE_START; - - errno = 0; - if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) - { - MP_ERR(priv, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno); - return 0; - } - - MP_VERBOSE(priv, "SET PES FILTER ON PID %d to fd %d, RESULT: %d, ERRNO: %d\n", pid, fd, i, errno); - return 1; + int i; + struct dmx_pes_filter_params pesFilterParams; + + pesFilterParams.pid = pid; + pesFilterParams.input = DMX_IN_FRONTEND; + pesFilterParams.output = DMX_OUT_TS_TAP; + pesFilterParams.pes_type = pestype; + pesFilterParams.flags = DMX_IMMEDIATE_START; + + errno = 0; + if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) + { + MP_ERR(priv, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno); + return 0; + } + + MP_VERBOSE(priv, "SET PES FILTER ON PID %d to fd %d, RESULT: %d, ERRNO: %d\n", pid, fd, i, errno); + return 1; } int dvb_demux_stop(int fd) { - int i; - i = ioctl(fd, DMX_STOP); + int i; + i = ioctl(fd, DMX_STOP); - return i == 0; + return i == 0; } int dvb_demux_start(int fd) { - int i; - i = ioctl(fd, DMX_START); + int i; + i = ioctl(fd, DMX_START); - return i == 0; + return i == 0; } static void print_status(dvb_priv_t *priv, fe_status_t festatus) { - MP_VERBOSE(priv, "FE_STATUS:"); - if (festatus & FE_HAS_SIGNAL) MP_VERBOSE(priv, " FE_HAS_SIGNAL"); - if (festatus & FE_TIMEDOUT) MP_VERBOSE(priv, " FE_TIMEDOUT"); - if (festatus & FE_HAS_LOCK) MP_VERBOSE(priv, " FE_HAS_LOCK"); - if (festatus & FE_HAS_CARRIER) MP_VERBOSE(priv, " FE_HAS_CARRIER"); - if (festatus & FE_HAS_VITERBI) MP_VERBOSE(priv, " FE_HAS_VITERBI"); - if (festatus & FE_HAS_SYNC) MP_VERBOSE(priv, " FE_HAS_SYNC"); - MP_VERBOSE(priv, "\n"); + MP_VERBOSE(priv, "FE_STATUS:"); + if (festatus & FE_HAS_SIGNAL) MP_VERBOSE(priv, " FE_HAS_SIGNAL"); + if (festatus & FE_TIMEDOUT) MP_VERBOSE(priv, " FE_TIMEDOUT"); + if (festatus & FE_HAS_LOCK) MP_VERBOSE(priv, " FE_HAS_LOCK"); + if (festatus & FE_HAS_CARRIER) MP_VERBOSE(priv, " FE_HAS_CARRIER"); + if (festatus & FE_HAS_VITERBI) MP_VERBOSE(priv, " FE_HAS_VITERBI"); + if (festatus & FE_HAS_SYNC) MP_VERBOSE(priv, " FE_HAS_SYNC"); + MP_VERBOSE(priv, "\n"); } static int check_status(dvb_priv_t *priv, int fd_frontend, int tmout) { - int32_t strength; - fe_status_t festatus; - struct pollfd pfd[1]; - int ok=0, locks=0; - time_t tm1, tm2; - - pfd[0].fd = fd_frontend; - pfd[0].events = POLLPRI; - - MP_VERBOSE(priv, "Getting frontend status\n"); - tm1 = tm2 = time((time_t*) NULL); - while(!ok) - { - festatus = 0; - if(poll(pfd,1,tmout*1000) > 0) - { - if (pfd[0].revents & POLLPRI) - { - if(ioctl(fd_frontend, FE_READ_STATUS, &festatus) >= 0) - if(festatus & FE_HAS_LOCK) - locks++; - } - } - usleep(10000); - tm2 = time((time_t*) NULL); - if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= tmout)) - ok = 1; - } - - if(festatus & FE_HAS_LOCK) - { - strength=0; - if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) - MP_VERBOSE(priv, "Bit error rate: %d\n",strength); - - strength=0; - if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) - MP_VERBOSE(priv, "Signal strength: %d\n",strength); - - strength=0; - if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) - MP_VERBOSE(priv, "SNR: %d\n",strength); - - strength=0; - if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0) - MP_VERBOSE(priv, "UNC: %d\n",strength); - - print_status(priv, festatus); - } - else - { - MP_ERR(priv, "Not able to lock to the signal on the given frequency, timeout: %d\n", tmout); - return -1; - } - return 0; + int32_t strength; + fe_status_t festatus; + struct pollfd pfd[1]; + int ok=0, locks=0; + time_t tm1, tm2; + + pfd[0].fd = fd_frontend; + pfd[0].events = POLLPRI; + + MP_VERBOSE(priv, "Getting frontend status\n"); + tm1 = tm2 = time((time_t*) NULL); + while(!ok) + { + festatus = 0; + if(poll(pfd,1,tmout*1000) > 0) + { + if (pfd[0].revents & POLLPRI) + { + if(ioctl(fd_frontend, FE_READ_STATUS, &festatus) >= 0) + if(festatus & FE_HAS_LOCK) + locks++; + } + } + usleep(10000); + tm2 = time((time_t*) NULL); + if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= tmout)) + ok = 1; + } + + if(festatus & FE_HAS_LOCK) + { + strength=0; + if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0) + MP_VERBOSE(priv, "Bit error rate: %d\n",strength); + + strength=0; + if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0) + MP_VERBOSE(priv, "Signal strength: %d\n",strength); + + strength=0; + if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0) + MP_VERBOSE(priv, "SNR: %d\n",strength); + + strength=0; + if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0) + MP_VERBOSE(priv, "UNC: %d\n",strength); + + print_status(priv, festatus); + } + else + { + MP_ERR(priv, "Not able to lock to the signal on the given frequency, timeout: %d\n", tmout); + return -1; + } + return 0; } @@ -280,7 +280,7 @@ struct diseqc_cmd { }; static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd, - fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b) + fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b) { if(ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) return -1; @@ -314,14 +314,14 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) 0xf0 | (((sat_no * 4) & 0x0f) | (hi_lo ? 1 : 0) | (polv ? 0 : 2)); return diseqc_send_msg(secfd, polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18, - &cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF, - (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A); + &cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF, + (sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A); } static int tune_it(dvb_priv_t *priv, int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, - fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, - fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, - fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) + fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, + fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, + fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) { int hi_lo = 0, dfd; struct dvb_frontend_parameters feparams; @@ -423,18 +423,18 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, int fd_sec, unsigned int f int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, - fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, - fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate, - fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) + fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, + fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate, + fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) { - int ris; + int ris; - MP_INFO(priv, "dvb_tune Freq: %lu\n", (long unsigned int) freq); + MP_INFO(priv, "dvb_tune Freq: %lu\n", (long unsigned int) freq); - ris = tune_it(priv, priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout); + ris = tune_it(priv, priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout); - if(ris != 0) - MP_INFO(priv, "dvb_tune, TUNING FAILED\n"); + if(ris != 0) + MP_INFO(priv, "dvb_tune, TUNING FAILED\n"); - return ris == 0; + return ris == 0; } diff --git a/stream/dvbin.h b/stream/dvbin.h index 38b1d15c6d..4caba45c7d 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -43,54 +43,54 @@ #endif typedef struct { - char *name; - int freq, srate, diseqc, tone; - char pol; - int tpid, dpid1, dpid2, progid, ca, pids[DMX_FILTER_SIZE], pids_cnt; - fe_spectral_inversion_t inv; - fe_modulation_t mod; - fe_transmit_mode_t trans; - fe_bandwidth_t bw; - fe_guard_interval_t gi; - fe_code_rate_t cr, cr_lp; - fe_hierarchy_t hier; + char *name; + int freq, srate, diseqc, tone; + char pol; + int tpid, dpid1, dpid2, progid, ca, pids[DMX_FILTER_SIZE], pids_cnt; + fe_spectral_inversion_t inv; + fe_modulation_t mod; + fe_transmit_mode_t trans; + fe_bandwidth_t bw; + fe_guard_interval_t gi; + fe_code_rate_t cr, cr_lp; + fe_hierarchy_t hier; } dvb_channel_t; typedef struct { - uint16_t NUM_CHANNELS; - uint16_t current; - dvb_channel_t *channels; + uint16_t NUM_CHANNELS; + uint16_t current; + dvb_channel_t *channels; } dvb_channels_list; typedef struct { - int type; - dvb_channels_list *list; - char *name; - int devno; + int type; + dvb_channels_list *list; + char *name; + int devno; } dvb_card_config_t; typedef struct { - int count; - dvb_card_config_t *cards; - void *priv; + int count; + dvb_card_config_t *cards; + void *priv; } dvb_config_t; typedef struct { struct mp_log *log; int fd; - int card; - int fe_fd; - int sec_fd; - int demux_fd[3], demux_fds[DMX_FILTER_SIZE], demux_fds_cnt; - int dvr_fd; - - dvb_config_t *config; - dvb_channels_list *list; - int tuner_type; - int is_on; - int retry; - int timeout; - int last_freq; + int card; + int fe_fd; + int sec_fd; + int demux_fd[3], demux_fds[DMX_FILTER_SIZE], demux_fds_cnt; + int dvr_fd; + + dvb_config_t *config; + dvb_channels_list *list; + int tuner_type; + int is_on; + int retry; + int timeout; + int last_freq; char *cfg_prog; int cfg_card; @@ -98,10 +98,10 @@ typedef struct { } dvb_priv_t; -#define TUNER_SAT 1 -#define TUNER_TER 2 -#define TUNER_CBL 3 -#define TUNER_ATSC 4 +#define TUNER_SAT 1 +#define TUNER_TER 2 +#define TUNER_CBL 3 +#define TUNER_ATSC 4 int dvb_step_channel(stream_t *, int); int dvb_set_channel(stream_t *, int, int); diff --git a/stream/frequencies.c b/stream/frequencies.c index 0ac9e483ee..ff020fabe6 100644 --- a/stream/frequencies.c +++ b/stream/frequencies.c @@ -25,371 +25,371 @@ /* US broadcast */ static const struct CHANLIST ntsc_bcast[] = { - { "2", 55250 }, - { "3", 61250 }, - { "4", 67250 }, - { "5", 77250 }, - { "6", 83250 }, - { "7", 175250 }, - { "8", 181250 }, - { "9", 187250 }, - { "10", 193250 }, - { "11", 199250 }, - { "12", 205250 }, - { "13", 211250 }, - { "14", 471250 }, - { "15", 477250 }, - { "16", 483250 }, - { "17", 489250 }, - { "18", 495250 }, - { "19", 501250 }, - { "20", 507250 }, - { "21", 513250 }, - { "22", 519250 }, - { "23", 525250 }, - { "24", 531250 }, - { "25", 537250 }, - { "26", 543250 }, - { "27", 549250 }, - { "28", 555250 }, - { "29", 561250 }, - { "30", 567250 }, - { "31", 573250 }, - { "32", 579250 }, - { "33", 585250 }, - { "34", 591250 }, - { "35", 597250 }, - { "36", 603250 }, - { "37", 609250 }, - { "38", 615250 }, - { "39", 621250 }, - { "40", 627250 }, - { "41", 633250 }, - { "42", 639250 }, - { "43", 645250 }, - { "44", 651250 }, - { "45", 657250 }, - { "46", 663250 }, - { "47", 669250 }, - { "48", 675250 }, - { "49", 681250 }, - { "50", 687250 }, - { "51", 693250 }, - { "52", 699250 }, - { "53", 705250 }, - { "54", 711250 }, - { "55", 717250 }, - { "56", 723250 }, - { "57", 729250 }, - { "58", 735250 }, - { "59", 741250 }, - { "60", 747250 }, - { "61", 753250 }, - { "62", 759250 }, - { "63", 765250 }, - { "64", 771250 }, - { "65", 777250 }, - { "66", 783250 }, - { "67", 789250 }, - { "68", 795250 }, - { "69", 801250 }, + { "2", 55250 }, + { "3", 61250 }, + { "4", 67250 }, + { "5", 77250 }, + { "6", 83250 }, + { "7", 175250 }, + { "8", 181250 }, + { "9", 187250 }, + { "10", 193250 }, + { "11", 199250 }, + { "12", 205250 }, + { "13", 211250 }, + { "14", 471250 }, + { "15", 477250 }, + { "16", 483250 }, + { "17", 489250 }, + { "18", 495250 }, + { "19", 501250 }, + { "20", 507250 }, + { "21", 513250 }, + { "22", 519250 }, + { "23", 525250 }, + { "24", 531250 }, + { "25", 537250 }, + { "26", 543250 }, + { "27", 549250 }, + { "28", 555250 }, + { "29", 561250 }, + { "30", 567250 }, + { "31", 573250 }, + { "32", 579250 }, + { "33", 585250 }, + { "34", 591250 }, + { "35", 597250 }, + { "36", 603250 }, + { "37", 609250 }, + { "38", 615250 }, + { "39", 621250 }, + { "40", 627250 }, + { "41", 633250 }, + { "42", 639250 }, + { "43", 645250 }, + { "44", 651250 }, + { "45", 657250 }, + { "46", 663250 }, + { "47", 669250 }, + { "48", 675250 }, + { "49", 681250 }, + { "50", 687250 }, + { "51", 693250 }, + { "52", 699250 }, + { "53", 705250 }, + { "54", 711250 }, + { "55", 717250 }, + { "56", 723250 }, + { "57", 729250 }, + { "58", 735250 }, + { "59", 741250 }, + { "60", 747250 }, + { "61", 753250 }, + { "62", 759250 }, + { "63", 765250 }, + { "64", 771250 }, + { "65", 777250 }, + { "66", 783250 }, + { "67", 789250 }, + { "68", 795250 }, + { "69", 801250 }, - { "70", 807250 }, - { "71", 813250 }, - { "72", 819250 }, - { "73", 825250 }, - { "74", 831250 }, - { "75", 837250 }, - { "76", 843250 }, - { "77", 849250 }, - { "78", 855250 }, - { "79", 861250 }, - { "80", 867250 }, - { "81", 873250 }, - { "82", 879250 }, - { "83", 885250 }, + { "70", 807250 }, + { "71", 813250 }, + { "72", 819250 }, + { "73", 825250 }, + { "74", 831250 }, + { "75", 837250 }, + { "76", 843250 }, + { "77", 849250 }, + { "78", 855250 }, + { "79", 861250 }, + { "80", 867250 }, + { "81", 873250 }, + { "82", 879250 }, + { "83", 885250 }, }; /* US cable */ static const struct CHANLIST ntsc_cable[] = { - { "1", 73250 }, - { "2", 55250 }, - { "3", 61250 }, - { "4", 67250 }, - { "5", 77250 }, - { "6", 83250 }, - { "7", 175250 }, - { "8", 181250 }, - { "9", 187250 }, - { "10", 193250 }, - { "11", 199250 }, - { "12", 205250 }, + { "1", 73250 }, + { "2", 55250 }, + { "3", 61250 }, + { "4", 67250 }, + { "5", 77250 }, + { "6", 83250 }, + { "7", 175250 }, + { "8", 181250 }, + { "9", 187250 }, + { "10", 193250 }, + { "11", 199250 }, + { "12", 205250 }, - { "13", 211250 }, - { "14", 121250 }, - { "15", 127250 }, - { "16", 133250 }, - { "17", 139250 }, - { "18", 145250 }, - { "19", 151250 }, - { "20", 157250 }, + { "13", 211250 }, + { "14", 121250 }, + { "15", 127250 }, + { "16", 133250 }, + { "17", 139250 }, + { "18", 145250 }, + { "19", 151250 }, + { "20", 157250 }, - { "21", 163250 }, - { "22", 169250 }, - { "23", 217250 }, - { "24", 223250 }, - { "25", 229250 }, - { "26", 235250 }, - { "27", 241250 }, - { "28", 247250 }, - { "29", 253250 }, - { "30", 259250 }, - { "31", 265250 }, - { "32", 271250 }, - { "33", 277250 }, - { "34", 283250 }, - { "35", 289250 }, - { "36", 295250 }, - { "37", 301250 }, - { "38", 307250 }, - { "39", 313250 }, - { "40", 319250 }, - { "41", 325250 }, - { "42", 331250 }, - { "43", 337250 }, - { "44", 343250 }, - { "45", 349250 }, - { "46", 355250 }, - { "47", 361250 }, - { "48", 367250 }, - { "49", 373250 }, - { "50", 379250 }, - { "51", 385250 }, - { "52", 391250 }, - { "53", 397250 }, - { "54", 403250 }, - { "55", 409250 }, - { "56", 415250 }, - { "57", 421250 }, - { "58", 427250 }, - { "59", 433250 }, - { "60", 439250 }, - { "61", 445250 }, - { "62", 451250 }, - { "63", 457250 }, - { "64", 463250 }, - { "65", 469250 }, - { "66", 475250 }, - { "67", 481250 }, - { "68", 487250 }, - { "69", 493250 }, + { "21", 163250 }, + { "22", 169250 }, + { "23", 217250 }, + { "24", 223250 }, + { "25", 229250 }, + { "26", 235250 }, + { "27", 241250 }, + { "28", 247250 }, + { "29", 253250 }, + { "30", 259250 }, + { "31", 265250 }, + { "32", 271250 }, + { "33", 277250 }, + { "34", 283250 }, + { "35", 289250 }, + { "36", 295250 }, + { "37", 301250 }, + { "38", 307250 }, + { "39", 313250 }, + { "40", 319250 }, + { "41", 325250 }, + { "42", 331250 }, + { "43", 337250 }, + { "44", 343250 }, + { "45", 349250 }, + { "46", 355250 }, + { "47", 361250 }, + { "48", 367250 }, + { "49", 373250 }, + { "50", 379250 }, + { "51", 385250 }, + { "52", 391250 }, + { "53", 397250 }, + { "54", 403250 }, + { "55", 409250 }, + { "56", 415250 }, + { "57", 421250 }, + { "58", 427250 }, + { "59", 433250 }, + { "60", 439250 }, + { "61", 445250 }, + { "62", 451250 }, + { "63", 457250 }, + { "64", 463250 }, + { "65", 469250 }, + { "66", 475250 }, + { "67", 481250 }, + { "68", 487250 }, + { "69", 493250 }, - { "70", 499250 }, - { "71", 505250 }, - { "72", 511250 }, - { "73", 517250 }, - { "74", 523250 }, - { "75", 529250 }, - { "76", 535250 }, - { "77", 541250 }, - { "78", 547250 }, - { "79", 553250 }, - { "80", 559250 }, - { "81", 565250 }, - { "82", 571250 }, - { "83", 577250 }, - { "84", 583250 }, - { "85", 589250 }, - { "86", 595250 }, - { "87", 601250 }, - { "88", 607250 }, - { "89", 613250 }, - { "90", 619250 }, - { "91", 625250 }, - { "92", 631250 }, - { "93", 637250 }, - { "94", 643250 }, - { "95", 91250 }, - { "96", 97250 }, - { "97", 103250 }, - { "98", 109250 }, - { "99", 115250 }, - { "100", 649250 }, - { "101", 655250 }, - { "102", 661250 }, - { "103", 667250 }, - { "104", 673250 }, - { "105", 679250 }, - { "106", 685250 }, - { "107", 691250 }, - { "108", 697250 }, - { "109", 703250 }, - { "110", 709250 }, - { "111", 715250 }, - { "112", 721250 }, - { "113", 727250 }, - { "114", 733250 }, - { "115", 739250 }, - { "116", 745250 }, - { "117", 751250 }, - { "118", 757250 }, - { "119", 763250 }, - { "120", 769250 }, - { "121", 775250 }, - { "122", 781250 }, - { "123", 787250 }, - { "124", 793250 }, - { "125", 799250 }, + { "70", 499250 }, + { "71", 505250 }, + { "72", 511250 }, + { "73", 517250 }, + { "74", 523250 }, + { "75", 529250 }, + { "76", 535250 }, + { "77", 541250 }, + { "78", 547250 }, + { "79", 553250 }, + { "80", 559250 }, + { "81", 565250 }, + { "82", 571250 }, + { "83", 577250 }, + { "84", 583250 }, + { "85", 589250 }, + { "86", 595250 }, + { "87", 601250 }, + { "88", 607250 }, + { "89", 613250 }, + { "90", 619250 }, + { "91", 625250 }, + { "92", 631250 }, + { "93", 637250 }, + { "94", 643250 }, + { "95", 91250 }, + { "96", 97250 }, + { "97", 103250 }, + { "98", 109250 }, + { "99", 115250 }, + { "100", 649250 }, + { "101", 655250 }, + { "102", 661250 }, + { "103", 667250 }, + { "104", 673250 }, + { "105", 679250 }, + { "106", 685250 }, + { "107", 691250 }, + { "108", 697250 }, + { "109", 703250 }, + { "110", 709250 }, + { "111", 715250 }, + { "112", 721250 }, + { "113", 727250 }, + { "114", 733250 }, + { "115", 739250 }, + { "116", 745250 }, + { "117", 751250 }, + { "118", 757250 }, + { "119", 763250 }, + { "120", 769250 }, + { "121", 775250 }, + { "122", 781250 }, + { "123", 787250 }, + { "124", 793250 }, + { "125", 799250 }, - { "T7", 8250 }, - { "T8", 14250 }, - { "T9", 20250 }, - { "T10", 26250 }, - { "T11", 32250 }, - { "T12", 38250 }, - { "T13", 44250 }, - { "T14", 50250 } + { "T7", 8250 }, + { "T8", 14250 }, + { "T9", 20250 }, + { "T10", 26250 }, + { "T11", 32250 }, + { "T12", 38250 }, + { "T13", 44250 }, + { "T14", 50250 } }; /* US HRC */ static const struct CHANLIST ntsc_hrc[] = { - { "1", 72000 }, - { "2", 54000 }, - { "3", 60000 }, - { "4", 66000 }, - { "5", 78000 }, - { "6", 84000 }, - { "7", 174000 }, - { "8", 180000 }, - { "9", 186000 }, - { "10", 192000 }, - { "11", 198000 }, - { "12", 204000 }, + { "1", 72000 }, + { "2", 54000 }, + { "3", 60000 }, + { "4", 66000 }, + { "5", 78000 }, + { "6", 84000 }, + { "7", 174000 }, + { "8", 180000 }, + { "9", 186000 }, + { "10", 192000 }, + { "11", 198000 }, + { "12", 204000 }, - { "13", 210000 }, - { "14", 120000 }, - { "15", 126000 }, - { "16", 132000 }, - { "17", 138000 }, - { "18", 144000 }, - { "19", 150000 }, - { "20", 156000 }, + { "13", 210000 }, + { "14", 120000 }, + { "15", 126000 }, + { "16", 132000 }, + { "17", 138000 }, + { "18", 144000 }, + { "19", 150000 }, + { "20", 156000 }, - { "21", 162000 }, - { "22", 168000 }, - { "23", 216000 }, - { "24", 222000 }, - { "25", 228000 }, - { "26", 234000 }, - { "27", 240000 }, - { "28", 246000 }, - { "29", 252000 }, - { "30", 258000 }, - { "31", 264000 }, - { "32", 270000 }, - { "33", 276000 }, - { "34", 282000 }, - { "35", 288000 }, - { "36", 294000 }, - { "37", 300000 }, - { "38", 306000 }, - { "39", 312000 }, - { "40", 318000 }, - { "41", 324000 }, - { "42", 330000 }, - { "43", 336000 }, - { "44", 342000 }, - { "45", 348000 }, - { "46", 354000 }, - { "47", 360000 }, - { "48", 366000 }, - { "49", 372000 }, - { "50", 378000 }, - { "51", 384000 }, - { "52", 390000 }, - { "53", 396000 }, - { "54", 402000 }, - { "55", 408000 }, - { "56", 414000 }, - { "57", 420000 }, - { "58", 426000 }, - { "59", 432000 }, - { "60", 438000 }, - { "61", 444000 }, - { "62", 450000 }, - { "63", 456000 }, - { "64", 462000 }, - { "65", 468000 }, - { "66", 474000 }, - { "67", 480000 }, - { "68", 486000 }, - { "69", 492000 }, + { "21", 162000 }, + { "22", 168000 }, + { "23", 216000 }, + { "24", 222000 }, + { "25", 228000 }, + { "26", 234000 }, + { "27", 240000 }, + { "28", 246000 }, + { "29", 252000 }, + { "30", 258000 }, + { "31", 264000 }, + { "32", 270000 }, + { "33", 276000 }, + { "34", 282000 }, + { "35", 288000 }, + { "36", 294000 }, + { "37", 300000 }, + { "38", 306000 }, + { "39", 312000 }, + { "40", 318000 }, + { "41", 324000 }, + { "42", 330000 }, + { "43", 336000 }, + { "44", 342000 }, + { "45", 348000 }, + { "46", 354000 }, + { "47", 360000 }, + { "48", 366000 }, + { "49", 372000 }, + { "50", 378000 }, + { "51", 384000 }, + { "52", 390000 }, + { "53", 396000 }, + { "54", 402000 }, + { "55", 408000 }, + { "56", 414000 }, + { "57", 420000 }, + { "58", 426000 }, + { "59", 432000 }, + { "60", 438000 }, + { "61", 444000 }, + { "62", 450000 }, + { "63", 456000 }, + { "64", 462000 }, + { "65", 468000 }, + { "66", 474000 }, + { "67", 480000 }, + { "68", 486000 }, + { "69", 492000 }, - { "70", 498000 }, - { "71", 504000 }, - { "72", 510000 }, - { "73", 516000 }, - { "74", 522000 }, - { "75", 528000 }, - { "76", 534000 }, - { "77", 540000 }, - { "78", 546000 }, - { "79", 552000 }, - { "80", 558000 }, - { "81", 564000 }, - { "82", 570000 }, - { "83", 576000 }, - { "84", 582000 }, - { "85", 588000 }, - { "86", 594000 }, - { "87", 600000 }, - { "88", 606000 }, - { "89", 612000 }, - { "90", 618000 }, - { "91", 624000 }, - { "92", 630000 }, - { "93", 636000 }, - { "94", 642000 }, - { "95", 900000 }, - { "96", 960000 }, - { "97", 102000 }, - { "98", 108000 }, - { "99", 114000 }, - { "100", 648000 }, - { "101", 654000 }, - { "102", 660000 }, - { "103", 666000 }, - { "104", 672000 }, - { "105", 678000 }, - { "106", 684000 }, - { "107", 690000 }, - { "108", 696000 }, - { "109", 702000 }, - { "110", 708000 }, - { "111", 714000 }, - { "112", 720000 }, - { "113", 726000 }, - { "114", 732000 }, - { "115", 738000 }, - { "116", 744000 }, - { "117", 750000 }, - { "118", 756000 }, - { "119", 762000 }, - { "120", 768000 }, - { "121", 774000 }, - { "122", 780000 }, - { "123", 786000 }, - { "124", 792000 }, - { "125", 798000 }, + { "70", 498000 }, + { "71", 504000 }, + { "72", 510000 }, + { "73", 516000 }, + { "74", 522000 }, + { "75", 528000 }, + { "76", 534000 }, + { "77", 540000 }, + { "78", 546000 }, + { "79", 552000 }, + { "80", 558000 }, + { "81", 564000 }, + { "82", 570000 }, + { "83", 576000 }, + { "84", 582000 }, + { "85", 588000 }, + { "86", 594000 }, + { "87", 600000 }, + { "88", 606000 }, + { "89", 612000 }, + { "90", 618000 }, + { "91", 624000 }, + { "92", 630000 }, + { "93", 636000 }, + { "94", 642000 }, + { "95", 900000 }, + { "96", 960000 }, + { "97", 102000 }, + { "98", 108000 }, + { "99", 114000 }, + { "100", 648000 }, + { "101", 654000 }, + { "102", 660000 }, + { "103", 666000 }, + { "104", 672000 }, + { "105", 678000 }, + { "106", 684000 }, + { "107", 690000 }, + { "108", 696000 }, + { "109", 702000 }, + { "110", 708000 }, + { "111", 714000 }, + { "112", 720000 }, + { "113", 726000 }, + { "114", 732000 }, + { "115", 738000 }, + { "116", 744000 }, + { "117", 750000 }, + { "118", 756000 }, + { "119", 762000 }, + { "120", 768000 }, + { "121", 774000 }, + { "122", 780000 }, + { "123", 786000 }, + { "124", 792000 }, + { "125", 798000 }, - { "T7", 7000 }, - { "T8", 13000 }, - { "T9", 19000 }, - { "T10", 25000 }, - { "T11", 31000 }, - { "T12", 37000 }, - { "T13", 43000 }, - { "T14", 49000 }, + { "T7", 7000 }, + { "T8", 13000 }, + { "T9", 19000 }, + { "T10", 25000 }, + { "T11", 31000 }, + { "T12", 37000 }, + { "T13", 43000 }, + { "T14", 49000 }, }; /* --------------------------------------------------------------------- */ @@ -464,117 +464,117 @@ static const struct CHANLIST ntsc_bcast_jp[] = { /* JP cable */ static const struct CHANLIST ntsc_cable_jp[] = { - { "13", 109250 }, - { "14", 115250 }, - { "15", 121250 }, - { "16", 127250 }, - { "17", 133250 }, - { "18", 139250 }, - { "19", 145250 }, - { "20", 151250 }, + { "13", 109250 }, + { "14", 115250 }, + { "15", 121250 }, + { "16", 127250 }, + { "17", 133250 }, + { "18", 139250 }, + { "19", 145250 }, + { "20", 151250 }, - { "21", 157250 }, - { "22", 165250 }, - { "23", 223250 }, - { "24", 231250 }, - { "25", 237250 }, - { "26", 243250 }, - { "27", 249250 }, - { "28", 253250 }, - { "29", 259250 }, - { "30", 265250 }, - { "31", 271250 }, - { "32", 277250 }, - { "33", 283250 }, - { "34", 289250 }, - { "35", 295250 }, - { "36", 301250 }, - { "37", 307250 }, - { "38", 313250 }, - { "39", 319250 }, - { "40", 325250 }, - { "41", 331250 }, - { "42", 337250 }, - { "43", 343250 }, - { "44", 349250 }, - { "45", 355250 }, - { "46", 361250 }, - { "47", 367250 }, - { "48", 373250 }, - { "49", 379250 }, - { "50", 385250 }, - { "51", 391250 }, - { "52", 397250 }, - { "53", 403250 }, - { "54", 409250 }, - { "55", 415250 }, - { "56", 421250 }, - { "57", 427250 }, - { "58", 433250 }, - { "59", 439250 }, - { "60", 445250 }, - { "61", 451250 }, - { "62", 457250 }, - { "63", 463250 }, + { "21", 157250 }, + { "22", 165250 }, + { "23", 223250 }, + { "24", 231250 }, + { "25", 237250 }, + { "26", 243250 }, + { "27", 249250 }, + { "28", 253250 }, + { "29", 259250 }, + { "30", 265250 }, + { "31", 271250 }, + { "32", 277250 }, + { "33", 283250 }, + { "34", 289250 }, + { "35", 295250 }, + { "36", 301250 }, + { "37", 307250 }, + { "38", 313250 }, + { "39", 319250 }, + { "40", 325250 }, +