[vlc-commits] avformat: remove 2 chained data structures
Rafaël Carré
git at videolan.org
Sun Mar 4 22:42:01 CET 2012
vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Sat Mar 3 00:03:00 2012 +0900| [91bfde6d536a417cbe9318bfffde884671debc6a] | committer: Rafaël Carré
avformat: remove 2 chained data structures
They were only used to hold one opaque pointer
(cherry picked from commit e7e1a0f3bd279ce5fd2bdd4f1994bd7ff5be3deb)
Signed-off-by: KO Myung-Hun <komh at chollian.net>
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=91bfde6d536a417cbe9318bfffde884671debc6a
---
modules/demux/avformat/demux.c | 22 +++-------------------
modules/demux/avformat/mux.c | 21 +++------------------
2 files changed, 6 insertions(+), 37 deletions(-)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index bab3ea6..e7fa672 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -66,8 +66,6 @@ struct demux_sys_t
AVInputFormat *fmt;
AVFormatContext *ic;
- URLContext url;
- URLProtocol prot;
int i_tk;
es_out_id_t **tk;
@@ -214,19 +212,8 @@ int OpenDemux( vlc_object_t *p_this )
/* Create I/O wrapper */
p_sys->io_buffer_size = 32768; /* FIXME */
p_sys->io_buffer = malloc( p_sys->io_buffer_size );
- p_sys->url.priv_data = p_demux;
- p_sys->url.prot = &p_sys->prot;
- p_sys->url.prot->name = "VLC I/O wrapper";
- p_sys->url.prot->url_open = 0;
- p_sys->url.prot->url_read =
- (int (*) (URLContext *, unsigned char *, int))IORead;
- p_sys->url.prot->url_write = 0;
- p_sys->url.prot->url_seek =
- (int64_t (*) (URLContext *, int64_t, int))IOSeek;
- p_sys->url.prot->url_close = 0;
- p_sys->url.prot->next = 0;
init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size,
- 0, &p_sys->url, IORead, NULL, IOSeek );
+ 0, p_demux, IORead, NULL, IOSeek );
stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_can_seek );
if( !b_can_seek )
@@ -235,7 +222,6 @@ int OpenDemux( vlc_object_t *p_this )
when trying av_find_stream_info() trying to seek all the wrong places
init_put_byte defaults io.is_streamed=0, so thats why we set them after it
*/
- p_sys->url.is_streamed = 1;
p_sys->io.is_streamed = 1;
#if defined(AVIO_SEEKABLE_NORMAL)
p_sys->io.seekable = 0;
@@ -927,8 +913,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*****************************************************************************/
static int IORead( void *opaque, uint8_t *buf, int buf_size )
{
- URLContext *p_url = opaque;
- demux_t *p_demux = p_url->priv_data;
+ demux_t *p_demux = opaque;
if( buf_size < 0 ) return -1;
int i_ret = stream_Read( p_demux->s, buf, buf_size );
return i_ret ? i_ret : -1;
@@ -936,8 +921,7 @@ static int IORead( void *opaque, uint8_t *buf, int buf_size )
static int64_t IOSeek( void *opaque, int64_t offset, int whence )
{
- URLContext *p_url = opaque;
- demux_t *p_demux = p_url->priv_data;
+ demux_t *p_demux = opaque;
int64_t i_absolute;
int64_t i_size = stream_Size( p_demux->s );
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index d913bf1..eea867e 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -55,8 +55,6 @@ struct sout_mux_sys_t
uint8_t *io_buffer;
AVFormatContext *oc;
- URLContext url;
- URLProtocol prot;
bool b_write_header;
bool b_error;
@@ -130,19 +128,8 @@ int OpenMux( vlc_object_t *p_this )
/* Create I/O wrapper */
p_sys->io_buffer_size = 32768; /* FIXME */
p_sys->io_buffer = malloc( p_sys->io_buffer_size );
- p_sys->url.priv_data = p_mux;
- p_sys->url.prot = &p_sys->prot;
- p_sys->url.prot->name = "VLC I/O wrapper";
- p_sys->url.prot->url_open = 0;
- p_sys->url.prot->url_read = 0;
- p_sys->url.prot->url_write =
- (int (*) (URLContext *, unsigned char *, int))IOWrite;
- p_sys->url.prot->url_seek =
- (int64_t (*) (URLContext *, int64_t, int))IOSeek;
- p_sys->url.prot->url_close = 0;
- p_sys->url.prot->next = 0;
init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size,
- 1, &p_sys->url, NULL, IOWrite, IOSeek );
+ 1, p_mux, NULL, IOWrite, IOSeek );
memset( ap, 0, sizeof(*ap) );
if( av_set_parameters( p_sys->oc, ap ) < 0 )
@@ -431,8 +418,7 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
*****************************************************************************/
static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
{
- URLContext *p_url = opaque;
- sout_mux_t *p_mux = p_url->priv_data;
+ sout_mux_t *p_mux = opaque;
int i_ret;
#ifdef AVFORMAT_DEBUG
@@ -451,8 +437,7 @@ static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
static int64_t IOSeek( void *opaque, int64_t offset, int whence )
{
- URLContext *p_url = opaque;
- sout_mux_t *p_mux = p_url->priv_data;
+ sout_mux_t *p_mux = opaque;
#ifdef AVFORMAT_DEBUG
msg_Dbg( p_mux, "IOSeek offset: %"PRId64", whence: %i", offset, whence );
More information about the vlc-commits
mailing list