I try to use libmpeg2 library inside my programm. The mpeg2dec example provided with the library use a mpeg2 play with a mpeg file on the disk of the computer.
I would like to use data from the memory instead (an unsigned char array stored in the memory). Here is the detail of the function I would like to modify:
static void es_loop (unsigned char * data10r, unsigned int * size10r)
{
buffer_size = 4096;
uint8_t * buffer = (uint8_t *) malloc (buffer_size);
uint8_t * end;
if (buffer == NULL)
exit (1);
do {
end = buffer + fread (buffer, 1, buffer_size, in_file);
decode_mpeg2 (buffer, end);
} while (end == buffer + buffer_size && !sigint);
free (buffer);
}
where data10r is an unsigned char array containing the mpeg2 data in memory with the size of size10r.
in_file is a pointer to the mpeg2 file on the disk to be played. I would like to replace this file by the data10r unsigned char array in memory... buffer contains 4096 bytes of the video to be sent to the decoder
I have spent several hours to find a solution to change this function, without any succes for the moment.
Thanks by advance for your help,
Pierre