Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
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
audiowmark
Commits
5a836c95
Commit
5a836c95
authored
Apr 28, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decode hls segments via ffmpeg.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
5b3486dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
testhls.cc
src/testhls.cc
+26
-0
No files found.
src/testhls.cc
View file @
5a836c95
...
...
@@ -22,11 +22,26 @@
#include "utils.hh"
#include "mpegts.hh"
#include "wavdata.hh"
using
std
::
string
;
using
std
::
regex
;
using
std
::
vector
;
Error
ff_decode
(
const
string
&
filename
,
WavData
&
out_wav_data
)
{
FILE
*
tmp_file
=
tmpfile
();
ScopedFile
tmp_file_s
(
tmp_file
);
string
tmp_file_name
=
string_printf
(
"/dev/fd/%d"
,
fileno
(
tmp_file
));
string
cmd
=
string_printf
(
"ffmpeg -v error -y -i '%s' -f wav /dev/fd/%d"
,
filename
.
c_str
(),
fileno
(
tmp_file
));
system
(
cmd
.
c_str
());
Error
err
=
out_wav_data
.
load
(
tmp_file_name
);
return
err
;
}
int
hls_embed_context
(
const
string
&
in_dir
,
const
string
&
out_dir
,
const
string
&
filename
)
{
...
...
@@ -76,6 +91,17 @@ hls_embed_context (const string& in_dir, const string& out_dir, const string& fi
}
line
++
;
}
for
(
size_t
i
=
0
;
i
<
segments
.
size
();
i
++
)
{
WavData
out
;
Error
err
=
ff_decode
(
in_dir
+
"/"
+
segments
[
i
],
out
);
if
(
err
)
{
error
(
"audiowmark: hls: ff_decode failed: %s
\n
"
,
err
.
message
());
return
1
;
}
printf
(
"%d %zd
\n
"
,
out
.
sample_rate
(),
out
.
n_values
()
/
out
.
n_channels
());
}
for
(
size_t
i
=
0
;
i
<
segments
.
size
();
i
++
)
{
TSWriter
writer
;
...
...
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