summaryrefslogtreecommitdiff
path: root/y4menc.c
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-01-28 11:12:58 -0800
committerDmitry Kovalev <dkovalev@google.com>2014-01-28 11:12:58 -0800
commit5260b39e5fd632858f98aed250427633307a64ad (patch)
treee43eb09def5bce3b8dd4df6ba6d2020046fcd463 /y4menc.c
parentf9f936b82fae6c5eeca4d793ef9c94ed498dc409 (diff)
downloadlibvpx-5260b39e5fd632858f98aed250427633307a64ad.tar.gz
libvpx-5260b39e5fd632858f98aed250427633307a64ad.tar.bz2
libvpx-5260b39e5fd632858f98aed250427633307a64ad.zip
vpxdec: restoring old md5 behavior for y4m files.
Fix of https://code.google.com/p/webm/issues/detail?id=698 issue. Change-Id: I7a92d91481dbbae28d8953f146e9faafdcd7a310
Diffstat (limited to 'y4menc.c')
-rw-r--r--y4menc.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/y4menc.c b/y4menc.c
index 8321b432e..8b1c95e2b 100644
--- a/y4menc.c
+++ b/y4menc.c
@@ -10,21 +10,18 @@
#include "./y4menc.h"
-void y4m_write_file_header(FILE *file, int width, int height,
- const struct VpxRational *framerate,
- vpx_img_fmt_t fmt) {
- const char *color = fmt == VPX_IMG_FMT_444A ? "C444alpha\n" :
- fmt == VPX_IMG_FMT_I444 ? "C444\n" :
- fmt == VPX_IMG_FMT_I422 ? "C422\n" :
- "C420jpeg\n";
+int y4m_write_file_header(char *buf, size_t len, int width, int height,
+ const struct VpxRational *framerate,
+ vpx_img_fmt_t fmt) {
+ const char *const color = fmt == VPX_IMG_FMT_444A ? "C444alpha\n" :
+ fmt == VPX_IMG_FMT_I444 ? "C444\n" :
+ fmt == VPX_IMG_FMT_I422 ? "C422\n" :
+ "C420jpeg\n";
- // Note: We can't output an aspect ratio here because IVF doesn't
- // store one, and neither does VP8.
- // That will have to wait until these tools support WebM natively.*/
- fprintf(file, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,
- framerate->numerator, framerate->denominator, 'p', color);
+ return snprintf(buf, len, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,
+ framerate->numerator, framerate->denominator, 'p', color);
}
-void y4m_write_frame_header(FILE *file) {
- fprintf(file, "FRAME\n");
+int y4m_write_frame_header(char *buf, size_t len) {
+ return snprintf(buf, len, "FRAME\n");
}