2 /*****************************************************************************
3 * mkv.cpp : matroska demuxer
4 *****************************************************************************
5 * Copyright (C) 2003-2004 the VideoLAN team
8 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * Steve Lhomme <steve.lhomme@free.fr>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
25 #include "stream_io_callback.hpp"
27 #include "matroska_segment.hpp"
29 /*****************************************************************************
31 *****************************************************************************/
32 vlc_stream_io_callback::vlc_stream_io_callback( stream_t *s_, bool b_owner_ )
39 uint32 vlc_stream_io_callback::read( void *p_buffer, size_t i_size )
41 if( i_size <= 0 || mb_eof )
46 return stream_Read( s, p_buffer, i_size );
48 void vlc_stream_io_callback::setFilePointer(int64_t i_offset, seek_mode mode )
58 i_pos = stream_Size( s ) - i_offset;
61 i_pos= stream_Tell( s ) + i_offset;
65 if( i_pos < 0 || i_pos >= stream_Size( s ) )
72 if( stream_Seek( s, i_pos ) )
78 size_t vlc_stream_io_callback::write( const void *p_buffer, size_t i_size )
82 uint64 vlc_stream_io_callback::getFilePointer( void )
86 return stream_Tell( s );
88 void vlc_stream_io_callback::close( void )