Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
641761ac
Commit
641761ac
authored
Aug 24, 2021
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alp: convert to new channel layout API
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
ffc4fd3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
alp.c
libavformat/alp.c
+6
-10
No files found.
libavformat/alp.c
View file @
641761ac
...
...
@@ -119,18 +119,14 @@ static int alp_read_header(AVFormatContext *s)
par
->
codec_id
=
AV_CODEC_ID_ADPCM_IMA_ALP
;
par
->
format
=
AV_SAMPLE_FMT_S16
;
par
->
sample_rate
=
hdr
->
sample_rate
;
par
->
channels
=
hdr
->
num_channels
;
if
(
hdr
->
num_channels
==
1
)
par
->
channel_layout
=
AV_CH_LAYOUT_MONO
;
else
if
(
hdr
->
num_channels
==
2
)
par
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
else
if
(
hdr
->
num_channels
>
2
)
return
AVERROR_INVALIDDATA
;
av_channel_layout_default
(
&
par
->
ch_layout
,
hdr
->
num_channels
);
par
->
bits_per_coded_sample
=
4
;
par
->
block_align
=
1
;
par
->
bit_rate
=
par
->
channels
*
par
->
bit_rate
=
par
->
ch
_layout
.
nb_ch
annels
*
par
->
sample_rate
*
par
->
bits_per_coded_sample
;
...
...
@@ -148,7 +144,7 @@ static int alp_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt
->
flags
&=
~
AV_PKT_FLAG_CORRUPT
;
pkt
->
stream_index
=
0
;
pkt
->
duration
=
ret
*
2
/
par
->
channels
;
pkt
->
duration
=
ret
*
2
/
par
->
ch
_layout
.
nb_ch
annels
;
return
0
;
}
...
...
@@ -202,7 +198,7 @@ static int alp_write_init(AVFormatContext *s)
return
AVERROR
(
EINVAL
);
}
if
(
par
->
channels
>
2
)
{
if
(
par
->
ch
_layout
.
nb_ch
annels
>
2
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"A maximum of 2 channels are supported
\n
"
);
return
AVERROR
(
EINVAL
);
}
...
...
@@ -228,7 +224,7 @@ static int alp_write_header(AVFormatContext *s)
avio_wl32
(
s
->
pb
,
alp
->
type
==
ALP_TYPE_PCM
?
12
:
8
);
avio_write
(
s
->
pb
,
"ADPCM"
,
6
);
avio_w8
(
s
->
pb
,
0
);
avio_w8
(
s
->
pb
,
par
->
channels
);
avio_w8
(
s
->
pb
,
par
->
ch
_layout
.
nb_ch
annels
);
if
(
alp
->
type
==
ALP_TYPE_PCM
)
avio_wl32
(
s
->
pb
,
par
->
sample_rate
);
...
...
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