Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
a6d3ffa1
Commit
a6d3ffa1
authored
Dec 08, 1999
by
Jean-Marc Dressler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fin du remplacement des pthread + ajout du frame rate dans display.c.
Polux
parent
1d620095
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
180 additions
and
191 deletions
+180
-191
src/audio_decoder/audio_decoder.c
src/audio_decoder/audio_decoder.c
+19
-19
src/audio_decoder/audio_math.c
src/audio_decoder/audio_math.c
+1
-1
src/audio_output/audio_dsp.c
src/audio_output/audio_dsp.c
+1
-1
src/audio_output/audio_output.c
src/audio_output/audio_output.c
+28
-28
src/generic_decoder/generic_decoder.c
src/generic_decoder/generic_decoder.c
+5
-5
src/input/input.c
src/input/input.c
+18
-28
src/input/input_ctrl.c
src/input/input_ctrl.c
+17
-17
src/input/input_file.c
src/input/input_file.c
+1
-1
src/input/input_netlist.c
src/input/input_netlist.c
+1
-1
src/input/input_network.c
src/input/input_network.c
+1
-1
src/input/input_pcr.c
src/input/input_pcr.c
+4
-4
src/input/input_psi.c
src/input/input_psi.c
+10
-11
src/input/input_vlan.c
src/input/input_vlan.c
+8
-8
src/interface/control.c
src/interface/control.c
+1
-1
src/interface/interface.c
src/interface/interface.c
+1
-1
src/interface/intf_cmd.c
src/interface/intf_cmd.c
+1
-1
src/interface/intf_ctrl.c
src/interface/intf_ctrl.c
+1
-1
src/interface/intf_msg.c
src/interface/intf_msg.c
+8
-8
src/interface/main.c
src/interface/main.c
+1
-1
src/interface/xconsole.c
src/interface/xconsole.c
+1
-1
src/video_decoder/video_decoder.c
src/video_decoder/video_decoder.c
+13
-13
src/video_output/video_output.c
src/video_output/video_output.c
+38
-38
src/video_output/video_x11.c
src/video_output/video_x11.c
+1
-1
No files found.
src/audio_decoder/audio_decoder.c
View file @
a6d3ffa1
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
******************************************************************************/
******************************************************************************/
#include <unistd.h>
#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
/* "intf_msg.h" */
#include <stdio.h>
/* "intf_msg.h" */
#include <stdlib.h>
/* malloc(), free() */
#include <stdlib.h>
/* malloc(), free() */
#include <netinet/in.h>
/* ntohl() */
#include <netinet/in.h>
/* ntohl() */
...
@@ -23,6 +22,7 @@
...
@@ -23,6 +22,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "debug.h"
/* "input_netlist.h" */
#include "debug.h"
/* "input_netlist.h" */
#include "intf_msg.h"
/* intf_DbgMsg(), intf_ErrMsg() */
#include "intf_msg.h"
/* intf_DbgMsg(), intf_ErrMsg() */
...
@@ -85,8 +85,8 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
...
@@ -85,8 +85,8 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
*/
*/
/* Initialize the decoder fifo's data lock and conditional variable and set
/* Initialize the decoder fifo's data lock and conditional variable and set
* its buffer as empty */
* its buffer as empty */
pthread_mutex_init
(
&
p_adec
->
fifo
.
data_lock
,
NULL
);
vlc_mutex_init
(
&
p_adec
->
fifo
.
data_lock
);
pthread_cond_init
(
&
p_adec
->
fifo
.
data_wait
,
NULL
);
vlc_cond_init
(
&
p_adec
->
fifo
.
data_wait
);
p_adec
->
fifo
.
i_start
=
0
;
p_adec
->
fifo
.
i_start
=
0
;
p_adec
->
fifo
.
i_end
=
0
;
p_adec
->
fifo
.
i_end
=
0
;
/* Initialize the bit stream structure */
/* Initialize the bit stream structure */
...
@@ -110,7 +110,7 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
...
@@ -110,7 +110,7 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
p_adec
->
p_aout_fifo
=
NULL
;
p_adec
->
p_aout_fifo
=
NULL
;
/* Spawn the audio decoder thread */
/* Spawn the audio decoder thread */
if
(
pthread_create
(
&
p_adec
->
thread_id
,
NULL
,
(
void
*
)
RunThread
,
(
void
*
)
p_adec
)
)
if
(
vlc_thread_create
(
&
p_adec
->
thread_id
,
"audio decoder"
,
(
vlc_thread_func
)
RunThread
,
(
void
*
)
p_adec
)
)
{
{
intf_ErrMsg
(
"adec error: can't spawn audio decoder thread
\n
"
);
intf_ErrMsg
(
"adec error: can't spawn audio decoder thread
\n
"
);
free
(
p_adec
);
free
(
p_adec
);
...
@@ -137,13 +137,13 @@ void adec_DestroyThread( adec_thread_t * p_adec )
...
@@ -137,13 +137,13 @@ void adec_DestroyThread( adec_thread_t * p_adec )
/* Ask thread to kill itself */
/* Ask thread to kill itself */
p_adec
->
b_die
=
1
;
p_adec
->
b_die
=
1
;
/* Make sure the decoder thread leaves the GetByte() function */
/* Make sure the decoder thread leaves the GetByte() function */
pthread
_mutex_lock
(
&
(
p_adec
->
fifo
.
data_lock
)
);
vlc
_mutex_lock
(
&
(
p_adec
->
fifo
.
data_lock
)
);
pthread
_cond_signal
(
&
(
p_adec
->
fifo
.
data_wait
)
);
vlc
_cond_signal
(
&
(
p_adec
->
fifo
.
data_wait
)
);
pthread
_mutex_unlock
(
&
(
p_adec
->
fifo
.
data_lock
)
);
vlc
_mutex_unlock
(
&
(
p_adec
->
fifo
.
data_lock
)
);
/* Waiting for the decoder thread to exit */
/* Waiting for the decoder thread to exit */
/* Remove this as soon as the "status" flag is implemented */
/* Remove this as soon as the "status" flag is implemented */
pthread_join
(
p_adec
->
thread_id
,
NULL
);
vlc_thread_join
(
p_adec
->
thread_id
);
}
}
/* Following functions are local */
/* Following functions are local */
...
@@ -702,14 +702,14 @@ static int InitThread( adec_thread_t * p_adec )
...
@@ -702,14 +702,14 @@ static int InitThread( adec_thread_t * p_adec )
/* Our first job is to initialize the bit stream structure with the
/* Our first job is to initialize the bit stream structure with the
* beginning of the input stream */
* beginning of the input stream */
pthread
_mutex_lock
(
&
p_adec
->
fifo
.
data_lock
);
vlc
_mutex_lock
(
&
p_adec
->
fifo
.
data_lock
);
while
(
DECODER_FIFO_ISEMPTY
(
p_adec
->
fifo
)
)
while
(
DECODER_FIFO_ISEMPTY
(
p_adec
->
fifo
)
)
{
{
pthread
_cond_wait
(
&
p_adec
->
fifo
.
data_wait
,
&
p_adec
->
fifo
.
data_lock
);
vlc
_cond_wait
(
&
p_adec
->
fifo
.
data_wait
,
&
p_adec
->
fifo
.
data_lock
);
}
}
p_adec
->
bit_stream
.
p_ts
=
DECODER_FIFO_START
(
p_adec
->
fifo
)
->
p_first_ts
;
p_adec
->
bit_stream
.
p_ts
=
DECODER_FIFO_START
(
p_adec
->
fifo
)
->
p_first_ts
;
p_adec
->
bit_stream
.
i_byte
=
p_adec
->
bit_stream
.
p_ts
->
i_payload_start
;
p_adec
->
bit_stream
.
i_byte
=
p_adec
->
bit_stream
.
p_ts
->
i_payload_start
;
pthread
_mutex_unlock
(
&
p_adec
->
fifo
.
data_lock
);
vlc
_mutex_unlock
(
&
p_adec
->
fifo
.
data_lock
);
/* Now we look for an audio frame header in the input stream */
/* Now we look for an audio frame header in the input stream */
if
(
FindHeader
(
p_adec
)
)
if
(
FindHeader
(
p_adec
)
)
...
@@ -836,7 +836,7 @@ static void RunThread( adec_thread_t * p_adec )
...
@@ -836,7 +836,7 @@ static void RunThread( adec_thread_t * p_adec )
/* Waiting until there is enough free space in the audio output fifo
/* Waiting until there is enough free space in the audio output fifo
* in order to store the new decoded frames */
* in order to store the new decoded frames */
pthread
_mutex_lock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
vlc
_mutex_lock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
/* adec_Layer2_Stereo() produces 6 output frames (2*1152/384)...
/* adec_Layer2_Stereo() produces 6 output frames (2*1152/384)...
* If these 6 frames were recorded in the audio output fifo, the
* If these 6 frames were recorded in the audio output fifo, the
* l_end_frame index would be incremented 6 times. But, if after
* l_end_frame index would be incremented 6 times. But, if after
...
@@ -844,14 +844,14 @@ static void RunThread( adec_thread_t * p_adec )
...
@@ -844,14 +844,14 @@ static void RunThread( adec_thread_t * p_adec )
* it would mean that we had not enough room to store the 6 frames :-P */
* it would mean that we had not enough room to store the 6 frames :-P */
while
(
(((
p_adec
->
p_aout_fifo
->
l_end_frame
+
6
)
-
p_adec
->
p_aout_fifo
->
l_start_frame
)
&
AOUT_FIFO_SIZE
)
<
6
)
/* !! */
while
(
(((
p_adec
->
p_aout_fifo
->
l_end_frame
+
6
)
-
p_adec
->
p_aout_fifo
->
l_start_frame
)
&
AOUT_FIFO_SIZE
)
<
6
)
/* !! */
{
{
pthread
_cond_wait
(
&
p_adec
->
p_aout_fifo
->
data_wait
,
&
p_adec
->
p_aout_fifo
->
data_lock
);
vlc
_cond_wait
(
&
p_adec
->
p_aout_fifo
->
data_wait
,
&
p_adec
->
p_aout_fifo
->
data_lock
);
}
}
pthread
_mutex_unlock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
vlc
_mutex_unlock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
/* Decoding the frames */
/* Decoding the frames */
if
(
adec_Layer2_Stereo
(
p_adec
)
)
if
(
adec_Layer2_Stereo
(
p_adec
)
)
{
{
pthread
_mutex_lock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
vlc
_mutex_lock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
/* Frame 1 */
/* Frame 1 */
if
(
DECODER_FIFO_START
(
p_adec
->
fifo
)
->
b_has_pts
)
if
(
DECODER_FIFO_START
(
p_adec
->
fifo
)
->
b_has_pts
)
{
{
...
@@ -878,7 +878,7 @@ static void RunThread( adec_thread_t * p_adec )
...
@@ -878,7 +878,7 @@ static void RunThread( adec_thread_t * p_adec )
/* Frame 6 */
/* Frame 6 */
p_adec
->
p_aout_fifo
->
date
[
p_adec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_adec
->
p_aout_fifo
->
date
[
p_adec
->
p_aout_fifo
->
l_end_frame
]
=
LAST_MDATE
;
p_adec
->
p_aout_fifo
->
l_end_frame
=
(
p_adec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
p_adec
->
p_aout_fifo
->
l_end_frame
=
(
p_adec
->
p_aout_fifo
->
l_end_frame
+
1
)
&
AOUT_FIFO_SIZE
;
pthread
_mutex_unlock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
vlc
_mutex_unlock
(
&
p_adec
->
p_aout_fifo
->
data_lock
);
}
}
}
}
break
;
break
;
...
@@ -926,7 +926,7 @@ static void ErrorThread( adec_thread_t *p_adec )
...
@@ -926,7 +926,7 @@ static void ErrorThread( adec_thread_t *p_adec )
{
{
/* We take the lock, because we are going to read/write the start/end
/* We take the lock, because we are going to read/write the start/end
* indexes of the decoder fifo */
* indexes of the decoder fifo */
pthread
_mutex_lock
(
&
p_adec
->
fifo
.
data_lock
);
vlc
_mutex_lock
(
&
p_adec
->
fifo
.
data_lock
);
/* Wait until a `die' order is sent */
/* Wait until a `die' order is sent */
while
(
!
p_adec
->
b_die
)
while
(
!
p_adec
->
b_die
)
...
@@ -939,11 +939,11 @@ static void ErrorThread( adec_thread_t *p_adec )
...
@@ -939,11 +939,11 @@ static void ErrorThread( adec_thread_t *p_adec )
}
}
/* Waiting for the input thread to put new PES packets in the fifo */
/* Waiting for the input thread to put new PES packets in the fifo */
pthread
_cond_wait
(
&
p_adec
->
fifo
.
data_wait
,
&
p_adec
->
fifo
.
data_lock
);
vlc
_cond_wait
(
&
p_adec
->
fifo
.
data_wait
,
&
p_adec
->
fifo
.
data_lock
);
}
}
/* We can release the lock before leaving */
/* We can release the lock before leaving */
pthread
_mutex_unlock
(
&
p_adec
->
fifo
.
data_lock
);
vlc
_mutex_unlock
(
&
p_adec
->
fifo
.
data_lock
);
}
}
/******************************************************************************
/******************************************************************************
...
...
src/audio_decoder/audio_math.c
View file @
a6d3ffa1
...
@@ -10,12 +10,12 @@
...
@@ -10,12 +10,12 @@
#include <stdlib.h>
/* malloc(), free() */
#include <stdlib.h>
/* malloc(), free() */
#include <netinet/in.h>
/* ntohl() */
#include <netinet/in.h>
/* ntohl() */
#include <sys/soundcard.h>
/* "audio_output.h" */
#include <sys/soundcard.h>
/* "audio_output.h" */
#include <pthread.h>
#include <sys/uio.h>
#include <sys/uio.h>
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "debug.h"
#include "debug.h"
#include "intf_msg.h"
/* intf_DbgMsg(), intf_ErrMsg() */
#include "intf_msg.h"
/* intf_DbgMsg(), intf_ErrMsg() */
...
...
src/audio_output/audio_dsp.c
View file @
a6d3ffa1
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
/******************************************************************************
/******************************************************************************
* Preamble
* Preamble
******************************************************************************/
******************************************************************************/
#include <pthread.h>
#include <fcntl.h>
/* open(), O_WRONLY */
#include <fcntl.h>
/* open(), O_WRONLY */
#include <sys/ioctl.h>
/* ioctl() */
#include <sys/ioctl.h>
/* ioctl() */
#include <unistd.h>
/* write(), close() */
#include <unistd.h>
/* write(), close() */
...
@@ -24,6 +23,7 @@
...
@@ -24,6 +23,7 @@
#include "common.h"
/* boolean_t, byte_t */
#include "common.h"
/* boolean_t, byte_t */
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "audio_output.h"
/* aout_dsp_t */
#include "audio_output.h"
/* aout_dsp_t */
#include "audio_dsp.h"
#include "audio_dsp.h"
...
...
src/audio_output/audio_output.c
View file @
a6d3ffa1
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* chaque boucle
* chaque boucle
* = Utiliser des tables pour les gros calculs
* = Utiliser des tables pour les gros calculs
* - Faire une structure diffrente pour intf/adec fifo
* - Faire une structure diffrente pour intf/adec fifo
* - Rajouter des
pthread
_cond_signal ?
* - Rajouter des
vlc
_cond_signal ?
*
*
*/
*/
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
******************************************************************************/
******************************************************************************/
#include <unistd.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/soundcard.h>
#include <sys/soundcard.h>
#include <stdio.h>
/* "intf_msg.h" */
#include <stdio.h>
/* "intf_msg.h" */
#include <stdlib.h>
/* calloc(), malloc(), free() */
#include <stdlib.h>
/* calloc(), malloc(), free() */
...
@@ -29,6 +28,7 @@
...
@@ -29,6 +28,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
/* mtime_t, mdate(), msleep() */
#include "mtime.h"
/* mtime_t, mdate(), msleep() */
#include "vlc_thread.h"
#include "intf_msg.h"
/* intf_DbgMsg(), intf_ErrMsg() */
#include "intf_msg.h"
/* intf_DbgMsg(), intf_ErrMsg() */
...
@@ -112,13 +112,13 @@ int aout_SpawnThread( aout_thread_t * p_aout )
...
@@ -112,13 +112,13 @@ int aout_SpawnThread( aout_thread_t * p_aout )
p_aout
->
b_die
=
0
;
p_aout
->
b_die
=
0
;
/* Initialize the fifos lock */
/* Initialize the fifos lock */
pthread_mutex_init
(
&
p_aout
->
fifos_lock
,
NULL
);
vlc_mutex_init
(
&
p_aout
->
fifos_lock
);
/* Initialize audio fifos : set all fifos as empty and initialize locks */
/* Initialize audio fifos : set all fifos as empty and initialize locks */
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
{
{
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
pthread_mutex_init
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
,
NULL
);
vlc_mutex_init
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
pthread_cond_init
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
,
NULL
);
vlc_cond_init
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
}
}
/* Compute the size (in audio units) of the audio output buffer. Although
/* Compute the size (in audio units) of the audio output buffer. Although
...
@@ -239,7 +239,7 @@ int aout_SpawnThread( aout_thread_t * p_aout )
...
@@ -239,7 +239,7 @@ int aout_SpawnThread( aout_thread_t * p_aout )
p_aout
->
date
=
mdate
();
p_aout
->
date
=
mdate
();
/* Launch the thread */
/* Launch the thread */
if
(
pthread_create
(
&
p_aout
->
thread_id
,
NULL
,
aout_thread
,
p_aout
)
)
if
(
vlc_thread_create
(
&
p_aout
->
thread_id
,
"audio output"
,
(
vlc_thread_func
)
aout_thread
,
p_aout
)
)
{
{
intf_ErrMsg
(
"aout error: can't spawn audio output thread (%p)
\n
"
,
p_aout
);
intf_ErrMsg
(
"aout error: can't spawn audio output thread (%p)
\n
"
,
p_aout
);
free
(
p_aout
->
buffer
);
free
(
p_aout
->
buffer
);
...
@@ -260,7 +260,7 @@ void aout_CancelThread( aout_thread_t * p_aout )
...
@@ -260,7 +260,7 @@ void aout_CancelThread( aout_thread_t * p_aout )
/* Ask thread to kill itself and wait until it's done */
/* Ask thread to kill itself and wait until it's done */
p_aout
->
b_die
=
1
;
p_aout
->
b_die
=
1
;
pthread_join
(
p_aout
->
thread_id
,
NULL
);
vlc_thread_join
(
p_aout
->
thread_id
);
/* Free the allocated memory */
/* Free the allocated memory */
free
(
p_aout
->
buffer
);
free
(
p_aout
->
buffer
);
...
@@ -284,7 +284,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
...
@@ -284,7 +284,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
int
i_fifo
;
int
i_fifo
;
/* Take the fifos lock */
/* Take the fifos lock */
pthread
_mutex_lock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_lock
(
&
p_aout
->
fifos_lock
);
/* Looking for a free fifo structure */
/* Looking for a free fifo structure */
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
...
@@ -297,7 +297,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
...
@@ -297,7 +297,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
if
(
i_fifo
==
AOUT_MAX_FIFOS
)
if
(
i_fifo
==
AOUT_MAX_FIFOS
)
{
{
intf_ErrMsg
(
"aout error: no empty fifo available
\n
"
);
intf_ErrMsg
(
"aout error: no empty fifo available
\n
"
);
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -333,7 +333,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
...
@@ -333,7 +333,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
{
{
intf_ErrMsg
(
"aout error: not enough memory to create the frames buffer
\n
"
);
intf_ErrMsg
(
"aout error: not enough memory to create the frames buffer
\n
"
);
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -343,7 +343,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
...
@@ -343,7 +343,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
intf_ErrMsg
(
"aout error: not enough memory to create the dates buffer
\n
"
);
intf_ErrMsg
(
"aout error: not enough memory to create the dates buffer
\n
"
);
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
free
(
p_aout
->
fifo
[
i_fifo
].
buffer
);
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -365,12 +365,12 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
...
@@ -365,12 +365,12 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
default:
default:
intf_ErrMsg
(
"aout error: unknown fifo type (%i)
\n
"
,
p_aout
->
fifo
[
i_fifo
].
i_type
);
intf_ErrMsg
(
"aout error: unknown fifo type (%i)
\n
"
,
p_aout
->
fifo
[
i_fifo
].
i_type
);
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
p_aout
->
fifo
[
i_fifo
].
i_type
=
AOUT_EMPTY_FIFO
;
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
return
(
NULL
);
return
(
NULL
);
}
}
/* Release the fifos lock */
/* Release the fifos lock */
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
/* Return the pointer to the fifo structure */
/* Return the pointer to the fifo structure */
intf_DbgMsg
(
"aout debug: audio output fifo (%p) allocated
\n
"
,
&
p_aout
->
fifo
[
i_fifo
]);
intf_DbgMsg
(
"aout debug: audio output fifo (%p) allocated
\n
"
,
&
p_aout
->
fifo
[
i_fifo
]);
...
@@ -431,7 +431,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -431,7 +431,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
long
l_units
,
l_rate
;
long
l_units
,
l_rate
;
/* We take the lock */
/* We take the lock */
pthread
_mutex_lock
(
&
p_fifo
->
data_lock
);
vlc
_mutex_lock
(
&
p_fifo
->
data_lock
);
/* Are we looking for a dated start frame ? */
/* Are we looking for a dated start frame ? */
if
(
!
p_fifo
->
b_start_frame
)
if
(
!
p_fifo
->
b_start_frame
)
...
@@ -448,7 +448,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -448,7 +448,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
}
}
if
(
p_fifo
->
l_start_frame
==
p_fifo
->
l_end_frame
)
if
(
p_fifo
->
l_start_frame
==
p_fifo
->
l_end_frame
)
{
{
pthread
_mutex_unlock
(
&
p_fifo
->
data_lock
);
vlc
_mutex_unlock
(
&
p_fifo
->
data_lock
);
return
(
-
1
);
return
(
-
1
);
}
}
}
}
...
@@ -456,7 +456,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -456,7 +456,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
if ( aout_date < p_fifo->date[p_fifo->l_start_frame] )
if ( aout_date < p_fifo->date[p_fifo->l_start_frame] )
{
{
fprintf(stderr, "+");
fprintf(stderr, "+");
pthread
_mutex_unlock( &p_fifo->data_lock );
vlc
_mutex_unlock( &p_fifo->data_lock );
return( -1 );
return( -1 );
}
}
*/
*/
...
@@ -496,7 +496,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -496,7 +496,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
/* p_fifo->b_next_frame = 0; */
/* p_fifo->b_next_frame = 0; */
p_fifo
->
l_end_frame
=
0
;
p_fifo
->
l_end_frame
=
0
;
}
}
pthread
_mutex_unlock
(
&
p_fifo
->
data_lock
);
vlc
_mutex_unlock
(
&
p_fifo
->
data_lock
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -513,7 +513,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
...
@@ -513,7 +513,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
*
p_aout
->
dsp
.
l_rate
)
/
l_rate
)
+
1
;
*
p_aout
->
dsp
.
l_rate
)
/
l_rate
)
+
1
;
/* We release the lock before leaving */
/* We release the lock before leaving */
pthread
_mutex_unlock
(
&
p_fifo
->
data_lock
);
vlc
_mutex_unlock
(
&
p_fifo
->
data_lock
);
return
(
0
);
return
(
0
);
}
}
...
@@ -549,7 +549,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -549,7 +549,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
* memory to zero and we can immediately jump into the thread's loop */
* memory to zero and we can immediately jump into the thread's loop */
while
(
!
p_aout
->
b_die
)
while
(
!
p_aout
->
b_die
)
{
{
pthread
_mutex_lock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_lock
(
&
p_aout
->
fifos_lock
);
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
{
{
switch
(
p_aout
->
fifo
[
i_fifo
].
i_type
)
switch
(
p_aout
->
fifo
[
i_fifo
].
i_type
)
...
@@ -674,10 +674,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -674,10 +674,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
}
}
l_units
-=
p_aout
->
fifo
[
i_fifo
].
l_units
;
l_units
-=
p_aout
->
fifo
[
i_fifo
].
l_units
;
pthread
_mutex_lock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
vlc
_mutex_lock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_next_frame
;
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_next_frame
;
pthread
_cond_signal
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
vlc
_cond_signal
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
pthread
_mutex_unlock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
/* p_aout->fifo[i_fifo].b_start_frame = 1; */
/* p_aout->fifo[i_fifo].b_start_frame = 1; */
p_aout
->
fifo
[
i_fifo
].
l_next_frame
+=
1
;
p_aout
->
fifo
[
i_fifo
].
l_next_frame
+=
1
;
...
@@ -742,10 +742,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -742,10 +742,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
}
}
l_units
-=
p_aout
->
fifo
[
i_fifo
].
l_units
;
l_units
-=
p_aout
->
fifo
[
i_fifo
].
l_units
;
pthread
_mutex_lock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
vlc
_mutex_lock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_next_frame
;
p_aout
->
fifo
[
i_fifo
].
l_start_frame
=
p_aout
->
fifo
[
i_fifo
].
l_next_frame
;
pthread
_cond_signal
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
vlc
_cond_signal
(
&
p_aout
->
fifo
[
i_fifo
].
data_wait
);
pthread
_mutex_unlock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifo
[
i_fifo
].
data_lock
);
/* p_aout->fifo[i_fifo].b_start_frame = 1; */
/* p_aout->fifo[i_fifo].b_start_frame = 1; */
p_aout
->
fifo
[
i_fifo
].
l_next_frame
+=
1
;
p_aout
->
fifo
[
i_fifo
].
l_next_frame
+=
1
;
...
@@ -760,7 +760,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -760,7 +760,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
break
;
break
;
}
}
}
}
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
l_buffer_limit
=
p_aout
->
l_units
<<
1
;
/* p_aout->dsp.b_stereo == 1 */
l_buffer_limit
=
p_aout
->
l_units
<<
1
;
/* p_aout->dsp.b_stereo == 1 */
...
@@ -790,7 +790,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -790,7 +790,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
UPDATE_INCREMENT
(
p_aout
->
date_increment
,
p_aout
->
date
)
UPDATE_INCREMENT
(
p_aout
->
date_increment
,
p_aout
->
date
)
}
}
pthread
_mutex_lock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_lock
(
&
p_aout
->
fifos_lock
);
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
for
(
i_fifo
=
0
;
i_fifo
<
AOUT_MAX_FIFOS
;
i_fifo
++
)
{
{
switch
(
p_aout
->
fifo
[
i_fifo
].
i_type
)
switch
(
p_aout
->
fifo
[
i_fifo
].
i_type
)
...
@@ -817,7 +817,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
...
@@ -817,7 +817,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
break
;
break
;
}
}
}
}
pthread
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
vlc
_mutex_unlock
(
&
p_aout
->
fifos_lock
);
}
}
void
aout_Thread_U16_Mono
(
aout_thread_t
*
p_aout
)
void
aout_Thread_U16_Mono
(
aout_thread_t
*
p_aout
)
...
...
src/generic_decoder/generic_decoder.c
View file @
a6d3ffa1
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -28,6 +27,7 @@
...
@@ -28,6 +27,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "thread.h"
#include "thread.h"
#include "intf_msg.h"
#include "intf_msg.h"
...
@@ -100,7 +100,7 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
...
@@ -100,7 +100,7 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
p_gdec
->
b_active
=
1
;
p_gdec
->
b_active
=
1
;
/* Create thread */
/* Create thread */
if
(
pthread_create
(
&
p_gdec
->
thread_id
,
NULL
,
(
void
*
)
RunThread
,
(
void
*
)
p_gdec
)
)
if
(
vlc_thread_create
(
&
p_gdec
->
thread_id
,
"generic decoder"
,
(
vlc_thread_func
)
RunThread
,
(
void
*
)
p_gdec
)
)
{
{
intf_ErrMsg
(
"gdec error: %s
\n
"
,
strerror
(
ENOMEM
));
intf_ErrMsg
(
"gdec error: %s
\n
"
,
strerror
(
ENOMEM
));
intf_DbgMsg
(
"failed
\n
"
);
intf_DbgMsg
(
"failed
\n
"
);
...
@@ -145,9 +145,9 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
...
@@ -145,9 +145,9 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
/* Request thread destruction */
/* Request thread destruction */
p_gdec
->
b_die
=
1
;
p_gdec
->
b_die
=
1
;
/* Make sure the decoder thread leaves the GetByte() function */
/* Make sure the decoder thread leaves the GetByte() function */
pthread
_mutex_lock
(
&
(
p_gdec
->
fifo
.
data_lock
)
);
vlc
_mutex_lock
(
&
(
p_gdec
->
fifo
.
data_lock
)
);
pthread
_cond_signal
(
&
(
p_gdec
->
fifo
.
data_wait
)
);
vlc
_cond_signal
(
&
(
p_gdec
->
fifo
.
data_wait
)
);
pthread
_mutex_unlock
(
&
(
p_gdec
->
fifo
.
data_lock
)
);
vlc
_mutex_unlock
(
&
(
p_gdec
->
fifo
.
data_lock
)
);
/* If status is NULL, wait until thread has been destroyed */
/* If status is NULL, wait until thread has been destroyed */
if
(
pi_status
)
if
(
pi_status
)
...
...
src/input/input.c
View file @
a6d3ffa1
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
* Preamble
* Preamble
******************************************************************************/
******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <sys/uio.h>
/* iovec */
#include <sys/uio.h>
/* iovec */
#include <string.h>
#include <string.h>
...
@@ -27,6 +26,7 @@
...
@@ -27,6 +26,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "intf_msg.h"
#include "intf_msg.h"
#include "debug.h"
#include "debug.h"
...
@@ -186,13 +186,13 @@ input_thread_t *input_CreateThread( input_cfg_t *p_cfg )
...
@@ -186,13 +186,13 @@ input_thread_t *input_CreateThread( input_cfg_t *p_cfg )
/* Create thread and set locks. */
/* Create thread and set locks. */
p_input
->
b_die
=
0
;
p_input
->
b_die
=
0
;
pthread_mutex_init
(
&
p_input
->
netlist
.
lock
,
NULL
);
vlc_mutex_init
(
&
p_input
->
netlist
.
lock
);
pthread_mutex_init
(
&
p_input
->
programs_lock
,
NULL
);
vlc_mutex_init
(
&
p_input
->
programs_lock
);
pthread_mutex_init
(
&
p_input
->
es_lock
,
NULL
);
vlc_mutex_init
(
&
p_input
->
es_lock
);
#ifdef NO_THREAD
#ifdef NO_THREAD
input_Thread
(
p_input
);
input_Thread
(
p_input
);
#else
#else
if
(
pthread_create
(
&
p_input
->
thread_id
,
NULL
,
(
void
*
)
input_Thread
,
if
(
vlc_thread_create
(
&
p_input
->
thread_id
,
"input"
,
(
vlc_thread_func
)
input_Thread
,
(
void
*
)
p_input
)
)
(
void
*
)
p_input
)
)
{
{
intf_ErrMsg
(
"input error: can't spawn input thread (%s)
\n
"
,
intf_ErrMsg
(
"input error: can't spawn input thread (%s)
\n
"
,
...
@@ -223,7 +223,7 @@ void input_DestroyThread( input_thread_t *p_input )
...
@@ -223,7 +223,7 @@ void input_DestroyThread( input_thread_t *p_input )
p_input
->
b_die
=
1
;
/* ask thread to kill itself */
p_input
->
b_die
=
1
;
/* ask thread to kill itself */
/* Remove this as soon as the "status" flag is implemented */
/* Remove this as soon as the "status" flag is implemented */
pthread_join
(
p_input
->
thread_id
,
NULL
);
/* wait until it's done */
vlc_thread_join
(
p_input
->
thread_id
);
/* wait until it's done */
}
}
#if 0
#if 0
...
@@ -304,7 +304,7 @@ static void input_Thread( input_thread_t *p_input )
...
@@ -304,7 +304,7 @@ static void input_Thread( input_thread_t *p_input )
EndThread
(
p_input
);
EndThread
(
p_input
);
intf_DbgMsg
(
"input debug: thread %p destroyed
\n
"
,
p_input
);
intf_DbgMsg
(
"input debug: thread %p destroyed
\n
"
,
p_input
);
p
thread_exit
(
0
);
vlc_
thread_exit
(
0
);
}
}
...
@@ -458,7 +458,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
...
@@ -458,7 +458,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
/* Remove the TS packets we have just filled from the netlist */
/* Remove the TS packets we have just filled from the netlist */
#ifdef INPUT_LIFO_TS_NETLIST
#ifdef INPUT_LIFO_TS_NETLIST
/* We need to take a lock here while we're calculating index positions. */
/* We need to take a lock here while we're calculating index positions. */
pthread
_mutex_lock
(
&
p_input
->
netlist
.
lock
);
vlc
_mutex_lock
(
&
p_input
->
netlist
.
lock
);
i_meanwhile_released
=
i_base_index
-
p_input
->
netlist
.
i_ts_index
;
i_meanwhile_released
=
i_base_index
-
p_input
->
netlist
.
i_ts_index
;
if
(
i_meanwhile_released
)
if
(
i_meanwhile_released
)
...
@@ -498,7 +498,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
...
@@ -498,7 +498,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
p_input
->
netlist
.
i_ts_index
=
i_current_index
;
p_input
->
netlist
.
i_ts_index
=
i_current_index
;
}
}
pthread
_mutex_unlock
(
&
p_input
->
netlist
.
lock
);
vlc
_mutex_unlock
(
&
p_input
->
netlist
.
lock
);
#else
/* FIFO netlist */
#else
/* FIFO netlist */
/* & is modulo ; that's where we make the loop. */
/* & is modulo ; that's where we make the loop. */
...
@@ -538,7 +538,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
...
@@ -538,7 +538,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
// i_current_pid, p_ts_packet);
// i_current_pid, p_ts_packet);
/* Lock current ES state. */
/* Lock current ES state. */
pthread
_mutex_lock
(
&
p_input
->
es_lock
);
vlc
_mutex_lock
(
&
p_input
->
es_lock
);
/* Verify that we actually want this PID. */
/* Verify that we actually want this PID. */
for
(
i_es_loop
=
0
;
i_es_loop
<
INPUT_MAX_SELECTED_ES
;
i_es_loop
++
)
for
(
i_es_loop
=
0
;
i_es_loop
<
INPUT_MAX_SELECTED_ES
;
i_es_loop
++
)
...
@@ -553,7 +553,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
...
@@ -553,7 +553,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
modified from inside the input_thread (by the PSI
modified from inside the input_thread (by the PSI
decoder): interface thread is only allowed to modify
decoder): interface thread is only allowed to modify
the pp_selected_es table */
the pp_selected_es table */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
/* We're interested. Pass it to the demultiplexer. */
/* We're interested. Pass it to the demultiplexer. */
input_DemuxTS
(
p_input
,
p_ts_packet
,
input_DemuxTS
(
p_input
,
p_ts_packet
,
...
@@ -567,7 +567,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
...
@@ -567,7 +567,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
break
;
break
;
}
}
}
}
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
}
}
/* We weren't interested in receiving this packet. Give it back to the
/* We weren't interested in receiving this packet. Give it back to the
...
@@ -705,16 +705,6 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
...
@@ -705,16 +705,6 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
intf_DbgMsg
(
"Duplicate packet received by TS demux
\n
"
);
intf_DbgMsg
(
"Duplicate packet received by TS demux
\n
"
);
b_trash
=
1
;
b_trash
=
1
;
}
}
else
if
(
p_es_descriptor
->
i_continuity_counter
==
0xFF
)
{
/* This means that the packet is the first one we receive for this
ES since the continuity counter ranges between 0 and 0x0F
excepts when it has been initialized by the input: Init the
counter to the correct value. */
intf_DbgMsg
(
"First packet for PID %d received by TS demux
\n
"
,
p_es_descriptor
->
i_id
);
p_es_descriptor
->
i_continuity_counter
=
(
p
[
3
]
&
0x0f
);
}
else
else
{
{
/* This can indicate that we missed a packet or that the
/* This can indicate that we missed a packet or that the
...
@@ -841,7 +831,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
...
@@ -841,7 +831,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
so the PES won't be usefull for any decoder. Moreover,
so the PES won't be usefull for any decoder. Moreover,
this should never happen so we can trash the packet and
this should never happen so we can trash the packet and
exit roughly without regrets */
exit roughly without regrets */
intf_DbgMsg
(
"PES packet
is
too short: trashed
\n
"
);
intf_DbgMsg
(
"PES packet too short: trashed
\n
"
);
input_NetlistFreePES
(
p_input
,
p_pes
);
input_NetlistFreePES
(
p_input
,
p_pes
);
p_pes
=
NULL
;
p_pes
=
NULL
;
/* Stats ?? */
/* Stats ?? */
...
@@ -915,7 +905,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
...
@@ -915,7 +905,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
pcr_descriptor_t
*
p_pcr
;
pcr_descriptor_t
*
p_pcr
;
p_pcr
=
p_input
->
p_pcr
;
p_pcr
=
p_input
->
p_pcr
;
pthread
_mutex_lock
(
&
p_pcr
->
lock
);
vlc
_mutex_lock
(
&
p_pcr
->
lock
);
if
(
p_pcr
->
delta_clock
==
0
)
if
(
p_pcr
->
delta_clock
==
0
)
{
{
p_pes
->
b_has_pts
=
0
;
p_pes
->
b_has_pts
=
0
;
...
@@ -935,7 +925,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
...
@@ -935,7 +925,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
p_pes
->
i_pts
+=
p_pcr
->
delta_decode
;
p_pes
->
i_pts
+=
p_pcr
->
delta_decode
;
p_pcr
->
c_pts
+=
1
;
p_pcr
->
c_pts
+=
1
;
}
}
pthread
_mutex_unlock
(
&
p_pcr
->
lock
);
vlc
_mutex_unlock
(
&
p_pcr
->
lock
);
}
}
break
;
break
;
}
}
...
@@ -982,7 +972,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
...
@@ -982,7 +972,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
if
(
p_fifo
!=
NULL
)
if
(
p_fifo
!=
NULL
)
{
{
pthread
_mutex_lock
(
&
p_fifo
->
data_lock
);
vlc
_mutex_lock
(
&
p_fifo
->
data_lock
);
if
(
DECODER_FIFO_ISFULL
(
*
p_fifo
)
)
if
(
DECODER_FIFO_ISFULL
(
*
p_fifo
)
)
{
{
/* The FIFO is full !!! This should not happen. */
/* The FIFO is full !!! This should not happen. */
...
@@ -1002,9 +992,9 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
...
@@ -1002,9 +992,9 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
DECODER_FIFO_INCEND
(
*
p_fifo
);
DECODER_FIFO_INCEND
(
*
p_fifo
);
/* Warn the decoder that it's got work to do. */
/* Warn the decoder that it's got work to do. */
pthread
_cond_signal
(
&
p_fifo
->
data_wait
);
vlc
_cond_signal
(
&
p_fifo
->
data_wait
);
}
}
pthread
_mutex_unlock
(
&
p_fifo
->
data_lock
);
vlc
_mutex_unlock
(
&
p_fifo
->
data_lock
);
}
}
else
else
{
{
...
...
src/input/input_ctrl.c
View file @
a6d3ffa1
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <sys/uio.h>
/* iovec */
#include <sys/uio.h>
/* iovec */
#include <stdlib.h>
/* atoi(), malloc(), free() */
#include <stdlib.h>
/* atoi(), malloc(), free() */
#include <string.h>
#include <string.h>
...
@@ -25,6 +24,7 @@
...
@@ -25,6 +24,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "intf_msg.h"
#include "intf_msg.h"
#include "debug.h"
#include "debug.h"
...
@@ -56,7 +56,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -56,7 +56,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
/* Since this function is intended to be called by interface, lock the
/* Since this function is intended to be called by interface, lock the
* elementary stream structure. */
* elementary stream structure. */
pthread
_mutex_lock
(
&
p_input
->
es_lock
);
vlc
_mutex_lock
(
&
p_input
->
es_lock
);
/* Find out which PID we need. */
/* Find out which PID we need. */
for
(
i_es_loop
=
0
;
i_es_loop
<
INPUT_MAX_ES
;
i_es_loop
++
)
for
(
i_es_loop
=
0
;
i_es_loop
<
INPUT_MAX_ES
;
i_es_loop
++
)
...
@@ -66,7 +66,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -66,7 +66,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
if
(
p_input
->
p_es
[
i_es_loop
].
p_dec
!=
NULL
)
if
(
p_input
->
p_es
[
i_es_loop
].
p_dec
!=
NULL
)
{
{
/* We already have a decoder for that PID. */
/* We already have a decoder for that PID. */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
intf_ErrMsg
(
"input error: PID %d already selected
\n
"
,
intf_ErrMsg
(
"input error: PID %d already selected
\n
"
,
i_current_id
);
i_current_id
);
return
(
-
1
);
return
(
-
1
);
...
@@ -82,7 +82,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -82,7 +82,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
if
(
i_selected_es_loop
==
INPUT_MAX_SELECTED_ES
)
if
(
i_selected_es_loop
==
INPUT_MAX_SELECTED_ES
)
{
{
/* array full */
/* array full */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
intf_ErrMsg
(
"input error: MAX_SELECTED_ES reached: try increasing it in config.h
\n
"
);
intf_ErrMsg
(
"input error: MAX_SELECTED_ES reached: try increasing it in config.h
\n
"
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -91,7 +91,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -91,7 +91,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
if
(
p_input
->
p_es
[
i_es_loop
].
b_psi
)
if
(
p_input
->
p_es
[
i_es_loop
].
b_psi
)
{
{
intf_ErrMsg
(
"input_error: trying to decode PID %d which is the one of a PSI
\n
"
);
intf_ErrMsg
(
"input_error: trying to decode PID %d which is the one of a PSI
\n
"
);
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
-
1
);
return
(
-
1
);
}
}
else
else
...
@@ -106,7 +106,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -106,7 +106,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
adec_CreateThread
(
p_input
))
==
NULL
)
adec_CreateThread
(
p_input
))
==
NULL
)
{
{
intf_ErrMsg
(
"Could not start audio decoder
\n
"
);
intf_ErrMsg
(
"Could not start audio decoder
\n
"
);
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
-
1
);
return
(
-
1
);
}
}
break
;
break
;
...
@@ -119,7 +119,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -119,7 +119,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
vdec_CreateThread
(
p_input
))
==
NULL
)
vdec_CreateThread
(
p_input
))
==
NULL
)
{
{
intf_ErrMsg
(
"Could not start video decoder
\n
"
);
intf_ErrMsg
(
"Could not start video decoder
\n
"
);
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
-
1
);
return
(
-
1
);
}
}
break
;
break
;
...
@@ -128,27 +128,27 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -128,27 +128,27 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
/* That should never happen. */
/* That should never happen. */
intf_DbgMsg
(
"input error: unknown stream type (%d)
\n
"
,
intf_DbgMsg
(
"input error: unknown stream type (%d)
\n
"
,
p_input
->
p_es
[
i_es_loop
].
i_type
);
p_input
->
p_es
[
i_es_loop
].
i_type
);
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
-
1
);
return
(
-
1
);
break
;
break
;
}
}
/* Initialise the demux */
/* Initialise the demux */
p_input
->
p_es
[
i_es_loop
].
p_pes_packet
=
NULL
;
p_input
->
p_es
[
i_es_loop
].
p_pes_packet
=
NULL
;
p_input
->
p_es
[
i_es_loop
].
i_continuity_counter
=
0
xFF
;
p_input
->
p_es
[
i_es_loop
].
i_continuity_counter
=
0
;
p_input
->
p_es
[
i_es_loop
].
b_random
=
0
;
p_input
->
p_es
[
i_es_loop
].
b_random
=
0
;
/* Mark stream to be demultiplexed. */
/* Mark stream to be demultiplexed. */
intf_DbgMsg
(
"Stream %d added in %d
\n
"
,
i_current_id
,
i_selected_es_loop
);
intf_DbgMsg
(
"Stream %d added in %d
\n
"
,
i_current_id
,
i_selected_es_loop
);
p_input
->
pp_selected_es
[
i_selected_es_loop
]
=
&
p_input
->
p_es
[
i_es_loop
];
p_input
->
pp_selected_es
[
i_selected_es_loop
]
=
&
p_input
->
p_es
[
i_es_loop
];
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
0
);
return
(
0
);
}
}
}
}
}
}
/* We haven't found this PID in the current stream. */
/* We haven't found this PID in the current stream. */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
intf_ErrMsg
(
"input error: can't find PID %d
\n
"
,
i_current_id
);
intf_ErrMsg
(
"input error: can't find PID %d
\n
"
,
i_current_id
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -167,7 +167,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -167,7 +167,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
/* Since this function is intended to be called by interface, lock the
/* Since this function is intended to be called by interface, lock the
structure. */
structure. */
pthread
_mutex_lock
(
&
p_input
->
es_lock
);
vlc
_mutex_lock
(
&
p_input
->
es_lock
);
/* Find out which PID we need. */
/* Find out which PID we need. */
for
(
i_selected_es_loop
=
0
;
i_selected_es_loop
<
INPUT_MAX_SELECTED_ES
;
for
(
i_selected_es_loop
=
0
;
i_selected_es_loop
<
INPUT_MAX_SELECTED_ES
;
...
@@ -180,7 +180,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -180,7 +180,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
if
(
!
(
p_input
->
pp_selected_es
[
i_selected_es_loop
]
->
p_dec
)
)
if
(
!
(
p_input
->
pp_selected_es
[
i_selected_es_loop
]
->
p_dec
)
)
{
{
/* We don't have a decoder for that PID. */
/* We don't have a decoder for that PID. */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
intf_ErrMsg
(
"input error: PID %d already deselected
\n
"
,
intf_ErrMsg
(
"input error: PID %d already deselected
\n
"
,
i_current_id
);
i_current_id
);
return
(
-
1
);
return
(
-
1
);
...
@@ -217,14 +217,14 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
...
@@ -217,14 +217,14 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
p_input
->
pp_selected_es
[
i_last_selected
];
p_input
->
pp_selected_es
[
i_last_selected
];
p_input
->
pp_selected_es
[
i_last_selected
]
=
NULL
;
p_input
->
pp_selected_es
[
i_last_selected
]
=
NULL
;
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
0
);
return
(
0
);
}
}
}
}
}
}
/* We haven't found this PID in the current stream. */
/* We haven't found this PID in the current stream. */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
intf_ErrMsg
(
"input error: can't find PID %d
\n
"
,
i_current_id
);
intf_ErrMsg
(
"input error: can't find PID %d
\n
"
,
i_current_id
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -244,7 +244,7 @@ boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
...
@@ -244,7 +244,7 @@ boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
/* Since this function is intended to be called by interface, lock the
/* Since this function is intended to be called by interface, lock the
structure. */
structure. */
pthread
_mutex_lock
(
&
p_input
->
es_lock
);
vlc
_mutex_lock
(
&
p_input
->
es_lock
);
/* Scan the table */
/* Scan the table */
while
(
i_index
<
INPUT_MAX_SELECTED_ES
&&
!
p_input
->
pp_selected_es
[
i_index
]
)
while
(
i_index
<
INPUT_MAX_SELECTED_ES
&&
!
p_input
->
pp_selected_es
[
i_index
]
)
...
@@ -257,7 +257,7 @@ boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
...
@@ -257,7 +257,7 @@ boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
}
}
/* Unlock the structure */
/* Unlock the structure */
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
return
(
b_is_recv
);
return
(
b_is_recv
);
}
}
src/input/input_file.c
View file @
a6d3ffa1
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
/*******************************************************************************
/*******************************************************************************
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <pthread.h>
#include <sys/uio.h>
#include <sys/uio.h>
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "input.h"
#include "input_file.h"
#include "input_file.h"
...
...
src/input/input_netlist.c
View file @
a6d3ffa1
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
/*******************************************************************************
/*******************************************************************************
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <pthread.h>
#include <sys/uio.h>
#include <sys/uio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -18,6 +17,7 @@
...
@@ -18,6 +17,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "intf_msg.h"
#include "intf_msg.h"
#include "debug.h"
#include "debug.h"
#include "input.h"
#include "input.h"
...
...
src/input/input_network.c
View file @
a6d3ffa1
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
/*******************************************************************************
/*******************************************************************************
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <pthread.h>
#include <sys/uio.h>
#include <sys/uio.h>
#include <string.h>
#include <string.h>
#include <stdio.h>
#include <stdio.h>
...
@@ -24,6 +23,7 @@
...
@@ -24,6 +23,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "netutils.h"
#include "netutils.h"
#include "input.h"
#include "input.h"
...
...
src/input/input_pcr.c
View file @
a6d3ffa1
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <stdio.h>
#include <stdio.h>
#include <pthread.h>
#include <sys/uio.h>
/* iovec */
#include <sys/uio.h>
/* iovec */
#include <stdlib.h>
/* atoi(), malloc(), free() */
#include <stdlib.h>
/* atoi(), malloc(), free() */
#include <netinet/in.h>
#include <netinet/in.h>
...
@@ -17,6 +16,7 @@
...
@@ -17,6 +16,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "debug.h"
#include "debug.h"
#include "input.h"
#include "input.h"
#include "intf_msg.h"
#include "intf_msg.h"
...
@@ -54,7 +54,7 @@ int input_PcrInit( input_thread_t *p_input )
...
@@ -54,7 +54,7 @@ int input_PcrInit( input_thread_t *p_input )
{
{
return
(
-
1
);
return
(
-
1
);
}
}
pthread_mutex_init
(
&
p_input
->
p_pcr
->
lock
,
NULL
);
vlc_mutex_init
(
&
p_input
->
p_pcr
->
lock
);
input_PcrReInit
(
p_input
);
input_PcrReInit
(
p_input
);
return
(
0
);
return
(
0
);
...
@@ -81,7 +81,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
...
@@ -81,7 +81,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
sys_time
=
mdate
();
sys_time
=
mdate
();
delta_clock
=
sys_time
-
pcr_time
;
delta_clock
=
sys_time
-
pcr_time
;
pthread
_mutex_lock
(
&
p_pcr
->
lock
);
vlc
_mutex_lock
(
&
p_pcr
->
lock
);
if
(
p_es
->
b_discontinuity
||
if
(
p_es
->
b_discontinuity
||
(
p_pcr
->
last_pcr
!=
0
&&
(
p_pcr
->
last_pcr
!=
0
&&
...
@@ -106,7 +106,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
...
@@ -106,7 +106,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
p_pcr
->
c_average
++
;
p_pcr
->
c_average
++
;
}
}
pthread
_mutex_unlock
(
&
p_pcr
->
lock
);
vlc
_mutex_unlock
(
&
p_pcr
->
lock
);
#ifdef STATS
#ifdef STATS
{
{
...
...
src/input/input_psi.c
View file @
a6d3ffa1
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
* Preamble
* Preamble
******************************************************************************/
******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <stdio.h>
#include <sys/uio.h>
/* iovec */
#include <sys/uio.h>
/* iovec */
#include <stdlib.h>
/* atoi(), malloc(), free() */
#include <stdlib.h>
/* atoi(), malloc(), free() */
...
@@ -23,6 +22,7 @@
...
@@ -23,6 +22,7 @@
#include "common.h"
#include "common.h"
#include "config.h"
#include "config.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "intf_msg.h"
#include "intf_msg.h"
#include "debug.h"
#include "debug.h"
...
@@ -163,7 +163,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
...
@@ -163,7 +163,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
ASSERT
(
p_input
);
ASSERT
(
p_input
);
/* Lock the tables, since this method can be called from any thread */
/* Lock the tables, since this method can be called from any thread */
//
pthread
_mutex_lock()
//
vlc
_mutex_lock()
/* Check if the table is complete or not */
/* Check if the table is complete or not */
if
(
!
p_input
->
p_stream
->
b_is_PMT_complete
)
if
(
!
p_input
->
p_stream
->
b_is_PMT_complete
)
...
@@ -195,7 +195,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
...
@@ -195,7 +195,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
}
}
/* Unock the tables */
/* Unock the tables */
//
pthread
_mutex_unlock()
//
vlc
_mutex_unlock()
}
}
/******************************************************************************
/******************************************************************************
...
@@ -566,7 +566,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
...
@@ -566,7 +566,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
intf_DbgMsg
(
"ES Type: %d
\n
"
,
p_pms
[
i_offset
]);
intf_DbgMsg
(
"ES Type: %d
\n
"
,
p_pms
[
i_offset
]);
/* Read PID of that ES */
/* Read PID of that ES */
i_es_pid
=
U16_AT
(
&
p_pms
[
i_offset
+
1
])
&
0x1FF
F
;
i_es_pid
=
U16_AT
(
&
p_pms
[
i_offset
+
1
])
&
0x1FF
;
intf_DbgMsg
(
"ES PID: %d
\n
"
,
i_es_pid
);
intf_DbgMsg
(
"ES PID: %d
\n
"
,
i_es_pid
);
/* Add the ES to the program description and reserve a slot in the
/* Add the ES to the program description and reserve a slot in the
...
@@ -880,7 +880,7 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
...
@@ -880,7 +880,7 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
/* Ask the input thread to demultiplex it: since the interface
/* Ask the input thread to demultiplex it: since the interface
can also access the table of selected es, lock the elementary
can also access the table of selected es, lock the elementary
stream structure */
stream structure */
pthread
_mutex_lock
(
&
p_input
->
es_lock
);
vlc
_mutex_lock
(
&
p_input
->
es_lock
);
for
(
i_index
=
0
;
i_index
<
INPUT_MAX_SELECTED_ES
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
INPUT_MAX_SELECTED_ES
;
i_index
++
)
{
{
if
(
!
p_input
->
pp_selected_es
[
i_index
]
)
if
(
!
p_input
->
pp_selected_es
[
i_index
]
)
...
@@ -891,7 +891,7 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
...
@@ -891,7 +891,7 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
break
;
break
;
}
}
}
}
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
if
(
i_index
>=
INPUT_MAX_SELECTED_ES
)
if
(
i_index
>=
INPUT_MAX_SELECTED_ES
)
{
{
...
@@ -922,7 +922,7 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
...
@@ -922,7 +922,7 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
/* Stop to receive the ES. Since the interface can also access the table
/* Stop to receive the ES. Since the interface can also access the table
of selected es, lock the elementary stream structure */
of selected es, lock the elementary stream structure */
pthread
_mutex_lock
(
&
p_input
->
es_lock
);
vlc
_mutex_lock
(
&
p_input
->
es_lock
);
for
(
i_es_index
=
0
;
i_es_index
<
INPUT_MAX_SELECTED_ES
;
i_es_index
++
)
for
(
i_es_index
=
0
;
i_es_index
<
INPUT_MAX_SELECTED_ES
;
i_es_index
++
)
{
{
...
@@ -942,7 +942,7 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
...
@@ -942,7 +942,7 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
}
}
}
}
pthread
_mutex_unlock
(
&
p_input
->
es_lock
);
vlc
_mutex_unlock
(
&
p_input
->
es_lock
);
#ifdef DEBUG
#ifdef DEBUG
/* Check if the pp_selected_es table may be corrupted */
/* Check if the pp_selected_es table may be corrupted */
...
@@ -1167,7 +1167,7 @@ static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
...
@@ -1167,7 +1167,7 @@ static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
}
}
/******************************************************************************
/******************************************************************************
*
Destroy
PgrmDescr: destroy a program descriptor
*
Add
PgrmDescr: destroy a program descriptor
******************************************************************************
******************************************************************************
* All ES descriptions referenced in the descriptor will be deleted.
* All ES descriptions referenced in the descriptor will be deleted.
******************************************************************************/
******************************************************************************/
...
@@ -1253,7 +1253,6 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
...
@@ -1253,7 +1253,6 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
p_es
->
i_type
=
0
;
/* ??? */
p_es
->
i_type
=
0
;
/* ??? */
p_es
->
b_psi
=
0
;
p_es
->
b_psi
=
0
;
p_es
->
b_pcr
=
0
;
p_es
->
b_pcr
=
0
;
p_es
->
i_continuity_counter
=
0xFF
;
p_es
->
p_pes_packet
=
NULL
;
p_es
->
p_pes_packet
=
NULL
;
// p_es->p_next_pes_packet = NULL;
// p_es->p_next_pes_packet = NULL;
...
@@ -1270,7 +1269,7 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
...
@@ -1270,7 +1269,7 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
i_es_pid
,
p_pgrm
->
i_number
);
i_es_pid
,
p_pgrm
->
i_number
);
}
}
else
else
intf_DbgMsg
(
"ES %d not added to the definition of any pgrm
\n
"
,
intf_DbgMsg
(
"
Added
ES %d not added to the definition of any pgrm
\n
"
,
i_es_pid
);
i_es_pid
);
}
}
...
...
src/input/input_vlan.c
View file @
a6d3ffa1
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <unistd.h>
#include <unistd.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -46,6 +45,7 @@
...
@@ -46,6 +45,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "netutils.h"
#include "netutils.h"
#include "input.h"
#include "input.h"
...
@@ -172,7 +172,7 @@ int input_VlanMethodInit( input_vlan_method_t *p_method, char *psz_server, int i
...
@@ -172,7 +172,7 @@ int input_VlanMethodInit( input_vlan_method_t *p_method, char *psz_server, int i
}
}
/* Initialize lock */
/* Initialize lock */
pthread_mutex_init
(
&
p_method
->
lock
,
NULL
);
vlc_mutex_init
(
&
p_method
->
lock
);
intf_Msg
(
"input: vlans input method installed
\n
"
,
p_method
->
i_ifaces
);
intf_Msg
(
"input: vlans input method installed
\n
"
,
p_method
->
i_ifaces
);
return
(
0
);
return
(
0
);
...
@@ -270,7 +270,7 @@ int input_VlanJoin( int i_vlan_id )
...
@@ -270,7 +270,7 @@ int input_VlanJoin( int i_vlan_id )
}
}
/* Get lock */
/* Get lock */
pthread
_mutex_lock
(
&
p_method
->
lock
);
vlc
_mutex_lock
(
&
p_method
->
lock
);
/* If the interface is in the wished vlan, increase lock counter */
/* If the interface is in the wished vlan, increase lock counter */
if
(
p_iface
->
i_vlan
!=
VLAN_ID_VLAN
(
i_vlan_id
)
)
if
(
p_iface
->
i_vlan
!=
VLAN_ID_VLAN
(
i_vlan_id
)
)
...
@@ -301,7 +301,7 @@ int input_VlanJoin( int i_vlan_id )
...
@@ -301,7 +301,7 @@ int input_VlanJoin( int i_vlan_id )
}
}
/* Release lock (if this point is reached, the function succeeded) */
/* Release lock (if this point is reached, the function succeeded) */
pthread
_mutex_unlock
(
&
p_method
->
lock
);
vlc
_mutex_unlock
(
&
p_method
->
lock
);
return
(
i_err
);
return
(
i_err
);
}
}
...
@@ -327,13 +327,13 @@ void input_VlanLeave( int i_vlan_id )
...
@@ -327,13 +327,13 @@ void input_VlanLeave( int i_vlan_id )
}
}
/* Get lock */
/* Get lock */
pthread
_mutex_lock
(
&
p_method
->
lock
);
vlc
_mutex_lock
(
&
p_method
->
lock
);
/* Decrease reference counter */
/* Decrease reference counter */
p_method
->
p_iface
[
VLAN_ID_IFACE
(
i_vlan_id
)
].
i_refcount
--
;
p_method
->
p_iface
[
VLAN_ID_IFACE
(
i_vlan_id
)
].
i_refcount
--
;
/* Release lock */
/* Release lock */
pthread
_mutex_unlock
(
&
p_method
->
lock
);
vlc
_mutex_unlock
(
&
p_method
->
lock
);
}
}
/*******************************************************************************
/*******************************************************************************
...
@@ -391,7 +391,7 @@ int input_VlanSynchronize( void )
...
@@ -391,7 +391,7 @@ int input_VlanSynchronize( void )
/* Get lock */
/* Get lock */
p_method
=
&
p_program_data
->
input_vlan_method
;
p_method
=
&
p_program_data
->
input_vlan_method
;
pthread
_mutex_lock
(
&
p_method
->
lock
);
vlc
_mutex_lock
(
&
p_method
->
lock
);
for
(
i_index
=
0
;
i_index
<
p_method
->
i_ifaces
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
p_method
->
i_ifaces
;
i_index
++
)
{
{
...
@@ -431,7 +431,7 @@ int input_VlanSynchronize( void )
...
@@ -431,7 +431,7 @@ int input_VlanSynchronize( void )
}
}
/* Release lock */
/* Release lock */
pthread
_mutex_unlock
(
&
p_method
->
lock
);
vlc
_mutex_unlock
(
&
p_method
->
lock
);
return
(
0
);
return
(
0
);
}
}
...
...
src/interface/control.c
View file @
a6d3ffa1
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
/*******************************************************************************
/*******************************************************************************
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <pthread.h>
#include <stdio.h>
#include <stdio.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <sys/soundcard.h>
#include <sys/soundcard.h>
...
@@ -21,6 +20,7 @@
...
@@ -21,6 +20,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "input.h"
#include "input_vlan.h"
#include "input_vlan.h"
...
...
src/interface/interface.c
View file @
a6d3ffa1
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
/*******************************************************************************
/*******************************************************************************
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <pthread.h>
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
#include <netinet/in.h>
#include <netinet/in.h>
...
@@ -25,6 +24,7 @@
...
@@ -25,6 +24,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "thread.h"
#include "thread.h"
#include "debug.h"
#include "debug.h"
...
...
src/interface/intf_cmd.c
View file @
a6d3ffa1
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -24,6 +23,7 @@
...
@@ -24,6 +23,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "input.h"
#include "input_vlan.h"
#include "input_vlan.h"
...
...
src/interface/intf_ctrl.c
View file @
a6d3ffa1
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <fcntl.h>
#include <pthread.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -41,6 +40,7 @@
...
@@ -41,6 +40,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "debug.h"
#include "debug.h"
#include "intf_msg.h"
#include "intf_msg.h"
...
...
src/interface/intf_msg.c
View file @
a6d3ffa1
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <stdio.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -29,6 +28,7 @@
...
@@ -29,6 +28,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "debug.h"
#include "debug.h"
#include "input.h"
#include "input.h"
...
@@ -73,7 +73,7 @@ int intf_InitMsg( interface_msg_t *p_intf_msg )
...
@@ -73,7 +73,7 @@ int intf_InitMsg( interface_msg_t *p_intf_msg )
{
{
#ifdef INTF_MSG_QUEUE
#ifdef INTF_MSG_QUEUE
/* Message queue initialization */
/* Message queue initialization */
pthread_mutex_init
(
&
p_intf_msg
->
lock
,
NULL
);
/* intialize lock */
vlc_mutex_init
(
&
p_intf_msg
->
lock
);
/* intialize lock */
p_intf_msg
->
i_count
=
0
;
/* queue is empty */
p_intf_msg
->
i_count
=
0
;
/* queue is empty */
#endif
#endif
...
@@ -241,9 +241,9 @@ void _intf_DbgMsgImm( char *psz_file, char *psz_function, int i_line,
...
@@ -241,9 +241,9 @@ void _intf_DbgMsgImm( char *psz_file, char *psz_function, int i_line,
#ifdef INTF_MSG_QUEUE
#ifdef INTF_MSG_QUEUE
void
intf_FlushMsg
(
void
)
void
intf_FlushMsg
(
void
)
{
{
pthread_mutex_lock
(
&
p_program_data
->
intf_msg
.
lock
);
/* get lock */
vlc_mutex_lock
(
&
p_program_data
->
intf_msg
.
lock
);
/* get lock */
FlushLockedMsg
(
&
p_program_data
->
intf_msg
);
/* flush messages */
FlushLockedMsg
(
&
p_program_data
->
intf_msg
);
/* flush messages */
pthread_mutex_unlock
(
&
p_program_data
->
intf_msg
.
lock
);
/* give lock back */
vlc_mutex_unlock
(
&
p_program_data
->
intf_msg
.
lock
);
/* give lock back */
}
}
#endif
#endif
...
@@ -280,7 +280,7 @@ static void QueueMsg(interface_msg_t *p_intf_msg, int i_type, char *psz_format,
...
@@ -280,7 +280,7 @@ static void QueueMsg(interface_msg_t *p_intf_msg, int i_type, char *psz_format,
* Queue mode: the queue is flushed if it is full, then the message is
* Queue mode: the queue is flushed if it is full, then the message is
* queued. A lock is required on queue to avoid indexes corruption
* queued. A lock is required on queue to avoid indexes corruption
*/
*/
pthread_mutex_lock
(
&
p_intf_msg
->
lock
);
/* get lock */
vlc_mutex_lock
(
&
p_intf_msg
->
lock
);
/* get lock */
if
(
p_intf_msg
->
i_count
==
INTF_MSG_QSIZE
)
/* flush queue if needed */
if
(
p_intf_msg
->
i_count
==
INTF_MSG_QSIZE
)
/* flush queue if needed */
{
{
...
@@ -297,7 +297,7 @@ static void QueueMsg(interface_msg_t *p_intf_msg, int i_type, char *psz_format,
...
@@ -297,7 +297,7 @@ static void QueueMsg(interface_msg_t *p_intf_msg, int i_type, char *psz_format,
p_intf_msg
->
msg
[
p_intf_msg
->
i_count
].
date
=
mdate
();
p_intf_msg
->
msg
[
p_intf_msg
->
i_count
].
date
=
mdate
();
#endif
#endif
pthread_mutex_unlock
(
&
p_intf_msg
->
lock
);
/* give lock back */
vlc_mutex_unlock
(
&
p_intf_msg
->
lock
);
/* give lock back */
#else
#else
...
@@ -346,7 +346,7 @@ static void QueueDbgMsg(interface_msg_t *p_intf_msg, char *psz_file, char *psz_f
...
@@ -346,7 +346,7 @@ static void QueueDbgMsg(interface_msg_t *p_intf_msg, char *psz_file, char *psz_f
* Queue mode: the queue is flushed if it is full, then the message is
* Queue mode: the queue is flushed if it is full, then the message is
* queued. A lock is required on queue to avoid indexes corruption
* queued. A lock is required on queue to avoid indexes corruption
*/
*/
pthread_mutex_lock
(
&
p_intf_msg
->
lock
);
/* get lock */
vlc_mutex_lock
(
&
p_intf_msg
->
lock
);
/* get lock */
if
(
p_intf_msg
->
i_count
==
INTF_MSG_QSIZE
)
/* flush queue if needed */
if
(
p_intf_msg
->
i_count
==
INTF_MSG_QSIZE
)
/* flush queue if needed */
{
{
...
@@ -362,7 +362,7 @@ static void QueueDbgMsg(interface_msg_t *p_intf_msg, char *psz_file, char *psz_f
...
@@ -362,7 +362,7 @@ static void QueueDbgMsg(interface_msg_t *p_intf_msg, char *psz_file, char *psz_f
p_intf_msg
->
msg
[
p_intf_msg
->
i_count
].
i_line
=
i_line
;
p_intf_msg
->
msg
[
p_intf_msg
->
i_count
].
i_line
=
i_line
;
p_intf_msg
->
msg
[
p_intf_msg
->
i_count
++
].
psz_msg
=
psz_str
;
p_intf_msg
->
msg
[
p_intf_msg
->
i_count
++
].
psz_msg
=
psz_str
;
pthread_mutex_unlock
(
&
p_intf_msg
->
lock
);
/* give lock back */
vlc_mutex_unlock
(
&
p_intf_msg
->
lock
);
/* give lock back */
#else
#else
...
...
src/interface/main.c
View file @
a6d3ffa1
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <getopt.h>
#include <getopt.h>
#include <pthread.h>
#include <signal.h>
#include <signal.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -25,6 +24,7 @@
...
@@ -25,6 +24,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "netutils.h"
#include "netutils.h"
#include "debug.h"
#include "debug.h"
...
...
src/interface/xconsole.c
View file @
a6d3ffa1
...
@@ -24,7 +24,6 @@
...
@@ -24,7 +24,6 @@
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <keysym.h>
#include <keysym.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
...
@@ -34,6 +33,7 @@
...
@@ -34,6 +33,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "xutils.h"
#include "xutils.h"
#include "xconsole.h"
#include "xconsole.h"
...
...
src/video_decoder/video_decoder.c
View file @
a6d3ffa1
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
...
@@ -21,6 +20,7 @@
...
@@ -21,6 +20,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "intf_msg.h"
#include "intf_msg.h"
#include "debug.h"
/* ?? temporaire, requis par netlist.h */
#include "debug.h"
/* ?? temporaire, requis par netlist.h */
...
@@ -73,8 +73,8 @@ vdec_thread_t * vdec_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
...
@@ -73,8 +73,8 @@ vdec_thread_t * vdec_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
* Initialize the input properties
* Initialize the input properties
*/
*/
/* Initialize the decoder fifo's data lock and conditional variable and set * its buffer as empty */
/* Initialize the decoder fifo's data lock and conditional variable and set * its buffer as empty */
pthread_mutex_init
(
&
p_vdec
->
fifo
.
data_lock
,
NULL
);
vlc_mutex_init
(
&
p_vdec
->
fifo
.
data_lock
);
pthread_cond_init
(
&
p_vdec
->
fifo
.
data_wait
,
NULL
);
vlc_cond_init
(
&
p_vdec
->
fifo
.
data_wait
);
p_vdec
->
fifo
.
i_start
=
0
;
p_vdec
->
fifo
.
i_start
=
0
;
p_vdec
->
fifo
.
i_end
=
0
;
p_vdec
->
fifo
.
i_end
=
0
;
/* Initialize the bit stream structure */
/* Initialize the bit stream structure */
...
@@ -84,7 +84,7 @@ vdec_thread_t * vdec_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
...
@@ -84,7 +84,7 @@ vdec_thread_t * vdec_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
p_vdec
->
bit_stream
.
fifo
.
i_available
=
0
;
p_vdec
->
bit_stream
.
fifo
.
i_available
=
0
;
/* Spawn the video decoder thread */
/* Spawn the video decoder thread */
if
(
pthread_create
(
&
p_vdec
->
thread_id
,
NULL
,
(
void
*
)
RunThread
,
(
void
*
)
p_vdec
)
)
if
(
vlc_thread_create
(
&
p_vdec
->
thread_id
,
"video decoder"
,
(
vlc_thread_func
)
RunThread
,
(
void
*
)
p_vdec
)
)
{
{
intf_ErrMsg
(
"vdec error: can't spawn video decoder thread
\n
"
);
intf_ErrMsg
(
"vdec error: can't spawn video decoder thread
\n
"
);
free
(
p_vdec
);
free
(
p_vdec
);
...
@@ -109,13 +109,13 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
...
@@ -109,13 +109,13 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
/* Ask thread to kill itself */
/* Ask thread to kill itself */
p_vdec
->
b_die
=
1
;
p_vdec
->
b_die
=
1
;
/* Make sure the decoder thread leaves the GetByte() function */
/* Make sure the decoder thread leaves the GetByte() function */
pthread
_mutex_lock
(
&
(
p_vdec
->
fifo
.
data_lock
)
);
vlc
_mutex_lock
(
&
(
p_vdec
->
fifo
.
data_lock
)
);
pthread
_cond_signal
(
&
(
p_vdec
->
fifo
.
data_wait
)
);
vlc
_cond_signal
(
&
(
p_vdec
->
fifo
.
data_wait
)
);
pthread
_mutex_unlock
(
&
(
p_vdec
->
fifo
.
data_lock
)
);
vlc
_mutex_unlock
(
&
(
p_vdec
->
fifo
.
data_lock
)
);
/* Waiting for the decoder thread to exit */
/* Waiting for the decoder thread to exit */
/* Remove this as soon as the "status" flag is implemented */
/* Remove this as soon as the "status" flag is implemented */
pthread_join
(
p_vdec
->
thread_id
,
NULL
);
vlc_thread_join
(
p_vdec
->
thread_id
);
}
}
/* following functions are local */
/* following functions are local */
...
@@ -149,14 +149,14 @@ static int InitThread( vdec_thread_t *p_vdec )
...
@@ -149,14 +149,14 @@ static int InitThread( vdec_thread_t *p_vdec )
/* Our first job is to initialize the bit stream structure with the
/* Our first job is to initialize the bit stream structure with the
* beginning of the input stream */
* beginning of the input stream */
pthread
_mutex_lock
(
&
p_vdec
->
fifo
.
data_lock
);
vlc
_mutex_lock
(
&
p_vdec
->
fifo
.
data_lock
);
while
(
DECODER_FIFO_ISEMPTY
(
p_vdec
->
fifo
)
)
while
(
DECODER_FIFO_ISEMPTY
(
p_vdec
->
fifo
)
)
{
{
pthread
_cond_wait
(
&
p_vdec
->
fifo
.
data_wait
,
&
p_vdec
->
fifo
.
data_lock
);
vlc
_cond_wait
(
&
p_vdec
->
fifo
.
data_wait
,
&
p_vdec
->
fifo
.
data_lock
);
}
}
p_vdec
->
bit_stream
.
p_ts
=
DECODER_FIFO_START
(
p_vdec
->
fifo
)
->
p_first_ts
;
p_vdec
->
bit_stream
.
p_ts
=
DECODER_FIFO_START
(
p_vdec
->
fifo
)
->
p_first_ts
;
p_vdec
->
bit_stream
.
i_byte
=
p_vdec
->
bit_stream
.
p_ts
->
i_payload_start
;
p_vdec
->
bit_stream
.
i_byte
=
p_vdec
->
bit_stream
.
p_ts
->
i_payload_start
;
pthread
_mutex_unlock
(
&
p_vdec
->
fifo
.
data_lock
);
vlc
_mutex_unlock
(
&
p_vdec
->
fifo
.
data_lock
);
#if 0
#if 0
/* ?? */
/* ?? */
...
@@ -250,7 +250,7 @@ static void ErrorThread( vdec_thread_t *p_vdec )
...
@@ -250,7 +250,7 @@ static void ErrorThread( vdec_thread_t *p_vdec )
{
{
/* We take the lock, because we are going to read/write the start/end
/* We take the lock, because we are going to read/write the start/end
* indexes of the decoder fifo */
* indexes of the decoder fifo */
pthread
_mutex_lock
(
&
p_vdec
->
fifo
.
data_lock
);
vlc
_mutex_lock
(
&
p_vdec
->
fifo
.
data_lock
);
/* ?? trash all trashable PES packets */
/* ?? trash all trashable PES packets */
while
(
!
DECODER_FIFO_ISEMPTY
(
p_vdec
->
fifo
)
)
while
(
!
DECODER_FIFO_ISEMPTY
(
p_vdec
->
fifo
)
)
...
@@ -259,7 +259,7 @@ static void ErrorThread( vdec_thread_t *p_vdec )
...
@@ -259,7 +259,7 @@ static void ErrorThread( vdec_thread_t *p_vdec )
DECODER_FIFO_INCSTART
(
p_vdec
->
fifo
);
DECODER_FIFO_INCSTART
(
p_vdec
->
fifo
);
}
}
pthread
_mutex_unlock
(
&
p_vdec
->
fifo
.
data_lock
);
vlc
_mutex_unlock
(
&
p_vdec
->
fifo
.
data_lock
);
/* Sleep a while */
/* Sleep a while */
msleep
(
VDEC_IDLE_SLEEP
);
msleep
(
VDEC_IDLE_SLEEP
);
}
}
...
...
src/video_output/video_output.c
View file @
a6d3ffa1
This diff is collapsed.
Click to expand it.
src/video_output/video_x11.c
View file @
a6d3ffa1
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
* Preamble
* Preamble
*******************************************************************************/
*******************************************************************************/
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
...
@@ -27,6 +26,7 @@
...
@@ -27,6 +26,7 @@
#include "config.h"
#include "config.h"
#include "common.h"
#include "common.h"
#include "mtime.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "xutils.h"
#include "xutils.h"
#include "input.h"
#include "input.h"
...
...
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