Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
Steve Lhomme
VLC
Commits
c779bd78
Commit
c779bd78
authored
Sep 11, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: move audio-specific code to audio.c
parent
9478802c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
31 deletions
+34
-31
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+34
-4
modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.c
+0
-27
No files found.
modules/codec/avcodec/audio.c
View file @
c779bd78
...
...
@@ -115,6 +115,38 @@ static void InitDecoderConfig( decoder_t *p_dec, AVCodecContext *p_context )
}
}
static
int
OpenAudioCodec
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
p_sys
->
p_context
->
extradata_size
<=
0
)
{
if
(
p_sys
->
i_codec_id
==
AV_CODEC_ID_VORBIS
||
(
p_sys
->
i_codec_id
==
AV_CODEC_ID_AAC
&&
!
p_dec
->
fmt_in
.
b_packetized
)
)
{
msg_Warn
(
p_dec
,
"waiting for extra data for codec %s"
,
p_sys
->
psz_namecodec
);
return
1
;
}
}
p_sys
->
p_context
->
sample_rate
=
p_dec
->
fmt_in
.
audio
.
i_rate
;
p_sys
->
p_context
->
channels
=
p_dec
->
fmt_in
.
audio
.
i_channels
;
p_sys
->
p_context
->
block_align
=
p_dec
->
fmt_in
.
audio
.
i_blockalign
;
p_sys
->
p_context
->
bit_rate
=
p_dec
->
fmt_in
.
i_bitrate
;
p_sys
->
p_context
->
bits_per_coded_sample
=
p_dec
->
fmt_in
.
audio
.
i_bitspersample
;
if
(
p_sys
->
i_codec_id
==
AV_CODEC_ID_ADPCM_G726
&&
p_sys
->
p_context
->
bit_rate
>
0
&&
p_sys
->
p_context
->
sample_rate
>
0
)
p_sys
->
p_context
->
bits_per_coded_sample
=
p_sys
->
p_context
->
bit_rate
/
p_sys
->
p_context
->
sample_rate
;
return
ffmpeg_OpenCodec
(
p_dec
);
}
/**
* Allocates decoded audio buffer for libavcodec to use.
*/
...
...
@@ -231,9 +263,8 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
InitDecoderConfig
(
p_dec
,
p_context
);
/* ***** Open the codec ***** */
if
(
ffmpeg_Open
Codec
(
p_dec
)
<
0
)
if
(
OpenAudio
Codec
(
p_dec
)
<
0
)
{
msg_Err
(
p_dec
,
"cannot open codec (%s)"
,
p_sys
->
psz_namecodec
);
av_free
(
p_sys
->
p_context
->
extradata
);
free
(
p_sys
);
return
VLC_EGENERIC
;
...
...
@@ -274,8 +305,7 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
if
(
!
ctx
->
extradata_size
&&
p_dec
->
fmt_in
.
i_extra
&&
p_sys
->
b_delayed_open
)
{
InitDecoderConfig
(
p_dec
,
ctx
);
if
(
ffmpeg_OpenCodec
(
p_dec
)
)
msg_Err
(
p_dec
,
"Cannot open decoder %s"
,
p_sys
->
psz_namecodec
);
OpenAudioCodec
(
p_dec
);
}
if
(
p_sys
->
b_delayed_open
)
...
...
modules/codec/avcodec/avcodec.c
View file @
c779bd78
...
...
@@ -368,33 +368,6 @@ static void CloseDecoder( vlc_object_t *p_this )
int
ffmpeg_OpenCodec
(
decoder_t
*
p_dec
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
p_sys
->
p_context
->
extradata_size
<=
0
)
{
if
(
p_sys
->
i_codec_id
==
AV_CODEC_ID_VORBIS
||
(
p_sys
->
i_codec_id
==
AV_CODEC_ID_AAC
&&
!
p_dec
->
fmt_in
.
b_packetized
)
)
{
msg_Warn
(
p_dec
,
"waiting for extra data for codec %s"
,
p_sys
->
psz_namecodec
);
return
1
;
}
}
if
(
p_dec
->
fmt_in
.
i_cat
==
AUDIO_ES
)
{
p_sys
->
p_context
->
sample_rate
=
p_dec
->
fmt_in
.
audio
.
i_rate
;
p_sys
->
p_context
->
channels
=
p_dec
->
fmt_in
.
audio
.
i_channels
;
p_sys
->
p_context
->
block_align
=
p_dec
->
fmt_in
.
audio
.
i_blockalign
;
p_sys
->
p_context
->
bit_rate
=
p_dec
->
fmt_in
.
i_bitrate
;
p_sys
->
p_context
->
bits_per_coded_sample
=
p_dec
->
fmt_in
.
audio
.
i_bitspersample
;
if
(
p_sys
->
i_codec_id
==
AV_CODEC_ID_ADPCM_G726
&&
p_sys
->
p_context
->
bit_rate
>
0
&&
p_sys
->
p_context
->
sample_rate
>
0
)
p_sys
->
p_context
->
bits_per_coded_sample
=
p_sys
->
p_context
->
bit_rate
/
p_sys
->
p_context
->
sample_rate
;
}
char
*
psz_opts
=
var_InheritString
(
p_dec
,
"avcodec-options"
);
AVDictionary
*
options
=
NULL
;
int
ret
;
...
...
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