summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-06-04 08:10:48 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-06-04 08:10:48 +0300
commitd5c868325cefcd5fad53361d1dfdc9757674eb70 (patch)
treea838e509fdc2468220466e6337097b3ef590b00c /stream
parent0cb5123c8f65b3d7715deb22ce8430eccc21996e (diff)
parent5b3834c5d1033f05d798278c33782c5563247062 (diff)
downloadmpv-d5c868325cefcd5fad53361d1dfdc9757674eb70.tar.bz2
mpv-d5c868325cefcd5fad53361d1dfdc9757674eb70.tar.xz
Merge svn changes up to r26979
Most of the conflicts are trivial. Conflicts: Makefile cfg-mplayer.h input/input.c libmenu/vf_menu.c libmpcodecs/dec_video.c libmpcodecs/vf_expand.c libmpcodecs/vf_vo.c libmpdemux/demux_mkv.c libmpdemux/demuxer.c libmpdemux/demuxer.h libvo/vo_directfb2.c libvo/vo_gl.c libvo/vo_winvidix.c libvo/vo_xv.c libvo/vo_xvidix.c libvo/vo_xvmc.c libvo/x11_common.c mplayer.c osdep/timer-linux.c stream/cache2.c
Diffstat (limited to 'stream')
-rw-r--r--stream/asf_mmst_streaming.c2
-rw-r--r--stream/cache2.c98
-rw-r--r--stream/cache2.h1
-rw-r--r--stream/rtp.c4
-rw-r--r--stream/stream.c2
-rw-r--r--stream/stream_cddb.c2
-rw-r--r--stream/stream_cue.c4
-rw-r--r--stream/stream_dvd.c7
-rw-r--r--stream/stream_dvd.h8
-rw-r--r--stream/stream_dvd_common.c5
-rw-r--r--stream/stream_dvd_common.h4
-rw-r--r--stream/stream_ftp.c2
-rw-r--r--stream/tv.c26
-rw-r--r--stream/tvi_bsdbt848.c112
-rw-r--r--stream/tvi_def.h6
-rw-r--r--stream/tvi_dshow.c36
-rw-r--r--stream/tvi_dummy.c38
-rw-r--r--stream/tvi_v4l.c160
-rw-r--r--stream/tvi_v4l2.c4
19 files changed, 312 insertions, 209 deletions
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c
index f3417260a3..57a9d7c584 100644
--- a/stream/asf_mmst_streaming.c
+++ b/stream/asf_mmst_streaming.c
@@ -266,7 +266,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
// mp_msg(MSGT_NETWORK,MSGL_INFO,"get header packet finished\n");
- return (header_len);
+ return header_len;
}
diff --git a/stream/cache2.c b/stream/cache2.c
index 7d67bfb034..0696526f32 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -7,6 +7,7 @@
#define READ_USLEEP_TIME 10000
#define FILL_USLEEP_TIME 50000
#define PREFILL_SLEEP_TIME 200
+#define CONTROL_SLEEP_TIME 0
#include <stdio.h>
#include <stdlib.h>
@@ -57,6 +58,12 @@ typedef struct {
// int fifo_flag; // 1 if we should use FIFO to notice cache about buffer reads.
// callback
stream_t* stream;
+ volatile int control;
+ volatile unsigned control_uint_arg;
+ volatile double control_double_arg;
+ volatile int control_res;
+ volatile off_t control_new_pos;
+ volatile double stream_time_length;
} cache_vars_t;
static int min_fill=0;
@@ -191,6 +198,46 @@ static int cache_fill(cache_vars_t* s){
}
+static void cache_execute_control(cache_vars_t *s) {
+ static unsigned last;
+ if (!s->stream->control) {
+ s->stream_time_length = 0;
+ s->control_new_pos = 0;
+ s->control_res = STREAM_UNSUPPORTED;
+ s->control = -1;
+ return;
+ }
+ if (GetTimerMS() - last > 99) {
+ double len;
+ if (s->stream->control(s->stream, STREAM_CTRL_GET_TIME_LENGTH, &len) == STREAM_OK)
+ s->stream_time_length = len;
+ else
+ s->stream_time_length = 0;
+ last = GetTimerMS();
+ }
+ if (s->control == -1) return;
+ switch (s->control) {
+ case STREAM_CTRL_GET_CURRENT_TIME:
+ case STREAM_CTRL_SEEK_TO_TIME:
+ case STREAM_CTRL_GET_ASPECT_RATIO:
+ s->control_res = s->stream->control(s->stream, s->control, &s->control_double_arg);
+ break;
+ case STREAM_CTRL_SEEK_TO_CHAPTER:
+ case STREAM_CTRL_GET_NUM_CHAPTERS:
+ case STREAM_CTRL_GET_CURRENT_CHAPTER:
+ case STREAM_CTRL_GET_NUM_ANGLES:
+ case STREAM_CTRL_GET_ANGLE:
+ case STREAM_CTRL_SET_ANGLE:
+ s->control_res = s->stream->control(s->stream, s->control, &s->control_uint_arg);
+ break;
+ default:
+ s->control_res = STREAM_UNSUPPORTED;
+ break;
+ }
+ s->control_new_pos = s->stream->pos;
+ s->control = -1;
+}
+
static cache_vars_t* cache_init(int size,int sector){
int num;
#if !defined(WIN32) && !defined(__OS2__)
@@ -331,6 +378,7 @@ static void ThreadProc( void *s ){
if(!cache_fill((cache_vars_t*)s)){
usec_sleep(FILL_USLEEP_TIME); // idle
}
+ cache_execute_control((cache_vars_t*)s);
// cache_stats(s->cache_data);
}
}
@@ -384,3 +432,53 @@ int cache_stream_seek_long(stream_t *stream,off_t pos){
mp_msg(MSGT_CACHE,MSGL_V,"cache_stream_seek: WARNING! Can't seek to 0x%"PRIX64" !\n",(int64_t)(pos+newpos));
return 0;
}
+
+int cache_do_control(stream_t *stream, int cmd, void *arg) {
+ cache_vars_t* s = stream->cache_data;
+ switch (cmd) {
+ case STREAM_CTRL_SEEK_TO_TIME:
+ s->control_double_arg = *(double *)arg;
+ s->control = cmd;
+ break;
+ case STREAM_CTRL_SEEK_TO_CHAPTER:
+ case STREAM_CTRL_SET_ANGLE:
+ s->control_uint_arg = *(unsigned *)arg;
+ s->control = cmd;
+ break;
+// the core might call these every frame, they are too slow for this...
+ case STREAM_CTRL_GET_TIME_LENGTH:
+// case STREAM_CTRL_GET_CURRENT_TIME:
+ *(double *)arg = s->stream_time_length;
+ return s->stream_time_length ? STREAM_OK : STREAM_UNSUPPORTED;
+ case STREAM_CTRL_GET_NUM_CHAPTERS:
+ case STREAM_CTRL_GET_CURRENT_CHAPTER:
+ case STREAM_CTRL_GET_ASPECT_RATIO:
+ case STREAM_CTRL_GET_NUM_ANGLES:
+ case STREAM_CTRL_GET_ANGLE:
+ s->control = cmd;
+ break;
+ default:
+ return STREAM_UNSUPPORTED;
+ }
+ while (s->control != -1)
+ usec_sleep(CONTROL_SLEEP_TIME);
+ switch (cmd) {
+ case STREAM_CTRL_GET_TIME_LENGTH:
+ case STREAM_CTRL_GET_CURRENT_TIME:
+ case STREAM_CTRL_GET_ASPECT_RATIO:
+ *(double *)arg = s->control_double_arg;
+ break;
+ case STREAM_CTRL_GET_NUM_CHAPTERS:
+ case STREAM_CTRL_GET_CURRENT_CHAPTER:
+ case STREAM_CTRL_GET_NUM_ANGLES:
+ case STREAM_CTRL_GET_ANGLE:
+ *(unsigned *)arg = s->control_uint_arg;
+ break;
+ case STREAM_CTRL_SEEK_TO_CHAPTER:
+ case STREAM_CTRL_SEEK_TO_TIME:
+ case STREAM_CTRL_SET_ANGLE:
+ stream->pos = s->read_filepos = s->control_new_pos;
+ break;
+ }
+ return s->control_res;
+}
diff --git a/stream/cache2.h b/stream/cache2.h
index f61865f419..4eb201e177 100644
--- a/stream/cache2.h
+++ b/stream/cache2.h
@@ -4,5 +4,6 @@
#include "stream.h"
extern void cache_uninit(stream_t *s);
+int cache_do_control(stream_t *stream, int cmd, void *arg);
#endif /* MPLAYER_CACHE2_H */
diff --git a/stream/rtp.c b/stream/rtp.c
index db522df9b5..1c31bef4a1 100644
--- a/stream/rtp.c
+++ b/stream/rtp.c
@@ -213,7 +213,7 @@ int read_rtp_from_server(int fd, char *buffer, int length) {
mp_msg(MSGT_NETWORK, MSGL_ERR, "Got empty packet from RTP cache!?\n");
}
- return(length);
+ return length;
}
static int getrtp2(int fd, struct rtpheader *rh, char** data, int* lengthData) {
@@ -251,5 +251,5 @@ static int getrtp2(int fd, struct rtpheader *rh, char** data, int* lengthData) {
// mp_msg(MSGT_NETWORK,MSGL_DBG2,"Reading rtp: v=%x p=%x x=%x cc=%x m=%x pt=%x seq=%x ts=%x lgth=%d\n",rh->b.v,rh->b.p,rh->b.x,rh->b.cc,rh->b.m,rh->b.pt,rh->b.sequence,rh->timestamp,lengthPacket);
- return(0);
+ return 0;
}
diff --git a/stream/stream.c b/stream/stream.c
index e24237fa1d..227fcf4ea4 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -379,6 +379,8 @@ void stream_reset(stream_t *s){
int stream_control(stream_t *s, int cmd, void *arg){
if(!s->control) return STREAM_UNSUPPORTED;
+ if (s->cache_pid)
+ return cache_do_control(s, cmd, arg);
return s->control(s, cmd, arg);
}
diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c
index 775652c322..b2c455d5d9 100644
--- a/stream/stream_cddb.c
+++ b/stream/stream_cddb.c
@@ -259,7 +259,7 @@ cddb_discid(int tot_trks) {
}
t = ((cdtoc[tot_trks].min * 60) + cdtoc[tot_trks].sec) -
((cdtoc[0].min * 60) + cdtoc[0].sec);
- return ((n % 0xff) << 24 | t << 8 | tot_trks);
+ return (n % 0xff) << 24 | t << 8 | tot_trks;
}
diff --git a/stream/stream_cue.c b/stream/stream_cue.c
index e25fddf99d..85628131d0 100644
--- a/stream/stream_cue.c
+++ b/stream/stream_cue.c
@@ -120,7 +120,7 @@ static int cue_getTrackinfo(char *Line, tTrack *track)
if(strncmp(&Line[11], "MODE2/2352", 10)==0) track->mode = MODE2_2352;
if(strncmp(&Line[11], "MODE2/2336", 10)==0) track->mode = MODE2_2336;
}
- else return(1);
+ else return 1;
/* Get the track indexes */
while(1) {
@@ -150,7 +150,7 @@ static int cue_getTrackinfo(char *Line, tTrack *track)
else mp_msg (MSGT_OPEN,MSGL_INFO,
MSGTR_MPDEMUX_CUEREAD_UnexpectedCuefileLine, Line);
}
- return(0);
+ return 0;
}
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index c5a22d8089..85a0d6ba03 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -41,7 +41,6 @@
#include "libmpdemux/demuxer.h"
#include "libavutil/intreadwrite.h"
-extern int stream_cache_size;
extern char* dvd_device;
int dvd_angle=1;
int dvd_speed=0; /* 0 => don't touch speed */
@@ -708,7 +707,6 @@ static int control(stream_t *stream,int cmd,void* arg)
case STREAM_CTRL_SEEK_TO_CHAPTER:
{
int r;
- if(stream_cache_size > 0) return STREAM_UNSUPPORTED;
r = seek_to_chapter(stream, d->vts_file, d->tt_srpt, d->cur_title-1, *((unsigned int *)arg));
if(! r) return STREAM_UNSUPPORTED;
@@ -716,14 +714,12 @@ static int control(stream_t *stream,int cmd,void* arg)
}
case STREAM_CTRL_GET_CURRENT_CHAPTER:
{
- if(stream_cache_size > 0) return STREAM_UNSUPPORTED;
*((unsigned int *)arg) = dvd_chapter_from_cell(d, d->cur_title-1, d->cur_cell);
return 1;
}
case STREAM_CTRL_GET_CURRENT_TIME:
{
double tm;
- if(stream_cache_size > 0) return STREAM_UNSUPPORTED;
tm = dvd_get_current_time(stream, 0);
if(tm != -1) {
*((double *)arg) = tm;
@@ -733,7 +729,6 @@ static int control(stream_t *stream,int cmd,void* arg)
}
case STREAM_CTRL_SEEK_TO_TIME:
{
- if(stream_cache_size > 0) return STREAM_UNSUPPORTED;
if(dvd_seek_to_time(stream, d->vts_file, *((double*)arg)))
return 1;
break;
@@ -1062,8 +1057,6 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
*file_format = DEMUXER_TYPE_MPEG_PS;
mp_msg(MSGT_DVD,MSGL_V,"DVD start=%d end=%d \n",d->cur_pack,d->cur_pgc->cell_playback[d->last_cell-1].last_sector);
stream->priv = (void*)d;
- if(stream_cache_size > 0)
- mp_msg(MSGT_DVD,MSGL_INFO,"[stream_dvd] Warning! the cache is enabled. Seeking won't work correctly\n");
return STREAM_OK;
fail:
diff --git a/stream/stream_dvd.h b/stream/stream_dvd.h
index 84ab1baaa1..379a7ffc84 100644
--- a/stream/stream_dvd.h
+++ b/stream/stream_dvd.h
@@ -8,10 +8,10 @@
#include "dvdread/ifo_read.h"
#include "dvdread/nav_read.h"
#else
-#include <dvdread/dvd_reader.h>
-#include <dvdread/ifo_types.h>
-#include <dvdread/ifo_read.h>
-#include <dvdread/nav_read.h>
+#include <libdvdread/dvd_reader.h>
+#include <libdvdread/ifo_types.h>
+#include <libdvdread/ifo_read.h>
+#include <libdvdread/nav_read.h>
#endif
#include "stream.h"
diff --git a/stream/stream_dvd_common.c b/stream/stream_dvd_common.c
index 895db3a567..5b08107dae 100644
--- a/stream/stream_dvd_common.c
+++ b/stream/stream_dvd_common.c
@@ -1,5 +1,10 @@
+#include "config.h"
#include <inttypes.h>
+#ifdef USE_DVDREAD_INTERNAL
#include <dvdread/ifo_types.h>
+#else
+#include <libdvdread/ifo_types.h>
+#endif
#include "stream_dvd_common.h"
/**
diff --git a/stream/stream_dvd_common.h b/stream/stream_dvd_common.h
index 9838f612fc..443daa45f9 100644
--- a/stream/stream_dvd_common.h
+++ b/stream/stream_dvd_common.h
@@ -2,7 +2,11 @@
#define MPLAYER_STREAM_DVD_COMMON_H
#include <inttypes.h>
+#ifdef USE_DVDREAD_INTERNAL
#include <dvdread/ifo_types.h>
+#else
+#include <libdvdread/ifo_types.h>
+#endif
int mp_dvdtimetomsec(dvd_time_t *dt);
diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c
index de821b7ed1..091fc4e35c 100644
--- a/stream/stream_ftp.c
+++ b/stream/stream_ftp.c
@@ -81,7 +81,7 @@ static int fd_can_read(int fd,int timeout) {
tv.tv_sec = timeout;
tv.tv_usec = 0;
- return (select(fd+1, &fds, NULL, NULL, &tv) > 0);
+ return select(fd+1, &fds, NULL, NULL, &tv) > 0;
}
/*
diff --git a/stream/tv.c b/stream/tv.c
index 17bedccce3..696c0d542d 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -601,7 +601,7 @@ static tvi_handle_t *tv_begin(tv_param_t* tv_param)
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param->driver);
else
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_DriverAutoDetectionFailed);
- return(NULL);
+ return NULL;
}
static int tv_uninit(tvi_handle_t *tvh)
@@ -804,7 +804,7 @@ int tv_set_color_options(tvi_handle_t *tvh, int opt, int value)
mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt);
}
- return(TVI_CONTROL_UNKNOWN);
+ return TVI_CONTROL_UNKNOWN;
}
int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
@@ -825,7 +825,7 @@ int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt);
}
- return(TVI_CONTROL_UNKNOWN);
+ return TVI_CONTROL_UNKNOWN;
}
int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq)
@@ -836,7 +836,7 @@ int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq)
mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency,
*freq, (float)*freq/16);
}
- return(1);
+ return 1;
}
int tv_set_freq(tvi_handle_t *tvh, unsigned long freq)
@@ -853,7 +853,7 @@ int tv_set_freq(tvi_handle_t *tvh, unsigned long freq)
freq, (float)freq/16);
}
tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param);
- return(1);
+ return 1;
}
int tv_get_signal(tvi_handle_t *tvh)
@@ -910,7 +910,7 @@ int tv_step_channel_real(tvi_handle_t *tvh, int direction)
tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
}
}
- return(1);
+ return 1;
}
int tv_step_channel(tvi_handle_t *tvh, int direction) {
@@ -938,7 +938,7 @@ int tv_step_channel(tvi_handle_t *tvh, int direction) {
tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000);
}
} else tv_step_channel_real(tvh, direction);
- return(1);
+ return 1;
}
int tv_set_channel_real(tvi_handle_t *tvh, char *channel) {
@@ -961,7 +961,7 @@ int tv_set_channel_real(tvi_handle_t *tvh, char *channel) {
break;
}
}
- return(1);
+ return 1;
}
int tv_set_channel(tvi_handle_t *tvh, char *channel) {
@@ -979,7 +979,7 @@ int tv_set_channel(tvi_handle_t *tvh, char *channel) {
tv_channel_current->name, (float)tv_channel_current->freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
} else tv_set_channel_real(tvh, channel);
- return(1);
+ return 1;
}
int tv_last_channel(tvi_handle_t *tvh) {
@@ -1013,7 +1013,7 @@ int tv_last_channel(tvi_handle_t *tvh) {
}
}
}
- return(1);
+ return 1;
}
int tv_step_norm(tvi_handle_t *tvh)
@@ -1029,12 +1029,12 @@ int tv_step_norm(tvi_handle_t *tvh)
}
}
tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param);
- return(1);
+ return 1;
}
int tv_step_chanlist(tvi_handle_t *tvh)
{
- return(1);
+ return 1;
}
int tv_set_norm(tvi_handle_t *tvh, char* norm)
@@ -1047,7 +1047,7 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm)
return 0;
}
tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param);
- return(1);
+ return 1;
}
demuxer_desc_t demuxer_desc_tv = {
diff --git a/stream/tvi_bsdbt848.c b/stream/tvi_bsdbt848.c
index 5db90a2bde..1ad7778f37 100644
--- a/stream/tvi_bsdbt848.c
+++ b/stream/tvi_bsdbt848.c
@@ -227,18 +227,18 @@ static int control(priv_t *priv, int cmd, void *arg)
case TVI_CONTROL_IS_TUNER:
if(priv->tunerready == FALSE) return TVI_CONTROL_FALSE;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_TUN_GET_FREQ:
{
if(ioctl(priv->tunerfd, TVTUNER_GETFREQ, &priv->tunerfreq) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "TVTUNER_GETFREQ", strerror(errno));
- return(TVI_CONTROL_FALSE);
+ return TVI_CONTROL_FALSE;
}
*(int *)arg = priv->tunerfreq;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_TUN_SET_FREQ:
@@ -248,10 +248,10 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->tunerfd, TVTUNER_SETFREQ, &priv->tunerfreq) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "TVTUNER_SETFREQ", strerror(errno));
- return(0);
+ return 0;
}
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_TUN_GET_SIGNAL:
{
@@ -259,10 +259,10 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->tunerfd, TVTUNER_GETSTATUS, &status) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "GETSTATUS", strerror(errno));
- return(0);
+ return 0;
}
*(int*)arg=(status & 0x02)? 100 : 0;
- return (TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_TUN_GET_TUNER:
@@ -275,11 +275,11 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORGINPUT, &priv->input) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORGINPUT", strerror(errno));
- return(TVI_CONTROL_FALSE);
+ return TVI_CONTROL_FALSE;
}
*(int *)arg = priv->input;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_SPC_SET_INPUT:
@@ -289,27 +289,27 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSINPUT, &priv->input) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSINPUT", strerror(errno));
- return(0);
+ return 0;
}
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
/* Audio Controls */
case TVI_CONTROL_IS_AUDIO:
if(priv->dspready == FALSE) return TVI_CONTROL_FALSE;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_AUD_GET_FORMAT:
{
*(int *)arg = AF_FORMAT_S16_LE;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_AUD_GET_CHANNELS:
{
*(int *)arg = 2;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_AUD_SET_SAMPLERATE:
{
@@ -318,7 +318,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &dspspeed) == -1)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848InvalidAudioRate, strerror(errno));
- return(TVI_CONTROL_FALSE);
+ return TVI_CONTROL_FALSE;
}
priv->dspspeed = dspspeed;
@@ -328,24 +328,24 @@ static int control(priv_t *priv, int cmd, void *arg)
priv->dsprate = priv->dspspeed * priv->dspsamplesize/8*
(priv->dspstereo+1);
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_AUD_GET_SAMPLERATE:
{
*(int *)arg = priv->dspspeed;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_AUD_GET_SAMPLESIZE:
{
*(int *)arg = priv->dspsamplesize/8;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
/* Video Controls */
case TVI_CONTROL_IS_VIDEO:
if(priv->videoready == FALSE) return TVI_CONTROL_FALSE;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_TUN_SET_NORM:
{
@@ -406,20 +406,20 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSFMT, &priv->iformat) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFMT", strerror(errno));
- return(TVI_CONTROL_FALSE);
+ return TVI_CONTROL_FALSE;
}
if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSETGEO", strerror(errno));
- return(0);
+ return 0;
}
tmp_fps = priv->fps;
if(ioctl(priv->btfd, METEORSFPS, &tmp_fps) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFPS", strerror(errno));
- return(0);
+ return 0;
}
#ifdef BT848_SAUDIO
@@ -430,20 +430,20 @@ static int control(priv_t *priv, int cmd, void *arg)
}
#endif
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_VID_GET_FORMAT:
*(int *)arg = IMGFMT_UYVY;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_FORMAT:
{
int req_fmt = *(int *)arg;
- if(req_fmt != IMGFMT_UYVY) return(TVI_CONTROL_FALSE);
+ if(req_fmt != IMGFMT_UYVY) return TVI_CONTROL_FALSE;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
case TVI_CONTROL_VID_SET_WIDTH:
priv->geom.columns = *(int *)arg;
@@ -456,14 +456,14 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorSettingWidth, strerror(errno));
- return(0);
+ return 0;
}
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_WIDTH:
*(int *)arg = priv->geom.columns;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_SET_HEIGHT:
priv->geom.rows = *(int *)arg;
@@ -481,18 +481,18 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorSettingWidth, strerror(errno));
- return(0);
+ return 0;
}
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_HEIGHT:
*(int *)arg = priv->geom.rows;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_VID_GET_FPS:
*(float *)arg = priv->fps;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
/*
case TVI_CONTROL_VID_SET_FPS:
@@ -503,22 +503,22 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSFPS, &priv->fps) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFPS", strerror(errno));
- return(0);
+ return 0;
}
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
*/
case TVI_CONTROL_VID_CHK_WIDTH:
case TVI_CONTROL_VID_CHK_HEIGHT:
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
case TVI_CONTROL_IMMEDIATE:
priv->immediatemode = TRUE;
- return(TVI_CONTROL_TRUE);
+ return TVI_CONTROL_TRUE;
}
- return(TVI_CONTROL_UNKNOWN);
+ return TVI_CONTROL_UNKNOWN;
}
static int init(priv_t *priv)
@@ -660,7 +660,7 @@ if((priv->dspready == TRUE) &&
priv->dspready = FALSE;
}
-return(1);
+return 1;
}
/* that's the real start, we'got the format parameters (checked with control) */
@@ -671,7 +671,7 @@ struct timeval curtime;
int marg;
fprintf(stderr,"START\n");
-if(priv->videoready == FALSE) return(0);
+if(priv->videoready == FALSE) return 0;
signal(SIGUSR1, processframe);
signal(SIGALRM, processframe);
@@ -681,7 +681,7 @@ marg = SIGUSR1;
if(ioctl(priv->btfd, METEORSSIGNAL, &marg) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSSIGNAL", strerror(errno));
- return(0);
+ return 0;
}
read(priv->dspfd, &tmp, 2);
@@ -695,24 +695,24 @@ marg = METEOR_CAP_CONTINOUS;
if(ioctl(priv->btfd, METEORCAPTUR, &marg) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORCAPTUR", strerror(errno));
- return(0);
+ return 0;
}
-return(1);
+return 1;
}
static int uninit(priv_t *priv)
{
int marg;
-if(priv->videoready == FALSE) return(0);
+if(priv->videoready == FALSE) return 0;
marg = METEOR_SIG_MODE_MASK;
if(ioctl( priv->btfd, METEORSSIGNAL, &marg) < 0 )
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSSIGNAL", strerror(errno));
- return(0);
+ return 0;
}
marg = METEOR_CAP_STOP_CONT;
@@ -720,7 +720,7 @@ marg = METEOR_CAP_STOP_CONT;
if(ioctl(priv->btfd, METEORCAPTUR, &marg) < 0 )
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848UnableToStopCapture, strerror(errno));
- return(0);
+ return 0;
}
close(priv->btfd);
@@ -731,7 +731,7 @@ priv->btfd = -1;
priv->dspready = priv->videoready = FALSE;
-return(1);
+return 1;
}
@@ -739,7 +739,7 @@ static double grabimmediate_video_frame(priv_t *priv, char *buffer, int len)
{
sigset_t sa_mask;
-if(priv->videoready == FALSE) return(0);
+if(priv->videoready == FALSE) return 0;
alarm(1);
sigfillset(&sa_mask);
@@ -754,7 +754,7 @@ memcpy(buffer, priv->livebuf, len);
/* PTS = 0, show the frame NOW, this routine is only used in playback mode
without audio capture .. */
-return(0);
+return 0;
}
static double grab_video_frame(priv_t *priv, char *buffer, int len)
@@ -762,7 +762,7 @@ static double grab_video_frame(priv_t *priv, char *buffer, int len)
double timestamp=0;
sigset_t sa_mask;
-if(priv->videoready == FALSE) return(0);
+if(priv->videoready == FALSE) return 0;
if(priv->immediatemode == TRUE)
{
@@ -784,12 +784,12 @@ priv->framebuf[priv->curbufframe].dirty = TRUE;
priv->curbufframe++;
if(priv->curbufframe >= RINGSIZE) priv->curbufframe = 0;
-return(timestamp-priv->starttime);
+return timestamp-priv->starttime;
}
static int get_video_framesize(priv_t *priv)
{
-return(priv->geom.columns*priv->geom.rows*16/8);
+return priv->geom.columns * priv->geom.rows * 16 / 8;
}
static double grab_audio_frame(priv_t *priv, char *buffer, int len)
@@ -839,7 +839,7 @@ else
}
}
-return(priv->dspbytesread * 1.0 / priv->dsprate);
+return priv->dspbytesread * 1.0 / priv->dsprate;
}
static int get_audio_framesize(priv_t *priv)
@@ -855,7 +855,7 @@ if(priv->dspready == FALSE) return 0;
if(ioctl(priv->dspfd, AUDIO_GETINFO, &auinf) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "AUDIO_GETINFO", strerror(errno));
- return(TVI_CONTROL_FALSE);
+ return TVI_CONTROL_FALSE;
}
else
bytesavail = auinf.record.seek; /* *priv->dspsamplesize; */
@@ -863,7 +863,7 @@ else
if(ioctl(priv->dspfd, FIONREAD, &bytesavail) < 0)
{
mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "FIONREAD", strerror(errno));
- return(TVI_CONTROL_FALSE);
+ return TVI_CONTROL_FALSE;
}
#endif
@@ -872,7 +872,7 @@ if(ioctl(priv->dspfd, FIONREAD, &bytesavail) < 0)
if(bytesavail == 0) return FRAGSIZE;
-return(bytesavail);
+return bytesavail;
}
static int getinput(int innumber)
diff --git a/stream/tvi_def.h b/stream/tvi_def.h
index 7b664a15b9..967c15ee15 100644
--- a/stream/tvi_def.h
+++ b/stream/tvi_def.h
@@ -34,12 +34,12 @@ static tvi_handle_t *new_handle(void)
tvi_handle_t *h = (tvi_handle_t *)malloc(sizeof(tvi_handle_t));
if (!h)
- return(NULL);
+ return NULL;
h->priv = (priv_t *)malloc(sizeof(priv_t));
if (!h->priv)
{
free(h);
- return(NULL);
+ return NULL;
}
memset(h->priv, 0, sizeof(priv_t));
h->functions = &functions;
@@ -49,7 +49,7 @@ static tvi_handle_t *new_handle(void)
h->norm = -1;
h->channel = -1;
h->scan = NULL;
- return(h);
+ return h;
}