@ -84,7 +84,11 @@ void ffio_init_context(FFIOContext *ctx,
int write_flag ,
void * opaque ,
int ( * read_packet ) ( void * opaque , uint8_t * buf , int buf_size ) ,
# if FF_API_AVIO_WRITE_NONCONST
int ( * write_packet ) ( void * opaque , uint8_t * buf , int buf_size ) ,
# else
int ( * write_packet ) ( void * opaque , const uint8_t * buf , int buf_size ) ,
# endif
int64_t ( * seek ) ( void * opaque , int64_t offset , int whence ) )
{
AVIOContext * const s = & ctx - > pub ;
@ -143,7 +147,11 @@ AVIOContext *avio_alloc_context(
int write_flag ,
void * opaque ,
int ( * read_packet ) ( void * opaque , uint8_t * buf , int buf_size ) ,
# if FF_API_AVIO_WRITE_NONCONST
int ( * write_packet ) ( void * opaque , uint8_t * buf , int buf_size ) ,
# else
int ( * write_packet ) ( void * opaque , const uint8_t * buf , int buf_size ) ,
# endif
int64_t ( * seek ) ( void * opaque , int64_t offset , int whence ) )
{
FFIOContext * s = av_malloc ( sizeof ( * s ) ) ;
@ -165,12 +173,20 @@ static void writeout(AVIOContext *s, const uint8_t *data, int len)
if ( ! s - > error ) {
int ret = 0 ;
if ( s - > write_data_type )
# if FF_API_AVIO_WRITE_NONCONST
ret = s - > write_data_type ( s - > opaque , ( uint8_t * ) data ,
# else
ret = s - > write_data_type ( s - > opaque , data ,
# endif
len ,
ctx - > current_type ,
ctx - > last_time ) ;
else if ( s - > write_packet )
# if FF_API_AVIO_WRITE_NONCONST
ret = s - > write_packet ( s - > opaque , ( uint8_t * ) data , len ) ;
# else
ret = s - > write_packet ( s - > opaque , data , len ) ;
# endif
if ( ret < 0 ) {
s - > error = ret ;
} else {
@ -1396,7 +1412,11 @@ typedef struct DynBuffer {
uint8_t io_buffer [ 1 ] ;
} DynBuffer ;
# if FF_API_AVIO_WRITE_NONCONST
static int dyn_buf_write ( void * opaque , uint8_t * buf , int buf_size )
# else
static int dyn_buf_write ( void * opaque , const uint8_t * buf , int buf_size )
# endif
{
DynBuffer * d = opaque ;
unsigned new_size ;
@ -1428,7 +1448,11 @@ static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
return buf_size ;
}
# if FF_API_AVIO_WRITE_NONCONST
static int dyn_packet_buf_write ( void * opaque , uint8_t * buf , int buf_size )
# else
static int dyn_packet_buf_write ( void * opaque , const uint8_t * buf , int buf_size )
# endif
{
unsigned char buf1 [ 4 ] ;
int ret ;
@ -1565,7 +1589,11 @@ void ffio_free_dyn_buf(AVIOContext **s)
avio_context_free ( s ) ;
}
# if FF_API_AVIO_WRITE_NONCONST
static int null_buf_write ( void * opaque , uint8_t * buf , int buf_size )
# else
static int null_buf_write ( void * opaque , const uint8_t * buf , int buf_size )
# endif
{
DynBuffer * d = opaque ;