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).
This commit is contained in:
wm4
2014-04-13 18:00:51 +02:00
parent 44f382cf98
commit 78128bddda
65 changed files with 6487 additions and 6487 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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];
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++;
}
}
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;
}
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;
return 1;
}
int dvb_fix_demuxes(dvb_priv_t *priv, int cnt)
{
int i;
char demux_dev[32];
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++;
}
}
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;
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;
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;
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;
}
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;
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;
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;
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;
}
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);
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_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_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);
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;
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;
}

View File

@@ -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;
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;
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);

View File

File diff suppressed because it is too large Load Diff

View File

@@ -25,13 +25,13 @@
#ifndef MPLAYER_FREQUENCIES_H
#define MPLAYER_FREQUENCIES_H
#define NTSC_AUDIO_CARRIER 4500
#define PAL_AUDIO_CARRIER_I 6000
#define PAL_AUDIO_CARRIER_BGHN 5500
#define PAL_AUDIO_CARRIER_MN 4500
#define PAL_AUDIO_CARRIER_D 6500
#define SEACAM_AUDIO_DKK1L 6500
#define SEACAM_AUDIO_BG 5500
#define NTSC_AUDIO_CARRIER 4500
#define PAL_AUDIO_CARRIER_I 6000
#define PAL_AUDIO_CARRIER_BGHN 5500
#define PAL_AUDIO_CARRIER_MN 4500
#define PAL_AUDIO_CARRIER_D 6500
#define SEACAM_AUDIO_DKK1L 6500
#define SEACAM_AUDIO_BG 5500
/* NICAM 728 32-kHz, 14-bit digital stereo audio is transmitted in 1ms frames
containing 8 bits frame sync, 5 bits control, 11 bits additional data, and
704 bits audio data. The bit rate is reduced by transmitting only 10 bits
@@ -41,69 +41,69 @@
companeded audio data is interleaved to reduce the influence of dropouts
and the whole frame except for sync bits is scrambled for spectrum shaping.
Data is modulated using QPSK, at below following subcarrier freqs */
#define NICAM728_PAL_BGH 5850
#define NICAM728_PAL_I 6552
#define NICAM728_PAL_BGH 5850
#define NICAM728_PAL_I 6552
/* COMPREHENSIVE LIST OF FORMAT BY COUNTRY
(M) NTSC used in:
Antigua, Aruba, Bahamas, Barbados, Belize, Bermuda, Bolivia, Burma,
Canada, Chile, Colombia, Costa Rica, Cuba, Curacao, Dominican Republic,
Ecuador, El Salvador, Guam Guatemala, Honduras, Jamaica, Japan,
South Korea, Mexico, Montserrat, Myanmar, Nicaragua, Panama, Peru,
Philippines, Puerto Rico, St Christopher and Nevis, Samoa, Suriname,
Taiwan, Trinidad/Tobago, United States, Venezuela, Virgin Islands
Antigua, Aruba, Bahamas, Barbados, Belize, Bermuda, Bolivia, Burma,
Canada, Chile, Colombia, Costa Rica, Cuba, Curacao, Dominican Republic,
Ecuador, El Salvador, Guam Guatemala, Honduras, Jamaica, Japan,
South Korea, Mexico, Montserrat, Myanmar, Nicaragua, Panama, Peru,
Philippines, Puerto Rico, St Christopher and Nevis, Samoa, Suriname,
Taiwan, Trinidad/Tobago, United States, Venezuela, Virgin Islands
(B) PAL used in:
Albania, Algeria, Australia, Austria, Bahrain, Bangladesh, Belgium,
Bosnia-Herzegovinia, Brunei Darussalam, Cambodia, Cameroon, Croatia,
Cyprus, Denmark, Egypt, Ethiopia, Equatorial Guinea, Finland, Germany,
Ghana, Gibraltar, Greenland, Iceland, India, Indonesia, Israel, Italy,
Jordan, Kenya, Kuwait, Liberia, Libya, Luxembourg, Malaysa, Maldives,
Malta, Nepal, Netherlands, New Zeland, Nigeria, Norway, Oman, Pakistan,
Papua New Guinea, Portugal, Qatar, Sao Tome and Principe, Saudi Arabia,
Seychelles, Sierra Leone, Singapore, Slovenia, Somali, Spain,
Sri Lanka, Sudan, Swaziland, Sweden, Switzeland, Syria, Thailand,
Tunisia, Turkey, Uganda, United Arab Emirates, Yemen
Albania, Algeria, Australia, Austria, Bahrain, Bangladesh, Belgium,
Bosnia-Herzegovinia, Brunei Darussalam, Cambodia, Cameroon, Croatia,
Cyprus, Denmark, Egypt, Ethiopia, Equatorial Guinea, Finland, Germany,
Ghana, Gibraltar, Greenland, Iceland, India, Indonesia, Israel, Italy,
Jordan, Kenya, Kuwait, Liberia, Libya, Luxembourg, Malaysa, Maldives,
Malta, Nepal, Netherlands, New Zeland, Nigeria, Norway, Oman, Pakistan,
Papua New Guinea, Portugal, Qatar, Sao Tome and Principe, Saudi Arabia,
Seychelles, Sierra Leone, Singapore, Slovenia, Somali, Spain,
Sri Lanka, Sudan, Swaziland, Sweden, Switzeland, Syria, Thailand,
Tunisia, Turkey, Uganda, United Arab Emirates, Yemen
(N) PAL used in: (Combination N = 4.5MHz audio carrier, 3.58MHz burst)
Argentina (Combination N), Paraguay, Uruguay
Argentina (Combination N), Paraguay, Uruguay
(M) PAL (525/60, 3.57MHz burst) used in:
Brazil
Brazil
(G) PAL used in:
Albania, Algeria, Austria, Bahrain, Bosnia/Herzegovinia, Cambodia,
Cameroon, Croatia, Cyprus, Denmark, Egypt, Ethiopia, Equatorial Guinea,
Finland, Germany, Gibraltar, Greenland, Iceland, Israel, Italy, Jordan,
Kenya, Kuwait, Liberia, Libya, Luxembourg, Malaysia, Monaco,
Mozambique, Netherlands, New Zealand, Norway, Oman, Pakistan,
Papa New Guinea, Portugal, Qatar, Romania, Sierra Leone, Singapore,
Slovenia, Somalia, Spain, Sri Lanka, Sudan, Swaziland, Sweeden,
Switzerland, Syria, Thailand, Tunisia, Turkey, United Arab Emirates,
Yemen, Zambia, Zimbabwe
Albania, Algeria, Austria, Bahrain, Bosnia/Herzegovinia, Cambodia,
Cameroon, Croatia, Cyprus, Denmark, Egypt, Ethiopia, Equatorial Guinea,
Finland, Germany, Gibraltar, Greenland, Iceland, Israel, Italy, Jordan,
Kenya, Kuwait, Liberia, Libya, Luxembourg, Malaysia, Monaco,
Mozambique, Netherlands, New Zealand, Norway, Oman, Pakistan,
Papa New Guinea, Portugal, Qatar, Romania, Sierra Leone, Singapore,
Slovenia, Somalia, Spain, Sri Lanka, Sudan, Swaziland, Sweeden,
Switzerland, Syria, Thailand, Tunisia, Turkey, United Arab Emirates,
Yemen, Zambia, Zimbabwe
(D) PAL used in:
China, North Korea, Romania, Czech Republic
China, North Korea, Romania, Czech Republic
(H) PAL used in:
Belgium
Belgium
(I) PAL used in:
Angola, Botswana, Gambia, Guinea-Bissau, Hong Kong, Ireland, Lesotho,
Malawi, Nambia, Nigeria, South Africa, Tanzania, United Kingdom,
Zanzibar
Angola, Botswana, Gambia, Guinea-Bissau, Hong Kong, Ireland, Lesotho,
Malawi, Nambia, Nigeria, South Africa, Tanzania, United Kingdom,
Zanzibar
(B) SECAM used in:
Djibouti, Greece, Iran, Iraq, Lebanon, Mali, Mauritania, Mauritus,
Morocco
Djibouti, Greece, Iran, Iraq, Lebanon, Mali, Mauritania, Mauritus,
Morocco
(D) SECAM used in:
Afghanistan, Armenia, Azerbaijan, Belarus, Bulgaria,
Estonia, Georgia, Hungary, Zazakhstan, Lithuania, Mongolia, Moldova,
Russia, Slovak Republic, Ukraine, Vietnam
Afghanistan, Armenia, Azerbaijan, Belarus, Bulgaria,
Estonia, Georgia, Hungary, Zazakhstan, Lithuania, Mongolia, Moldova,
Russia, Slovak Republic, Ukraine, Vietnam
(G) SECAM used in:
Greecem Iran, Iraq, Mali, Mauritus, Morocco, Saudi Arabia
Greecem Iran, Iraq, Mali, Mauritus, Morocco, Saudi Arabia
(K) SECAM used in:
Armenia, Azerbaijan, Bulgaria, Estonia, Georgia,
Hungary, Kazakhstan, Lithuania, Madagascar, Moldova, Poland, Russia,
Slovak Republic, Ukraine, Vietnam
Armenia, Azerbaijan, Bulgaria, Estonia, Georgia,
Hungary, Kazakhstan, Lithuania, Madagascar, Moldova, Poland, Russia,
Slovak Republic, Ukraine, Vietnam
(K1) SECAM used in:
Benin, Burkina Faso, Burundi, Chad, Cape Verde, Central African
Republic, Comoros, Congo, Gabon, Madagascar, Niger, Rwanda, Senegal,
Togo, Zaire
Benin, Burkina Faso, Burundi, Chad, Cape Verde, Central African
Republic, Comoros, Congo, Gabon, Madagascar, Niger, Rwanda, Senegal,
Togo, Zaire
(L) SECAM used in:
France
France
*/
/* --------------------------------------------------------------------- */

