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
ac10e3c4
Commit
ac10e3c4
authored
May 15, 2019
by
Anton Khirnov
Committed by
James Almer
Mar 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf: convert the generic layer to the new channel layout
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
c30e22c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
demux.c
libavformat/demux.c
+16
-0
mux.c
libavformat/mux.c
+17
-1
utils.c
libavformat/utils.c
+2
-2
No files found.
libavformat/demux.c
View file @
ac10e3c4
...
...
@@ -206,6 +206,18 @@ static int update_stream_avctx(AVFormatContext *s)
}
}
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
if
(
st
->
codecpar
->
ch_layout
.
nb_channels
&&
!
st
->
codecpar
->
channels
)
{
st
->
codecpar
->
channels
=
st
->
codecpar
->
ch_layout
.
nb_channels
;
st
->
codecpar
->
channel_layout
=
st
->
codecpar
->
ch_layout
.
order
==
AV_CHANNEL_ORDER_NATIVE
?
st
->
codecpar
->
ch_layout
.
u
.
mask
:
0
;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* update internal codec context, for the parser */
ret
=
avcodec_parameters_to_context
(
sti
->
avctx
,
st
->
codecpar
);
if
(
ret
<
0
)
...
...
@@ -1333,8 +1345,12 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
return
ret
;
st
->
codecpar
->
sample_rate
=
sti
->
avctx
->
sample_rate
;
st
->
codecpar
->
bit_rate
=
sti
->
avctx
->
bit_rate
;
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
st
->
codecpar
->
channels
=
sti
->
avctx
->
channels
;
st
->
codecpar
->
channel_layout
=
sti
->
avctx
->
channel_layout
;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
st
->
codecpar
->
codec_id
=
sti
->
avctx
->
codec_id
;
}
else
{
/* free packet */
...
...
libavformat/mux.c
View file @
ac10e3c4
...
...
@@ -282,8 +282,24 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
par
->
ch_layout
.
u
.
mask
:
0
;
}
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
/* if the caller is using the deprecated channel layout API,
* convert it to the new style */
if
(
!
par
->
ch_layout
.
nb_channels
&&
par
->
channels
)
{
if
(
par
->
channel_layout
)
{
av_channel_layout_from_mask
(
&
par
->
ch_layout
,
par
->
channel_layout
);
}
else
{
par
->
ch_layout
.
order
=
AV_CHANNEL_ORDER_UNSPEC
;
par
->
ch_layout
.
nb_channels
=
par
->
channels
;
}
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if
(
!
par
->
block_align
)
par
->
block_align
=
par
->
channels
*
par
->
block_align
=
par
->
ch
_layout
.
nb_ch
annels
*
av_get_bits_per_sample
(
par
->
codec_id
)
>>
3
;
break
;
case
AVMEDIA_TYPE_VIDEO
:
...
...
libavformat/utils.c
View file @
ac10e3c4
...
...
@@ -525,7 +525,7 @@ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
continue
;
if
(
wanted_stream_nb
>=
0
&&
real_stream_index
!=
wanted_stream_nb
)
continue
;
if
(
type
==
AVMEDIA_TYPE_AUDIO
&&
!
(
par
->
channels
&&
par
->
sample_rate
))
if
(
type
==
AVMEDIA_TYPE_AUDIO
&&
!
(
par
->
ch
_layout
.
nb_ch
annels
&&
par
->
sample_rate
))
continue
;
if
(
decoder_ret
)
{
decoder
=
ff_find_decoder
(
ic
,
st
,
par
->
codec_id
);
...
...
@@ -1523,7 +1523,7 @@ static int match_stream_specifier(const AVFormatContext *s, const AVStream *st,
int
val
;
switch
(
par
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:
val
=
par
->
sample_rate
&&
par
->
channels
;
val
=
par
->
sample_rate
&&
par
->
ch
_layout
.
nb_ch
annels
;
if
(
par
->
format
==
AV_SAMPLE_FMT_NONE
)
return
0
;
break
;
...
...
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