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
4351c288
Commit
4351c288
authored
May 03, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffplay&cmdutils:Factor get_rotation() code out
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
a6b630e9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
16 deletions
+26
-16
cmdutils.c
cmdutils.c
+23
-0
cmdutils.h
cmdutils.h
+2
-0
ffplay.c
ffplay.c
+1
-16
No files found.
cmdutils.c
View file @
4351c288
...
...
@@ -41,6 +41,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/display.h"
#include "libavutil/mathematics.h"
#include "libavutil/imgutils.h"
#include "libavutil/parseutils.h"
...
...
@@ -2229,4 +2230,26 @@ int show_sinks(void *optctx, const char *opt, const char *arg)
av_log_set_level
(
error_level
);
return
ret
;
}
double
get_rotation
(
AVStream
*
st
)
{
AVDictionaryEntry
*
rotate_tag
=
av_dict_get
(
st
->
metadata
,
"rotate"
,
NULL
,
0
);
uint8_t
*
displaymatrix
=
av_stream_get_side_data
(
st
,
AV_PKT_DATA_DISPLAYMATRIX
,
NULL
);
double
theta
=
0
;
if
(
rotate_tag
&&
*
rotate_tag
->
value
&&
strcmp
(
rotate_tag
->
value
,
"0"
))
{
char
*
tail
;
theta
=
av_strtod
(
rotate_tag
->
value
,
&
tail
);
if
(
*
tail
)
theta
=
0
;
}
if
(
displaymatrix
&&
!
theta
)
theta
=
av_display_rotation_get
((
int32_t
*
)
displaymatrix
);
theta
-=
360
*
floor
(
theta
/
360
+
0
.
9
/
360
);
return
theta
;
}
#endif
cmdutils.h
View file @
4351c288
...
...
@@ -597,4 +597,6 @@ void *grow_array(void *array, int elem_size, int *size, int new_size);
char name[128];\
av_get_channel_layout_string(name, sizeof(name), 0, ch_layout);
double
get_rotation
(
AVStream
*
st
);
#endif
/* CMDUTILS_H */
ffplay.c
View file @
4351c288
...
...
@@ -32,7 +32,6 @@
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
#include "libavutil/display.h"
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
...
...
@@ -2018,21 +2017,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
INSERT_FILT
(
"crop"
,
"floor(in_w/2)*2:floor(in_h/2)*2"
);
if
(
autorotate
)
{
AVDictionaryEntry
*
rotate_tag
=
av_dict_get
(
is
->
video_st
->
metadata
,
"rotate"
,
NULL
,
0
);
uint8_t
*
displaymatrix
=
av_stream_get_side_data
(
is
->
video_st
,
AV_PKT_DATA_DISPLAYMATRIX
,
NULL
);
double
theta
=
0
;
if
(
rotate_tag
&&
*
rotate_tag
->
value
&&
strcmp
(
rotate_tag
->
value
,
"0"
))
{
char
*
tail
;
theta
=
av_strtod
(
rotate_tag
->
value
,
&
tail
);
if
(
*
tail
)
theta
=
0
;
}
if
(
displaymatrix
&&
!
theta
)
theta
=
av_display_rotation_get
((
int32_t
*
)
displaymatrix
);
theta
-=
360
*
floor
(
theta
/
360
+
0
.
9
/
360
);
double
theta
=
get_rotation
(
is
->
video_st
);
if
(
fabs
(
theta
-
90
)
<
1
.
0
)
{
INSERT_FILT
(
"transpose"
,
"clock"
);
...
...
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