Re: [FFmpeg-devel] [PATCH 43/87] avformat/mov, movenc: Enc exporting rotation via metadata
On 4/19/2021 3:35 PM, Michael Niedermayer wrote: On Mon, Apr 19, 2021 at 11:09:40AM -0300, James Almer wrote: From: Andreas Rheinhardt Deprecated in ddef3d902f0e4cbd6be6b3e5df7ec158ce51488b. (The reference file of the mov-zombie test needed to be updated, because a rotate metadata tag is no longer exported; the side-data is of course still present.) Signed-off-by: Andreas Rheinhardt --- libavformat/mov.c | 14 -- libavformat/movenc.c | 15 --- libavformat/version.h | 3 --- tests/ref/fate/mov-zombie | 2 +- 4 files changed, 1 insertion(+), 33 deletions(-) it seems this doesnt want to apply Applying: avformat/mov, movenc: Enc exporting rotation via metadata Using index info to reconstruct a base tree... M libavformat/mov.c error: patch failed: tests/ref/fate/mov-zombie:194 error: tests/ref/fate/mov-zombie: patch does not apply error: Did you hand edit your patch? It does not apply to blobs recorded in its index. Patch failed at 0001 avformat/mov, movenc: Enc exporting rotation via metadata hint: Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Probably its related to the long line Odd, git send-email doesn't normally screw up like this. I'm attaching the patch here, then. From 8fcb2b40b9210bf9dcc04eff34a56391514d4c3b Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 6 Mar 2021 16:33:48 +0100 Subject: [PATCH 43/87] avformat/mov, movenc: Enc exporting rotation via metadata Deprecated in ddef3d902f0e4cbd6be6b3e5df7ec158ce51488b. (The reference file of the mov-zombie test needed to be updated, because a rotate metadata tag is no longer exported; the side-data is of course still present.) Signed-off-by: Andreas Rheinhardt --- libavformat/mov.c | 14 -- libavformat/movenc.c | 15 --- libavformat/version.h | 3 --- tests/ref/fate/mov-zombie | 2 +- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 9ca1ac89a8..8b3371abe6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4582,8 +4582,6 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) // save the matrix when it is not the default identity if (!IS_MATRIX_IDENT(res_display_matrix)) { -double rotate; - av_freep(&sc->display_matrix); sc->display_matrix = av_malloc(sizeof(int32_t) * 9); if (!sc->display_matrix) @@ -4592,18 +4590,6 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) sc->display_matrix[i * 3 + j] = res_display_matrix[i][j]; - -#if FF_API_OLD_ROTATE_API -rotate = av_display_rotation_get(sc->display_matrix); -if (!isnan(rotate)) { -char rotate_buf[64]; -rotate = -rotate; -if (rotate < 0) // for backward compatibility -rotate += 360; -snprintf(rotate_buf, sizeof(rotate_buf), "%g", rotate); -av_dict_set(&st->metadata, "rotate", rotate_buf, 0); -} -#endif } // transform the display width/height according to the matrix diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8e6ed817d8..b15ecbe713 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3043,7 +3043,6 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, AV_ROUND_UP); int version = duration < INT32_MAX ? 0 : 1; int flags = MOV_TKHD_FLAG_IN_MOVIE; -int rotation = 0; int group = 0; uint32_t *display_matrix = NULL; @@ -3100,23 +3099,9 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb16(pb, 0); /* reserved */ /* Matrix structure */ -#if FF_API_OLD_ROTATE_API -if (st && st->metadata) { -AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0); -rotation = (rot && rot->value) ? atoi(rot->value) : 0; -} -#endif if (display_matrix) { for (i = 0; i < 9; i++) avio_wb32(pb, display_matrix[i]); -#if FF_API_OLD_ROTATE_API -} else if (rotation == 90) { -write_matrix(pb, 0, 1, -1, 0, track->par->height, 0); -} else if (rotation == 180) { -write_matrix(pb, -1, 0, 0, -1, track->par->width, track->par->height); -} else if (rotation == 270) { -write_matrix(pb, 0, -1, 1, 0, 0, track->par->width); -#endif } else { write_matrix(pb, 1, 0, 0, 1, 0, 0); } diff --git a/libavformat/version.h b/libavformat/version.h index 7108482624..4c186f2915 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -58,9 +58,6 @@ #ifndef FF_API_LAVF_AVCTX #define FF_API_LAVF_
Re: [FFmpeg-devel] [PATCH 43/87] avformat/mov, movenc: Enc exporting rotation via metadata
On Mon, Apr 19, 2021 at 11:09:40AM -0300, James Almer wrote: > From: Andreas Rheinhardt > > Deprecated in ddef3d902f0e4cbd6be6b3e5df7ec158ce51488b. > > (The reference file of the mov-zombie test needed to be updated, because > a rotate metadata tag is no longer exported; the side-data is of course > still present.) > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/mov.c | 14 -- > libavformat/movenc.c | 15 --- > libavformat/version.h | 3 --- > tests/ref/fate/mov-zombie | 2 +- > 4 files changed, 1 insertion(+), 33 deletions(-) it seems this doesnt want to apply Applying: avformat/mov, movenc: Enc exporting rotation via metadata Using index info to reconstruct a base tree... M libavformat/mov.c error: patch failed: tests/ref/fate/mov-zombie:194 error: tests/ref/fate/mov-zombie: patch does not apply error: Did you hand edit your patch? It does not apply to blobs recorded in its index. Patch failed at 0001 avformat/mov, movenc: Enc exporting rotation via metadata hint: Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Probably its related to the long line [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "I am not trying to be anyone's saviour, I'm trying to think about the future and not be sad" - Elon Musk signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 43/87] avformat/mov, movenc: Enc exporting rotation via metadata
From: Andreas Rheinhardt Deprecated in ddef3d902f0e4cbd6be6b3e5df7ec158ce51488b. (The reference file of the mov-zombie test needed to be updated, because a rotate metadata tag is no longer exported; the side-data is of course still present.) Signed-off-by: Andreas Rheinhardt --- libavformat/mov.c | 14 -- libavformat/movenc.c | 15 --- libavformat/version.h | 3 --- tests/ref/fate/mov-zombie | 2 +- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 9ca1ac89a8..8b3371abe6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4582,8 +4582,6 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) // save the matrix when it is not the default identity if (!IS_MATRIX_IDENT(res_display_matrix)) { -double rotate; - av_freep(&sc->display_matrix); sc->display_matrix = av_malloc(sizeof(int32_t) * 9); if (!sc->display_matrix) @@ -4592,18 +4590,6 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) sc->display_matrix[i * 3 + j] = res_display_matrix[i][j]; - -#if FF_API_OLD_ROTATE_API -rotate = av_display_rotation_get(sc->display_matrix); -if (!isnan(rotate)) { -char rotate_buf[64]; -rotate = -rotate; -if (rotate < 0) // for backward compatibility -rotate += 360; -snprintf(rotate_buf, sizeof(rotate_buf), "%g", rotate); -av_dict_set(&st->metadata, "rotate", rotate_buf, 0); -} -#endif } // transform the display width/height according to the matrix diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8e6ed817d8..b15ecbe713 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3043,7 +3043,6 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, AV_ROUND_UP); int version = duration < INT32_MAX ? 0 : 1; int flags = MOV_TKHD_FLAG_IN_MOVIE; -int rotation = 0; int group = 0; uint32_t *display_matrix = NULL; @@ -3100,23 +3099,9 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb16(pb, 0); /* reserved */ /* Matrix structure */ -#if FF_API_OLD_ROTATE_API -if (st && st->metadata) { -AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0); -rotation = (rot && rot->value) ? atoi(rot->value) : 0; -} -#endif if (display_matrix) { for (i = 0; i < 9; i++) avio_wb32(pb, display_matrix[i]); -#if FF_API_OLD_ROTATE_API -} else if (rotation == 90) { -write_matrix(pb, 0, 1, -1, 0, track->par->height, 0); -} else if (rotation == 180) { -write_matrix(pb, -1, 0, 0, -1, track->par->width, track->par->height); -} else if (rotation == 270) { -write_matrix(pb, 0, -1, 1, 0, 0, track->par->width); -#endif } else { write_matrix(pb, 1, 0, 0, 1, 0, 0); } diff --git a/libavformat/version.h b/libavformat/version.h index 7108482624..4c186f2915 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -58,9 +58,6 @@ #ifndef FF_API_LAVF_AVCTX #define FF_API_LAVF_AVCTX (LIBAVFORMAT_VERSION_MAJOR < 59) #endif -#ifndef FF_API_OLD_ROTATE_API -#define FF_API_OLD_ROTATE_API (LIBAVFORMAT_VERSION_MAJOR < 59) -#endif #ifndef FF_API_OLD_AVIO_EOF_0 #define FF_API_OLD_AVIO_EOF_0 (LIBAVFORMAT_VERSION_MAJOR < 59) #endif diff --git a/tests/ref/fate/mov-zombie b/tests/ref/fate/mov-zombie index 7b417e59dd..3001c6daa2 100644 --- a/tests/ref/fate/mov-zombie +++ b/tests/ref/fate/mov-zombie @@ -194,5 +194,5 @@ frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=188623|pkt_pts_time=2. packet|codec_type=video|stream_index=0|pts=197632|pts_time=2.195911|dts=191625|dts_time=2.129167|duration=3003|duration_time=0.033367|size=580|pos=101820|flags=__ frame|media_type=video|stream_index=0|key_frame=0|pkt_pts=191626|pkt_pts_time=2.129178|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=191626|best_effort_timestamp_time=2.129178|pkt_duration=3003|pkt_duration_time=0.033367|pkt_pos=99180|pkt_size=1666|width=160|height=240|pix_fmt=yuv420p|sample_aspect_ratio=2:1|pict_type=P|coded_picture_number=63|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=tv|color_space=smpte170m|color_primaries=smpte170m|color_transfer=bt709|chroma_location=topleftside_data|side_data_type=H.26[45] User Data Unregistered SEI message -stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=avc1|codec_tag=0x31637661|width=160|height=240|coded_width=160|coded_height=240|closed_captions=0|has_b_frames=1|sample_aspect_ratio=2:1|display_aspect_ratio=4:3|pix_fmt=yuv420p|level=12|color_range=tv|color_space=smpte170m|color_transfer=bt709|color