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
c0cab766
Commit
c0cab766
authored
Oct 21, 2002
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* input_ext-dec.* : add a new function to parse decoder fifo at PES level
(input_NextPES); * araw.c : use this new function.
parent
14aec216
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
56 deletions
+109
-56
include/input_ext-dec.h
include/input_ext-dec.h
+3
-1
modules/codec/araw.c
modules/codec/araw.c
+52
-54
src/input/input_ext-dec.c
src/input/input_ext-dec.c
+54
-1
No files found.
include/input_ext-dec.h
View file @
c0cab766
...
...
@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.7
1 2002/08/30 22:22:24 massiot
Exp $
* $Id: input_ext-dec.h,v 1.7
2 2002/10/21 10:46:34 fenrir
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
...
...
@@ -216,6 +216,8 @@ VLC_EXPORT( u32, UnalignedGetBits, ( bit_stream_t *, unsigned int ) );
VLC_EXPORT
(
void
,
CurrentPTS
,
(
bit_stream_t
*
,
mtime_t
*
,
mtime_t
*
)
);
VLC_EXPORT
(
void
,
NextPTS
,
(
bit_stream_t
*
,
mtime_t
*
,
mtime_t
*
)
);
VLC_EXPORT
(
int
,
input_NextPES
,
(
decoder_fifo_t
*
,
pes_packet_t
**
)
);
/*****************************************************************************
* AlignWord : fill in the bit buffer so that the byte pointer be aligned
* on a word boundary (XXX: there must be at least sizeof(WORD_TYPE) - 1
...
...
modules/codec/araw.c
View file @
c0cab766
...
...
@@ -2,7 +2,7 @@
* araw.c: Pseudo audio decoder; for raw pcm data
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: araw.c,v 1.
2 2002/10/20 17:44:17
fenrir Exp $
* $Id: araw.c,v 1.
3 2002/10/21 10:46:34
fenrir Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -52,7 +52,7 @@ typedef struct adec_thread_s
waveformatex_t
format
;
/* The bit stream structure handles the PES stream at the bit level */
bit_stream_t
bit_stream
;
//
bit_stream_t bit_stream;
/* Input properties */
decoder_fifo_t
*
p_fifo
;
...
...
@@ -191,48 +191,6 @@ static void GetWaveFormatEx( waveformatex_t *p_wh,
}
}
/* get the first pes from fifo */
static
pes_packet_t
*
PESGetFirst
(
decoder_fifo_t
*
p_fifo
)
{
pes_packet_t
*
p_pes
;
vlc_mutex_lock
(
&
p_fifo
->
data_lock
);
/* if fifo is empty wait */
while
(
!
p_fifo
->
p_first
)
{
if
(
p_fifo
->
b_die
)
{
vlc_mutex_unlock
(
&
p_fifo
->
data_lock
);
return
NULL
;
}
vlc_cond_wait
(
&
p_fifo
->
data_wait
,
&
p_fifo
->
data_lock
);
}
p_pes
=
p_fifo
->
p_first
;
vlc_mutex_unlock
(
&
p_fifo
->
data_lock
);
return
p_pes
;
}
static
int
PESGetSize
(
pes_packet_t
*
p_pes
)
{
data_packet_t
*
p_data
;
int
i_size
=
0
;
if
(
!
p_pes
)
{
return
(
0
);
}
for
(
p_data
=
p_pes
->
p_first
;
p_data
!=
NULL
;
p_data
=
p_data
->
p_next
)
{
i_size
+=
p_data
->
p_payload_end
-
p_data
->
p_payload_start
;
}
return
(
i_size
);
}
/*****************************************************************************
* InitThread: initialize data before entering main loop
*****************************************************************************/
...
...
@@ -282,8 +240,9 @@ static int InitThread( adec_thread_t * p_adec )
return
(
-
1
);
}
p_adec
->
output_format
.
i_rate
=
p_adec
->
format
.
i_samplespersec
;
if
(
p_adec
->
output_format
.
i_channels
<=
0
||
p_adec
->
output_format
.
i_channels
>
5
)
if
(
p_adec
->
format
.
i_channels
<=
0
||
p_adec
->
format
.
i_channels
>
5
)
{
msg_Err
(
p_adec
->
p_fifo
,
"bad channels count(1-5)"
);
return
(
-
1
);
...
...
@@ -306,12 +265,44 @@ static int InitThread( adec_thread_t * p_adec )
}
/* Init the BitStream */
InitBitstream
(
&
p_adec
->
bit_stream
,
p_adec
->
p_fifo
,
NULL
,
NULL
);
//
InitBitstream( &p_adec->bit_stream, p_adec->p_fifo,
//
NULL, NULL );
return
(
0
);
}
static
void
GetPESData
(
u8
*
p_buf
,
int
i_max
,
pes_packet_t
*
p_pes
)
{
int
i_copy
;
int
i_count
;
data_packet_t
*
p_data
;
i_count
=
0
;
p_data
=
p_pes
->
p_first
;
while
(
p_data
!=
NULL
&&
i_count
<
i_max
)
{
i_copy
=
__MIN
(
p_data
->
p_payload_end
-
p_data
->
p_payload_start
,
i_max
-
i_count
);
if
(
i_copy
>
0
)
{
memcpy
(
p_buf
,
p_data
->
p_payload_start
,
i_copy
);
}
p_data
=
p_data
->
p_next
;
i_count
+=
i_copy
;
p_buf
+=
i_copy
;
}
if
(
i_count
<
i_max
)
{
memset
(
p_buf
,
0
,
i_max
-
i_count
);
}
}
/*****************************************************************************
* DecodeThread: decodes a frame
*****************************************************************************/
...
...
@@ -320,12 +311,17 @@ static void DecodeThread( adec_thread_t *p_adec )
aout_buffer_t
*
p_aout_buffer
;
int
i_samples
;
// per channels
int
i_size
;
pes_packet_t
*
p_pes
;
/* **** get samples count **** */
p_pes
=
PESGetFirst
(
p_adec
->
p_fifo
);
i_size
=
PESGetSize
(
p_pes
);
if
(
input_NextPES
(
p_adec
->
p_fifo
,
&
p_pes
)
<
0
)
{
p_adec
->
p_fifo
->
b_error
=
1
;
return
;
}
i_size
=
p_pes
->
i_pes_size
;
if
(
p_adec
->
format
.
i_blockalign
>
0
)
{
i_size
-=
i_size
%
p_adec
->
format
.
i_blockalign
;
...
...
@@ -368,11 +364,13 @@ static void DecodeThread( adec_thread_t *p_adec )
p_aout_buffer
->
start_date
=
aout_DateGet
(
&
p_adec
->
date
);
p_aout_buffer
->
end_date
=
aout_DateIncrement
(
&
p_adec
->
date
,
i_samples
);
GetChunk
(
&
p_adec
->
bit_stream
,
p_aout_buffer
->
p_buffer
,
p_aout_buffer
->
i_nb_bytes
);
GetPESData
(
p_aout_buffer
->
p_buffer
,
p_aout_buffer
->
i_nb_bytes
,
p_pes
);
aout_DecPlay
(
p_adec
->
p_aout
,
p_adec
->
p_aout_input
,
p_aout_buffer
);
input_DeletePES
(
p_adec
->
p_fifo
->
p_packets_mgt
,
p_pes
);
}
...
...
src/input/input_ext-dec.c
View file @
c0cab766
...
...
@@ -2,7 +2,7 @@
* input_ext-dec.c: services to the decoders
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_ext-dec.c,v 1.3
4 2002/08/26 23:00:23 massiot
Exp $
* $Id: input_ext-dec.c,v 1.3
5 2002/10/21 10:46:34 fenrir
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -471,3 +471,56 @@ void NextPTS( bit_stream_t * p_bit_stream, mtime_t * pi_pts,
}
}
/****************************************************************************
* input_NextPES : extract a PES from the fifo. If pp_pes is NULL then this
* PES is deleted, else pp_pes will be set to this PES
****************************************************************************/
int
input_NextPES
(
decoder_fifo_t
*
p_fifo
,
pes_packet_t
**
pp_pes
)
{
pes_packet_t
*
p_pes
,
*
p_next
;
vlc_mutex_lock
(
&
p_fifo
->
data_lock
);
/* if fifo is emty wait */
while
(
!
p_fifo
->
p_first
)
{
if
(
p_fifo
->
b_die
)
{
vlc_mutex_unlock
(
&
p_fifo
->
data_lock
);
if
(
pp_pes
)
{
*
pp_pes
=
NULL
;
}
return
(
-
1
);
}
vlc_cond_signal
(
&
p_fifo
->
data_wait
);
vlc_cond_wait
(
&
p_fifo
->
data_wait
,
&
p_fifo
->
data_lock
);
}
p_pes
=
p_fifo
->
p_first
;
p_next
=
p_pes
->
p_next
;
p_pes
->
p_next
=
NULL
;
p_fifo
->
p_first
=
p_next
;
p_fifo
->
i_depth
--
;
if
(
!
p_fifo
->
p_first
)
{
/* No PES in the fifo */
/* pp_last no longer valid */
p_fifo
->
pp_last
=
&
p_fifo
->
p_first
;
}
vlc_mutex_unlock
(
&
p_fifo
->
data_lock
);
if
(
pp_pes
)
{
*
pp_pes
=
p_pes
;
}
else
{
input_DeletePES
(
p_fifo
->
p_packets_mgt
,
p_pes
);
}
return
(
0
);
}
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