From d86a237bdd9d458de6b67e585ab1c7d7186ded06 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 21 Feb 2010 20:39:49 +0000 Subject: cosmetics: Move functions around to avoid forward declarations and #ifdefs. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30687 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/dvb_tune.c | 253 +++++++++++++++++++++++++----------------------------- 1 file changed, 119 insertions(+), 134 deletions(-) (limited to 'stream') diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index 214fe871c2..1eb55746c1 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -91,8 +91,6 @@ int dvb_get_tuner_type(int fe_fd) } -int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype); - int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt) { int i; @@ -245,89 +243,6 @@ int dvb_demux_start(int fd) } -static int tune_it(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 tmout); - - -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) -{ - int ris; - - mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune Freq: %lu\n", (long unsigned int) freq); - - ris = tune_it(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_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune, TUNING FAILED\n"); - - return ris == 0; -} - - -#ifndef CONFIG_DVB_HEAD -static int SecGetStatus (int fd, struct secStatus *state) -{ - if(ioctl(fd, SEC_GET_STATUS, state) < 0) - { - mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: ")); - return -1; - } - - switch (state->busMode) - { - case SEC_BUS_IDLE: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: IDLE (%d)\n",state->busMode); - break; - case SEC_BUS_BUSY: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: BUSY (%d)\n",state->busMode); - break; - case SEC_BUS_OFF: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OFF (%d)\n",state->busMode); - break; - case SEC_BUS_OVERLOAD: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OVERLOAD (%d)\n",state->busMode); - break; - default: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: unknown (%d)\n",state->busMode); - break; - } - - switch (state->selVolt) - { - case SEC_VOLTAGE_OFF: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_LT: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_13: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_13_5: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13.5 (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_18: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt); - break; - case SEC_VOLTAGE_18_5: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18.5 (%d)\n",state->selVolt); - break; - default: - mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt); - break; - } - - mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF")); - return 0; -} - -#endif - static void print_status(fe_status_t festatus) { mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:"); @@ -407,8 +322,109 @@ static int check_status(int fd_frontend, int tmout) return 0; } + +struct diseqc_cmd { + struct dvb_diseqc_master_cmd cmd; + uint32_t wait; +}; + +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) +{ + if(ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) + return -1; + if(ioctl(fd, FE_SET_VOLTAGE, v) == -1) + return -1; + usleep(15 * 1000); + if(ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) == -1) + return -1; + usleep(cmd->wait * 1000); + usleep(15 * 1000); + if(ioctl(fd, FE_DISEQC_SEND_BURST, b) == -1) + return -1; + usleep(15 * 1000); + if(ioctl(fd, FE_SET_TONE, t) == -1) + return -1; + + return 0; +} + +/* digital satellite equipment control, + * specification is available from http://www.eutelsat.com/ + */ +static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) +{ + struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 }; + + /* param: high nibble: reset bits, low nibble set bits, + * bits are: option, position, polarizaion, band + */ + cmd.cmd.msg[3] = + 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); +} + #else +static int SecGetStatus (int fd, struct secStatus *state) +{ + if(ioctl(fd, SEC_GET_STATUS, state) < 0) + { + mp_msg(MSGT_DEMUX, MSGL_ERR, ("SEC GET STATUS: ")); + return -1; + } + + switch (state->busMode) + { + case SEC_BUS_IDLE: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: IDLE (%d)\n",state->busMode); + break; + case SEC_BUS_BUSY: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: BUSY (%d)\n",state->busMode); + break; + case SEC_BUS_OFF: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OFF (%d)\n",state->busMode); + break; + case SEC_BUS_OVERLOAD: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: OVERLOAD (%d)\n",state->busMode); + break; + default: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC BUS MODE: unknown (%d)\n",state->busMode); + break; + } + + switch (state->selVolt) + { + case SEC_VOLTAGE_OFF: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: OFF (%d)\n",state->selVolt); + break; + case SEC_VOLTAGE_LT: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: LT (%d)\n",state->selVolt); + break; + case SEC_VOLTAGE_13: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13 (%d)\n",state->selVolt); + break; + case SEC_VOLTAGE_13_5: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 13.5 (%d)\n",state->selVolt); + break; + case SEC_VOLTAGE_18: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18 (%d)\n",state->selVolt); + break; + case SEC_VOLTAGE_18_5: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: 18.5 (%d)\n",state->selVolt); + break; + default: + mp_msg(MSGT_DEMUX, MSGL_V, "SEC VOLTAGE: unknown (%d)\n",state->selVolt); + break; + } + + mp_msg(MSGT_DEMUX, MSGL_V, "SEC CONT TONE: %s\n", (state->contTone == SEC_TONE_ON ? "ON" : "OFF")); + return 0; +} + static int check_status(int fd_frontend, int tmout) { int i,res; @@ -499,55 +515,6 @@ static int check_status(int fd_frontend, int tmout) } return 0; } -#endif - -#ifdef CONFIG_DVB_HEAD - -struct diseqc_cmd { - struct dvb_diseqc_master_cmd cmd; - uint32_t wait; -}; - -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) -{ - if(ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1) - return -1; - if(ioctl(fd, FE_SET_VOLTAGE, v) == -1) - return -1; - usleep(15 * 1000); - if(ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) == -1) - return -1; - usleep(cmd->wait * 1000); - usleep(15 * 1000); - if(ioctl(fd, FE_DISEQC_SEND_BURST, b) == -1) - return -1; - usleep(15 * 1000); - if(ioctl(fd, FE_SET_TONE, t) == -1) - return -1; - - return 0; -} - -/* digital satellite equipment control, - * specification is available from http://www.eutelsat.com/ - */ -static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) -{ - struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 }; - - /* param: high nibble: reset bits, low nibble set bits, - * bits are: option, position, polarizaion, band - */ - cmd.cmd.msg[3] = - 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); -} - -#else static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) { @@ -742,3 +709,21 @@ static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int return check_status(fd_frontend, timeout); } + + +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) +{ + int ris; + + mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune Freq: %lu\n", (long unsigned int) freq); + + ris = tune_it(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_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune, TUNING FAILED\n"); + + return ris == 0; +} -- cgit v1.2.3 From 49b8b80199af265bc6e3a6c863a334e97fdbf1ba Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 21 Feb 2010 21:00:08 +0000 Subject: Add header for exported DVB-related functions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30688 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/dvb_tune.c | 1 + stream/dvb_tune.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 stream/dvb_tune.h (limited to 'stream') diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index 1eb55746c1..e03a4eb1e6 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -44,6 +44,7 @@ #endif #include "dvbin.h" +#include "dvb_tune.h" #include "mp_msg.h" diff --git a/stream/dvb_tune.h b/stream/dvb_tune.h new file mode 100644 index 0000000000..c3d2c63104 --- /dev/null +++ b/stream/dvb_tune.h @@ -0,0 +1,37 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_DVB_TUNE_H +#define MPLAYER_DVB_TUNE_H + +#include "dvbin.h" + +int dvb_get_tuner_type(int fe_fd); +int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt); +int dvb_fix_demuxes(dvb_priv_t *priv, int cnt); +int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype); +int dvb_demux_stop(int fd); +int dvb_demux_start(int fd); +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); + +#endif /* MPLAYER_DVB_TUNE_H */ -- cgit v1.2.3 From 326397d81558d229c9c616355c74b00a4b663574 Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 21 Feb 2010 23:26:16 +0000 Subject: Add header for asf_mmst_streaming_start() instead of forward declaring it. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30690 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/asf_mmst_streaming.c | 2 +- stream/asf_mmst_streaming.h | 26 ++++++++++++++++++++++++++ stream/asf_streaming.c | 3 +-- 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 stream/asf_mmst_streaming.h (limited to 'stream') diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c index 73eed7c43e..4caf79856a 100644 --- a/stream/asf_mmst_streaming.c +++ b/stream/asf_mmst_streaming.c @@ -51,7 +51,7 @@ #include "libmpdemux/asf.h" #include "stream.h" - +#include "asf_mmst_streaming.h" #include "network.h" #include "tcp.h" diff --git a/stream/asf_mmst_streaming.h b/stream/asf_mmst_streaming.h new file mode 100644 index 0000000000..204cf0a450 --- /dev/null +++ b/stream/asf_mmst_streaming.h @@ -0,0 +1,26 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_ASF_MMST_STREAMING_H +#define MPLAYER_ASF_MMST_STREAMING_H + +#include "stream.h" + +int asf_mmst_streaming_start(stream_t *stream); + +#endif /* MPLAYER_ASF_MMST_STREAMING_H */ diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c index df93352388..f00f503372 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -37,7 +37,7 @@ #include "stream.h" #include "libmpdemux/demuxer.h" - +#include "asf_mmst_streaming.h" #include "network.h" #include "tcp.h" @@ -47,7 +47,6 @@ extern int network_bandwidth; -int asf_mmst_streaming_start( stream_t *stream ); static int asf_http_streaming_start(stream_t *stream, int *demuxer_type); static int asf_read_wrapper(int fd, void *buffer, int len, streaming_ctrl_t *stream_ctrl) { -- cgit v1.2.3 From f9c2ab17affbbfcc2068b3269887aec14fb9ddac Mon Sep 17 00:00:00 2001 From: diego Date: Sun, 21 Feb 2010 23:30:34 +0000 Subject: Declare stream_fill_buffer() and stream_seek_long() unconditionally. They are public functions that are unconditionally compiled, so they should not be declared conditionally. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30691 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'stream') diff --git a/stream/stream.h b/stream/stream.h index e281a266f3..e5f0d90ed7 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -142,14 +142,15 @@ typedef struct stream_st { unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE]; } stream_t; +int stream_fill_buffer(stream_t *s); +int stream_seek_long(stream_t *s, off_t pos); + #ifdef CONFIG_STREAM_CACHE int stream_enable_cache(stream_t *stream,int size,int min,int prefill); int cache_stream_fill_buffer(stream_t *s); int cache_stream_seek_long(stream_t *s,off_t pos); #else // no cache, define wrappers: -int stream_fill_buffer(stream_t *s); -int stream_seek_long(stream_t *s,off_t pos); #define cache_stream_fill_buffer(x) stream_fill_buffer(x) #define cache_stream_seek_long(x,y) stream_seek_long(x,y) #define stream_enable_cache(x,y,z,w) 1 -- cgit v1.2.3