diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-03-10 01:01:15 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-03-10 01:01:15 +0200 |
commit | 0dce155dd3e52d24c7a0ffbd4be9461170d53de3 (patch) | |
tree | 0d675e2bbd3fa90303f72708b8533d5d068278f4 /stream | |
parent | db7fe7ce92a229c6529b9b6b2894f325a778ead2 (diff) | |
parent | 22e310b9aef77477e022874beb388514911ead1e (diff) | |
download | mpv-0dce155dd3e52d24c7a0ffbd4be9461170d53de3.tar.bz2 mpv-0dce155dd3e52d24c7a0ffbd4be9461170d53de3.tar.xz |
Merge svn changes up to r30694
Diffstat (limited to 'stream')
-rw-r--r-- | stream/asf_mmst_streaming.c | 2 | ||||
-rw-r--r-- | stream/asf_mmst_streaming.h | 26 | ||||
-rw-r--r-- | stream/asf_streaming.c | 3 | ||||
-rw-r--r-- | stream/dvb_tune.c | 254 | ||||
-rw-r--r-- | stream/dvb_tune.h | 37 | ||||
-rw-r--r-- | stream/stream.h | 3 |
6 files changed, 187 insertions, 138 deletions
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c index 4e7b2eb2c7..6a69b426d0 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 c76ccb5d92..5b92fdcead 100644 --- a/stream/asf_streaming.c +++ b/stream/asf_streaming.c @@ -38,7 +38,7 @@ #include "stream.h" #include "libmpdemux/demuxer.h" - +#include "asf_mmst_streaming.h" #include "network.h" #include "tcp.h" @@ -48,7 +48,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) { diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index 214fe871c2..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" @@ -91,8 +92,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 +244,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 +323,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 +516,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 +710,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; +} 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 */ diff --git a/stream/stream.h b/stream/stream.h index 03d7431df2..2dd65051c8 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -144,7 +144,8 @@ typedef struct stream { } stream_t; int stream_fill_buffer(stream_t *s); -int stream_seek_long(stream_t *s,off_t pos); +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); |