Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
ba3c22cf
Commit
ba3c22cf
authored
Apr 24, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up the way BDA store data from the sample grabber.
parent
9861cd7b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
120 deletions
+98
-120
modules/access/bda/bda.c
modules/access/bda/bda.c
+1
-21
modules/access/bda/bda.h
modules/access/bda/bda.h
+1
-2
modules/access/bda/bdagraph.cpp
modules/access/bda/bdagraph.cpp
+73
-92
modules/access/bda/bdagraph.h
modules/access/bda/bdagraph.h
+23
-5
No files found.
modules/access/bda/bda.c
View file @
ba3c22cf
...
@@ -565,25 +565,5 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -565,25 +565,5 @@ static int Control( access_t *p_access, int i_query, va_list args )
*****************************************************************************/
*****************************************************************************/
static
block_t
*
Block
(
access_t
*
p_access
)
static
block_t
*
Block
(
access_t
*
p_access
)
{
{
block_t
*
p_block
;
return
dvb_Pop
(
p_access
);
long
l_buffer_len
;
if
(
!
vlc_object_alive
(
p_access
)
)
return
NULL
;
l_buffer_len
=
dvb_GetBufferSize
(
p_access
);
if
(
l_buffer_len
<
0
)
{
p_access
->
info
.
b_eof
=
true
;
return
NULL
;
}
p_block
=
block_New
(
p_access
,
l_buffer_len
);
if
(
dvb_ReadBuffer
(
p_access
,
&
l_buffer_len
,
p_block
->
p_buffer
)
<
0
)
{
p_access
->
info
.
b_eof
=
true
;
return
NULL
;
}
return
p_block
;
}
}
modules/access/bda/bda.h
View file @
ba3c22cf
...
@@ -67,8 +67,7 @@ int dvb_SubmitATSCTuneRequest( access_t* p_access );
...
@@ -67,8 +67,7 @@ int dvb_SubmitATSCTuneRequest( access_t* p_access );
int
dvb_SubmitDVBTTuneRequest
(
access_t
*
p_access
);
int
dvb_SubmitDVBTTuneRequest
(
access_t
*
p_access
);
int
dvb_SubmitDVBCTuneRequest
(
access_t
*
p_access
);
int
dvb_SubmitDVBCTuneRequest
(
access_t
*
p_access
);
int
dvb_SubmitDVBSTuneRequest
(
access_t
*
p_access
);
int
dvb_SubmitDVBSTuneRequest
(
access_t
*
p_access
);
long
dvb_GetBufferSize
(
access_t
*
p_access
);
block_t
*
dvb_Pop
(
access_t
*
p_access
);
long
dvb_ReadBuffer
(
access_t
*
p_access
,
long
*
l_buffer_len
,
BYTE
*
p_buff
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
modules/access/bda/bdagraph.cpp
View file @
ba3c22cf
...
@@ -69,22 +69,60 @@ extern "C" {
...
@@ -69,22 +69,60 @@ extern "C" {
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
};
};
long
dvb_GetBufferSize
(
access_t
*
p_access
)
block_t
*
dvb_Pop
(
access_t
*
p_access
)
{
{
if
(
p_access
->
p_sys
->
p_bda_module
)
if
(
p_access
->
p_sys
->
p_bda_module
)
return
p_access
->
p_sys
->
p_bda_module
->
GetBufferSize
();
return
p_access
->
p_sys
->
p_bda_module
->
Pop
();
return
-
1
;
return
NULL
;
};
long
dvb_ReadBuffer
(
access_t
*
p_access
,
long
*
l_buffer_len
,
BYTE
*
p_buff
)
{
if
(
p_access
->
p_sys
->
p_bda_module
)
return
p_access
->
p_sys
->
p_bda_module
->
ReadBuffer
(
l_buffer_len
,
p_buff
);
return
-
1
;
};
};
};
};
/*****************************************************************************
* BDAOutput
*****************************************************************************/
BDAOutput
::
BDAOutput
(
access_t
*
p_access
)
:
p_access
(
p_access
),
p_first
(
NULL
),
pp_next
(
&
p_first
)
{
vlc_mutex_init
(
&
lock
);
vlc_cond_init
(
&
wait
);
}
BDAOutput
::~
BDAOutput
()
{
Empty
();
vlc_mutex_destroy
(
&
lock
);
vlc_cond_destroy
(
&
wait
);
}
void
BDAOutput
::
Push
(
block_t
*
p_block
)
{
vlc_mutex_locker
l
(
&
lock
);
block_ChainLastAppend
(
&
pp_next
,
p_block
);
vlc_cond_signal
(
&
wait
);
}
block_t
*
BDAOutput
::
Pop
()
{
vlc_mutex_locker
l
(
&
lock
);
if
(
!
p_first
)
vlc_cond_timedwait
(
&
wait
,
&
lock
,
mdate
()
+
250
*
1000
);
block_t
*
p_ret
=
p_first
;
p_first
=
NULL
;
pp_next
=
&
p_first
;
return
p_ret
;
}
void
BDAOutput
::
Empty
()
{
vlc_mutex_locker
l
(
&
lock
);
if
(
p_first
)
block_ChainRelease
(
p_first
);
p_first
=
NULL
;
pp_next
=
&
p_first
;
}
/*****************************************************************************
/*****************************************************************************
* Constructor
* Constructor
*****************************************************************************/
*****************************************************************************/
...
@@ -92,9 +130,9 @@ BDAGraph::BDAGraph( access_t* p_this ):
...
@@ -92,9 +130,9 @@ BDAGraph::BDAGraph( access_t* p_this ):
p_access
(
p_this
),
p_access
(
p_this
),
guid_network_type
(
GUID_NULL
),
guid_network_type
(
GUID_NULL
),
l_tuner_used
(
-
1
),
l_tuner_used
(
-
1
),
d_graph_register
(
0
)
d_graph_register
(
0
),
output
(
p_this
)
{
{
b_ready
=
false
;
p_tuning_space
=
NULL
;
p_tuning_space
=
NULL
;
p_tune_request
=
NULL
;
p_tune_request
=
NULL
;
p_media_control
=
NULL
;
p_media_control
=
NULL
;
...
@@ -1746,61 +1784,11 @@ HRESULT BDAGraph::Start()
...
@@ -1746,61 +1784,11 @@ HRESULT BDAGraph::Start()
}
}
/*****************************************************************************
/*****************************************************************************
*
Read the stream of data - query the buffer size required
*
Pop the stream of data
*****************************************************************************/
*****************************************************************************/
long
BDAGraph
::
GetBufferSize
()
block_t
*
BDAGraph
::
Pop
()
{
long
l_buffer_size
=
0
;
long
l_queue_size
;
b_ready
=
true
;
for
(
int
i_timer
=
0
;
queue_sample
.
empty
()
&&
i_timer
<
200
;
i_timer
++
)
Sleep
(
10
);
l_queue_size
=
queue_sample
.
size
();
if
(
l_queue_size
<=
0
)
{
msg_Warn
(
p_access
,
"BDA GetBufferSize: Timed Out waiting for sample"
);
return
-
1
;
}
/* Establish the length of the queue as it grows quickly. If the queue
* size is checked dynamically there is a risk of not exiting the loop */
for
(
long
l_queue_count
=
0
;
l_queue_count
<
l_queue_size
;
l_queue_count
++
)
{
l_buffer_size
+=
queue_sample
.
front
()
->
GetActualDataLength
();
queue_buffer
.
push
(
queue_sample
.
front
()
);
queue_sample
.
pop
();
}
return
l_buffer_size
;
}
/*****************************************************************************
* Read the stream of data - Retrieve from the buffer queue
******************************************************************************/
long
BDAGraph
::
ReadBuffer
(
long
*
pl_buffer_len
,
BYTE
*
p_buffer
)
{
{
HRESULT
hr
=
S_OK
;
return
output
.
Pop
();
*
pl_buffer_len
=
0
;
BYTE
*
p_buff_temp
;
while
(
!
queue_buffer
.
empty
()
)
{
queue_buffer
.
front
()
->
GetPointer
(
&
p_buff_temp
);
hr
=
queue_buffer
.
front
()
->
IsDiscontinuity
();
if
(
hr
==
S_OK
)
msg_Warn
(
p_access
,
"BDA ReadBuffer: Sample Discontinuity. 0x%8lx"
,
hr
);
memcpy
(
p_buffer
+
*
pl_buffer_len
,
p_buff_temp
,
queue_buffer
.
front
()
->
GetActualDataLength
()
);
*
pl_buffer_len
+=
queue_buffer
.
front
()
->
GetActualDataLength
();
queue_buffer
.
front
()
->
Release
();
queue_buffer
.
pop
();
}
return
*
pl_buffer_len
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -1808,16 +1796,24 @@ long BDAGraph::ReadBuffer( long* pl_buffer_len, BYTE* p_buffer )
...
@@ -1808,16 +1796,24 @@ long BDAGraph::ReadBuffer( long* pl_buffer_len, BYTE* p_buffer )
******************************************************************************/
******************************************************************************/
STDMETHODIMP
BDAGraph
::
SampleCB
(
double
d_time
,
IMediaSample
*
p_sample
)
STDMETHODIMP
BDAGraph
::
SampleCB
(
double
d_time
,
IMediaSample
*
p_sample
)
{
{
if
(
b_ready
)
if
(
p_sample
->
IsDiscontinuity
()
==
S_OK
)
{
msg_Warn
(
p_access
,
"BDA SampleCB: Sample Discontinuity."
);
p_sample
->
AddRef
();
queue_sample
.
push
(
p_sample
);
const
size_t
i_sample_size
=
p_sample
->
GetActualDataLength
();
}
BYTE
*
p_sample_data
;
else
p_sample
->
GetPointer
(
&
p_sample_data
);
if
(
i_sample_size
>
0
&&
p_sample_data
)
{
{
msg_Warn
(
p_access
,
"BDA SampleCB: Not ready - dropped sample"
);
block_t
*
p_block
=
block_New
(
p_access
,
i_sample_size
);
}
return
S_OK
;
if
(
p_block
)
{
memcpy
(
p_block
->
p_buffer
,
p_sample_data
,
i_sample_size
);
output
.
Push
(
p_block
);
}
}
return
S_OK
;
}
}
STDMETHODIMP
BDAGraph
::
BufferCB
(
double
d_time
,
BYTE
*
p_buffer
,
STDMETHODIMP
BDAGraph
::
BufferCB
(
double
d_time
,
BYTE
*
p_buffer
,
...
@@ -1842,23 +1838,8 @@ HRESULT BDAGraph::Destroy()
...
@@ -1842,23 +1838,8 @@ HRESULT BDAGraph::Destroy()
Deregister
();
Deregister
();
}
}
/* We need to empty the buffers of any unprocessed data */
output
.
Empty
();
msg_Dbg
(
p_access
,
"Queue sample size = %d"
,
queue_sample
.
size
()
);
while
(
!
queue_sample
.
empty
()
)
{
ul_refcount
=
queue_sample
.
front
()
->
Release
();
queue_sample
.
pop
();
if
(
ul_refcount
)
msg_Warn
(
p_access
,
"BDAGraph: Non-zero Ref: %d"
,
ul_refcount
);
}
msg_Dbg
(
p_access
,
"Queue buffer size = %d"
,
queue_buffer
.
size
()
);
while
(
!
queue_buffer
.
empty
()
)
{
ul_refcount
=
queue_buffer
.
front
()
->
Release
();
queue_buffer
.
pop
();
if
(
ul_refcount
)
msg_Warn
(
p_access
,
"BDAGraph: Non-zero Ref: %d"
,
ul_refcount
);
}
if
(
p_grabber
)
if
(
p_grabber
)
{
{
p_grabber
->
Release
();
p_grabber
->
Release
();
...
...
modules/access/bda/bdagraph.h
View file @
ba3c22cf
...
@@ -52,6 +52,24 @@ using namespace std;
...
@@ -52,6 +52,24 @@ using namespace std;
#include "bdadefs.h"
#include "bdadefs.h"
#include "bda.h"
#include "bda.h"
class
BDAOutput
{
public:
BDAOutput
(
access_t
*
);
~
BDAOutput
();
void
Push
(
block_t
*
);
block_t
*
Pop
();
void
Empty
();
private:
access_t
*
p_access
;
vlc_mutex_t
lock
;
vlc_cond_t
wait
;
block_t
*
p_first
;
block_t
**
pp_next
;
};
/* The main class for building the filter graph */
/* The main class for building the filter graph */
class
BDAGraph
:
public
ISampleGrabberCB
class
BDAGraph
:
public
ISampleGrabberCB
{
{
...
@@ -59,12 +77,14 @@ public:
...
@@ -59,12 +77,14 @@ public:
BDAGraph
(
access_t
*
p_access
);
BDAGraph
(
access_t
*
p_access
);
virtual
~
BDAGraph
();
virtual
~
BDAGraph
();
/* */
int
SubmitATSCTuneRequest
();
int
SubmitATSCTuneRequest
();
int
SubmitDVBTTuneRequest
();
int
SubmitDVBTTuneRequest
();
int
SubmitDVBCTuneRequest
();
int
SubmitDVBCTuneRequest
();
int
SubmitDVBSTuneRequest
();
int
SubmitDVBSTuneRequest
();
long
GetBufferSize
();
long
ReadBuffer
(
long
*
l_buffer_len
,
BYTE
*
p_buff
);
/* */
block_t
*
Pop
();
private:
private:
/* ISampleGrabberCB methods */
/* ISampleGrabberCB methods */
...
@@ -82,9 +102,7 @@ private:
...
@@ -82,9 +102,7 @@ private:
/* registration number for the RunningObjectTable */
/* registration number for the RunningObjectTable */
DWORD
d_graph_register
;
DWORD
d_graph_register
;
queue
<
IMediaSample
*>
queue_sample
;
BDAOutput
output
;
queue
<
IMediaSample
*>
queue_buffer
;
BOOL
b_ready
;
IMediaControl
*
p_media_control
;
IMediaControl
*
p_media_control
;
IGraphBuilder
*
p_filter_graph
;
IGraphBuilder
*
p_filter_graph
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment