[FFmpeg-devel] [PATCH]Write tiff aspect ratio by default instead of dpi
Carl Eugen Hoyos
cehoyos at ag.or.at
Sat Apr 5 14:52:37 CEST 2014
On Saturday 05 April 2014 02:39:18 pm Clément Bœsch wrote:
> > + AVRational y = av_mul_q((AVRational) { s->dpi, 1 },
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^
> av_make_q()
How do the compilers mentioned in libavutil/rational.h compile
libavcodec/mpeg12dec.c?
New patch attached, thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 7b1e510..67229a9 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -436,6 +436,13 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
add_entry1(s, TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps);
add_entry(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, s->strip_sizes);
add_entry(s, TIFF_XRES, TIFF_RATIONAL, 1, res);
+ if (avctx->sample_aspect_ratio.num > 0 &&
+ avctx->sample_aspect_ratio.den > 0) {
+ AVRational y = av_mul_q(av_make_q(s->dpi, 1),
+ avctx->sample_aspect_ratio);
+ res[0] = y.num;
+ res[1] = y.den;
+ }
add_entry(s, TIFF_YRES, TIFF_RATIONAL, 1, res);
add_entry1(s, TIFF_RES_UNIT, TIFF_SHORT, 2);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6472c0f..ca5ab26 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 55
#define LIBAVCODEC_VERSION_MINOR 57
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
More information about the ffmpeg-devel
mailing list