Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
73c4b6ce
Commit
73c4b6ce
authored
Apr 21, 2014
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/ffhash: implement base64 output.
Also fix usage string: the algorithm is not optional.
parent
3926a30b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
ffhash.c
tools/ffhash.c
+16
-5
No files found.
tools/ffhash.c
View file @
73c4b6ce
...
...
@@ -21,6 +21,7 @@
*/
#include "config.h"
#include "libavutil/avstring.h"
#include "libavutil/error.h"
#include "libavutil/hash.h"
#include "libavutil/mem.h"
...
...
@@ -40,13 +41,14 @@
#define SIZE 65536
static
struct
AVHashContext
*
hash
;
static
int
out_b64
;
static
void
usage
(
void
)
{
int
i
=
0
;
const
char
*
name
;
printf
(
"usage: ffhash [
algorithm]
[input]...
\n
"
);
printf
(
"usage: ffhash [
b64:]algorithm
[input]...
\n
"
);
printf
(
"Supported hash algorithms:"
);
do
{
name
=
av_hash_names
(
i
);
...
...
@@ -59,10 +61,16 @@ static void usage(void)
static
void
finish
(
void
)
{
char
res
[
2
*
AV_HASH_MAX_SIZE
+
1
];
char
res
[
2
*
AV_HASH_MAX_SIZE
+
4
];
printf
(
"%s="
,
av_hash_get_name
(
hash
));
if
(
out_b64
)
{
av_hash_final_b64
(
hash
,
res
,
sizeof
(
res
));
printf
(
"b64:%s"
,
res
);
}
else
{
av_hash_final_hex
(
hash
,
res
,
sizeof
(
res
));
printf
(
"%s=0x%s"
,
av_hash_get_name
(
hash
),
res
);
printf
(
"0x%s"
,
res
);
}
}
static
int
check
(
char
*
file
)
...
...
@@ -110,16 +118,19 @@ int main(int argc, char **argv)
{
int
i
;
int
ret
=
0
;
const
char
*
hash_name
;
if
(
argc
==
1
)
{
usage
();
return
0
;
}
if
((
ret
=
av_hash_alloc
(
&
hash
,
argv
[
1
]))
<
0
)
{
hash_name
=
argv
[
1
];
out_b64
=
av_strstart
(
hash_name
,
"b64:"
,
&
hash_name
);
if
((
ret
=
av_hash_alloc
(
&
hash
,
hash_name
))
<
0
)
{
switch
(
ret
)
{
case
AVERROR
(
EINVAL
):
printf
(
"Invalid hash type: %s
\n
"
,
argv
[
1
]
);
printf
(
"Invalid hash type: %s
\n
"
,
hash_name
);
break
;
case
AVERROR
(
ENOMEM
):
printf
(
"%s
\n
"
,
strerror
(
errno
));
...
...
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