ffmpeg | branch: master | Michael Niedermayer <[email protected]> | Mon May 18 
00:28:57 2015 +0200| [57e38043def65418333885c7481b197d470af336] | committer: 
Michael Niedermayer

ffmpeg: Do not copy the display matrix if rotation meta-data is manually added

Fixes Ticket4560

Signed-off-by: Michael Niedermayer <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57e38043def65418333885c7481b197d470af336
---

 ffmpeg.c     |    6 +++++-
 ffmpeg.h     |    1 +
 ffmpeg_opt.c |    4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 6fe169a..a89ae39 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2757,9 +2757,13 @@ static int transcode_init(void)
                 if (!ost->st->side_data)
                     return AVERROR(ENOMEM);
 
+                ost->st->nb_side_data = 0;
                 for (j = 0; j < ist->st->nb_side_data; j++) {
                     const AVPacketSideData *sd_src = &ist->st->side_data[j];
-                    AVPacketSideData *sd_dst = &ost->st->side_data[j];
+                    AVPacketSideData *sd_dst = 
&ost->st->side_data[ost->st->nb_side_data];
+
+                    if (ost->rotate_overridden && sd_src->type == 
AV_PKT_DATA_DISPLAYMATRIX)
+                        continue;
 
                     sd_dst->data = av_malloc(sd_src->size);
                     if (!sd_dst->data)
diff --git a/ffmpeg.h b/ffmpeg.h
index 800bd0a..7fd129a 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -405,6 +405,7 @@ typedef struct OutputStream {
     AVRational frame_rate;
     int force_fps;
     int top_field_first;
+    int rotate_overridden;
 
     AVRational frame_aspect_ratio;
 
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 240f727..5731299 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2209,8 +2209,12 @@ loop_end:
         parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec);
         if (type == 's') {
             for (j = 0; j < oc->nb_streams; j++) {
+                ost = output_streams[nb_output_streams - oc->nb_streams + j];
                 if ((ret = check_stream_specifier(oc, oc->streams[j], 
stream_spec)) > 0) {
                     av_dict_set(&oc->streams[j]->metadata, 
o->metadata[i].u.str, *val ? val : NULL, 0);
+                    if (!strcmp(o->metadata[i].u.str, "rotate")) {
+                        ost->rotate_overridden = 1;
+                    }
                 } else if (ret < 0)
                     exit_program(1);
             }

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to