Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
052b9785
Commit
052b9785
authored
Oct 18, 2016
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aviocat: Support avio options
Useful to test protocols that require options to be used.
parent
99aeae20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
aviocat.c
tools/aviocat.c
+22
-3
No files found.
tools/aviocat.c
View file @
052b9785
...
...
@@ -26,7 +26,8 @@
static
int
usage
(
const
char
*
argv0
,
int
ret
)
{
fprintf
(
stderr
,
"%s [-b bytespersec] [-d duration] input_url output_url
\n
"
,
argv0
);
fprintf
(
stderr
,
"%s [-b bytespersec] [-d duration] [-oi <options>] [-oo <options>] input_url output_url
\n
"
,
argv0
);
fprintf
(
stderr
,
"<options>: AVOptions expressed as key=value, :-separated
\n
"
);
return
ret
;
}
...
...
@@ -38,6 +39,8 @@ int main(int argc, char **argv)
int64_t
start_time
;
char
errbuf
[
50
];
AVIOContext
*
input
,
*
output
;
AVDictionary
*
in_opts
=
NULL
;
AVDictionary
*
out_opts
=
NULL
;
av_register_all
();
avformat_network_init
();
...
...
@@ -49,6 +52,20 @@ int main(int argc, char **argv)
}
else
if
(
!
strcmp
(
argv
[
i
],
"-d"
)
&&
i
+
1
<
argc
)
{
duration
=
atoi
(
argv
[
i
+
1
]);
i
++
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-oi"
)
&&
i
+
1
<
argc
)
{
if
(
av_dict_parse_string
(
&
in_opts
,
argv
[
i
+
1
],
"="
,
":"
,
0
)
<
0
)
{
fprintf
(
stderr
,
"Cannot parse option string %s
\n
"
,
argv
[
i
+
1
]);
return
usage
(
argv
[
0
],
1
);
}
i
++
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"-oo"
)
&&
i
+
1
<
argc
)
{
if
(
av_dict_parse_string
(
&
out_opts
,
argv
[
i
+
1
],
"="
,
":"
,
0
)
<
0
)
{
fprintf
(
stderr
,
"Cannot parse option string %s
\n
"
,
argv
[
i
+
1
]);
return
usage
(
argv
[
0
],
1
);
}
i
++
;
}
else
if
(
!
input_url
)
{
input_url
=
argv
[
i
];
}
else
if
(
!
output_url
)
{
...
...
@@ -60,7 +77,7 @@ int main(int argc, char **argv)
if
(
!
output_url
)
return
usage
(
argv
[
0
],
1
);
ret
=
avio_open2
(
&
input
,
input_url
,
AVIO_FLAG_READ
,
NULL
,
NULL
);
ret
=
avio_open2
(
&
input
,
input_url
,
AVIO_FLAG_READ
,
NULL
,
&
in_opts
);
if
(
ret
)
{
av_strerror
(
ret
,
errbuf
,
sizeof
(
errbuf
));
fprintf
(
stderr
,
"Unable to open %s: %s
\n
"
,
input_url
,
errbuf
);
...
...
@@ -75,7 +92,7 @@ int main(int argc, char **argv)
}
bps
=
size
/
duration
;
}
ret
=
avio_open2
(
&
output
,
output_url
,
AVIO_FLAG_WRITE
,
NULL
,
NULL
);
ret
=
avio_open2
(
&
output
,
output_url
,
AVIO_FLAG_WRITE
,
NULL
,
&
out_opts
);
if
(
ret
)
{
av_strerror
(
ret
,
errbuf
,
sizeof
(
errbuf
));
fprintf
(
stderr
,
"Unable to open %s: %s
\n
"
,
output_url
,
errbuf
);
...
...
@@ -102,6 +119,8 @@ int main(int argc, char **argv)
avio_close
(
output
);
fail:
av_dict_free
(
&
in_opts
);
av_dict_free
(
&
out_opts
);
avio_close
(
input
);
avformat_network_deinit
();
return
ret
?
1
:
0
;
...
...
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