Commit c18c56d3 authored by Gildas Bazin's avatar Gildas Bazin

* modules/access/dshow/dshow.cpp: fixed stupid bug in ReadCompressed() that...

* modules/access/dshow/dshow.cpp: fixed stupid bug in ReadCompressed() that was dropping part of the received data (Fixes the PVR issue).
parent f6555654
......@@ -38,7 +38,7 @@
/*****************************************************************************
* Access: local prototypes
*****************************************************************************/
static int ReadCompressed( access_t *, byte_t *, int );
static block_t *ReadCompressed( access_t * );
static int AccessControl ( access_t *, int, va_list );
static int Demux ( demux_t * );
......@@ -533,8 +533,8 @@ static int AccessOpen( vlc_object_t *p_this )
}
/* Setup Access */
p_access->pf_read = ReadCompressed;
p_access->pf_block = NULL;
p_access->pf_read = NULL;
p_access->pf_block = ReadCompressed;
p_access->pf_control = AccessControl;
p_access->pf_seek = NULL;
p_access->info.i_update = 0;
......@@ -1255,13 +1255,11 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, IBaseFilter *p_filter,
* Returns -1 in case of error, 0 in case of EOF, otherwise the number of
* bytes.
*****************************************************************************/
static int ReadCompressed( access_t *p_access, uint8_t *p_buffer, int i_len )
static block_t *ReadCompressed( access_t *p_access )
{
access_sys_t *p_sys = p_access->p_sys;
dshow_stream_t *p_stream = NULL;
VLCMediaSample sample;
int i_data_size;
uint8_t *p_data;
VLCMediaSample sample;
/* Read 1 DV/MPEG frame (they contain the video and audio data) */
......@@ -1290,20 +1288,22 @@ static int ReadCompressed( access_t *p_access, uint8_t *p_buffer, int i_len )
/*
* We got our sample
*/
i_data_size = sample.p_sample->GetActualDataLength();
sample.p_sample->GetPointer( &p_data );
#if 0
msg_Info( p_access, "access read %i data_size %i", i_len, i_data_size );
#endif
i_data_size = __MIN( i_data_size, (int)i_len );
block_t *p_block;
uint8_t *p_data;
int i_data_size = sample.p_sample->GetActualDataLength();
p_access->p_vlc->pf_memcpy( p_buffer, p_data, i_data_size );
if( !i_data_size || !(p_block = block_New( p_access, i_data_size )) )
{
sample.p_sample->Release();
continue;
}
sample.p_sample->GetPointer( &p_data );
p_access->p_vlc->pf_memcpy( p_block->p_buffer, p_data, i_data_size );
sample.p_sample->Release();
/* The caller got what he wanted */
return i_data_size;
return p_block;
}
return 0; /* never reached */
......
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