projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change the default 'toggle onion skin' keyboard shortcut from control-o (which is...
[synfig.git]
/
synfig-core
/
trunk
/
src
/
modules
/
mod_ppm
/
trgt_mpg.cpp
diff --git
a/synfig-core/trunk/src/modules/mod_ppm/trgt_mpg.cpp
b/synfig-core/trunk/src/modules/mod_ppm/trgt_mpg.cpp
index
fc302ba
..
e379eb0
100644
(file)
--- a/
synfig-core/trunk/src/modules/mod_ppm/trgt_mpg.cpp
+++ b/
synfig-core/trunk/src/modules/mod_ppm/trgt_mpg.cpp
@@
-1,8
+1,10
@@
-/*! ========================================================================
-** Synfig
-** bsd_mpeg1 Target Module
-** $Id: trgt_mpg.cpp,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*! \file trgt_mpg.cpp
+** \brief bsd_mpeg1 Target Module
**
**
+** $Id$
+**
+** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** This package is free software; you can redistribute it and/or
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** This package is free software; you can redistribute it and/or
@@
-14,6
+16,7
@@
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details.
+** \endlegal
**
** === N O T E S ===========================================================
**
**
** === N O T E S ===========================================================
**
@@
-53,6
+56,8
@@
const char bsd_mpeg1::Ext[]="mpg";
/* === M E T H O D S ======================================================= */
/* === M E T H O D S ======================================================= */
+#error This code has tmpfile vulnerabilites
+
Target *
bsd_mpeg1::New(const char *filename)
{
Target *
bsd_mpeg1::New(const char *filename)
{
@@
-64,7
+69,7
@@
bsd_mpeg1::bsd_mpeg1(const char *Filename)
filename=Filename;
passthru=ppm::New((tmp_dir+"temp.ppm").c_str());
paramfile=NULL;
filename=Filename;
passthru=ppm::New((tmp_dir+"temp.ppm").c_str());
paramfile=NULL;
-
+
}
bsd_mpeg1::~bsd_mpeg1()
}
bsd_mpeg1::~bsd_mpeg1()
@@
-84,16
+89,16
@@
bool
bsd_mpeg1::set_rend_desc(RendDesc *given_desc)
{
if(paramfile)
bsd_mpeg1::set_rend_desc(RendDesc *given_desc)
{
if(paramfile)
- fclose(paramfile);
-
-
+ fclose(paramfile);
+
+
paramfile=fopen((tmp_dir+"temp.param").c_str(),"wt");
int bitrate=150; // kbytes per second
int buffer_drift=50; // bitrate drift (in kbytes per second)
paramfile=fopen((tmp_dir+"temp.param").c_str(),"wt");
int bitrate=150; // kbytes per second
int buffer_drift=50; // bitrate drift (in kbytes per second)
-
+
bitrate*=8*1024;
buffer_drift*=8*1024;
bitrate*=8*1024;
buffer_drift*=8*1024;
-
+
fprintf(paramfile,
"PATTERN IBBPBBPBBPBBPBBP\n"
"OUTPUT %s\n"
fprintf(paramfile,
"PATTERN IBBPBBPBBPBBPBBP\n"
"OUTPUT %s\n"
@@
-119,10
+124,10
@@
bsd_mpeg1::set_rend_desc(RendDesc *given_desc)
"BUFFER_SIZE %d\n"
,filename.c_str(),bitrate,buffer_drift);
float fps=given_desc->get_frame_rate();
"BUFFER_SIZE %d\n"
,filename.c_str(),bitrate,buffer_drift);
float fps=given_desc->get_frame_rate();
-
+
// Valid framerates:
// 23.976, 24, 25, 29.97, 30, 50 ,59.94, 60
// Valid framerates:
// 23.976, 24, 25, 29.97, 30, 50 ,59.94, 60
-
+
if(fps <24.0)
{
fprintf(paramfile,"FRAME_RATE 23.976\n");
if(fps <24.0)
{
fprintf(paramfile,"FRAME_RATE 23.976\n");
@@
-163,15
+168,15
@@
bsd_mpeg1::set_rend_desc(RendDesc *given_desc)
fprintf(paramfile,"FRAME_RATE 59.94\n");
given_desc->set_frame_rate(59.94);
}
fprintf(paramfile,"FRAME_RATE 59.94\n");
given_desc->set_frame_rate(59.94);
}
-
+
// Make sure that the width and height
// are multiples of 8
given_desc->set_w((given_desc->get_w()+4)/8*8);
given_desc->set_h((given_desc->get_h()+4)/8*8);
// Make sure that the width and height
// are multiples of 8
given_desc->set_w((given_desc->get_w()+4)/8*8);
given_desc->set_h((given_desc->get_h()+4)/8*8);
-
+
if(!passthru->set_rend_desc(given_desc))
return false;
if(!passthru->set_rend_desc(given_desc))
return false;
-
+
desc=*given_desc;
fprintf(paramfile,
desc=*given_desc;
fprintf(paramfile,
@@
-181,7
+186,7
@@
bsd_mpeg1::set_rend_desc(RendDesc *given_desc)
fclose(paramfile);
paramfile=NULL;
fclose(paramfile);
paramfile=NULL;
-
+
return true;
}
return true;
}