Commit d8759c26 authored by Gildas Bazin's avatar Gildas Bazin

* modules/demux/real.c, modules/access/rtsp/*: fixes for real rtsp / demuxing.

parent 83ec5ce2
......@@ -505,7 +505,7 @@ void rmff_fix_header(rmff_header_t *h) {
memset(h->data, 0, sizeof(rmff_data_t));
h->data->object_id=DATA_TAG;
h->data->object_version=0;
h->data->size=34;
h->data->size=18;
h->data->num_packets=0;
h->data->next_data_header=0;
}
......@@ -518,7 +518,7 @@ void rmff_fix_header(rmff_header_t *h) {
if( h->fileheader ) {
memset(h->fileheader, 0, sizeof(rmff_fileheader_t));
h->fileheader->object_id=RMF_TAG;
h->fileheader->size=34;
h->fileheader->size=18;
h->fileheader->object_version=0;
h->fileheader->file_version=0;
h->fileheader->num_headers=num_headers+1;
......@@ -536,6 +536,9 @@ void rmff_fix_header(rmff_header_t *h) {
lprintf("rmff_fix_header: setting prop.data_offset from %i to %i\n", h->prop->data_offset, header_size);
h->prop->data_offset=header_size;
}
/* FIXME: I doubt this is right to do this here.
* It should belong to the demux. */
if (h->prop->num_packets == 0) {
int p=(int)(h->prop->avg_bit_rate/8.0*(h->prop->duration/1000.0)/h->prop->avg_packet_size);
lprintf("rmff_fix_header: assuming prop.num_packets=%i\n", p);
......@@ -545,8 +548,10 @@ void rmff_fix_header(rmff_header_t *h) {
lprintf("rmff_fix_header: assuming data.num_packets=%i\n", h->prop->num_packets);
h->data->num_packets=h->prop->num_packets;
}
lprintf("rmff_fix_header: assuming data.size=%i\n", h->prop->num_packets*h->prop->avg_packet_size);
h->data->size=h->prop->num_packets*h->prop->avg_packet_size;
if (h->data->size == 18 || !h->data->size ) {
lprintf("rmff_fix_header: assuming data.size=%i\n", h->prop->num_packets*h->prop->avg_packet_size);
h->data->size+=h->prop->num_packets*h->prop->avg_packet_size;
}
}
}
......
......@@ -100,6 +100,7 @@ static int Open( vlc_object_t *p_this )
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
memset( p_sys, 0, sizeof( demux_sys_t ) );
p_sys->i_data_offset = 0;
p_sys->i_track = 0;
p_sys->track = NULL;
......@@ -175,9 +176,9 @@ static int Demux( demux_t *p_demux )
real_track_t *tk = NULL;
vlc_bool_t b_selected;
if( p_sys->i_data_packets >= p_sys->i_data_packets_count )
if( p_sys->i_data_packets >= p_sys->i_data_packets_count &&
p_sys->i_data_packets_count )
{
if( stream_Read( p_demux->s, header, 18 ) < 18 )
{
return 0;
......@@ -602,7 +603,11 @@ static int HeaderRead( demux_t *p_demux )
msg_Dbg( p_demux, "object %4.4s size=%d version=%d",
(char*)&i_id, i_size, i_version );
if( i_size < 10 ) return VLC_EGENERIC;
if( i_size < 10 )
{
msg_Dbg( p_demux, "invalid size for object %4.4s", (char*)&i_id );
return VLC_EGENERIC;
}
i_skip = i_size - 10;
if( i_id == VLC_FOURCC('.','R','M','F') )
......@@ -923,14 +928,6 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
if( fmt.i_codec != 0 )
{
msg_Dbg( p_demux, " - extra data=%d", fmt.i_extra );
{
int i;
for( i = 0; i < fmt.i_extra; i++ )
{
msg_Dbg( p_demux, " data[%d] = 0x%x", i,
((uint8_t*)fmt.p_extra)[i] );
}
}
tk = malloc( sizeof( real_track_t ) );
tk->i_id = i_num;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment