Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a3a150b9
Commit
a3a150b9
authored
Sep 22, 2013
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trascode: reinit audio filters if audio format changes in midstream
parent
1036a0be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
18 deletions
+38
-18
modules/stream_out/transcode/audio.c
modules/stream_out/transcode/audio.c
+37
-18
modules/stream_out/transcode/transcode.h
modules/stream_out/transcode/transcode.h
+1
-0
No files found.
modules/stream_out/transcode/audio.c
View file @
a3a150b9
...
@@ -52,6 +52,31 @@ static int audio_update_format( decoder_t *p_dec )
...
@@ -52,6 +52,31 @@ static int audio_update_format( decoder_t *p_dec )
return
0
;
return
0
;
}
}
static
int
transcode_audio_initialize_filters
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
,
sout_stream_sys_t
*
p_sys
,
audio_sample_format_t
*
fmt_last
)
{
/* Load user specified audio filters */
/* XXX: These variable names come kinda out of nowhere... */
var_Create
(
p_stream
,
"audio-time-stretch"
,
VLC_VAR_BOOL
);
var_Create
(
p_stream
,
"audio-filter"
,
VLC_VAR_STRING
);
if
(
p_sys
->
psz_af
)
var_SetString
(
p_stream
,
"audio-filter"
,
p_sys
->
psz_af
);
id
->
p_af_chain
=
aout_FiltersNew
(
p_stream
,
fmt_last
,
&
id
->
p_encoder
->
fmt_in
.
audio
,
NULL
);
var_Destroy
(
p_stream
,
"audio-filter"
);
var_Destroy
(
p_stream
,
"audio-time-stretch"
);
if
(
id
->
p_af_chain
==
NULL
)
{
msg_Err
(
p_stream
,
"Unable to initialize audio filters"
);
module_unneed
(
id
->
p_encoder
,
id
->
p_encoder
->
p_module
);
id
->
p_encoder
->
p_module
=
NULL
;
module_unneed
(
id
->
p_decoder
,
id
->
p_decoder
->
p_module
);
id
->
p_decoder
->
p_module
=
NULL
;
return
VLC_EGENERIC
;
}
memcpy
(
fmt_last
,
&
p_sys
->
fmt_audio
,
sizeof
(
audio_sample_format_t
)
);
return
VLC_SUCCESS
;
}
int
transcode_audio_new
(
sout_stream_t
*
p_stream
,
int
transcode_audio_new
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
)
sout_stream_id_t
*
id
)
{
{
...
@@ -128,25 +153,8 @@ int transcode_audio_new( sout_stream_t *p_stream,
...
@@ -128,25 +153,8 @@ int transcode_audio_new( sout_stream_t *p_stream,
}
}
aout_FormatPrepare
(
&
id
->
p_encoder
->
fmt_in
.
audio
);
aout_FormatPrepare
(
&
id
->
p_encoder
->
fmt_in
.
audio
);
/* Load user specified audio filters */
if
(
unlikely
(
transcode_audio_initialize_filters
(
p_stream
,
id
,
p_sys
,
&
fmt_last
)
!=
VLC_SUCCESS
)
)
/* XXX: These variable names come kinda out of nowhere... */
var_Create
(
p_stream
,
"audio-time-stretch"
,
VLC_VAR_BOOL
);
var_Create
(
p_stream
,
"audio-filter"
,
VLC_VAR_STRING
);
if
(
p_sys
->
psz_af
)
var_SetString
(
p_stream
,
"audio-filter"
,
p_sys
->
psz_af
);
id
->
p_af_chain
=
aout_FiltersNew
(
p_stream
,
&
fmt_last
,
&
id
->
p_encoder
->
fmt_in
.
audio
,
NULL
);
var_Destroy
(
p_stream
,
"audio-filter"
);
var_Destroy
(
p_stream
,
"audio-time-stretch"
);
if
(
id
->
p_af_chain
==
NULL
)
{
msg_Err
(
p_stream
,
"cannot connect audio filters chain"
);
module_unneed
(
id
->
p_encoder
,
id
->
p_encoder
->
p_module
);
id
->
p_encoder
->
p_module
=
NULL
;
module_unneed
(
id
->
p_decoder
,
id
->
p_decoder
->
p_module
);
id
->
p_decoder
->
p_module
=
NULL
;
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -212,6 +220,17 @@ int transcode_audio_process( sout_stream_t *p_stream,
...
@@ -212,6 +220,17 @@ int transcode_audio_process( sout_stream_t *p_stream,
p_audio_buf
->
i_dts
=
p_audio_buf
->
i_pts
;
p_audio_buf
->
i_dts
=
p_audio_buf
->
i_pts
;
/* Check if audio format has changed, and filters need reinit */
if
(
unlikely
(
AOUT_FMTS_IDENTICAL
(
&
id
->
p_decoder
->
fmt_out
.
audio
,
&
p_sys
->
fmt_audio
)
)
)
{
msg_Dbg
(
p_stream
,
"Audio changed, trying to reinitialize filters"
);
if
(
id
->
p_af_chain
!=
NULL
)
aout_FiltersDelete
(
(
vlc_object_t
*
)
NULL
,
id
->
p_af_chain
);
if
(
transcode_audio_initialize_filters
(
p_stream
,
id
,
p_sys
,
&
id
->
p_decoder
->
fmt_out
.
audio
)
!=
VLC_SUCCESS
)
return
VLC_EGENERIC
;
}
/* Run filter chain */
/* Run filter chain */
p_audio_buf
=
aout_FiltersPlay
(
id
->
p_af_chain
,
p_audio_buf
,
p_audio_buf
=
aout_FiltersPlay
(
id
->
p_af_chain
,
p_audio_buf
,
INPUT_RATE_DEFAULT
);
INPUT_RATE_DEFAULT
);
...
...
modules/stream_out/transcode/transcode.h
View file @
a3a150b9
...
@@ -25,6 +25,7 @@ struct sout_stream_sys_t
...
@@ -25,6 +25,7 @@ struct sout_stream_sys_t
/* Audio */
/* Audio */
vlc_fourcc_t
i_acodec
;
/* codec audio (0 if not transcode) */
vlc_fourcc_t
i_acodec
;
/* codec audio (0 if not transcode) */
audio_sample_format_t
fmt_audio
;
char
*
psz_aenc
;
char
*
psz_aenc
;
char
*
psz_alang
;
char
*
psz_alang
;
config_chain_t
*
p_audio_cfg
;
config_chain_t
*
p_audio_cfg
;
...
...
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