From 710ecd5b1941d5109f87c0def7e8049e58b92a90 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 16 May 2016 14:36:09 -0400 Subject: [PATCH] Put rotation metadata in the video stream metadata where it belongs --- src/zm_videostore.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index cd698c295..dfcd27036 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -76,20 +76,6 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, dsr = av_dict_set(&pmetadata, "title", "Zoneminder Security Recording", 0); if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - if ( orientation ) { - if ( orientation == Monitor::ROTATE_90 ) { - dsr = av_dict_set(&pmetadata, "rotate", "90", 0); - if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - } else if ( orientation == Monitor::ROTATE_180 ) { - dsr = av_dict_set(&pmetadata, "rotate", "180", 0); - if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - } else if ( orientation == Monitor::ROTATE_270 ) { - dsr = av_dict_set(&pmetadata, "rotate", "270", 0); - if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - } else { - Warning( "Unsupported Orientation(%d)", orientation ); - } - } oc->metadata = pmetadata; @@ -110,6 +96,20 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, if (oc->oformat->flags & AVFMT_GLOBALHEADER) { video_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; } + if ( orientation ) { + if ( orientation == Monitor::ROTATE_90 ) { + dsr = av_dict_set( &video_st->metadata, "rotate", "90", 0); + if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); + } else if ( orientation == Monitor::ROTATE_180 ) { + dsr = av_dict_set( &video_st->metadata, "rotate", "180", 0); + if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); + } else if ( orientation == Monitor::ROTATE_270 ) { + dsr = av_dict_set( &video_st->metadata, "rotate", "270", 0); + if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); + } else { + Warning( "Unsupported Orientation(%d)", orientation ); + } + } if (inpaud_st) {