View File

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,7 @@
static char* dvd_device_current;
int dvd_angle=1;
#define LIBDVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro))
#define LIBDVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro))
/*
* Try to autodetect the libdvd-0.9.0 library
* (0.9.0 removed the <dvdread/dvd_udf.h> header, and moved the two defines
@@ -56,9 +56,9 @@ int dvd_angle=1;
*/
#ifndef DVDREAD_VERSION
#if defined(DVD_VIDEO_LB_LEN) && defined(MAX_UDF_FILE_NAME_LEN)
#define DVDREAD_VERSION LIBDVDREAD_VERSION(0,9,0)
#define DVDREAD_VERSION LIBDVDREAD_VERSION(0,9,0)
#else
#define DVDREAD_VERSION LIBDVDREAD_VERSION(0,8,0)
#define DVDREAD_VERSION LIBDVDREAD_VERSION(0,8,0)
#endif
#endif
@@ -266,7 +266,7 @@ read_next:
if(d->angle_seek) {
int i,skip=0;
for(i=0;i<9;i++) // check if all values zero:
for(i=0;i<9;i++) // check if all values zero:
if((skip=d->dsi_pack.sml_agli.data[i].address)!=0) break;
if(skip && skip!=0x7fffffff) {
// sml_agli table has valid data (at least one non-zero):

View File

@@ -633,7 +633,7 @@ int radio_get_freq(struct stream *stream, float *frequency){
radio_priv_t* priv=(radio_priv_t*)stream->priv;
if (!frequency)
return 0;
return 0;
if (get_frequency(priv,frequency)!=STREAM_OK){
return 0;
}

View File

@@ -33,7 +33,7 @@ struct priv {
static void smb_auth_fn(const char *server, const char *share,
char *workgroup, int wgmaxlen, char *username, int unmaxlen,
char *password, int pwmaxlen)
char *password, int pwmaxlen)
{
strncpy(workgroup, "LAN", wgmaxlen - 1);
}

View File

@@ -111,7 +111,7 @@ static int open_s(stream_t *stream,int mode)
device[4] = dev ? dev[0] : 0;
/* open() can't be used for devices so do it the complicated way */
hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
f = _open_osfhandle((intptr_t)hd, _O_RDONLY);
#else
f=open(dev,O_RDONLY | O_CLOEXEC);

View File

@@ -249,12 +249,12 @@ static int demux_tv_fill_buffer(demuxer_t *demux)
if (want_video && tvh->functions->control(tvh->priv,
TVI_CONTROL_IS_VIDEO, 0) == TVI_CONTROL_TRUE)
{
len = tvh->functions->get_video_framesize(tvh->priv);
dp=new_demux_packet(len);
len = tvh->functions->get_video_framesize(tvh->priv);
dp=new_demux_packet(len);
dp->keyframe = true;
dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
demuxer_add_packet(demux, want_video, dp);
}
dp->pts=tvh->functions->grab_video_frame(tvh->priv, dp->buffer, len);
demuxer_add_packet(demux, want_video, dp);
}
if (tvh->tv_param->scan) tv_scan(tvh);
return 1;
@@ -387,8 +387,8 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm)
MP_VERBOSE(tvh, "Selected norm : %s\n", norm);
if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
MP_ERR(tvh, "Error: Cannot set norm!\n");
return 0;
MP_ERR(tvh, "Error: Cannot set norm!\n");
return 0;
}
return 1;
}
@@ -431,8 +431,8 @@ static int open_tv(tvi_handle_t *tvh)
if (funcs->control(tvh->priv, TVI_CONTROL_IS_VIDEO, 0) != TVI_CONTROL_TRUE)
{
MP_ERR(tvh, "Error: No video input present!\n");
return 0;
MP_ERR(tvh, "Error: No video input present!\n");
return 0;
}
if (tvh->tv_param->outfmt == -1)
@@ -447,25 +447,25 @@ static int open_tv(tvi_handle_t *tvh)
{
switch(tvh->tv_param->outfmt)
{
case MP_FOURCC_YV12:
case MP_FOURCC_I420:
case MP_FOURCC_UYVY:
case MP_FOURCC_YUY2:
case MP_FOURCC_RGB32:
case MP_FOURCC_RGB24:
case MP_FOURCC_BGR32:
case MP_FOURCC_BGR24:
case MP_FOURCC_BGR16:
case MP_FOURCC_BGR15:
break;
default:
MP_ERR(tvh, "==================================================================\n"\
" WARNING: UNTESTED OR UNKNOWN OUTPUT IMAGE FORMAT REQUESTED (0x%x)\n"\
" This may cause buggy playback or program crash! Bug reports will\n"\
" be ignored! You should try again with YV12 (which is the default\n"\
" colorspace) and read the documentation!\n"\
"==================================================================\n"
,tvh->tv_param->outfmt);
case MP_FOURCC_YV12:
case MP_FOURCC_I420:
case MP_FOURCC_UYVY:
case MP_FOURCC_YUY2:
case MP_FOURCC_RGB32:
case MP_FOURCC_RGB24:
case MP_FOURCC_BGR32:
case MP_FOURCC_BGR24:
case MP_FOURCC_BGR16:
case MP_FOURCC_BGR15:
break;
default:
MP_ERR(tvh, "==================================================================\n"\
" WARNING: UNTESTED OR UNKNOWN OUTPUT IMAGE FORMAT REQUESTED (0x%x)\n"\
" This may cause buggy playback or program crash! Bug reports will\n"\
" be ignored! You should try again with YV12 (which is the default\n"\
" colorspace) and read the documentation!\n"\
"==================================================================\n"
,tvh->tv_param->outfmt);
}
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &tvh->tv_param->outfmt);
}
@@ -488,155 +488,155 @@ static int open_tv(tvi_handle_t *tvh)
/* set width */
if (tvh->tv_param->width != -1)
{
if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_WIDTH, &tvh->tv_param->width) == TVI_CONTROL_TRUE)
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tvh->tv_param->width);
else
{
MP_ERR(tvh, "Unable to set requested width: %d\n", tvh->tv_param->width);
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tvh->tv_param->width);
}
if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_WIDTH, &tvh->tv_param->width) == TVI_CONTROL_TRUE)
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tvh->tv_param->width);
else
{
MP_ERR(tvh, "Unable to set requested width: %d\n", tvh->tv_param->width);
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tvh->tv_param->width);
}
}
/* set height */
if (tvh->tv_param->height != -1)
{
if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_HEIGHT, &tvh->tv_param->height) == TVI_CONTROL_TRUE)
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tvh->tv_param->height);
else
{
MP_ERR(tvh, "Unable to set requested height: %d\n", tvh->tv_param->height);
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tvh->tv_param->height);
}
if (funcs->control(tvh->priv, TVI_CONTROL_VID_CHK_HEIGHT, &tvh->tv_param->height) == TVI_CONTROL_TRUE)
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tvh->tv_param->height);
else
{
MP_ERR(tvh, "Unable to set requested height: %d\n", tvh->tv_param->height);
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tvh->tv_param->height);
}
}
if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE)
{
MP_WARN(tvh, "Selected input hasn't got a tuner!\n");
goto done;
MP_WARN(tvh, "Selected input hasn't got a tuner!\n");
goto done;
}
/* select channel list */
for (i = 0; chanlists[i].name != NULL; i++)
{
if (!strcasecmp(chanlists[i].name, tvh->tv_param->chanlist))
{
tvh->chanlist = i;
tvh->chanlist_s = chanlists[i].list;
break;
}
if (!strcasecmp(chanlists[i].name, tvh->tv_param->chanlist))
{
tvh->chanlist = i;
tvh->chanlist_s = chanlists[i].list;
break;
}
}
if (tvh->chanlist == -1) {
MP_WARN(tvh, "Unable to find selected channel list! (%s)\n",
tvh->tv_param->chanlist);
MP_WARN(tvh, "Unable to find selected channel list! (%s)\n",
tvh->tv_param->chanlist);
return 0;
} else
MP_VERBOSE(tvh, "Selected channel list: %s (including %d channels)\n",
chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count);
MP_VERBOSE(tvh, "Selected channel list: %s (including %d channels)\n",
chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count);
if (tvh->tv_param->freq && tvh->tv_param->channel)
{
MP_WARN(tvh, "You can't set frequency and channel simultaneously!\n");
goto done;
MP_WARN(tvh, "You can't set frequency and channel simultaneously!\n");
goto done;
}
/* Handle channel names */
if (tvh->tv_param->channels) {
parse_channels(tvh);
} else
tv_channel_last_real = malloc(5);
tv_channel_last_real = malloc(5);
if (tv_channel_list) {
int channel = 0;
if (tvh->tv_param->channel)
{
if (isdigit(*tvh->tv_param->channel))
/* if tvh->tv_param->channel begins with a digit interpret it as a number */
channel = atoi(tvh->tv_param->channel);
else
{
/* if tvh->tv_param->channel does not begin with a digit
set the first channel that contains tvh->tv_param->channel in its name */
int channel = 0;
if (tvh->tv_param->channel)
{
if (isdigit(*tvh->tv_param->channel))
/* if tvh->tv_param->channel begins with a digit interpret it as a number */
channel = atoi(tvh->tv_param->channel);
else
{
/* if tvh->tv_param->channel does not begin with a digit
set the first channel that contains tvh->tv_param->channel in its name */
tv_channel_current = tv_channel_list;
while ( tv_channel_current ) {
if ( strstr(tv_channel_current->name, tvh->tv_param->channel) )
break;
tv_channel_current = tv_channel_current->next;
}
if ( !tv_channel_current ) tv_channel_current = tv_channel_list;
}
}
else
channel = 1;
tv_channel_current = tv_channel_list;
while ( tv_channel_current ) {
if ( strstr(tv_channel_current->name, tvh->tv_param->channel) )
break;
tv_channel_current = tv_channel_current->next;
}
if ( !tv_channel_current ) tv_channel_current = tv_channel_list;
}
}
else
channel = 1;
if ( channel ) {
tv_channel_current = tv_channel_list;
for (int n = 1; n < channel; n++)
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
}
if ( channel ) {
tv_channel_current = tv_channel_list;
for (int n = 1; n < channel; n++)
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
}
set_norm_and_freq(tvh, tv_channel_current);
tv_channel_last = tv_channel_current;
set_norm_and_freq(tvh, tv_channel_current);
tv_channel_last = tv_channel_current;
} else {
/* we need to set frequency */
if (tvh->tv_param->freq)
{
unsigned long freq = atof(tvh->tv_param->freq)*16;
unsigned long freq = atof(tvh->tv_param->freq)*16;
/* set freq in MHz */
funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
MP_VERBOSE(tvh, "Selected frequency: %lu (%.3f)\n",
freq, freq/16.0);
funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
MP_VERBOSE(tvh, "Selected frequency: %lu (%.3f)\n",
freq, freq/16.0);
}
if (tvh->tv_param->channel) {
struct CHANLIST cl;
if (tvh->tv_param->channel) {
struct CHANLIST cl;
MP_VERBOSE(tvh, "Requested channel: %s\n", tvh->tv_param->channel);
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
// printf("count%d: name: %s, freq: %d\n",
// i, cl.name, cl.freq);
if (!strcasecmp(cl.name, tvh->tv_param->channel))
{
strcpy(tv_channel_last_real, cl.name);
tvh->channel = i;
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
break;
}
}
MP_VERBOSE(tvh, "Requested channel: %s\n", tvh->tv_param->channel);
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
// printf("count%d: name: %s, freq: %d\n",
// i, cl.name, cl.freq);
if (!strcasecmp(cl.name, tvh->tv_param->channel))
{
strcpy(tv_channel_last_real, cl.name);
tvh->channel = i;
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
break;
}
}
}
}
/* grep frequency in chanlist */
{
unsigned long i2;
int freq;
unsigned long i2;
int freq;
tv_get_freq(tvh, &i2);
tv_get_freq(tvh, &i2);
freq = (int) (((float)(i2/16))*1000)+250;
freq = (int) (((float)(i2/16))*1000)+250;
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
if (tvh->chanlist_s[i].freq == freq)
{
tvh->channel = i+1;
break;
}
}
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
if (tvh->chanlist_s[i].freq == freq)
{
tvh->channel = i+1;
break;
}
}
}
done:
/* also start device! */
return 1;
return 1;
}
static tvi_handle_t *tv_begin(tv_param_t* tv_param, struct mp_log *log)
@@ -646,12 +646,12 @@ static tvi_handle_t *tv_begin(tv_param_t* tv_param, struct mp_log *log)
if(tv_param->driver && !strcmp(tv_param->driver,"help")){
mp_info(log, "Available drivers:\n");
for(i=0;tvi_driver_list[i];i++){
mp_info(log, " %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name);
if(tvi_driver_list[i]->comment)
mp_info(log, " (%s)",tvi_driver_list[i]->comment);
mp_info(log, "\n");
}
return NULL;
mp_info(log, " %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name);
if(tvi_driver_list[i]->comment)
mp_info(log, " (%s)",tvi_driver_list[i]->comment);
mp_info(log, "\n");
}
return NULL;
}
for(i=0;tvi_driver_list[i];i++){
@@ -711,8 +711,8 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
tvh->demuxer = demuxer;
if (!open_tv(tvh)){
tv_uninit(tvh);
return -1;
tv_uninit(tvh);
return -1;
}
funcs = tvh->functions;
demuxer->priv=tvh;
@@ -761,71 +761,71 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
/* here comes audio init */
if (tvh->tv_param->noaudio == 0 && funcs->control(tvh->priv, TVI_CONTROL_IS_AUDIO, 0) == TVI_CONTROL_TRUE)
{
int audio_format;
int audio_format;
/* yeah, audio is present */
/* yeah, audio is present */
funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE,
&tvh->tv_param->audiorate);
funcs->control(tvh->priv, TVI_CONTROL_AUD_SET_SAMPLERATE,
&tvh->tv_param->audiorate);
if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE)
goto no_audio;
if (funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_FORMAT, &audio_format) != TVI_CONTROL_TRUE)
goto no_audio;
switch(audio_format)
{
case AF_FORMAT_U8:
case AF_FORMAT_S8:
case AF_FORMAT_U16_LE:
case AF_FORMAT_U16_BE:
case AF_FORMAT_S16_LE:
case AF_FORMAT_S16_BE:
case AF_FORMAT_S32_LE:
case AF_FORMAT_S32_BE:
break;
case AF_FORMAT_MPEG2:
default:
MP_ERR(tvh, "Audio type '%s' unsupported!\n",
af_fmt_to_str(audio_format));
goto no_audio;
}
switch(audio_format)
{
case AF_FORMAT_U8:
case AF_FORMAT_S8:
case AF_FORMAT_U16_LE:
case AF_FORMAT_U16_BE:
case AF_FORMAT_S16_LE:
case AF_FORMAT_S16_BE:
case AF_FORMAT_S32_LE:
case AF_FORMAT_S32_BE:
break;
case AF_FORMAT_MPEG2:
default:
MP_ERR(tvh, "Audio type '%s' unsupported!\n",
af_fmt_to_str(audio_format));
goto no_audio;
}
struct sh_stream *sh_a = new_sh_stream(demuxer, STREAM_AUDIO);
sh_audio = sh_a->audio;
struct sh_stream *sh_a = new_sh_stream(demuxer, STREAM_AUDIO);
sh_audio = sh_a->audio;
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE,
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE,
&sh_audio->samplerate);
int nchannels = sh_audio->channels.num;
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS,
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS,
&nchannels);
mp_chmap_from_channels(&sh_audio->channels, nchannels);
sh_a->codec = "mp-pcm";
sh_a->format = audio_format;
sh_a->format = audio_format;
int samplesize = af_fmt2bits(audio_format) / 8;
sh_audio->i_bps =
sh_audio->samplerate * samplesize * sh_audio->channels.num;
sh_audio->i_bps =
sh_audio->samplerate * samplesize * sh_audio->channels.num;
// emulate WF for win32 codecs:
sh_audio->wf = talloc_zero(sh_audio, MP_WAVEFORMATEX);
sh_audio->wf->wFormatTag = sh_a->format;
sh_audio->wf->nChannels = sh_audio->channels.num;
sh_audio->wf->wBitsPerSample = samplesize * 8;
sh_audio->wf->nSamplesPerSec = sh_audio->samplerate;
sh_audio->wf->nBlockAlign = samplesize * sh_audio->channels.num;
sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps;
// emulate WF for win32 codecs:
sh_audio->wf = talloc_zero(sh_audio, MP_WAVEFORMATEX);
sh_audio->wf->wFormatTag = sh_a->format;
sh_audio->wf->nChannels = sh_audio->channels.num;
sh_audio->wf->wBitsPerSample = samplesize * 8;
sh_audio->wf->nSamplesPerSec = sh_audio->samplerate;
sh_audio->wf->nBlockAlign = samplesize * sh_audio->channels.num;
sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps;
MP_VERBOSE(tvh, " TV audio: %d channels, %d bits, %d Hz\n",
MP_VERBOSE(tvh, " TV audio: %d channels, %d bits, %d Hz\n",
sh_audio->wf->nChannels, sh_audio->wf->wBitsPerSample,
sh_audio->wf->nSamplesPerSec);
}
no_audio:
if(!(funcs->start(tvh->priv))){
// start failed :(
tv_uninit(tvh);
return -1;
// start failed :(
tv_uninit(tvh);
return -1;
}
/* set color eq */
@@ -856,16 +856,16 @@ int tv_set_color_options(tvi_handle_t *tvh, int opt, int value)
switch(opt)
{
case TV_COLOR_BRIGHTNESS:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
case TV_COLOR_HUE:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
case TV_COLOR_SATURATION:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
case TV_COLOR_CONTRAST:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
default:
MP_WARN(tvh, "Unknown color option (%d) specified!\n", opt);
case TV_COLOR_BRIGHTNESS:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
case TV_COLOR_HUE:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
case TV_COLOR_SATURATION:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
case TV_COLOR_CONTRAST:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
default:
MP_WARN(tvh, "Unknown color option (%d) specified!\n", opt);
}
return TVI_CONTROL_UNKNOWN;
@@ -877,16 +877,16 @@ int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
switch(opt)
{
case TV_COLOR_BRIGHTNESS:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_BRIGHTNESS, value);
case TV_COLOR_HUE:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HUE, value);
case TV_COLOR_SATURATION:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_SATURATION, value);
case TV_COLOR_CONTRAST:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value);
default:
MP_WARN(tvh, "Unknown color option (%d) specified!\n", opt);
case TV_COLOR_BRIGHTNESS:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_BRIGHTNESS, value);
case TV_COLOR_HUE:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HUE, value);
case TV_COLOR_SATURATION:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_SATURATION, value);
case TV_COLOR_CONTRAST:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value);
default:
MP_WARN(tvh, "Unknown color option (%d) specified!\n", opt);
}
return TVI_CONTROL_UNKNOWN;
@@ -896,9 +896,9 @@ int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq)
{
if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE)
{
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq);
MP_VERBOSE(tvh, "Current frequency: %lu (%.3f)\n",
*freq, *freq/16.0);
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq);
MP_VERBOSE(tvh, "Current frequency: %lu (%.3f)\n",
*freq, *freq/16.0);
}
return 1;
}
@@ -907,14 +907,14 @@ int tv_set_freq(tvi_handle_t *tvh, unsigned long freq)
{
if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE)
{
// unsigned long freq = atof(tvh->tv_param->freq)*16;
// unsigned long freq = atof(tvh->tv_param->freq)*16;
/* set freq in MHz */
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
MP_VERBOSE(tvh, "Current frequency: %lu (%.3f)\n",
freq, freq/16.0);
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
MP_VERBOSE(tvh, "Current frequency: %lu (%.3f)\n",
freq, freq/16.0);
}
return 1;
}
@@ -952,123 +952,123 @@ int tv_step_channel_real(tvi_handle_t *tvh, int direction)
tvh->tv_param->scan=0;
if (direction == TV_CHANNEL_LOWER)
{
if (tvh->channel-1 >= 0)
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
cl = tvh->chanlist_s[--tvh->channel];
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
}
if (tvh->channel-1 >= 0)
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
cl = tvh->chanlist_s[--tvh->channel];
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
}
}
if (direction == TV_CHANNEL_HIGHER)
{
if (tvh->channel+1 < chanlists[tvh->chanlist].count)
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
cl = tvh->chanlist_s[++tvh->channel];
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
}
if (tvh->channel+1 < chanlists[tvh->chanlist].count)
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
cl = tvh->chanlist_s[++tvh->channel];
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
}
}
return 1;
}
int tv_step_channel(tvi_handle_t *tvh, int direction) {
tvh->tv_param->scan=0;
if (tv_channel_list) {
if (direction == TV_CHANNEL_HIGHER) {
tv_channel_last = tv_channel_current;
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
else
tv_channel_current = tv_channel_list;
set_norm_and_freq(tvh, tv_channel_current);
}
if (direction == TV_CHANNEL_LOWER) {
tv_channel_last = tv_channel_current;
if (tv_channel_current->prev)
tv_channel_current = tv_channel_current->prev;
else
while (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
set_norm_and_freq(tvh, tv_channel_current);
}
} else tv_step_channel_real(tvh, direction);
return 1;
tvh->tv_param->scan=0;
if (tv_channel_list) {
if (direction == TV_CHANNEL_HIGHER) {
tv_channel_last = tv_channel_current;
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
else
tv_channel_current = tv_channel_list;
set_norm_and_freq(tvh, tv_channel_current);
}
if (direction == TV_CHANNEL_LOWER) {
tv_channel_last = tv_channel_current;
if (tv_channel_current->prev)
tv_channel_current = tv_channel_current->prev;
else
while (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
set_norm_and_freq(tvh, tv_channel_current);
}
} else tv_step_channel_real(tvh, direction);
return 1;
}
int tv_set_channel_real(tvi_handle_t *tvh, char *channel) {
int i;
struct CHANLIST cl;
int i;
struct CHANLIST cl;
tvh->tv_param->scan=0;
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
// printf("count%d: name: %s, freq: %d\n",
// i, cl.name, cl.freq);
if (!strcasecmp(cl.name, channel))
{
tvh->channel = i;
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
break;
}
}
return 1;
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
// printf("count%d: name: %s, freq: %d\n",
// i, cl.name, cl.freq);
if (!strcasecmp(cl.name, channel))
{
tvh->channel = i;
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
break;
}
}
return 1;
}
int tv_set_channel(tvi_handle_t *tvh, char *channel) {
int i, channel_int;
int i, channel_int;
tvh->tv_param->scan=0;
if (tv_channel_list) {
tv_channel_last = tv_channel_current;
channel_int = atoi(channel);
tv_channel_current = tv_channel_list;
for (i = 1; i < channel_int; i++)
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
set_norm_and_freq(tvh, tv_channel_current);
} else tv_set_channel_real(tvh, channel);
return 1;
tvh->tv_param->scan=0;
if (tv_channel_list) {
tv_channel_last = tv_channel_current;
channel_int = atoi(channel);
tv_channel_current = tv_channel_list;
for (i = 1; i < channel_int; i++)
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
set_norm_and_freq(tvh, tv_channel_current);
} else tv_set_channel_real(tvh, channel);
return 1;
}
int tv_last_channel(tvi_handle_t *tvh) {
tvh->tv_param->scan=0;
if (tv_channel_list) {
tv_channels_t *tmp;
tvh->tv_param->scan=0;
if (tv_channel_list) {
tv_channels_t *tmp;
tmp = tv_channel_last;
tv_channel_last = tv_channel_current;
tv_channel_current = tmp;
tmp = tv_channel_last;
tv_channel_last = tv_channel_current;
tv_channel_current = tmp;
set_norm_and_freq(tvh, tv_channel_current);
} else {
int i;
struct CHANLIST cl;
set_norm_and_freq(tvh, tv_channel_current);
} else {
int i;
struct CHANLIST cl;
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
if (!strcasecmp(cl.name, tv_channel_last_real))
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
tvh->channel = i;
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
break;
}
}
}
return 1;
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
if (!strcasecmp(cl.name, tv_channel_last_real))
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
tvh->channel = i;
MP_INFO(tvh, "Selected channel: %s (freq: %.3f)\n",
cl.name, cl.freq/1000.0);
tv_set_freq_float(tvh, cl.freq);
break;
}
}
}
return 1;
}
int tv_step_norm(tvi_handle_t *tvh)

