Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
fbfe10b4
Commit
fbfe10b4
authored
Dec 04, 2013
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transcode: initialize audio encoder properly when first packet arrives
parent
8f01bd1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
38 deletions
+48
-38
modules/stream_out/transcode/audio.c
modules/stream_out/transcode/audio.c
+48
-38
No files found.
modules/stream_out/transcode/audio.c
View file @
fbfe10b4
...
...
@@ -78,45 +78,9 @@ static int transcode_audio_initialize_filters( sout_stream_t *p_stream, sout_str
return
VLC_SUCCESS
;
}
int
transcode_audio_new
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
)
static
int
transcode_audio_initialize_encoder
(
sout_stream_id_t
*
id
,
sout_stream_t
*
p_stream
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
audio_sample_format_t
fmt_last
;
/*
* Open decoder
*/
/* Initialization of decoder structures */
id
->
p_decoder
->
fmt_out
=
id
->
p_decoder
->
fmt_in
;
id
->
p_decoder
->
fmt_out
.
i_extra
=
0
;
id
->
p_decoder
->
fmt_out
.
p_extra
=
0
;
id
->
p_decoder
->
pf_decode_audio
=
NULL
;
id
->
p_decoder
->
pf_aout_format_update
=
audio_update_format
;
/* id->p_decoder->p_cfg = p_sys->p_audio_cfg; */
id
->
p_decoder
->
p_module
=
module_need
(
id
->
p_decoder
,
"decoder"
,
"$codec"
,
false
);
if
(
!
id
->
p_decoder
->
p_module
)
{
msg_Err
(
p_stream
,
"cannot find audio decoder"
);
return
VLC_EGENERIC
;
}
/* decoders don't set audio.i_format, but audio filters use it */
id
->
p_decoder
->
fmt_out
.
audio
.
i_format
=
id
->
p_decoder
->
fmt_out
.
i_codec
;
aout_FormatPrepare
(
&
id
->
p_decoder
->
fmt_out
.
audio
);
fmt_last
=
id
->
p_decoder
->
fmt_out
.
audio
;
/* Fix AAC SBR changing number of channels and sampling rate */
if
(
!
(
id
->
p_decoder
->
fmt_in
.
i_codec
==
VLC_CODEC_MP4A
&&
fmt_last
.
i_rate
!=
id
->
p_encoder
->
fmt_in
.
audio
.
i_rate
&&
fmt_last
.
i_channels
!=
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
)
)
fmt_last
.
i_rate
=
id
->
p_decoder
->
fmt_in
.
audio
.
i_rate
;
/*
* Open encoder
*/
/* Initialization of encoder format structures */
es_format_Init
(
&
id
->
p_encoder
->
fmt_in
,
id
->
p_decoder
->
fmt_in
.
i_cat
,
id
->
p_decoder
->
fmt_out
.
i_codec
);
...
...
@@ -154,6 +118,50 @@ int transcode_audio_new( sout_stream_t *p_stream,
}
aout_FormatPrepare
(
&
id
->
p_encoder
->
fmt_in
.
audio
);
return
VLC_SUCCESS
;
}
int
transcode_audio_new
(
sout_stream_t
*
p_stream
,
sout_stream_id_t
*
id
)
{
sout_stream_sys_t
*
p_sys
=
p_stream
->
p_sys
;
audio_sample_format_t
fmt_last
;
/*
* Open decoder
*/
/* Initialization of decoder structures */
id
->
p_decoder
->
fmt_out
=
id
->
p_decoder
->
fmt_in
;
id
->
p_decoder
->
fmt_out
.
i_extra
=
0
;
id
->
p_decoder
->
fmt_out
.
p_extra
=
0
;
id
->
p_decoder
->
pf_decode_audio
=
NULL
;
id
->
p_decoder
->
pf_aout_format_update
=
audio_update_format
;
/* id->p_decoder->p_cfg = p_sys->p_audio_cfg; */
id
->
p_decoder
->
p_module
=
module_need
(
id
->
p_decoder
,
"decoder"
,
"$codec"
,
false
);
if
(
!
id
->
p_decoder
->
p_module
)
{
msg_Err
(
p_stream
,
"cannot find audio decoder"
);
return
VLC_EGENERIC
;
}
/* decoders don't set audio.i_format, but audio filters use it */
id
->
p_decoder
->
fmt_out
.
audio
.
i_format
=
id
->
p_decoder
->
fmt_out
.
i_codec
;
aout_FormatPrepare
(
&
id
->
p_decoder
->
fmt_out
.
audio
);
fmt_last
=
id
->
p_decoder
->
fmt_out
.
audio
;
/* Fix AAC SBR changing number of channels and sampling rate */
if
(
!
(
id
->
p_decoder
->
fmt_in
.
i_codec
==
VLC_CODEC_MP4A
&&
fmt_last
.
i_rate
!=
id
->
p_encoder
->
fmt_in
.
audio
.
i_rate
&&
fmt_last
.
i_channels
!=
id
->
p_encoder
->
fmt_in
.
audio
.
i_channels
)
)
fmt_last
.
i_rate
=
id
->
p_decoder
->
fmt_in
.
audio
.
i_rate
;
/*
* Open encoder
*/
if
(
transcode_audio_initialize_encoder
(
id
,
p_stream
)
==
VLC_EGENERIC
)
return
VLC_EGENERIC
;
if
(
unlikely
(
transcode_audio_initialize_filters
(
p_stream
,
id
,
p_sys
,
&
fmt_last
)
!=
VLC_SUCCESS
)
)
return
VLC_EGENERIC
;
...
...
@@ -222,11 +230,13 @@ int transcode_audio_process( sout_stream_t *p_stream,
id
->
p_decoder
->
fmt_in
.
audio
.
i_physical_channels
;
id
->
p_encoder
->
fmt_out
.
audio
.
i_physical_channels
=
pi_channels_maps
[
id
->
p_encoder
->
fmt_out
.
audio
.
i_channels
];
if
(
transcode_audio_
new
(
p_stream
,
id
)
)
if
(
transcode_audio_
initialize_encoder
(
id
,
p_stream
)
)
{
msg_Err
(
p_stream
,
"cannot create audio chain"
);
return
VLC_EGENERIC
;
}
if
(
unlikely
(
transcode_audio_initialize_filters
(
p_stream
,
id
,
p_sys
,
&
id
->
p_decoder
->
fmt_out
.
audio
)
!=
VLC_SUCCESS
)
)
return
VLC_EGENERIC
;
date_Init
(
&
id
->
interpolated_pts
,
id
->
p_decoder
->
fmt_out
.
audio
.
i_rate
,
1
);
}
...
...
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