Commit d1d76141 authored by Gildas Bazin's avatar Gildas Bazin

* modules/access/rtsp: fixed problem in BlockRead().

parent 6a1a3a70
......@@ -259,6 +259,8 @@ static block_t *BlockRead( access_t *p_access )
{
access_sys_t *p_sys = p_access->p_sys;
block_t *p_block;
rmff_pheader_t pheader;
int i_size;
if( p_sys->p_header )
{
......@@ -267,8 +269,11 @@ static block_t *BlockRead( access_t *p_access )
return p_block;
}
p_block = block_New( p_access, 4096 );
p_block->i_buffer = real_get_rdt_chunk( p_access->p_sys->p_rtsp,
i_size = real_get_rdt_chunk_header( p_access->p_sys->p_rtsp, &pheader );
if( i_size <= 0 ) return 0;
p_block = block_New( p_access, i_size );
p_block->i_buffer = real_get_rdt_chunk( p_access->p_sys->p_rtsp, &pheader,
&p_block->p_buffer );
return p_block;
......
......@@ -532,11 +532,11 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
return header;
}
int real_get_rdt_chunk(rtsp_client_t *rtsp_session, unsigned char **buffer) {
int real_get_rdt_chunk_header(rtsp_client_t *rtsp_session, rmff_pheader_t *ph)
{
int n=1;
uint8_t header[8];
rmff_pheader_t ph;
int size;
int flags1;
int unknown1;
......@@ -582,17 +582,22 @@ int real_get_rdt_chunk(rtsp_client_t *rtsp_session, unsigned char **buffer) {
size+=2;
ph.object_version=0;
ph.length=size;
ph.stream_number=(flags1>>1)&1;
ph.timestamp=ts;
ph.reserved=0;
ph.flags=0; /* TODO: determine keyframe flag and insert here? */
//xine_buffer_ensure_size(*buffer, 12+size);
rmff_dump_pheader(&ph, *buffer);
size-=12;
n=rtsp_read_data(rtsp_session, (*buffer)+12, size);
ph->object_version=0;
ph->length=size;
ph->stream_number=(flags1>>1)&1;
ph->timestamp=ts;
ph->reserved=0;
ph->flags=0; /* TODO: determine keyframe flag and insert here? */
return size;
}
int real_get_rdt_chunk(rtsp_client_t *rtsp_session, rmff_pheader_t *ph,
unsigned char **buffer)
{
int n;
rmff_dump_pheader(ph, *buffer);
n=rtsp_read_data(rtsp_session, *buffer + 12, ph->length - 12);
return (n <= 0) ? 0 : n+12;
}
......
......@@ -40,7 +40,8 @@
static inline void lprintf( char *dummy, ... ){}
#endif
int real_get_rdt_chunk(rtsp_client_t *, unsigned char **buffer);
int real_get_rdt_chunk_header(rtsp_client_t *, rmff_pheader_t *);
int real_get_rdt_chunk(rtsp_client_t *, rmff_pheader_t *, unsigned char **);
rmff_header_t *real_setup_and_get_header(rtsp_client_t *, int bandwidth);
int asmrp_match(const char *rules, int bandwidth, int *matches) ;
......
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