View File

@@ -103,16 +103,16 @@ typedef struct tvi_functions_s
typedef struct tvi_handle_s {
struct mp_log *log;
const tvi_functions_t *functions;
void *priv;
int seq;
struct demuxer *demuxer;
const tvi_functions_t *functions;
void *priv;
int seq;
struct demuxer *demuxer;
/* specific */
int norm;
int chanlist;
int norm;
int chanlist;
const struct CHANLIST *chanlist_s;
int channel;
int channel;
tv_param_t * tv_param;
void * scan;
} tvi_handle_t;
@@ -137,79 +137,79 @@ typedef struct {
int new_channels;
} tv_scan_t;
#define TVI_CONTROL_FALSE 0
#define TVI_CONTROL_TRUE 1
#define TVI_CONTROL_NA -1
#define TVI_CONTROL_UNKNOWN -2
#define TVI_CONTROL_FALSE 0
#define TVI_CONTROL_TRUE 1
#define TVI_CONTROL_NA -1
#define TVI_CONTROL_UNKNOWN -2
/* ======================== CONTROLS =========================== */
/* GENERIC controls */
#define TVI_CONTROL_IS_AUDIO 0x1
#define TVI_CONTROL_IS_VIDEO 0x2
#define TVI_CONTROL_IS_TUNER 0x3
#define TVI_CONTROL_IS_AUDIO 0x1
#define TVI_CONTROL_IS_VIDEO 0x2
#define TVI_CONTROL_IS_TUNER 0x3
#define TVI_CONTROL_IMMEDIATE 0x4
/* VIDEO controls */
#define TVI_CONTROL_VID_GET_FPS 0x101
#define TVI_CONTROL_VID_GET_PLANES 0x102
#define TVI_CONTROL_VID_GET_BITS 0x103
#define TVI_CONTROL_VID_CHK_BITS 0x104
#define TVI_CONTROL_VID_SET_BITS 0x105
#define TVI_CONTROL_VID_GET_FORMAT 0x106
#define TVI_CONTROL_VID_CHK_FORMAT 0x107
#define TVI_CONTROL_VID_SET_FORMAT 0x108
#define TVI_CONTROL_VID_GET_WIDTH 0x109
#define TVI_CONTROL_VID_CHK_WIDTH 0x110
#define TVI_CONTROL_VID_SET_WIDTH 0x111
#define TVI_CONTROL_VID_GET_HEIGHT 0x112
#define TVI_CONTROL_VID_CHK_HEIGHT 0x113
#define TVI_CONTROL_VID_SET_HEIGHT 0x114
#define TVI_CONTROL_VID_GET_BRIGHTNESS 0x115
#define TVI_CONTROL_VID_SET_BRIGHTNESS 0x116
#define TVI_CONTROL_VID_GET_HUE 0x117
#define TVI_CONTROL_VID_SET_HUE 0x118
#define TVI_CONTROL_VID_GET_SATURATION 0x119
#define TVI_CONTROL_VID_SET_SATURATION 0x11a
#define TVI_CONTROL_VID_GET_CONTRAST 0x11b
#define TVI_CONTROL_VID_SET_CONTRAST 0x11c
#define TVI_CONTROL_VID_GET_PICTURE 0x11d
#define TVI_CONTROL_VID_SET_PICTURE 0x11e
#define TVI_CONTROL_VID_SET_GAIN 0x11f
#define TVI_CONTROL_VID_GET_GAIN 0x120
#define TVI_CONTROL_VID_SET_WIDTH_HEIGHT 0x121
#define TVI_CONTROL_VID_GET_FPS 0x101
#define TVI_CONTROL_VID_GET_PLANES 0x102
#define TVI_CONTROL_VID_GET_BITS 0x103
#define TVI_CONTROL_VID_CHK_BITS 0x104
#define TVI_CONTROL_VID_SET_BITS 0x105
#define TVI_CONTROL_VID_GET_FORMAT 0x106
#define TVI_CONTROL_VID_CHK_FORMAT 0x107
#define TVI_CONTROL_VID_SET_FORMAT 0x108
#define TVI_CONTROL_VID_GET_WIDTH 0x109
#define TVI_CONTROL_VID_CHK_WIDTH 0x110
#define TVI_CONTROL_VID_SET_WIDTH 0x111
#define TVI_CONTROL_VID_GET_HEIGHT 0x112
#define TVI_CONTROL_VID_CHK_HEIGHT 0x113
#define TVI_CONTROL_VID_SET_HEIGHT 0x114
#define TVI_CONTROL_VID_GET_BRIGHTNESS 0x115
#define TVI_CONTROL_VID_SET_BRIGHTNESS 0x116
#define TVI_CONTROL_VID_GET_HUE 0x117
#define TVI_CONTROL_VID_SET_HUE 0x118
#define TVI_CONTROL_VID_GET_SATURATION 0x119
#define TVI_CONTROL_VID_SET_SATURATION 0x11a
#define TVI_CONTROL_VID_GET_CONTRAST 0x11b
#define TVI_CONTROL_VID_SET_CONTRAST 0x11c
#define TVI_CONTROL_VID_GET_PICTURE 0x11d
#define TVI_CONTROL_VID_SET_PICTURE 0x11e
#define TVI_CONTROL_VID_SET_GAIN 0x11f
#define TVI_CONTROL_VID_GET_GAIN 0x120
#define TVI_CONTROL_VID_SET_WIDTH_HEIGHT 0x121
/* TUNER controls */
#define TVI_CONTROL_TUN_GET_FREQ 0x201
#define TVI_CONTROL_TUN_SET_FREQ 0x202
#define TVI_CONTROL_TUN_GET_TUNER 0x203 /* update priv->tuner struct for used input */
#define TVI_CONTROL_TUN_SET_TUNER 0x204 /* update priv->tuner struct for used input */
#define TVI_CONTROL_TUN_GET_NORM 0x205
#define TVI_CONTROL_TUN_SET_NORM 0x206
#define TVI_CONTROL_TUN_GET_SIGNAL 0x207
#define TVI_CONTROL_TUN_GET_FREQ 0x201
#define TVI_CONTROL_TUN_SET_FREQ 0x202
#define TVI_CONTROL_TUN_GET_TUNER 0x203 /* update priv->tuner struct for used input */
#define TVI_CONTROL_TUN_SET_TUNER 0x204 /* update priv->tuner struct for used input */
#define TVI_CONTROL_TUN_GET_NORM 0x205
#define TVI_CONTROL_TUN_SET_NORM 0x206
#define TVI_CONTROL_TUN_GET_SIGNAL 0x207
/* AUDIO controls */
#define TVI_CONTROL_AUD_GET_FORMAT 0x301
#define TVI_CONTROL_AUD_GET_SAMPLERATE 0x302
#define TVI_CONTROL_AUD_GET_CHANNELS 0x304
#define TVI_CONTROL_AUD_SET_SAMPLERATE 0x305
#define TVI_CONTROL_AUD_GET_FORMAT 0x301
#define TVI_CONTROL_AUD_GET_SAMPLERATE 0x302
#define TVI_CONTROL_AUD_GET_CHANNELS 0x304
#define TVI_CONTROL_AUD_SET_SAMPLERATE 0x305
/* SPECIFIC controls */
#define TVI_CONTROL_SPC_GET_INPUT 0x401 /* set input channel (tv,s-video,composite..) */
#define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */
#define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */
#define TVI_CONTROL_SPC_GET_INPUT 0x401 /* set input channel (tv,s-video,composite..) */
#define TVI_CONTROL_SPC_SET_INPUT 0x402 /* set input channel (tv,s-video,composite..) */
#define TVI_CONTROL_SPC_GET_NORMID 0x403 /* get normid from norm name */
int tv_set_color_options(tvi_handle_t *tvh, int opt, int val);
int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val);
#define TV_COLOR_BRIGHTNESS 1
#define TV_COLOR_HUE 2
#define TV_COLOR_SATURATION 3
#define TV_COLOR_CONTRAST 4
#define TV_COLOR_BRIGHTNESS 1
#define TV_COLOR_HUE 2
#define TV_COLOR_SATURATION 3
#define TV_COLOR_CONTRAST 4
int tv_step_channel_real(tvi_handle_t *tvh, int direction);
int tv_step_channel(tvi_handle_t *tvh, int direction);
#define TV_CHANNEL_LOWER 1
#define TV_CHANNEL_HIGHER 2
#define TV_CHANNEL_LOWER 1
#define TV_CHANNEL_HIGHER 2
int tv_last_channel(tvi_handle_t *tvh);
@@ -231,12 +231,12 @@ void tv_start_scan(tvi_handle_t *tvh, int start);
tvi_handle_t *tv_new_handle(int size, struct mp_log *log, const tvi_functions_t *functions);
void tv_free_handle(tvi_handle_t *h);
#define TV_NORM_PAL 1
#define TV_NORM_NTSC 2
#define TV_NORM_SECAM 3
#define TV_NORM_PALNC 4
#define TV_NORM_PALM 5
#define TV_NORM_PALN 6
#define TV_NORM_NTSCJP 7
#define TV_NORM_PAL 1
#define TV_NORM_NTSC 2
#define TV_NORM_SECAM 3
#define TV_NORM_PALNC 4
#define TV_NORM_PALM 5
#define TV_NORM_PALN 6
#define TV_NORM_NTSCJP 7
#endif /* MPLAYER_TV_H */

