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
39878fc5
Commit
39878fc5
authored
Oct 27, 2023
by
Dave Johansen
Committed by
Steven Liu
Nov 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/hlsenc: Add CHANNELS to EXT-X-MEDIA for Audio
Signed-off-by:
Steven Liu
<
lq@chinaffmpeg.org
>
parent
9bcbe04a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
dashenc.c
libavformat/dashenc.c
+2
-1
hlsenc.c
libavformat/hlsenc.c
+7
-1
hlsplaylist.c
libavformat/hlsplaylist.c
+4
-1
hlsplaylist.h
libavformat/hlsplaylist.h
+1
-1
No files found.
libavformat/dashenc.c
View file @
39878fc5
...
@@ -1284,7 +1284,8 @@ static int write_manifest(AVFormatContext *s, int final)
...
@@ -1284,7 +1284,8 @@ static int write_manifest(AVFormatContext *s, int final)
continue
;
continue
;
get_hls_playlist_name
(
playlist_file
,
sizeof
(
playlist_file
),
NULL
,
i
);
get_hls_playlist_name
(
playlist_file
,
sizeof
(
playlist_file
),
NULL
,
i
);
ff_hls_write_audio_rendition
(
c
->
m3u8_out
,
audio_group
,
ff_hls_write_audio_rendition
(
c
->
m3u8_out
,
audio_group
,
playlist_file
,
NULL
,
i
,
is_default
);
playlist_file
,
NULL
,
i
,
is_default
,
s
->
streams
[
i
]
->
codecpar
->
ch_layout
.
nb_channels
);
max_audio_bitrate
=
FFMAX
(
st
->
codecpar
->
bit_rate
+
max_audio_bitrate
=
FFMAX
(
st
->
codecpar
->
bit_rate
+
os
->
muxer_overhead
,
max_audio_bitrate
);
os
->
muxer_overhead
,
max_audio_bitrate
);
if
(
!
av_strnstr
(
audio_codec_str
,
os
->
codec_str
,
sizeof
(
audio_codec_str
)))
{
if
(
!
av_strnstr
(
audio_codec_str
,
os
->
codec_str
,
sizeof
(
audio_codec_str
)))
{
...
...
libavformat/hlsenc.c
View file @
39878fc5
...
@@ -1386,6 +1386,7 @@ static int create_master_playlist(AVFormatContext *s,
...
@@ -1386,6 +1386,7 @@ static int create_master_playlist(AVFormatContext *s,
int
is_file_proto
=
proto
&&
!
strcmp
(
proto
,
"file"
);
int
is_file_proto
=
proto
&&
!
strcmp
(
proto
,
"file"
);
int
use_temp_file
=
is_file_proto
&&
((
hls
->
flags
&
HLS_TEMP_FILE
)
||
hls
->
master_publish_rate
);
int
use_temp_file
=
is_file_proto
&&
((
hls
->
flags
&
HLS_TEMP_FILE
)
||
hls
->
master_publish_rate
);
char
temp_filename
[
MAX_URL_SIZE
];
char
temp_filename
[
MAX_URL_SIZE
];
int
nb_channels
;
input_vs
->
m3u8_created
=
1
;
input_vs
->
m3u8_created
=
1
;
if
(
!
hls
->
master_m3u8_created
)
{
if
(
!
hls
->
master_m3u8_created
)
{
...
@@ -1434,8 +1435,13 @@ static int create_master_playlist(AVFormatContext *s,
...
@@ -1434,8 +1435,13 @@ static int create_master_playlist(AVFormatContext *s,
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to find relative URL
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"Unable to find relative URL
\n
"
);
goto
fail
;
goto
fail
;
}
}
nb_channels
=
0
;
for
(
j
=
0
;
j
<
vs
->
nb_streams
;
j
++
)
if
(
vs
->
streams
[
j
]
->
codecpar
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
if
(
vs
->
streams
[
j
]
->
codecpar
->
ch_layout
.
nb_channels
>
nb_channels
)
nb_channels
=
vs
->
streams
[
j
]
->
codecpar
->
ch_layout
.
nb_channels
;
ff_hls_write_audio_rendition
(
hls
->
m3u8_out
,
vs
->
agroup
,
m3u8_rel_name
,
vs
->
language
,
i
,
hls
->
has_default_key
?
vs
->
is_default
:
1
);
ff_hls_write_audio_rendition
(
hls
->
m3u8_out
,
vs
->
agroup
,
m3u8_rel_name
,
vs
->
language
,
i
,
hls
->
has_default_key
?
vs
->
is_default
:
1
,
nb_channels
);
}
}
/* For variant streams with video add #EXT-X-STREAM-INF tag with attributes*/
/* For variant streams with video add #EXT-X-STREAM-INF tag with attributes*/
...
...
libavformat/hlsplaylist.c
View file @
39878fc5
...
@@ -39,7 +39,7 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version)
...
@@ -39,7 +39,7 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version)
void
ff_hls_write_audio_rendition
(
AVIOContext
*
out
,
const
char
*
agroup
,
void
ff_hls_write_audio_rendition
(
AVIOContext
*
out
,
const
char
*
agroup
,
const
char
*
filename
,
const
char
*
language
,
const
char
*
filename
,
const
char
*
language
,
int
name_id
,
int
is_default
)
int
name_id
,
int
is_default
,
int
nb_channels
)
{
{
if
(
!
out
||
!
agroup
||
!
filename
)
if
(
!
out
||
!
agroup
||
!
filename
)
return
;
return
;
...
@@ -49,6 +49,9 @@ void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
...
@@ -49,6 +49,9 @@ void ff_hls_write_audio_rendition(AVIOContext *out, const char *agroup,
if
(
language
)
{
if
(
language
)
{
avio_printf
(
out
,
"LANGUAGE=
\"
%s
\"
,"
,
language
);
avio_printf
(
out
,
"LANGUAGE=
\"
%s
\"
,"
,
language
);
}
}
if
(
nb_channels
)
{
avio_printf
(
out
,
"CHANNELS=
\"
%d
\"
,"
,
nb_channels
);
}
avio_printf
(
out
,
"URI=
\"
%s
\"\n
"
,
filename
);
avio_printf
(
out
,
"URI=
\"
%s
\"\n
"
,
filename
);
}
}
...
...
libavformat/hlsplaylist.h
View file @
39878fc5
...
@@ -38,7 +38,7 @@ typedef enum {
...
@@ -38,7 +38,7 @@ typedef enum {
void
ff_hls_write_playlist_version
(
AVIOContext
*
out
,
int
version
);
void
ff_hls_write_playlist_version
(
AVIOContext
*
out
,
int
version
);
void
ff_hls_write_audio_rendition
(
AVIOContext
*
out
,
const
char
*
agroup
,
void
ff_hls_write_audio_rendition
(
AVIOContext
*
out
,
const
char
*
agroup
,
const
char
*
filename
,
const
char
*
language
,
const
char
*
filename
,
const
char
*
language
,
int
name_id
,
int
is_default
);
int
name_id
,
int
is_default
,
int
nb_channels
);
void
ff_hls_write_subtitle_rendition
(
AVIOContext
*
out
,
const
char
*
sgroup
,
void
ff_hls_write_subtitle_rendition
(
AVIOContext
*
out
,
const
char
*
sgroup
,
const
char
*
filename
,
const
char
*
language
,
const
char
*
filename
,
const
char
*
language
,
int
name_id
,
int
is_default
);
int
name_id
,
int
is_default
);
...
...
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