Mercurial > mplayer.hg
changeset 3284:702e399a4b3e
update (audio support is coming:)
author | alex |
---|---|
date | Mon, 03 Dec 2001 16:38:40 +0000 |
parents | 73de2c85844d |
children | bd7bff4cb453 |
files | libmpdemux/tv.c libmpdemux/tvi_v4l.c |
diffstat | 2 files changed, 55 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/tv.c Mon Dec 03 15:57:10 2001 +0000 +++ b/libmpdemux/tv.c Mon Dec 03 16:38:40 2001 +0000 @@ -1,7 +1,9 @@ /* - TV subsystem for libMPDemux by Alex + TV Interface for MPlayer - API idea based on libvo2's + (C) Alex Beregszaszi <alex@naxine.org> + + API idea based on libvo2 UNDER HEAVY DEVELOPEMENT, NO FEATURE REQUESTS PLEASE! :) */ @@ -33,7 +35,7 @@ /* some default values */ char *tv_param_freq = NULL; -char *tv_param_channel = "26"; /* hungarian national tv channel 1 */ +char *tv_param_channel = NULL; char *tv_param_norm = "pal"; char *tv_param_chanlist = "europe-east"; char *tv_param_device = NULL; @@ -152,19 +154,6 @@ /* set some params got from cmdline */ funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input); - /* we need to set frequency */ - if (tv_param_freq && (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE)) - { - unsigned long freq = atof(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_GET_FREQ, &freq); - mp_msg(MSGT_TV, MSGL_INFO, "Current frequency: %lu (%.3f)\n", - freq, (float)freq/16); - } - /* select video norm */ if (!strcasecmp(tv_param_norm, "pal")) tvh->norm = TV_NORM_PAL; @@ -175,6 +164,12 @@ mp_msg(MSGT_TV, MSGL_INFO, "Selected norm: %s\n", tv_param_norm); + if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE) + { + mp_msg(MSGT_TV, MSGL_WARN, "Selected input hasn't got a tuner!\n"); + goto start_device; + } + /* select channel list */ for (i = 0; chanlists[i].name != NULL; i++) { @@ -189,16 +184,34 @@ if (tvh->chanlist == -1) mp_msg(MSGT_TV, MSGL_WARN, "Unable to find selected channel list! (%s)\n", tv_param_chanlist); - - mp_msg(MSGT_TV, MSGL_INFO, "Selected channel list: %s (including %d channels)\n", - chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count); + else + mp_msg(MSGT_TV, MSGL_INFO, "Selected channel list: %s (including %d channels)\n", + chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count); if (tv_param_freq && tv_param_channel) - mp_msg(MSGT_TV, MSGL_HINT, "You can't set frequency and channel simultanly!\n"); + { + mp_msg(MSGT_TV, MSGL_WARN, "You can't set frequency and channel simultanly!\n"); + goto start_device; + } + + /* we need to set frequency */ + if (tv_param_freq) + { + unsigned long freq = atof(tv_param_freq)*16; - if (!tv_param_freq && tv_param_channel) + /* set freq in MHz */ + funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq); + + funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq); + mp_msg(MSGT_TV, MSGL_INFO, "Selected frequency: %lu (%.3f)\n", + freq, (float)freq/16); + } + + if (tv_param_channel) { struct CHANLIST cl; + + mp_msg(MSGT_TV, MSGL_V, "Requested channel: %s\n", tv_param_channel); for (i = 0; i < chanlists[tvh->chanlist].count; i++) { cl = tvh->chanlist_s[i]; @@ -214,7 +227,8 @@ } } } - + +start_device: /* also start device! */ return(funcs->start(tvh->priv)); }
--- a/libmpdemux/tvi_v4l.c Mon Dec 03 15:57:10 2001 +0000 +++ b/libmpdemux/tvi_v4l.c Mon Dec 03 16:38:40 2001 +0000 @@ -1,5 +1,5 @@ /* - v4l interface for libmpemux/tvi + Video 4 Linux input (C) Alex Beregszaszi <alex@naxine.org> @@ -62,7 +62,8 @@ int queue; /* audio */ - struct video_audio audio; + struct video_audio *audio; + int act_audio; } priv_t; #include "tvi_def.h" @@ -261,16 +262,6 @@ } fcntl(priv->fd, F_SETFD, FD_CLOEXEC); -// siginit(); - -#if 0 - for (i=0; params[i].opt; i++) - { - if (!strcmp(params[i].opt, "input")) - priv->input = (int)*(void **)params[i].value; - } - printf("priv->input: %d\n", priv->input); -#endif mp_msg(MSGT_TV, MSGL_INFO, "Selected device: %s\n", priv->capability.name); mp_msg(MSGT_TV, MSGL_INFO, " Capabilites: "); @@ -309,24 +300,31 @@ if (priv->capability.audios) { mp_msg(MSGT_TV, MSGL_INFO, " Audio devices: %d\n", priv->capability.audios); + + priv->act_audio = 0; for (i = 0; i < priv->capability.audios; i++) { - priv->audio.audio = i; - if (ioctl(priv->fd, VIDIOCGAUDIO, &priv->audio) == -1) + priv->audio = realloc(priv->audio, sizeof(struct video_audio)*(i+1)); + priv->audio[i].audio = i; + if (ioctl(priv->fd, VIDIOCGAUDIO, &priv->audio[i]) == -1) { mp_msg(MSGT_TV, MSGL_ERR, "ioctl get audio failed: %s\n", strerror(errno)); break; } - mp_msg(MSGT_TV, MSGL_V, " %d: %s: ", priv->audio.audio, - priv->audio.name); - if (priv->audio.flags & VIDEO_AUDIO_MUTABLE) + mp_msg(MSGT_TV, MSGL_V, " %d: %s: ", priv->audio[i].audio, + priv->audio[i].name); + if (priv->audio[i].flags & VIDEO_AUDIO_MUTABLE) mp_msg(MSGT_TV, MSGL_V, "muted=%s ", - (priv->audio.flags & VIDEO_AUDIO_MUTE) ? "yes" : "no"); + (priv->audio[i].flags & VIDEO_AUDIO_MUTE) ? "yes" : "no"); mp_msg(MSGT_TV, MSGL_V, "volume=%d bass=%d treble=%d balance=%d mode=%s\n", - priv->audio.volume, priv->audio.bass, priv->audio.treble, - priv->audio.balance, audio_mode2name[priv->audio.mode]); + priv->audio[i].volume, priv->audio[i].bass, priv->audio[i].treble, + priv->audio[i].balance, audio_mode2name[priv->audio[i].mode]); + + /* un-mute channels */ + priv->audio[i].flags &= ~VIDEO_AUDIO_MUTE; + ioctl(priv->fd, VIDIOCGAUDIO, &priv->audio[i]); } } @@ -738,7 +736,7 @@ int frame = priv->queue % priv->nbuf; int nextframe = (priv->queue+1) % priv->nbuf; - mp_dbg(MSGT_TV, MSGL_DBG2, "grab_video_frame(priv=%p, buffer=%p, len=%d\n", + mp_dbg(MSGT_TV, MSGL_DBG2, "grab_video_frame(priv=%p, buffer=%p, len=%d)\n", priv, buffer, len); mp_dbg(MSGT_TV, MSGL_DBG3, "buf: %p + frame: %d => %p\n",