Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
9300de04
Commit
9300de04
authored
Jun 03, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flacdec: frame multi-threading support
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
d9704464
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
flacdec.c
libavcodec/flacdec.c
+13
-2
No files found.
libavcodec/flacdec.c
View file @
9300de04
...
@@ -44,6 +44,7 @@
...
@@ -44,6 +44,7 @@
#include "flac.h"
#include "flac.h"
#include "flacdata.h"
#include "flacdata.h"
#include "flacdsp.h"
#include "flacdsp.h"
#include "thread.h"
typedef
struct
FLACContext
{
typedef
struct
FLACContext
{
FLACSTREAMINFO
FLACSTREAMINFO
...
@@ -489,6 +490,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -489,6 +490,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
AVFrame
*
frame
=
data
;
AVFrame
*
frame
=
data
;
ThreadFrame
tframe
=
{
.
f
=
data
};
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
FLACContext
*
s
=
avctx
->
priv_data
;
FLACContext
*
s
=
avctx
->
priv_data
;
...
@@ -547,7 +549,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -547,7 +549,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
/* get output buffer */
frame
->
nb_samples
=
s
->
blocksize
;
frame
->
nb_samples
=
s
->
blocksize
;
if
((
ret
=
ff_
get_buffer
(
avctx
,
frame
,
0
))
<
0
)
if
((
ret
=
ff_
thread_get_buffer
(
avctx
,
&
t
frame
,
0
))
<
0
)
return
ret
;
return
ret
;
s
->
dsp
.
decorrelate
[
s
->
ch_mode
](
frame
->
data
,
s
->
decoded
,
s
->
channels
,
s
->
dsp
.
decorrelate
[
s
->
ch_mode
](
frame
->
data
,
s
->
decoded
,
s
->
channels
,
...
@@ -567,6 +569,14 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -567,6 +569,14 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
return
bytes_read
;
return
bytes_read
;
}
}
static
int
init_thread_copy
(
AVCodecContext
*
avctx
)
{
FLACContext
*
s
=
avctx
->
priv_data
;
s
->
decoded_buffer
=
NULL
;
s
->
decoded_buffer_size
=
0
;
return
allocate_buffers
(
s
);
}
static
av_cold
int
flac_decode_close
(
AVCodecContext
*
avctx
)
static
av_cold
int
flac_decode_close
(
AVCodecContext
*
avctx
)
{
{
FLACContext
*
s
=
avctx
->
priv_data
;
FLACContext
*
s
=
avctx
->
priv_data
;
...
@@ -584,7 +594,8 @@ AVCodec ff_flac_decoder = {
...
@@ -584,7 +594,8 @@ AVCodec ff_flac_decoder = {
.
init
=
flac_decode_init
,
.
init
=
flac_decode_init
,
.
close
=
flac_decode_close
,
.
close
=
flac_decode_close
,
.
decode
=
flac_decode_frame
,
.
decode
=
flac_decode_frame
,
.
capabilities
=
CODEC_CAP_DR1
,
.
init_thread_copy
=
init_thread_copy
,
.
capabilities
=
CODEC_CAP_DR1
|
CODEC_CAP_FRAME_THREADS
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"FLAC (Free Lossless Audio Codec)"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"FLAC (Free Lossless Audio Codec)"
),
.
sample_fmts
=
(
const
enum
AVSampleFormat
[])
{
AV_SAMPLE_FMT_S16
,
.
sample_fmts
=
(
const
enum
AVSampleFormat
[])
{
AV_SAMPLE_FMT_S16
,
AV_SAMPLE_FMT_S16P
,
AV_SAMPLE_FMT_S16P
,
...
...
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