Put rotation metadata in the video stream metadata where it belongs

This commit is contained in:
Isaac Connor 2016-05-16 14:36:09 -04:00
parent e28cb5b412
commit 710ecd5b19
1 changed files with 14 additions and 14 deletions

View File

@ -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) {