X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_yuv420p%2Ftrgt_yuv.cpp;h=bad2dcaf40d9f4b26f4b0f2b8af65ac2cfa87a56;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=e2da345e7b062285bd4ed3e0b7e961938ca56fb4;hpb=e8a065f2385c219c511b57dac52786120bfa097d;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp b/synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp index e2da345..bad2dca 100644 --- a/synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp +++ b/synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp @@ -2,10 +2,11 @@ /*! \file trgt_yuv.cpp ** \brief Template File ** -** $Id: trgt_yuv.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -58,13 +59,13 @@ SYNFIG_TARGET_INIT(yuv); SYNFIG_TARGET_SET_NAME(yuv,"yuv420p"); SYNFIG_TARGET_SET_EXT(yuv,"yuv"); SYNFIG_TARGET_SET_VERSION(yuv,"0.1"); -SYNFIG_TARGET_SET_CVS_ID(yuv,"$Id: trgt_yuv.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $"); +SYNFIG_TARGET_SET_CVS_ID(yuv,"$Id$"); /* === M E T H O D S ======================================================= */ yuv::yuv(const char *FILENAME): filename(FILENAME), - file( (filename=="-")?stdout:fopen(filename.c_str(),"wb") ), + file( (filename=="-")?stdout:fopen(filename.c_str(),POPEN_BINARY_WRITE_TYPE) ), dithering(true) { // YUV420P doesn't have an alpha channel @@ -76,6 +77,18 @@ yuv::~yuv() } bool +yuv::init() +{ + if (!file) + return false; + + fprintf(file.get(), "YUV4MPEG2 W%d H%d F%d:1 Ip\n", + desc.get_w(), desc.get_h(), + round_to_int(desc.get_frame_rate())); + return true; +} + +bool yuv::set_rend_desc(RendDesc *given_desc) { given_desc->clear_flags(); @@ -88,13 +101,14 @@ yuv::set_rend_desc(RendDesc *given_desc) // Set up our surface surface.set_wh(desc.get_w(),desc.get_h()); - + return true; } bool -yuv::start_frame(synfig::ProgressCallback *callback) +yuv::start_frame(synfig::ProgressCallback */*callback*/) { + fprintf(file.get(), "FRAME\n"); return static_cast(file); } @@ -146,11 +160,11 @@ yuv::end_frame() if(surface.get_w()>x+1) surface[y][x+1]+=error * ((float)7/(float)16); } - + fputc(i,file.get()); } - - + + // Create new super-sampled surface Surface sm_surface(w/2,h/2); for(y=0;y