Commit 676b1859 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: make stream_t.p_sys void * (refs #17078)

parent f5fa3a68
......@@ -62,7 +62,7 @@ struct stream_t
int (*pf_control)( stream_t *, int i_query, va_list );
/* Private data for module */
stream_sys_t *p_sys;
void *p_sys;
/* Weak link to parent input */
input_thread_t *p_input;
......
......@@ -66,19 +66,21 @@ static ssize_t ReadCallback(struct archive *p_archive, void *p_object, const voi
{
VLC_UNUSED(p_archive);
stream_t *p_stream = (stream_t*)p_object;
stream_sys_t *sys = p_stream->p_sys;
*pp_buffer = &p_stream->p_sys->buffer;
return stream_Read(p_stream->p_source, &p_stream->p_sys->buffer, ARCHIVE_READ_SIZE);
*pp_buffer = &sys->buffer;
return stream_Read(p_stream->p_source, &sys->buffer, ARCHIVE_READ_SIZE);
}
static ssize_t SkipCallback(struct archive *p_archive, void *p_object, ssize_t i_request)
{
VLC_UNUSED(p_archive);
stream_t *p_stream = (stream_t*)p_object;
stream_sys_t *sys = p_stream->p_sys;
ssize_t i_skipped = 0;
/* be smart as small seeks converts to reads */
if (p_stream->p_sys->b_source_canseek)
if (sys->b_source_canseek)
{
int64_t i_pos = stream_Tell(p_stream->p_source);
if (i_pos >=0)
......
......@@ -35,18 +35,14 @@
#include "rar.h"
struct stream_sys_t {
stream_t *payload;
};
static ssize_t Read(stream_t *s, void *data, size_t size)
{
return stream_Read(s->p_sys->payload, data, size);
return stream_Read(s->p_sys, data, size);
}
static int Seek(stream_t *s, uint64_t offset)
{
return stream_Seek(s->p_sys->payload, offset);
return stream_Seek(s->p_sys, offset);
}
static int Control(stream_t *s, int query, va_list args)
......@@ -58,7 +54,7 @@ static int Control(stream_t *s, int query, va_list args)
return VLC_SUCCESS;
}
default:
return stream_vaControl(s->p_sys->payload, query, args);
return stream_vaControl(s->p_sys, query, args);
}
}
......@@ -145,13 +141,7 @@ int RarStreamOpen(vlc_object_t *object)
s->pf_read = Read;
s->pf_seek = Seek;
s->pf_control = Control;
stream_sys_t *sys = s->p_sys = malloc(sizeof(*sys));
if (!sys) {
stream_Delete(payload);
return VLC_ENOMEM;
}
sys->payload = payload;
s->p_sys = payload;
char *tmp;
if (asprintf(&tmp, "%s.m3u", s->psz_url) < 0) {
......@@ -167,8 +157,6 @@ int RarStreamOpen(vlc_object_t *object)
void RarStreamClose(vlc_object_t *object)
{
stream_t *s = (stream_t*)object;
stream_sys_t *sys = s->p_sys;
stream_Delete(sys->payload);
free(sys);
stream_Delete(s->p_sys);
}
......@@ -1692,7 +1692,7 @@ static void Close( vlc_object_t *p_this )
// TODO: Change here for selectable stream
hds_stream_t *stream = vlc_array_count(p_sys->hds_streams) ?
s->p_sys->hds_streams->pp_elems[0] : NULL;
p_sys->hds_streams->pp_elems[0] : NULL;
p_sys->closed = true;
if (stream)
......@@ -1839,7 +1839,7 @@ static ssize_t Read( stream_t *s, void *buffer, size_t i_read )
return 0;
// TODO: change here for selectable stream
hds_stream_t *stream = s->p_sys->hds_streams->pp_elems[0];
hds_stream_t *stream = p_sys->hds_streams->pp_elems[0];
if ( header_unfinished( p_sys ) )
return send_flv_header( stream, p_sys, buffer, i_read );
......
......@@ -147,12 +147,13 @@ static int Control( stream_t *s, int i_query, va_list args )
if( i_query != STREAM_SET_RECORD_STATE )
return stream_vaControl( s->p_source, i_query, args );
stream_sys_t *sys = s->p_sys;
bool b_active = (bool)va_arg( args, int );
const char *psz_extension = NULL;
if( b_active )
psz_extension = (const char*)va_arg( args, const char* );
if( !s->p_sys->f == !b_active )
if( !sys->f == !b_active )
return VLC_SUCCESS;
if( b_active )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment