[vlc-devel] [PATCHv2 1/3] access: Add satip access module
Rémi Denis-Courmont
remi at remlab.net
Thu May 26 16:33:04 CEST 2016
Le 2016-05-26 13:27, Francois Cartegnie a écrit :
> Le 26/05/2016 à 12:22, Julian Scheel a écrit :
>
>> +#define BUFFER_TEXT ("Receive buffer")
>> +#define BUFFER_LONGTEXT ("UDP receive buffer size (bytes)")
>> +
>> +#define MULTICAST_TEXT ("Request multicast stream")
>> +#define MULTICAST_LONGTEXT ("Request server to send stream as
>> multicast")
>
> Needs gettext N_() and add access to POTFILES.in
>
>> +#define UDP_ADDRESS_LEN 16
>> +typedef struct access_sys_t {
>> + char *content_base;
>> + char *control;
>> + char session_id[64];
>> + int stream_id;
>
> likely uint16_t, same for udp_port
>
>> + uint16_t last_seq_nr;
>> +
>> + bool woken;
>> +} access_sys_t;
>> +
>
>> + while (start < end) {
>> + if (strncmp(start, "destination=", 12) == 0) {
>> + pos = 0;
>> + start += 12;
>> + while (*start != ';' && pos < UDP_ADDRESS_LEN - 1)
>> + sys->udp_address[pos++] = *(start++);
>> + sys->udp_address[pos++] = '\0';
>> + start++;
>> + } else if (strncmp(start, "port=", 5) == 0) {
>> + char port[6];
>> + pos = 0;
>> + start += 5;
>> + while (*start != ';' && *start != '-' && pos < 5)
>> + port[pos++] = *(start++);
>> + port[pos++] = '\0';
>> + sys->udp_port = atoi(port);
>> + start++;
>> + } else {
>> + while (*start != ';' && start < end)
>> + start++;
>> + if (start >= end)
>> + return;
>> + start++;
>> + }
>> + }
>> +}
>
> don't know if strtok can help here
Certainly could use some standard string heplers, but strotk() is not
thread-safe.
>
>
>> + case ACCESS_GET_SIZE:
>> + pi_64 = (int64_t*)va_arg(args, int64_t *);
>> + *pi_64 = 0;
>> + break;
>
> Live is not 0 sized. Return VLC_EGENERIC.
>
>> +static int satip_open(access_t *access) {
>> + access_sys_t *sys;
>> + vlc_url_t url;
>> +
>> + bool multicast = var_InheritBool(access, "satip-multicast");
>> +
>> + access->p_sys = sys = calloc(1, sizeof(*sys));
>> + if (sys == NULL)
>> + return VLC_ENOMEM;
>
>> +error:
>> + if (psz_lower_location)
>> + free(psz_lower_location);
>> +
>> + vlc_UrlClean(&url);
>> + satip_close(access);
>> + return VLC_EGENERIC;
>
> sys leak.
>
>
> Francois
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list