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
77869a3e
Commit
77869a3e
authored
May 13, 2019
by
Anton Khirnov
Committed by
James Almer
Mar 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpegtsenc: convert to new channel layout API
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
203a7bd7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
mpegtsenc.c
libavformat/mpegtsenc.c
+16
-14
No files found.
libavformat/mpegtsenc.c
View file @
77869a3e
...
...
@@ -466,7 +466,7 @@ static int get_m2ts_stream_type(AVFormatContext *s, AVStream *st)
stream_type
=
0x81
;
break
;
case
AV_CODEC_ID_DTS
:
stream_type
=
(
st
->
codecpar
->
channels
>
6
)
?
0x85
:
0x82
;
stream_type
=
(
st
->
codecpar
->
ch
_layout
.
nb_ch
annels
>
6
)
?
0x85
:
0x82
;
break
;
case
AV_CODEC_ID_TRUEHD
:
stream_type
=
0x83
;
...
...
@@ -592,6 +592,8 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
if
(
codec_id
==
AV_CODEC_ID_S302M
)
put_registration_descriptor
(
&
q
,
MKTAG
(
'B'
,
'S'
,
'S'
,
'D'
));
if
(
codec_id
==
AV_CODEC_ID_OPUS
)
{
int
ch
=
st
->
codecpar
->
ch_layout
.
nb_channels
;
/* 6 bytes registration descriptor, 4 bytes Opus audio descriptor */
if
(
q
-
data
>
SECTION_LENGTH
-
6
-
4
)
{
err
=
1
;
...
...
@@ -605,11 +607,11 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
*
q
++
=
0x80
;
if
(
st
->
codecpar
->
extradata
&&
st
->
codecpar
->
extradata_size
>=
19
)
{
if
(
st
->
codecpar
->
extradata
[
18
]
==
0
&&
st
->
codecpar
->
channels
<=
2
)
{
if
(
st
->
codecpar
->
extradata
[
18
]
==
0
&&
ch
<=
2
)
{
/* RTP mapping family */
*
q
++
=
st
->
codecpar
->
channels
;
}
else
if
(
st
->
codecpar
->
extradata
[
18
]
==
1
&&
st
->
codecpar
->
channels
<=
8
&&
st
->
codecpar
->
extradata_size
>=
21
+
st
->
codecpar
->
channels
)
{
*
q
++
=
ch
;
}
else
if
(
st
->
codecpar
->
extradata
[
18
]
==
1
&&
ch
<=
8
&&
st
->
codecpar
->
extradata_size
>=
21
+
ch
)
{
static
const
uint8_t
coupled_stream_counts
[
9
]
=
{
1
,
0
,
1
,
1
,
2
,
2
,
2
,
3
,
3
};
...
...
@@ -635,14 +637,14 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
};
/* Vorbis mapping family */
if
(
st
->
codecpar
->
extradata
[
19
]
==
st
->
codecpar
->
channels
-
coupled_stream_counts
[
st
->
codecpar
->
channels
]
&&
st
->
codecpar
->
extradata
[
20
]
==
coupled_stream_counts
[
st
->
codecpar
->
channels
]
&&
memcmp
(
&
st
->
codecpar
->
extradata
[
21
],
channel_map_a
[
st
->
codecpar
->
channels
-
1
],
st
->
codecpar
->
channels
)
==
0
)
{
*
q
++
=
st
->
codecpar
->
channels
;
}
else
if
(
st
->
codecpar
->
channels
>=
2
&&
st
->
codecpar
->
extradata
[
19
]
==
st
->
codecpar
->
channels
&&
if
(
st
->
codecpar
->
extradata
[
19
]
==
ch
-
coupled_stream_counts
[
ch
]
&&
st
->
codecpar
->
extradata
[
20
]
==
coupled_stream_counts
[
ch
]
&&
memcmp
(
&
st
->
codecpar
->
extradata
[
21
],
channel_map_a
[
ch
-
1
],
ch
)
==
0
)
{
*
q
++
=
ch
;
}
else
if
(
ch
>=
2
&&
st
->
codecpar
->
extradata
[
19
]
==
ch
&&
st
->
codecpar
->
extradata
[
20
]
==
0
&&
memcmp
(
&
st
->
codecpar
->
extradata
[
21
],
channel_map_b
[
st
->
codecpar
->
channels
-
1
],
st
->
codecpar
->
channels
)
==
0
)
{
*
q
++
=
st
->
codecpar
->
channels
|
0x80
;
memcmp
(
&
st
->
codecpar
->
extradata
[
21
],
channel_map_b
[
ch
-
1
],
ch
)
==
0
)
{
*
q
++
=
ch
|
0x80
;
}
else
{
/* Unsupported, could write an extended descriptor here */
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported Opus Vorbis-style channel mapping"
);
...
...
@@ -653,9 +655,9 @@ static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported Opus channel mapping for family %d"
,
st
->
codecpar
->
extradata
[
18
]);
*
q
++
=
0xff
;
}
}
else
if
(
st
->
codecpar
->
channels
<=
2
)
{
}
else
if
(
ch
<=
2
)
{
/* Assume RTP mapping family */
*
q
++
=
st
->
codecpar
->
channels
;
*
q
++
=
ch
;
}
else
{
/* Unsupported */
av_log
(
s
,
AV_LOG_ERROR
,
"Unsupported Opus channel mapping"
);
...
...
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