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
4b365b08
Commit
4b365b08
authored
Aug 03, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Aug 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavu/timecode: add av_timecode_check_frame_rate().
parent
6b3484dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
timecode.c
libavutil/timecode.c
+18
-8
timecode.h
libavutil/timecode.h
+7
-0
version.h
libavutil/version.h
+2
-2
No files found.
libavutil/timecode.c
View file @
4b365b08
...
...
@@ -146,6 +146,17 @@ char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
return
buf
;
}
static
int
check_fps
(
int
fps
)
{
int
i
;
static
const
int
supported_fps
[]
=
{
24
,
25
,
30
,
50
,
60
};
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
supported_fps
);
i
++
)
if
(
fps
==
supported_fps
[
i
])
return
0
;
return
-
1
;
}
static
int
check_timecode
(
void
*
log_ctx
,
AVTimecode
*
tc
)
{
if
(
tc
->
fps
<=
0
)
{
...
...
@@ -156,18 +167,12 @@ static int check_timecode(void *log_ctx, AVTimecode *tc)
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Drop frame is only allowed with 30000/1001 FPS
\n
"
);
return
AVERROR
(
EINVAL
);
}
switch
(
tc
->
fps
)
{
case
24
:
case
25
:
case
30
:
case
50
:
case
60
:
return
0
;
default:
if
(
check_fps
(
tc
->
fps
)
<
0
)
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Timecode frame rate %d/%d not supported
\n
"
,
tc
->
rate
.
num
,
tc
->
rate
.
den
);
return
AVERROR_PATCHWELCOME
;
}
return
0
;
}
static
int
fps_from_frame_rate
(
AVRational
rate
)
...
...
@@ -177,6 +182,11 @@ static int fps_from_frame_rate(AVRational rate)
return
(
rate
.
num
+
rate
.
den
/
2
)
/
rate
.
den
;
}
int
av_timecode_check_frame_rate
(
AVRational
rate
)
{
return
check_fps
(
fps_from_frame_rate
(
rate
));
}
int
av_timecode_init
(
AVTimecode
*
tc
,
AVRational
rate
,
int
flags
,
int
frame_start
,
void
*
log_ctx
)
{
memset
(
tc
,
0
,
sizeof
(
*
tc
));
...
...
libavutil/timecode.h
View file @
4b365b08
...
...
@@ -140,4 +140,11 @@ int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start
*/
int
av_timecode_init_from_string
(
AVTimecode
*
tc
,
AVRational
rate
,
const
char
*
str
,
void
*
log_ctx
);
/**
* Check if the timecode feature is available for the given frame rate
*
* @return 0 if supported, <0 otherwise
*/
int
av_timecode_check_frame_rate
(
AVRational
rate
);
#endif
/* AVUTIL_TIMECODE_H */
libavutil/version.h
View file @
4b365b08
...
...
@@ -39,8 +39,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 6
6
#define LIBAVUTIL_VERSION_MICRO 10
1
#define LIBAVUTIL_VERSION_MINOR 6
7
#define LIBAVUTIL_VERSION_MICRO 10
0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
...
...
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