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
56655ea8
Commit
56655ea8
authored
Jul 25, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec: avoid forward declaration
parent
4f3b5c69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
46 deletions
+45
-46
modules/codec/avcodec/audio.c
modules/codec/avcodec/audio.c
+45
-46
No files found.
modules/codec/avcodec/audio.c
View file @
56655ea8
...
...
@@ -69,7 +69,6 @@ struct decoder_sys_t
#define BLOCK_FLAG_PRIVATE_REALLOCATED (1 << BLOCK_FLAG_PRIVATE_SHIFT)
static
void
SetupOutputFormat
(
decoder_t
*
p_dec
,
bool
b_trust
);
static
int
GetAudioBuf
(
struct
AVCodecContext
*
,
AVFrame
*
);
static
void
InitDecoderConfig
(
decoder_t
*
p_dec
,
AVCodecContext
*
p_context
)
{
...
...
@@ -116,6 +115,51 @@ static void InitDecoderConfig( decoder_t *p_dec, AVCodecContext *p_context )
}
}
/**
* Allocates decoded audio buffer for libavcodec to use.
*/
static
int
GetAudioBuf
(
AVCodecContext
*
ctx
,
AVFrame
*
buf
)
{
block_t
*
block
;
bool
planar
=
av_sample_fmt_is_planar
(
ctx
->
sample_fmt
);
unsigned
channels
=
planar
?
1
:
ctx
->
channels
;
unsigned
planes
=
planar
?
ctx
->
channels
:
1
;
int
bytes
=
av_samples_get_buffer_size
(
&
buf
->
linesize
[
0
],
channels
,
buf
->
nb_samples
,
ctx
->
sample_fmt
,
16
);
assert
(
bytes
>=
0
);
block
=
block_Alloc
(
bytes
*
planes
);
if
(
unlikely
(
block
==
NULL
)
)
return
AVERROR
(
ENOMEM
);
block
->
i_nb_samples
=
buf
->
nb_samples
;
buf
->
opaque
=
block
;
if
(
planes
>
AV_NUM_DATA_POINTERS
)
{
uint8_t
**
ext
=
malloc
(
sizeof
(
*
ext
)
*
planes
);
if
(
unlikely
(
ext
==
NULL
)
)
{
block_Release
(
block
);
return
AVERROR
(
ENOMEM
);
}
buf
->
extended_data
=
ext
;
}
else
buf
->
extended_data
=
buf
->
data
;
uint8_t
*
buffer
=
block
->
p_buffer
;
for
(
unsigned
i
=
0
;
i
<
planes
;
i
++
)
{
buf
->
linesize
[
i
]
=
buf
->
linesize
[
0
];
buf
->
extended_data
[
i
]
=
buffer
;
buffer
+=
bytes
;
}
return
0
;
}
/*****************************************************************************
* InitAudioDec: initialize audio decoder
*****************************************************************************
...
...
@@ -173,51 +217,6 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
return
VLC_SUCCESS
;
}
/**
* Allocates decoded audio buffer for libavcodec to use.
*/
static
int
GetAudioBuf
(
AVCodecContext
*
ctx
,
AVFrame
*
buf
)
{
block_t
*
block
;
bool
planar
=
av_sample_fmt_is_planar
(
ctx
->
sample_fmt
);
unsigned
channels
=
planar
?
1
:
ctx
->
channels
;
unsigned
planes
=
planar
?
ctx
->
channels
:
1
;
int
bytes
=
av_samples_get_buffer_size
(
&
buf
->
linesize
[
0
],
channels
,
buf
->
nb_samples
,
ctx
->
sample_fmt
,
16
);
assert
(
bytes
>=
0
);
block
=
block_Alloc
(
bytes
*
planes
);
if
(
unlikely
(
block
==
NULL
)
)
return
AVERROR
(
ENOMEM
);
block
->
i_nb_samples
=
buf
->
nb_samples
;
buf
->
opaque
=
block
;
if
(
planes
>
AV_NUM_DATA_POINTERS
)
{
uint8_t
**
ext
=
malloc
(
sizeof
(
*
ext
)
*
planes
);
if
(
unlikely
(
ext
==
NULL
)
)
{
block_Release
(
block
);
return
AVERROR
(
ENOMEM
);
}
buf
->
extended_data
=
ext
;
}
else
buf
->
extended_data
=
buf
->
data
;
uint8_t
*
buffer
=
block
->
p_buffer
;
for
(
unsigned
i
=
0
;
i
<
planes
;
i
++
)
{
buf
->
linesize
[
i
]
=
buf
->
linesize
[
0
];
buf
->
extended_data
[
i
]
=
buffer
;
buffer
+=
bytes
;
}
return
0
;
}
/*****************************************************************************
* DecodeAudio: Called to decode one frame
*****************************************************************************/
...
...
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