diff options
Diffstat (limited to 'src/input/input_net.c')
-rw-r--r-- | src/input/input_net.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/input/input_net.c b/src/input/input_net.c index 0ce2e1340..8a4874203 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -15,13 +15,11 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.70 2007/01/19 01:05:25 dgp85 Exp $ - * * how to set up mp1e for use with this plugin: * * use mp1 to capture the live stream, e.g. @@ -68,9 +66,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #define NET_BS_LEN 2324 @@ -249,8 +247,9 @@ static int host_connect(const char *host, int port, xine_t *xine) { #define HIGH_WATER_MARK 100 static off_t net_plugin_read (input_plugin_t *this_gen, - char *buf, off_t len) { + void *buf_gen, off_t len) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; + char *buf = (char *)buf_gen; off_t n, total; lprintf("reading %" PRIdMAX " bytes...\n", (intmax_t)len); @@ -413,6 +412,8 @@ static int net_plugin_open (input_plugin_t *this_gen ) { char *filename; char *pptr; int port = 7658; + int toread = MAX_PREVIEW_SIZE; + int trycount = 0; filename = this->host_port; pptr=strrchr(filename, ':'); @@ -431,11 +432,15 @@ static int net_plugin_open (input_plugin_t *this_gen ) { /* * fill preview buffer */ + while ((toread > 0) && (trycount < 10)) { #ifndef WIN32 - this->preview_size = read (this->fh, this->preview, MAX_PREVIEW_SIZE); + this->preview_size += read (this->fh, this->preview + this->preview_size, toread); #else - this->preview_size = recv (this->fh, this->preview, MAX_PREVIEW_SIZE, 0); + this->preview_size += recv (this->fh, this->preview + this->preview_size, toread, 0); #endif + trycount++; + toread = MAX_PREVIEW_SIZE - this->preview_size; + } this->curpos = 0; @@ -506,20 +511,6 @@ static input_plugin_t *net_class_get_instance (input_class_t *cls_gen, xine_stre * net plugin class */ -static const char *net_class_get_description (input_class_t *this_gen) { - return _("net input plugin as shipped with xine"); -} - -static const char *net_class_get_identifier (input_class_t *this_gen) { - return "TCP"; -} - -static void net_class_dispose (input_class_t *this_gen) { - net_input_class_t *this = (net_input_class_t *) this_gen; - - free (this); -} - static void *init_class (xine_t *xine, void *data) { net_input_class_t *this; @@ -529,11 +520,11 @@ static void *init_class (xine_t *xine, void *data) { this->xine = xine; this->input_class.get_instance = net_class_get_instance; - this->input_class.get_description = net_class_get_description; - this->input_class.get_identifier = net_class_get_identifier; + this->input_class.description = N_("net input plugin as shipped with xine"); + this->input_class.identifier = "TCP"; this->input_class.get_dir = NULL; this->input_class.get_autoplay_list = NULL; - this->input_class.dispose = net_class_dispose; + this->input_class.dispose = default_input_class_dispose; this->input_class.eject_media = NULL; return this; @@ -545,7 +536,7 @@ static void *init_class (xine_t *xine, void *data) { const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 17, "tcp", XINE_VERSION_CODE, NULL, init_class }, + { PLUGIN_INPUT, 18, "tcp", XINE_VERSION_CODE, NULL, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |