Miguel Angel Arcos wrote:
>
> ByteIOContext *av_alloc_put_byte(
> unsigned char *buffer,
> int buffer_size,
> int write_flag, //???
> void *opaque, //???
> int (*read_packet)(void *opaque, uint8_t *buf, int
> buf_size), //???
> int (*write_packet)(void *opaque, uint8_t *buf, int
> buf_size), //???
> int64_t (*seek)(void *opaque, int64_t offset, int
> whence)); //???
>
You should define 1 - 3 functions which return int and have arguments 3
arguments as in pointers above, and call av_alloc_put_byte with pointers to
them. Not all of them are necessary.
The function
int read_packet(void *opaque,uint8_t *buf, int buf_size)
must read your data stream in your specific way and fill a buf with buf_size
bytes, and return a number of bytes it has copied to the buf.
If you call
input->pb = av_alloc_put_byte(.. ..,read_packet,NULL,NULL);
then libav* will call your read_packet function when it will need some data.
The arguments buffer and buffer_size specify a data buffer, which your
application allocates for libav* functions. Its purpose is unclear to me. I
use arbitrary buffer_size.
Similarly, if you define a write_packet function, libav* will call it, when
it prepares some data and will want to write them to a disk.
opaque is the pointer to your application specific data, which you can fill
in your specific way.
This can be a pointer to the class instance
I have the following in my app:
int read_packets(void *opaque, uint8_t *buf, int buf_size)
{
thread *tr=(thread *)opaque;
int ret=tr->read_packet(buf,buf_size);
return ret;
}
Here thread is my class, which has a method for reading raw data stream.
--
View this message in context:
http://n4.nabble.com/H264-decoding-tp1468742p1470023.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user