Home | History | Annotate | Download | only in libvpx
      1 /*
      2  *  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #include "./y4menc.h"
     12 
     13 int y4m_write_file_header(char *buf, size_t len, int width, int height,
     14                           const struct VpxRational *framerate,
     15                           vpx_img_fmt_t fmt) {
     16   const char *const color = fmt == VPX_IMG_FMT_444A ? "C444alpha\n" :
     17                             fmt == VPX_IMG_FMT_I444 ? "C444\n" :
     18                             fmt == VPX_IMG_FMT_I422 ? "C422\n" :
     19                             "C420jpeg\n";
     20 
     21   return snprintf(buf, len, "YUV4MPEG2 W%u H%u F%u:%u I%c %s", width, height,
     22                   framerate->numerator, framerate->denominator, 'p', color);
     23 }
     24 
     25 int y4m_write_frame_header(char *buf, size_t len) {
     26   return snprintf(buf, len, "FRAME\n");
     27 }
     28