Commit 9e842af8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: remove STREAM_GET_POSITION control

parent a4ca21be
......@@ -83,8 +83,7 @@ enum stream_query_e
STREAM_CAN_CONTROL_PACE, /**< arg1= bool * res=cannot fail*/
/* */
STREAM_SET_POSITION, /**< arg1= uint64_t res=can fail */
STREAM_GET_POSITION, /**< arg1= uint64_t * res=cannot fail*/
STREAM_GET_SIZE, /**< arg1= uint64_t * res=can fail */
STREAM_GET_SIZE=6, /**< arg1= uint64_t * res=can fail */
STREAM_IS_DIRECTORY, /**< arg1= bool *, arg2= bool *, arg3=bool *, res=cannot fail*/
/* */
......
......@@ -54,7 +54,6 @@ static int Control(stream_t *p_stream, int i_query, va_list args)
case STREAM_CAN_SEEK:
case STREAM_CAN_FASTSEEK:
case STREAM_GET_SIZE:
case STREAM_GET_POSITION:
case STREAM_SET_POSITION:
case STREAM_SET_RECORD_STATE:
case STREAM_GET_CONTENT_TYPE:
......
......@@ -290,13 +290,6 @@ static int Control( stream_t *s, int i_query, va_list args )
}
}
case STREAM_GET_POSITION:
{
uint64_t *pi_position = va_arg( args, uint64_t* );
*pi_position = p_sys->i_pos;
return VLC_SUCCESS;
}
case STREAM_GET_SIZE:
{
uint64_t *pi_size = va_arg( args, uint64_t* );
......
......@@ -95,7 +95,6 @@ struct stream_sys_t
block_t *p_list;
} remain;
size_t i_pos;
bool b_unitsizeset;
};
......@@ -256,8 +255,6 @@ static ssize_t Read( stream_t *p_stream, void *p_buf, size_t i_toread )
int i_read = DecoderRead( p_stream, p_buf, i_toread );
if ( i_read < 0 )
return -1;
else
p_sys->i_pos += i_read;
return i_read;
}
......@@ -269,10 +266,7 @@ static int Seek( stream_t *p_stream, uint64_t i_pos )
{
int i_ret = stream_Seek( p_stream->p_source, i_pos );
if ( i_ret == VLC_SUCCESS )
{
RemainFlush( p_stream->p_sys );
p_stream->p_sys->i_pos = i_pos;
}
return i_ret;
}
......@@ -283,9 +277,6 @@ static int Control( stream_t *p_stream, int i_query, va_list args )
{
switch( i_query )
{
case STREAM_GET_POSITION:
*va_arg( args, uint64_t *) = p_stream->p_sys->i_pos;
return VLC_SUCCESS;
case STREAM_SET_POSITION:
return Seek( p_stream, va_arg( args, uint64_t ) );
default:
......@@ -363,8 +354,6 @@ static int Open( vlc_object_t *p_object )
goto error;
}
p_sys->i_pos = stream_Tell( p_stream->p_source );
p_stream->pf_read = Read;
p_stream->pf_control = Control;
......
......@@ -434,10 +434,6 @@ static int AStreamControl(stream_t *s, int i_query, va_list args)
case STREAM_GET_PRIVATE_ID_STATE:
return stream_vaControl(s->p_source, i_query, args);
case STREAM_GET_POSITION:
*va_arg(args, uint64_t *) = sys->i_pos;
break;
case STREAM_SET_POSITION:
{
uint64_t offset = va_arg(args, uint64_t);
......
......@@ -485,10 +485,6 @@ static int AStreamControl(stream_t *s, int i_query, va_list args)
case STREAM_GET_PRIVATE_ID_STATE:
return stream_vaControl(s->p_source, i_query, args);
case STREAM_GET_POSITION:
*va_arg(args, uint64_t *) = sys->i_pos;
break;
case STREAM_SET_POSITION:
{
uint64_t offset = va_arg(args, uint64_t);
......
......@@ -86,8 +86,6 @@ struct stream_sys_t
vlc_thread_t thread;
pid_t pid;
uint64_t offset;
int read_fd;
bool can_pace;
bool can_pause;
......@@ -194,7 +192,6 @@ static void *Thread (void *data)
static ssize_t Read (stream_t *stream, void *buf, size_t buflen)
{
stream_sys_t *sys = stream->p_sys;
ssize_t ret = 0;
if (buf == NULL) /* caller skips data, get big enough peek buffer */
{
......@@ -202,20 +199,15 @@ static ssize_t Read (stream_t *stream, void *buf, size_t buflen)
if (unlikely(buf == NULL))
return -1;
ret = Read(stream, buf, buflen);
ssize_t val = Read(stream, buf, buflen);
free(buf);
return ret;
return val;
}
assert ((buf != NULL) || (buflen == 0));
ssize_t val = vlc_read_i11e (sys->read_fd, buf, buflen);
if (val > 0)
{
sys->offset += val;
ret += val;
}
return ret;
return (val >= 0) ? val : 0;
}
/**
......@@ -237,9 +229,6 @@ static int Control (stream_t *stream, int query, va_list args)
case STREAM_CAN_CONTROL_PACE:
*(va_arg (args, bool *)) = p_sys->can_pace;
break;
case STREAM_GET_POSITION:
*(va_arg (args, uint64_t *)) = p_sys->offset;
break;
case STREAM_GET_SIZE:
*(va_arg (args, uint64_t *)) = 0;
break;
......@@ -281,7 +270,6 @@ static int Open (stream_t *stream, const char *path)
vlc_mutex_init (&p_sys->lock);
p_sys->paused = false;
p_sys->pid = -1;
p_sys->offset = 0;
stream_Control (stream->p_source, STREAM_CAN_PAUSE, &p_sys->can_pause);
stream_Control (stream->p_source, STREAM_CAN_CONTROL_PACE,
&p_sys->can_pace);
......
......@@ -144,7 +144,6 @@ struct stream_sys_t
size_t flv_header_len;
size_t flv_header_bytes_sent;
uint64_t duration_seconds;
uint64_t playback_offset;
bool live;
bool closed;
......@@ -1847,9 +1846,7 @@ static ssize_t Read( stream_t *s, void *buffer, size_t i_read )
if ( header_unfinished( p_sys ) )
return send_flv_header( stream, p_sys, buffer, i_read );
i_read = read_chunk_data( (vlc_object_t*)s, buffer, i_read, stream );
p_sys->playback_offset += i_read;
return i_read;
return read_chunk_data( (vlc_object_t*)s, buffer, i_read, stream );
}
static int Control( stream_t *s, int i_query, va_list args )
......@@ -1870,9 +1867,6 @@ static int Control( stream_t *s, int i_query, va_list args )
*va_arg (args, int64_t *) = INT64_C(1000) *
var_InheritInteger(s, "network-caching");
break;
case STREAM_GET_POSITION:
*(va_arg (args, uint64_t *)) = s->p_sys->playback_offset;
break;
case STREAM_GET_SIZE:
*(va_arg (args, uint64_t *)) = get_stream_size(s);
break;
......
......@@ -338,9 +338,6 @@ static int Control(stream_t *stream, int query, va_list args)
break;
case STREAM_SET_POSITION:
return Seek(stream, va_arg(args, uint64_t));
case STREAM_GET_POSITION:
*va_arg (args, uint64_t *) = sys->stream_offset;
break;
case STREAM_IS_DIRECTORY:
return VLC_EGENERIC;
case STREAM_GET_SIZE:
......
......@@ -874,9 +874,6 @@ static int Control( stream_t *s, int i_query, va_list args )
case STREAM_CAN_CONTROL_PACE:
*(va_arg( args, bool * )) = true;
break;
case STREAM_GET_POSITION:
*(va_arg( args, uint64_t * )) = p_sys->playback.boffset;
break;
case STREAM_SET_POSITION:
{
uint64_t pos = (uint64_t)va_arg(args, uint64_t);
......
......@@ -311,19 +311,6 @@ static int AStreamControl(stream_t *s, int cmd, va_list args)
break;
}
case STREAM_GET_POSITION:
{
uint64_t *ppos =va_arg(args, uint64_t *);
*ppos = access->info.i_pos;
if (sys->block != NULL)
{
assert(sys->block->i_buffer <= *ppos);
*ppos -= sys->block->i_buffer;
}
break;
}
case STREAM_SET_POSITION:
{
uint64_t pos = va_arg(args, uint64_t);
......
......@@ -470,19 +470,6 @@ int stream_vaControl(stream_t *s, int cmd, va_list args)
switch (cmd)
{
case STREAM_GET_POSITION:
{
uint64_t *ppos = va_arg(args, uint64_t *);
stream_ControlInternal(s, STREAM_GET_POSITION, ppos);
if (priv->peek != NULL)
{
assert(priv->peek->i_buffer <= *ppos);
*ppos -= priv->peek->i_buffer;
}
return VLC_SUCCESS;
}
case STREAM_SET_POSITION:
{
uint64_t pos = va_arg(args, uint64_t);
......
......@@ -40,8 +40,6 @@ struct stream_sys_t
block_fifo_t *p_fifo;
block_t *p_block;
uint64_t i_pos;
/* Demuxer */
char *psz_name;
es_out_t *out;
......@@ -85,7 +83,6 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
return NULL;
}
p_sys->i_pos = 0;
p_sys->out = out;
p_sys->p_block = NULL;
p_sys->psz_name = strdup( psz_demux );
......@@ -208,7 +205,6 @@ static ssize_t DStreamRead( stream_t *s, void *buf, size_t len )
sys->p_block = NULL;
}
sys->i_pos += copy;
return copy;
}
......@@ -231,11 +227,6 @@ static int DStreamControl( stream_t *s, int i_query, va_list args )
*va_arg( args, bool * ) = false;
return VLC_SUCCESS;
case STREAM_GET_POSITION:
p_i64 = va_arg( args, uint64_t * );
*p_i64 = p_sys->i_pos;
return VLC_SUCCESS;
case STREAM_GET_PTS_DELAY:
*va_arg( args, int64_t * ) = DEFAULT_PTS_DELAY;
return VLC_SUCCESS;
......
......@@ -107,11 +107,6 @@ static int Control( stream_t *s, int i_query, va_list args )
*va_arg( args, bool * ) = true;
break;
case STREAM_GET_POSITION:
pi_64 = va_arg( args, uint64_t * );
*pi_64 = p_sys->i_pos;
break;
case STREAM_SET_POSITION:
i_64 = va_arg( args, uint64_t );
i_64 = __MIN( i_64, s->p_sys->i_size );
......
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