projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid a warning from g++ 4.3.
[synfig.git]
/
synfig-core
/
trunk
/
src
/
modules
/
mod_yuv420p
/
trgt_yuv.cpp
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
..
d45f8ad
100644
(file)
--- a/
synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp
+++ b/
synfig-core/trunk/src/modules/mod_yuv420p/trgt_yuv.cpp
@@
-2,7
+2,7
@@
/*! \file trgt_yuv.cpp
** \brief Template File
**
/*! \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
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
@@
-58,13
+58,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_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),
/* === 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
dithering(true)
{
// YUV420P doesn't have an alpha channel
@@
-76,6
+76,18
@@
yuv::~yuv()
}
bool
}
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();
yuv::set_rend_desc(RendDesc *given_desc)
{
given_desc->clear_flags();
@@
-88,13
+100,14
@@
yuv::set_rend_desc(RendDesc *given_desc)
// Set up our surface
surface.set_wh(desc.get_w(),desc.get_h());
// Set up our surface
surface.set_wh(desc.get_w(),desc.get_h());
-
+
return true;
}
bool
return true;
}
bool
-yuv::start_frame(synfig::ProgressCallback *
callback
)
+yuv::start_frame(synfig::ProgressCallback *
/*callback*/
)
{
{
+ fprintf(file.get(), "FRAME\n");
return static_cast<bool>(file);
}
return static_cast<bool>(file);
}
@@
-146,11
+159,11
@@
yuv::end_frame()
if(surface.get_w()>x+1)
surface[y][x+1]+=error * ((float)7/(float)16);
}
if(surface.get_w()>x+1)
surface[y][x+1]+=error * ((float)7/(float)16);
}
-
+
fputc(i,file.get());
}
fputc(i,file.get());
}
-
-
+
+
// Create new super-sampled surface
Surface sm_surface(w/2,h/2);
for(y=0;y<h;y+=2)
// Create new super-sampled surface
Surface sm_surface(w/2,h/2);
for(y=0;y<h;y+=2)
@@
-190,7
+203,7
@@
yuv::end_frame()
}
fputc(i,file.get());
}
}
fputc(i,file.get());
}
-
+
// Output V channel
for(y=0;y<sm_surface.get_h();y++)
for(x=0;x<sm_surface.get_w();x++)
// Output V channel
for(y=0;y<sm_surface.get_h();y++)
for(x=0;x<sm_surface.get_w();x++)
@@
-216,7
+229,7
@@
yuv::end_frame()
}
fputc(i,file.get());
}
}
fputc(i,file.get());
}
-
+
// Flush out the frame
fflush(file.get());
}
// Flush out the frame
fflush(file.get());
}