Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
87466f81
Commit
87466f81
authored
Jul 02, 2012
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flacdec: factor out code setting avctx->sample_fmt
parent
d155b60f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
flacdec.c
libavcodec/flacdec.c
+15
-13
No files found.
libavcodec/flacdec.c
View file @
87466f81
...
@@ -100,6 +100,19 @@ int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
...
@@ -100,6 +100,19 @@ int avpriv_flac_is_extradata_valid(AVCodecContext *avctx,
return
1
;
return
1
;
}
}
static
void
flac_set_bps
(
FLACContext
*
s
)
{
if
(
s
->
bps
>
16
)
{
s
->
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S32
;
s
->
sample_shift
=
32
-
s
->
bps
;
s
->
is32
=
1
;
}
else
{
s
->
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
s
->
sample_shift
=
16
-
s
->
bps
;
s
->
is32
=
0
;
}
}
static
av_cold
int
flac_decode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
flac_decode_init
(
AVCodecContext
*
avctx
)
{
{
enum
FLACExtradataFormat
format
;
enum
FLACExtradataFormat
format
;
...
@@ -117,11 +130,8 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
...
@@ -117,11 +130,8 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
/* initialize based on the demuxer-supplied streamdata header */
/* initialize based on the demuxer-supplied streamdata header */
avpriv_flac_parse_streaminfo
(
avctx
,
(
FLACStreaminfo
*
)
s
,
streaminfo
);
avpriv_flac_parse_streaminfo
(
avctx
,
(
FLACStreaminfo
*
)
s
,
streaminfo
);
if
(
s
->
bps
>
16
)
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S32
;
else
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
allocate_buffers
(
s
);
allocate_buffers
(
s
);
flac_set_bps
(
s
);
s
->
got_streaminfo
=
1
;
s
->
got_streaminfo
=
1
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
avcodec_get_frame_defaults
(
&
s
->
frame
);
...
@@ -512,15 +522,7 @@ static int decode_frame(FLACContext *s)
...
@@ -512,15 +522,7 @@ static int decode_frame(FLACContext *s)
}
}
s
->
bps
=
s
->
avctx
->
bits_per_raw_sample
=
fi
.
bps
;
s
->
bps
=
s
->
avctx
->
bits_per_raw_sample
=
fi
.
bps
;
if
(
s
->
bps
>
16
)
{
flac_set_bps
(
s
);
s
->
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S32
;
s
->
sample_shift
=
32
-
s
->
bps
;
s
->
is32
=
1
;
}
else
{
s
->
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
s
->
sample_shift
=
16
-
s
->
bps
;
s
->
is32
=
0
;
}
if
(
!
s
->
max_blocksize
)
if
(
!
s
->
max_blocksize
)
s
->
max_blocksize
=
FLAC_MAX_BLOCKSIZE
;
s
->
max_blocksize
=
FLAC_MAX_BLOCKSIZE
;
...
...
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