[FFmpeg-cvslog] ffplay&cmdutils:Factor get_rotation() code out
Geek.Song
ffmpeg at gmail.com
Tue May 5 05:31:20 CEST 2015
commit f2f2a6950ba28df78343fa25dbdd18e1ddbf0f7c
Author: GoogleGeek <ffmpeg at gmail.com>
Date: Mon May 4 14:40:02 2015 +0800
fix link when avdevice is disabled
diff --git a/cmdutils.c b/cmdutils.c
index d5a2cbe..59092fd 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -2231,6 +2231,8 @@ int show_sinks(void *optctx, const char *opt,
const char *arg)
return ret;
}
+#endif
+
double get_rotation(AVStream *st)
{
AVDictionaryEntry *rotate_tag = av_dict_get(st->metadata,
"rotate", NULL, 0);
@@ -2252,4 +2254,3 @@ double get_rotation(AVStream *st)
return theta;
}
-#endif
On Mon, May 4, 2015 at 6:15 AM, Michael Niedermayer <git at videolan.org> wrote:
> ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun May 3 23:49:16 2015 +0200| [4351c288b9841d02a55e7b836796d7da6d19cac8] | committer: Michael Niedermayer
>
> ffplay&cmdutils:Factor get_rotation() code out
>
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
>
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4351c288b9841d02a55e7b836796d7da6d19cac8
> ---
>
> cmdutils.c | 23 +++++++++++++++++++++++
> cmdutils.h | 2 ++
> ffplay.c | 17 +----------------
> 3 files changed, 26 insertions(+), 16 deletions(-)
>
> diff --git a/cmdutils.c b/cmdutils.c
> index 5a18cd5..d5a2cbe 100644
> --- a/cmdutils.c
> +++ b/cmdutils.c
> @@ -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
> diff --git a/cmdutils.h b/cmdutils.h
> index f6ad44c..a21ce35 100644
> --- a/cmdutils.h
> +++ b/cmdutils.h
> @@ -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 */
> diff --git a/ffplay.c b/ffplay.c
> index eea00e6..9ce13d7 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -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");
>
> _______________________________________________
> ffmpeg-cvslog mailing list
> ffmpeg-cvslog at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
--
-----------------------------------------------------
Founder of http://LiveKings.com
More information about the ffmpeg-cvslog
mailing list