View File

@@ -70,7 +70,7 @@ static inline void fill_blank_frame(char* buffer,int len,int fmt){
buffer[i+1]=0;
buffer[i+2]=0;
buffer[i+3]=0;
}
}
break;
case MP_FOURCC_YUY2:
for(i=0;i<len;i+=4){
@@ -78,13 +78,13 @@ static inline void fill_blank_frame(char* buffer,int len,int fmt){
buffer[i+1]=0xFF;
buffer[i+2]=0;
buffer[i+3]=0;
}
}
break;
case MP_FOURCC_MJPEG:
/*
This is compressed format. I don't know yet how to fill such frame with blue color.
Keeping frame unchanged.
*/
This is compressed format. I don't know yet how to fill such frame with blue color.
Keeping frame unchanged.
*/
break;
default:
memset(buffer,0xC0,len);

View File

@@ -27,11 +27,11 @@
static tvi_handle_t *tvi_init_dummy(struct mp_log *log, tv_param_t* tv_param);
/* information about this file */
const tvi_info_t tvi_info_dummy = {
tvi_init_dummy,
"NULL-TV",
"dummy",
"alex",
NULL
tvi_init_dummy,
"NULL-TV",
"dummy",
"alex",
NULL
};
/* private data's */
@@ -71,36 +71,36 @@ static int do_control(priv_t *priv, int cmd, void *arg)
{
switch(cmd)
{
case TVI_CONTROL_IS_VIDEO:
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_FORMAT:
*(int *)arg = MP_FOURCC_YV12;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_FORMAT:
{
// int req_fmt = *(int *)arg;
int req_fmt = *(int *)arg;
if (req_fmt != MP_FOURCC_YV12)
return TVI_CONTROL_FALSE;
return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_VID_SET_WIDTH:
priv->width = *(int *)arg;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_WIDTH:
*(int *)arg = priv->width;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_HEIGHT:
priv->height = *(int *)arg;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_HEIGHT:
*(int *)arg = priv->height;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_CHK_WIDTH:
case TVI_CONTROL_VID_CHK_HEIGHT:
return TVI_CONTROL_TRUE;
case TVI_CONTROL_TUN_SET_NORM:
return TVI_CONTROL_TRUE;
case TVI_CONTROL_IS_VIDEO:
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_FORMAT:
*(int *)arg = MP_FOURCC_YV12;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_FORMAT:
{
// int req_fmt = *(int *)arg;
int req_fmt = *(int *)arg;
if (req_fmt != MP_FOURCC_YV12)
return TVI_CONTROL_FALSE;
return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_VID_SET_WIDTH:
priv->width = *(int *)arg;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_WIDTH:
*(int *)arg = priv->width;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_HEIGHT:
priv->height = *(int *)arg;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_HEIGHT:
*(int *)arg = priv->height;
return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_CHK_WIDTH:
case TVI_CONTROL_VID_CHK_HEIGHT:
return TVI_CONTROL_TRUE;
case TVI_CONTROL_TUN_SET_NORM:
return TVI_CONTROL_TRUE;
}
return TVI_CONTROL_UNKNOWN;
}

View File

@@ -762,7 +762,7 @@ static int do_control(priv_t *priv, int cmd, void *arg)
case TVI_CONTROL_VID_SET_GAIN:
{
//value==0 means automatic gain control
int value=*(int*)arg;
int value=*(int*)arg;
if (value < 0 || value>100)
return TVI_CONTROL_FALSE;
@@ -1407,10 +1407,10 @@ static inline void copy_frame(priv_t *priv, video_buffer_entry *dest, unsigned c
if(priv->tv_param->automute>0){
if (v4l2_ioctl(priv->video_fd, VIDIOC_G_TUNER, &priv->tuner) >= 0) {
if(priv->tv_param->automute<<8>priv->tuner.signal){
fill_blank_frame(dest->data,dest->framesize,fcc_vl2mp(priv->format.fmt.pix.pixelformat));
set_mute(priv,1);
return;
}
fill_blank_frame(dest->data,dest->framesize,fcc_vl2mp(priv->format.fmt.pix.pixelformat));
set_mute(priv,1);
return;
}
}
set_mute(priv,0);
}

View File

@@ -100,8 +100,8 @@ static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd){
tocentry.cdte_format = CDROM_MSF;
if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) {
MP_ERR(stream, "read CDROM toc entry: %s\n",strerror(errno));
return NULL;
MP_ERR(stream, "read CDROM toc entry: %s\n",strerror(errno));
return NULL;
}
if (i<=tochdr.cdth_trk1)
@@ -155,10 +155,10 @@ static int vcd_read(mp_vcd_priv_t* vcd,char *mem){
#include <sys/scsi/generic/commands.h>
#include <sys/scsi/impl/uscsi.h>
#define SUN_XAREAD 1 /*fails on atapi drives*/
#define SUN_MODE2READ 2 /*fails on atapi drives*/
#define SUN_SCSIREAD 3
#define SUN_VCDREAD SUN_SCSIREAD
#define SUN_XAREAD 1 /*fails on atapi drives*/
#define SUN_MODE2READ 2 /*fails on atapi drives*/
#define SUN_SCSIREAD 3
#define SUN_VCDREAD SUN_SCSIREAD
static int sun_vcd_read(mp_vcd_priv_t* vcd, int *offset)
{
@@ -220,6 +220,6 @@ static int sun_vcd_read(mp_vcd_priv_t* vcd, int *offset)
#error SUN_VCDREAD
#endif
}
#endif /*sun*/
#endif /*sun*/
#endif /* MPLAYER_VCD_READ_H */

View File

@@ -37,25 +37,25 @@
#include "stream.h"
//=================== VideoCD ==========================
#define CDROM_LEADOUT 0xAA
#define CDROM_LEADOUT 0xAA
typedef struct
{
uint8_t sync [12];
uint8_t header [4];
uint8_t subheader [8];
uint8_t data [2324];
uint8_t spare [4];
uint8_t sync [12];
uint8_t header [4];
uint8_t subheader [8];
uint8_t data [2324];
uint8_t spare [4];
} cdsector_t;
typedef struct mp_vcd_priv_st
{
stream_t *stream;
int fd;
cdsector_t buf;
dk_cd_read_track_info_t entry;
struct CDDiscInfo hdr;
CDMSF msf;
int fd;
cdsector_t buf;
dk_cd_read_track_info_t entry;
struct CDDiscInfo hdr;
CDMSF msf;
} mp_vcd_priv_t;
static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
@@ -70,101 +70,101 @@ static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd)
static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
{
struct CDTrackInfo entry;
struct CDTrackInfo entry;
memset( &vcd->entry, 0, sizeof(vcd->entry));
vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
vcd->entry.address = track;
vcd->entry.bufferLength = sizeof(entry);
vcd->entry.buffer = &entry;
memset( &vcd->entry, 0, sizeof(vcd->entry));
vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
vcd->entry.address = track;
vcd->entry.bufferLength = sizeof(entry);
vcd->entry.buffer = &entry;
if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
{
MP_ERR(vcd->stream, "ioctl dif1: %s\n",strerror(errno));
return -1;
}
vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
{
MP_ERR(vcd->stream, "ioctl dif1: %s\n",strerror(errno));
return -1;
}
vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
}
static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
{
struct CDTrackInfo entry;
struct CDTrackInfo entry;
if (track > vcd->hdr.lastTrackNumberInLastSessionLSB) {
MP_ERR(vcd->stream, "track number %d greater than last track number %d\n",
track, vcd->hdr.lastTrackNumberInLastSessionLSB);
return -1;
}
if (track > vcd->hdr.lastTrackNumberInLastSessionLSB) {
MP_ERR(vcd->stream, "track number %d greater than last track number %d\n",
track, vcd->hdr.lastTrackNumberInLastSessionLSB);
return -1;
}
//read track info
memset( &vcd->entry, 0, sizeof(vcd->entry));
vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
vcd->entry.address = track<vcd->hdr.lastTrackNumberInLastSessionLSB?track+1:vcd->hdr.lastTrackNumberInLastSessionLSB;
vcd->entry.bufferLength = sizeof(entry);
vcd->entry.buffer = &entry;
//read track info
memset( &vcd->entry, 0, sizeof(vcd->entry));
vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
vcd->entry.address = track<vcd->hdr.lastTrackNumberInLastSessionLSB?track+1:vcd->hdr.lastTrackNumberInLastSessionLSB;
vcd->entry.bufferLength = sizeof(entry);
vcd->entry.buffer = &entry;
if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
{
MP_ERR(vcd->stream, "ioctl dif2: %s\n",strerror(errno));
return -1;
}
if (track == vcd->hdr.lastTrackNumberInLastSessionLSB)
vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress) +
be2me_32(entry.trackSize));
else
vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
{
MP_ERR(vcd->stream, "ioctl dif2: %s\n",strerror(errno));
return -1;
}
if (track == vcd->hdr.lastTrackNumberInLastSessionLSB)
vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress) +
be2me_32(entry.trackSize));
else
vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
return VCD_SECTOR_DATA*vcd_get_msf(vcd);
}
static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd)
{
dk_cd_read_disc_info_t tochdr;
struct CDDiscInfo hdr;
dk_cd_read_disc_info_t tochdr;
struct CDDiscInfo hdr;
dk_cd_read_track_info_t tocentry;
struct CDTrackInfo entry;
CDMSF trackMSF;
dk_cd_read_track_info_t tocentry;
struct CDTrackInfo entry;
CDMSF trackMSF;
mp_vcd_priv_t* vcd;
int i;
mp_vcd_priv_t* vcd;
int i;
//read toc header
//read toc header
memset(&tochdr, 0, sizeof(tochdr));
tochdr.buffer = &hdr;
tochdr.bufferLength = sizeof(hdr);
if (ioctl(fd, DKIOCCDREADDISCINFO, &tochdr) < 0)
{
MP_ERR(stream, "read CDROM toc header: %s\n",strerror(errno));
return NULL;
{
MP_ERR(stream, "read CDROM toc header: %s\n",strerror(errno));
return NULL;
}
//print all track info
for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
{
if (i <= hdr.lastTrackNumberInLastSessionLSB) {
memset( &tocentry, 0, sizeof(tocentry));
tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
tocentry.address = i;
tocentry.bufferLength = sizeof(entry);
tocentry.buffer = &entry;
//print all track info
for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
{
if (i <= hdr.lastTrackNumberInLastSessionLSB) {
memset( &tocentry, 0, sizeof(tocentry));
tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
tocentry.address = i;
tocentry.bufferLength = sizeof(entry);
tocentry.buffer = &entry;
if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
{
MP_ERR(stream, "read CDROM toc entry: %s\n",strerror(errno));
return NULL;
}
if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
{
MP_ERR(stream, "read CDROM toc entry: %s\n",strerror(errno));
return NULL;
}
trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
}
else
trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress)
+ be2me_32(entry.trackSize));
trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
}
else
trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress)
+ be2me_32(entry.trackSize));
//MP_INFO(vcd->stream, "track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
if (i<=hdr.lastTrackNumberInLastSessionLSB)
MP_INFO(stream, "track %02d: format=%d %02d:%02d:%02d\n",
//MP_INFO(vcd->stream, "track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
if (i<=hdr.lastTrackNumberInLastSessionLSB)
MP_INFO(stream, "track %02d: format=%d %02d:%02d:%02d\n",
(int)tocentry.address,
//(int)tocentry.entry.addr_type,
//(int)tocentry.entry.control,
@@ -172,33 +172,33 @@ static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd)
(int)trackMSF.minute,
(int)trackMSF.second,
(int)trackMSF.frame
);
);
}
}
vcd = malloc(sizeof(mp_vcd_priv_t));
vcd = malloc(sizeof(mp_vcd_priv_t));
vcd->stream = stream;
vcd->fd = fd;
vcd->hdr = hdr;
vcd->msf = trackMSF;
return vcd;
vcd->fd = fd;
vcd->hdr = hdr;
vcd->msf = trackMSF;
return vcd;
}
static int vcd_read(mp_vcd_priv_t* vcd,char *mem)
{
if (pread(vcd->fd,&vcd->buf,VCD_SECTOR_SIZE,vcd_get_msf(vcd)*VCD_SECTOR_SIZE) != VCD_SECTOR_SIZE)
return 0; // EOF?
if (pread(vcd->fd,&vcd->buf,VCD_SECTOR_SIZE,vcd_get_msf(vcd)*VCD_SECTOR_SIZE) != VCD_SECTOR_SIZE)
return 0; // EOF?
vcd->msf.frame++;
if (vcd->msf.frame==75)
{
vcd->msf.frame=0;
vcd->msf.second++;
vcd->msf.frame++;
if (vcd->msf.frame==75)
{
vcd->msf.frame=0;
vcd->msf.second++;
if (vcd->msf.second==60)
{
vcd->msf.second=0;
vcd->msf.minute++;
if (vcd->msf.second==60)
{
vcd->msf.second=0;
vcd->msf.minute++;
}
}

View File

@@ -44,14 +44,14 @@
#include "common/msg.h"
//=================== VideoCD ==========================
#define CDROM_LEADOUT 0xAA
#define CDROM_LEADOUT 0xAA
typedef struct {
uint8_t sync [12];
uint8_t header [4];
uint8_t subheader [8];
uint8_t data [2324];
uint8_t spare [4];
uint8_t sync [12];
uint8_t header [4];
uint8_t subheader [8];
uint8_t data [2324];
uint8_t spare [4];
} cdsector_t;
#ifdef VCD_NETBSD

View File

@@ -49,15 +49,15 @@ static inline unsigned vcd_get_msf(mp_vcd_priv_t* vcd, int track){
int index = track - vcd->toc.FirstTrack;
/* -150 to compensate the 2-second pregap */
return vcd->toc.TrackData[index].Address[3] +
(vcd->toc.TrackData[index].Address[2] +
vcd->toc.TrackData[index].Address[1] * 60) * 75 - 150;
(vcd->toc.TrackData[index].Address[2] +
vcd->toc.TrackData[index].Address[1] * 60) * 75 - 150;
}
static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
{
unsigned sect;
if (track < vcd->toc.FirstTrack || track > vcd->toc.LastTrack)
return -1;
return -1;
sect = vcd_get_msf(vcd, track);
vcd_set_msf(vcd, sect);
return VCD_SECTOR_DATA * (sect + 2);
@@ -66,7 +66,7 @@ static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
{
if (track < vcd->toc.FirstTrack || track > vcd->toc.LastTrack)
return -1;
return -1;
return VCD_SECTOR_DATA * (vcd_get_msf(vcd, track + 1));
}
@@ -77,29 +77,29 @@ static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd)
int i;
mp_vcd_priv_t* vcd = malloc(sizeof(mp_vcd_priv_t));
if (!vcd)
return NULL;
return NULL;
hd = (HANDLE)_get_osfhandle(fd);
if (!DeviceIoControl(hd, IOCTL_CDROM_READ_TOC, NULL, 0, &vcd->toc,
sizeof(CDROM_TOC), &dwBytesReturned, NULL)) {
MP_ERR(stream, "read CDROM toc header: %lu\n",
GetLastError());
free(vcd);
return NULL;
sizeof(CDROM_TOC), &dwBytesReturned, NULL)) {
MP_ERR(stream, "read CDROM toc header: %lu\n",
GetLastError());
free(vcd);
return NULL;
}
for (i = vcd->toc.FirstTrack; i <= vcd->toc.LastTrack + 1; i++) {
int index = i - vcd->toc.FirstTrack;
if (i <= vcd->toc.LastTrack) {
MP_INFO(stream, "track %02d: adr=%d ctrl=%d"
" %02d:%02d:%02d\n",
vcd->toc.TrackData[index].TrackNumber,
vcd->toc.TrackData[index].Adr,
vcd->toc.TrackData[index].Control,
vcd->toc.TrackData[index].Address[1],
vcd->toc.TrackData[index].Address[2],
vcd->toc.TrackData[index].Address[3]);
}
int index = i - vcd->toc.FirstTrack;
if (i <= vcd->toc.LastTrack) {
MP_INFO(stream, "track %02d: adr=%d ctrl=%d"
" %02d:%02d:%02d\n",
vcd->toc.TrackData[index].TrackNumber,
vcd->toc.TrackData[index].Adr,
vcd->toc.TrackData[index].Control,
vcd->toc.TrackData[index].Address[1],
vcd->toc.TrackData[index].Address[2],
vcd->toc.TrackData[index].Address[3]);
}
}
vcd->hd = hd;
@@ -119,9 +119,9 @@ static int vcd_read(mp_vcd_priv_t* vcd, char *mem)
cdrom_raw.TrackMode = XAForm2;
if (!DeviceIoControl(vcd->hd, IOCTL_CDROM_RAW_READ, &cdrom_raw,
sizeof(RAW_READ_INFO), vcd->buf, sizeof(vcd->buf),
&dwBytesReturned, NULL))
return 0;
sizeof(RAW_READ_INFO), vcd->buf, sizeof(vcd->buf),
&dwBytesReturned, NULL))
return 0;
vcd->sect++;
memcpy(mem, &vcd->buf[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);