[vlc-devel] [PATCHv2 1/3] access: Add satip access module

Julian Scheel julian at jusst.de
Thu May 26 16:14:50 CEST 2016


On 26.05.2016 13:27, Francois Cartegnie wrote:
> 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

Thanks, fixed.

>> +#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

You're right. Changed it.

>> +    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

Very good hint... Don't know why I did not think about it. Same goes for 
parse_session.

>
>> +        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.

Ack, dropped that case.

>> +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.

It calls satip_close to release sys and children of sys.

I'll send patchset v3 in a minute.

Thanks for the review!
Julian



More information about the vlc-devel mailing list