Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
F
ffworker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Video AG Infrastruktur
ffworker
Commits
fcc8b660
Commit
fcc8b660
authored
Nov 26, 2017
by
Julian Rother
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fileduration and filesize functions
parent
1a06687a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
util.h
util.h
+2
-0
util/fileduration.c
util/fileduration.c
+16
-0
util/filesize.c
util/filesize.c
+12
-0
No files found.
util.h
View file @
fcc8b660
...
...
@@ -13,6 +13,8 @@ char *mprintf(const char *fmt, ...);
void
*
xmalloc
(
size_t
size
);
char
*
hashfile
(
char
*
path
);
double
fileduration
(
char
*
path
);
size_t
filesize
(
char
*
path
);
/* JSON av parsing */
void
parse_dict
(
AVDictionary
**
d
,
char
*
s
);
...
...
util/fileduration.c
0 → 100644
View file @
fcc8b660
#include <libavformat/avformat.h>
#include "../util.h"
double
fileduration
(
char
*
path
)
{
double
res
;
AVFormatContext
*
demux
;
demux
=
0
;
if
(
avformat_open_input
(
&
demux
,
path
,
0
,
0
)
<
0
)
return
0
;
avformat_find_stream_info
(
demux
,
0
);
res
=
demux
->
duration
*
av_q2d
(
AV_TIME_BASE_Q
);
avformat_close_input
(
&
demux
);
return
res
;
}
util/filesize.c
0 → 100644
View file @
fcc8b660
#include <unistd.h>
#include <sys/stat.h>
#include "../util.h"
size_t
filesize
(
char
*
path
)
{
struct
stat
s
;
if
(
stat
(
path
,
&
s
))
return
0
;
return
s
.
st_size
;
}
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