-/*! ========================================================================
-** Sinfg
-** 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
**
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+** $Id$
**
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** \legal
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** 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 ===========================================================
**
/* === H E A D E R S ======================================================= */
-#define SINFG_TARGET
+#define SYNFIG_TARGET
#ifdef USING_PCH
# include "pch.h"
/* === M A C R O S ========================================================= */
-using namespace sinfg;
+using namespace synfig;
using namespace std;
using namespace etl;
filename=Filename;
passthru=ppm::New((tmp_dir+"temp.ppm").c_str());
paramfile=NULL;
-
+
}
bsd_mpeg1::~bsd_mpeg1()
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)
-
+
bitrate*=8*1024;
buffer_drift*=8*1024;
-
+
fprintf(paramfile,
"PATTERN IBBPBBPBBPBBPBBP\n"
"OUTPUT %s\n"
"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
-
+
if(fps <24.0)
{
fprintf(paramfile,"FRAME_RATE 23.976\n");
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);
-
+
if(!passthru->set_rend_desc(given_desc))
return false;
-
+
desc=*given_desc;
fprintf(paramfile,
fclose(paramfile);
paramfile=NULL;
-
+
return true;
}
}
bool
-bsd_mpeg1::start_frame(sinfg::ProgressCallback *callback)
+bsd_mpeg1::start_frame(synfig::ProgressCallback *callback)
{
return passthru->start_frame(callback);
}