~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/access/tcp.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * tcp.c: TCP input module
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2003-2004 the VideoLAN team
5
 
 * $Id: e8690e6c1f685f54bb5ff82968a86768908a5eff $
 
5
 * $Id$
6
6
 *
7
7
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8
8
 *
24
24
/*****************************************************************************
25
25
 * Preamble
26
26
 *****************************************************************************/
27
 
#include <stdlib.h>
28
 
 
29
 
#include <vlc/vlc.h>
30
 
#include <vlc/input.h>
31
 
 
32
 
#include "network.h"
 
27
 
 
28
#ifdef HAVE_CONFIG_H
 
29
# include "config.h"
 
30
#endif
 
31
 
 
32
#include <vlc_common.h>
 
33
#include <vlc_plugin.h>
 
34
#include <vlc_access.h>
 
35
 
 
36
#include <vlc_network.h>
33
37
 
34
38
/*****************************************************************************
35
39
 * Module descriptor
43
47
static void Close( vlc_object_t * );
44
48
 
45
49
vlc_module_begin();
46
 
    set_shortname( _("TCP") );
47
 
    set_description( _("TCP input") );
 
50
    set_shortname( N_("TCP") );
 
51
    set_description( N_("TCP input") );
48
52
    set_category( CAT_INPUT );
49
53
    set_subcategory( SUBCAT_INPUT_ACCESS );
50
54
 
51
55
    add_integer( "tcp-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
52
 
                 CACHING_LONGTEXT, VLC_TRUE );
 
56
                 CACHING_LONGTEXT, true );
53
57
 
54
 
    set_capability( "access2", 0 );
 
58
    set_capability( "access", 0 );
55
59
    add_shortcut( "tcp" );
56
60
    set_callbacks( Open, Close );
57
61
vlc_module_end();
65
69
};
66
70
 
67
71
 
68
 
static int Read( access_t *, uint8_t *, int );
 
72
static ssize_t Read( access_t *, uint8_t *, size_t );
69
73
static int Control( access_t *, int, va_list );
70
74
 
71
75
/*****************************************************************************
98
102
    *psz_parser++ = '\0';
99
103
 
100
104
    /* Init p_access */
101
 
    p_access->pf_read = Read;
102
 
    p_access->pf_block = NULL;
103
 
    p_access->pf_control = Control;
104
 
    p_access->pf_seek = NULL;
105
 
    p_access->info.i_update = 0;
106
 
    p_access->info.i_size = 0;
107
 
    p_access->info.i_pos = 0;
108
 
    p_access->info.b_eof = VLC_FALSE;
109
 
    p_access->info.i_title = 0;
110
 
    p_access->info.i_seekpoint = 0;
111
 
    p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
 
105
    access_InitFields( p_access ); \
 
106
    ACCESS_SET_CALLBACKS( Read, NULL, Control, NULL ); \
 
107
    MALLOC_ERR( p_access->p_sys, access_sys_t ); \
 
108
    p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) );
112
109
 
113
110
    p_sys->fd = net_ConnectTCP( p_access, psz_dup, atoi( psz_parser ) );
114
111
    free( psz_dup );
138
135
}
139
136
 
140
137
/*****************************************************************************
141
 
 * Read: read on a file descriptor, checking b_die periodically
 
138
 * Read: read on a file descriptor
142
139
 *****************************************************************************/
143
 
static int Read( access_t *p_access, uint8_t *p_buffer, int i_len )
 
140
static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
144
141
{
145
142
    access_sys_t *p_sys = p_access->p_sys;
146
143
    int i_read;
149
146
        return 0;
150
147
 
151
148
    i_read = net_Read( p_access, p_sys->fd, NULL, p_buffer, i_len,
152
 
                       VLC_FALSE );
 
149
                       false );
153
150
    if( i_read == 0 )
154
 
        p_access->info.b_eof = VLC_TRUE;
 
151
        p_access->info.b_eof = true;
155
152
    else if( i_read > 0 )
156
153
        p_access->info.i_pos += i_read;
157
154
 
163
160
 *****************************************************************************/
164
161
static int Control( access_t *p_access, int i_query, va_list args )
165
162
{
166
 
    vlc_bool_t   *pb_bool;
 
163
    bool   *pb_bool;
167
164
    int          *pi_int;
168
165
    int64_t      *pi_64;
169
166
 
172
169
        /* */
173
170
        case ACCESS_CAN_SEEK:
174
171
        case ACCESS_CAN_FASTSEEK:
175
 
            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
176
 
            *pb_bool = VLC_FALSE;
 
172
            pb_bool = (bool*)va_arg( args, bool* );
 
173
            *pb_bool = false;
177
174
            break;
178
175
        case ACCESS_CAN_PAUSE:
179
 
            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
180
 
            *pb_bool = VLC_TRUE;    /* FIXME */
 
176
            pb_bool = (bool*)va_arg( args, bool* );
 
177
            *pb_bool = true;    /* FIXME */
181
178
            break;
182
179
        case ACCESS_CAN_CONTROL_PACE:
183
 
            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
184
 
            *pb_bool = VLC_TRUE;    /* FIXME */
 
180
            pb_bool = (bool*)va_arg( args, bool* );
 
181
            *pb_bool = true;    /* FIXME */
185
182
            break;
186
183
 
187
184
        /* */
192
189
 
193
190
        case ACCESS_GET_PTS_DELAY:
194
191
            pi_64 = (int64_t*)va_arg( args, int64_t * );
195
 
            *pi_64 = (int64_t)var_GetInteger( p_access, "tcp-caching" ) * I64C(1000);
 
192
            *pi_64 = (int64_t)var_GetInteger( p_access, "tcp-caching" ) * INT64_C(1000);
196
193
            break;
197
194
 
198
195
        /* */
204
201
        case ACCESS_SET_TITLE:
205
202
        case ACCESS_SET_SEEKPOINT:
206
203
        case ACCESS_SET_PRIVATE_ID_STATE:
 
204
        case ACCESS_GET_CONTENT_TYPE:
207
205
            return VLC_EGENERIC;
208
206
 
209
207
        default: