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
edd26bca
Commit
edd26bca
authored
Mar 20, 2022
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/dfpwmdec: add support to set channel layout
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
e42e54fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
dfpwmdec.c
libavformat/dfpwmdec.c
+20
-2
No files found.
libavformat/dfpwmdec.c
View file @
edd26bca
...
@@ -31,7 +31,10 @@
...
@@ -31,7 +31,10 @@
typedef
struct
DFPWMAudioDemuxerContext
{
typedef
struct
DFPWMAudioDemuxerContext
{
AVClass
*
class
;
AVClass
*
class
;
int
sample_rate
;
int
sample_rate
;
#if FF_API_OLD_CHANNEL_LAYOUT
int
channels
;
int
channels
;
#endif
AVChannelLayout
ch_layout
;
}
DFPWMAudioDemuxerContext
;
}
DFPWMAudioDemuxerContext
;
static
int
dfpwm_read_header
(
AVFormatContext
*
s
)
static
int
dfpwm_read_header
(
AVFormatContext
*
s
)
...
@@ -39,6 +42,7 @@ static int dfpwm_read_header(AVFormatContext *s)
...
@@ -39,6 +42,7 @@ static int dfpwm_read_header(AVFormatContext *s)
DFPWMAudioDemuxerContext
*
s1
=
s
->
priv_data
;
DFPWMAudioDemuxerContext
*
s1
=
s
->
priv_data
;
AVCodecParameters
*
par
;
AVCodecParameters
*
par
;
AVStream
*
st
;
AVStream
*
st
;
int
ret
;
st
=
avformat_new_stream
(
s
,
NULL
);
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
if
(
!
st
)
...
@@ -48,7 +52,16 @@ static int dfpwm_read_header(AVFormatContext *s)
...
@@ -48,7 +52,16 @@ static int dfpwm_read_header(AVFormatContext *s)
par
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
par
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
par
->
codec_id
=
s
->
iformat
->
raw_codec_id
;
par
->
codec_id
=
s
->
iformat
->
raw_codec_id
;
par
->
sample_rate
=
s1
->
sample_rate
;
par
->
sample_rate
=
s1
->
sample_rate
;
par
->
ch_layout
.
nb_channels
=
s1
->
channels
;
#if FF_API_OLD_CHANNEL_LAYOUT
if
(
s1
->
ch_layout
.
nb_channels
)
{
#endif
ret
=
av_channel_layout_copy
(
&
par
->
ch_layout
,
&
s1
->
ch_layout
);
if
(
ret
<
0
)
return
ret
;
#if FF_API_OLD_CHANNEL_LAYOUT
}
else
par
->
ch_layout
.
nb_channels
=
s1
->
channels
;
#endif
par
->
bits_per_coded_sample
=
1
;
par
->
bits_per_coded_sample
=
1
;
par
->
block_align
=
1
;
par
->
block_align
=
1
;
...
@@ -58,7 +71,12 @@ static int dfpwm_read_header(AVFormatContext *s)
...
@@ -58,7 +71,12 @@ static int dfpwm_read_header(AVFormatContext *s)
static
const
AVOption
dfpwm_options
[]
=
{
static
const
AVOption
dfpwm_options
[]
=
{
{
"sample_rate"
,
""
,
offsetof
(
DFPWMAudioDemuxerContext
,
sample_rate
),
AV_OPT_TYPE_INT
,
{.
i64
=
48000
},
0
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"sample_rate"
,
""
,
offsetof
(
DFPWMAudioDemuxerContext
,
sample_rate
),
AV_OPT_TYPE_INT
,
{.
i64
=
48000
},
0
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"channels"
,
""
,
offsetof
(
DFPWMAudioDemuxerContext
,
channels
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
#if FF_API_OLD_CHANNEL_LAYOUT
{
"channels"
,
""
,
offsetof
(
DFPWMAudioDemuxerContext
,
channels
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
|
AV_OPT_FLAG_DEPRECATED
},
{
"ch_layout"
,
""
,
offsetof
(
DFPWMAudioDemuxerContext
,
ch_layout
),
AV_OPT_TYPE_CHLAYOUT
,
{.
str
=
NULL
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
#else
{
"ch_layout"
,
""
,
offsetof
(
DFPWMAudioDemuxerContext
,
ch_layout
),
AV_OPT_TYPE_CHLAYOUT
,
{.
str
=
"mono"
},
0
,
0
,
AV_OPT_FLAG_DECODING_PARAM
},
#endif
{
NULL
},
{
NULL
},
};
};
static
const
AVClass
dfpwm_demuxer_class
=
{
static
const
AVClass
dfpwm_demuxer_class
=
{
...
...
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