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
34bc07f8
Commit
34bc07f8
authored
Aug 10, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aout: allocate input from input.c, simplify
parent
b97b9eb9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
75 deletions
+48
-75
src/audio_output/aout_internal.h
src/audio_output/aout_internal.h
+3
-6
src/audio_output/dec.c
src/audio_output/dec.c
+17
-26
src/audio_output/input.c
src/audio_output/input.c
+28
-43
No files found.
src/audio_output/aout_internal.h
View file @
34bc07f8
...
...
@@ -66,9 +66,6 @@ struct aout_input_t
mtime_t
i_resamp_start_date
;
int
i_resamp_start_drift
;
/* If b_error == 1, there is no input pipeline. */
bool
b_error
;
/* last rate from input */
int
i_last_input_rate
;
...
...
@@ -130,9 +127,9 @@ static inline aout_owner_t *aout_owner (audio_output_t *aout)
*****************************************************************************/
/* From input.c : */
int
aout_InputNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
aout_input_t
*
aout_InputNew
(
audio_output_t
*
,
const
audio_sample_format_t
*
,
const
audio_sample_format_t
*
,
aout_input_t
*
,
const
aout_request_vout_t
*
);
const
aout_request_vout_t
*
);
int
aout_InputDelete
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
);
block_t
*
aout_InputPlay
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
block_t
*
p_buffer
,
int
i_input_rate
,
date_t
*
);
...
...
src/audio_output/dec.c
View file @
34bc07f8
...
...
@@ -80,15 +80,9 @@ int aout_DecNew( audio_output_t *p_aout,
return
-
1
;
}
aout_input_t
*
p_input
=
calloc
(
1
,
sizeof
(
aout_input_t
));
if
(
!
p_input
)
return
-
1
;
p_input
->
b_error
=
true
;
/* We can only be called by the decoder, so no need to lock
* p_input->lock. */
aout_owner_t
*
owner
=
aout_owner
(
p_aout
);
int
ret
=
-
1
;
aout_lock
(
p_aout
);
/* Create the audio output stream */
...
...
@@ -114,15 +108,15 @@ int aout_DecNew( audio_output_t *p_aout,
date_Set
(
&
owner
->
sync
.
date
,
VLC_TS_INVALID
);
assert
(
owner
->
input
==
NULL
);
owner
->
input
=
p_input
;
aout_InputNew
(
p_aout
,
p_format
,
&
owner
->
mixer_format
,
p_input
,
p_request_vout
);
aout_unlock
(
p_aout
);
return
0
;
owner
->
input
=
aout_InputNew
(
p_aout
,
p_format
,
&
owner
->
mixer_format
,
p_request_vout
);
if
(
owner
->
input
==
NULL
)
aout_OutputDelete
(
p_aout
);
else
ret
=
0
;
error:
aout_unlock
(
p_aout
);
free
(
p_input
);
return
-
1
;
return
ret
;
}
/*****************************************************************************
...
...
@@ -161,7 +155,6 @@ void aout_DecDelete( audio_output_t * p_aout )
static
void
aout_CheckRestart
(
audio_output_t
*
aout
)
{
aout_owner_t
*
owner
=
aout_owner
(
aout
);
aout_input_t
*
input
=
owner
->
input
;
aout_assert_locked
(
aout
);
...
...
@@ -170,7 +163,11 @@ static void aout_CheckRestart (audio_output_t *aout)
return
;
assert
(
restart
&
AOUT_RESTART_INPUT
);
aout_InputDelete
(
aout
,
input
);
const
aout_request_vout_t
request_vout
=
owner
->
input
->
request_vout
;
aout_InputDelete
(
aout
,
owner
->
input
);
owner
->
input
=
NULL
;
/* Reinitializes the output */
if
(
restart
&
AOUT_RESTART_OUTPUT
)
...
...
@@ -180,19 +177,13 @@ static void aout_CheckRestart (audio_output_t *aout)
aout_OutputDelete
(
aout
);
if
(
aout_OutputNew
(
aout
,
&
owner
->
input_format
))
{
input
->
b_error
=
true
;
return
;
/* we are officially screwed */
}
owner
->
volume
.
mixer
=
aout_MixerNew
(
aout
,
owner
->
mixer_format
.
i_format
);
}
if
(
aout_InputNew
(
aout
,
&
owner
->
input_format
,
&
owner
->
mixer_format
,
input
,
&
input
->
request_vout
))
assert
(
input
->
b_error
);
else
assert
(
!
input
->
b_error
);
owner
->
input
=
aout_InputNew
(
aout
,
&
owner
->
input_format
,
&
owner
->
mixer_format
,
&
request_vout
);
}
/**
...
...
@@ -267,7 +258,7 @@ int aout_DecPlay (audio_output_t *p_aout, block_t *p_buffer, int i_input_rate)
/
owner
->
input_format
.
i_rate
;
aout_lock
(
p_aout
);
if
(
p_input
->
b_error
)
if
(
unlikely
(
p_input
==
NULL
))
/* can happen due to restart */
{
aout_unlock
(
p_aout
);
aout_BufferFree
(
p_buffer
);
...
...
src/audio_output/input.c
View file @
34bc07f8
...
...
@@ -29,8 +29,6 @@
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <stdio.h>
...
...
@@ -46,7 +44,6 @@
#include "aout_internal.h"
static
void
inputFailure
(
audio_output_t
*
,
aout_input_t
*
,
const
char
*
);
static
void
inputDrop
(
aout_input_t
*
,
aout_buffer_t
*
);
static
void
inputResamplingStop
(
aout_input_t
*
p_input
);
...
...
@@ -61,16 +58,14 @@ static vout_thread_t *RequestVout( void *,
/*****************************************************************************
* aout_InputNew : allocate a new input and rework the filter pipeline
*****************************************************************************/
int
aout_InputNew
(
audio_output_t
*
p_aout
,
aout_input_t
*
aout_InputNew
(
audio_output_t
*
p_aout
,
const
audio_sample_format_t
*
restrict
infmt
,
const
audio_sample_format_t
*
restrict
outfmt
,
aout_input_t
*
p_input
,
const
aout_request_vout_t
*
p_request_vout
)
const
aout_request_vout_t
*
p_request_vout
)
{
audio_sample_format_t
chain_input_format
;
audio_sample_format_t
chain_output_format
;
char
*
psz_filters
,
*
psz_visual
,
*
psz_scaletempo
;
int
i_visual
;
aout_input_t
*
p_input
=
malloc
(
sizeof
(
*
p_input
));
if
(
unlikely
(
p_input
==
NULL
))
return
NULL
;
aout_FormatPrint
(
p_aout
,
"input"
,
infmt
);
p_input
->
samplerate
=
infmt
->
i_rate
;
...
...
@@ -89,8 +84,9 @@ int aout_InputNew( audio_output_t * p_aout,
}
/* Prepare format structure */
chain_input_format
=
*
infmt
;
chain_output_format
=
*
outfmt
;
audio_sample_format_t
chain_input_format
=
*
infmt
;
audio_sample_format_t
chain_output_format
=
*
outfmt
;
chain_output_format
.
i_rate
=
infmt
->
i_rate
;
aout_FormatPrepare
(
&
chain_output_format
);
...
...
@@ -98,9 +94,9 @@ int aout_InputNew( audio_output_t * p_aout,
var_AddCallback
(
p_aout
,
"visual"
,
VisualizationCallback
,
p_input
);
var_AddCallback
(
p_aout
,
"equalizer"
,
EqualizerCallback
,
p_input
);
psz_filters
=
var_GetString
(
p_aout
,
"audio-filter"
);
psz_visual
=
var_GetString
(
p_aout
,
"audio-visual"
);
psz_scaletempo
=
var_InheritBool
(
p_aout
,
"audio-time-stretch"
)
?
strdup
(
"scaletempo"
)
:
NULL
;
char
*
psz_filters
=
var_GetString
(
p_aout
,
"audio-filter"
);
char
*
psz_visual
=
var_GetString
(
p_aout
,
"audio-visual"
);
char
*
psz_scaletempo
=
var_InheritBool
(
p_aout
,
"audio-time-stretch"
)
?
strdup
(
"scaletempo"
)
:
NULL
;
p_input
->
b_recycle_vout
=
psz_visual
&&
*
psz_visual
;
...
...
@@ -108,7 +104,9 @@ int aout_InputNew( audio_output_t * p_aout,
char
*
const
ppsz_array
[]
=
{
psz_scaletempo
,
psz_filters
,
psz_visual
};
p_input
->
p_playback_rate_filter
=
NULL
;
for
(
i_visual
=
0
;
i_visual
<
3
&&
AOUT_FMT_LINEAR
(
&
chain_output_format
);
i_visual
++
)
for
(
unsigned
i_visual
=
0
;
i_visual
<
3
&&
AOUT_FMT_LINEAR
(
&
chain_output_format
);
i_visual
++
)
{
char
*
psz_next
=
NULL
;
char
*
psz_parser
=
ppsz_array
[
i_visual
];
...
...
@@ -254,8 +252,8 @@ int aout_InputNew( audio_output_t * p_aout,
&
chain_input_format
,
&
chain_output_format
)
<
0
)
{
inputFailure
(
p_aout
,
p_input
,
"couldn't set an input pipeline"
);
return
-
1
;
msg_Err
(
p_aout
,
"cannot setup filtering pipeline"
);
goto
error
;
}
/* Create resamplers. */
...
...
@@ -273,8 +271,8 @@ int aout_InputNew( audio_output_t * p_aout,
&
p_input
->
i_nb_resamplers
,
&
chain_output_format
,
outfmt
)
<
0
)
{
inputFailure
(
p_aout
,
p_input
,
"couldn't set a resampler
pipeline"
);
return
-
1
;
msg_Err
(
p_aout
,
"cannot setup a resampling
pipeline"
);
goto
error
;
}
/* Setup the initial rate of the resampler */
...
...
@@ -288,10 +286,16 @@ int aout_InputNew( audio_output_t * p_aout,
}
/* Success */
p_input
->
b_error
=
false
;
p_input
->
i_last_input_rate
=
INPUT_RATE_DEFAULT
;
p_input
->
i_buffer_lost
=
0
;
return
p_input
;
return
0
;
error:
aout_FiltersDestroyPipeline
(
p_input
->
pp_filters
,
p_input
->
i_nb_filters
);
aout_FiltersDestroyPipeline
(
p_input
->
pp_resamplers
,
p_input
->
i_nb_resamplers
);
free
(
p_input
);
return
NULL
;
}
/*****************************************************************************
...
...
@@ -301,10 +305,6 @@ int aout_InputNew( audio_output_t * p_aout,
*****************************************************************************/
int
aout_InputDelete
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
)
{
aout_assert_locked
(
p_aout
);
if
(
p_input
->
b_error
)
return
0
;
var_DelCallback
(
p_aout
,
"equalizer"
,
EqualizerCallback
,
p_input
);
var_DelCallback
(
p_aout
,
"visual"
,
VisualizationCallback
,
p_input
);
...
...
@@ -548,21 +548,6 @@ block_t *aout_InputPlay(audio_output_t *p_aout, aout_input_t *p_input,
* static functions
*****************************************************************************/
static
void
inputFailure
(
audio_output_t
*
p_aout
,
aout_input_t
*
p_input
,
const
char
*
psz_error_message
)
{
/* error message */
msg_Err
(
p_aout
,
"%s"
,
psz_error_message
);
/* clean up */
aout_FiltersDestroyPipeline
(
p_input
->
pp_filters
,
p_input
->
i_nb_filters
);
aout_FiltersDestroyPipeline
(
p_input
->
pp_resamplers
,
p_input
->
i_nb_resamplers
);
/* error flag */
p_input
->
b_error
=
1
;
}
static
void
inputDrop
(
aout_input_t
*
p_input
,
aout_buffer_t
*
p_buffer
)
{
aout_BufferFree
(
p_buffer
);
...
...
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