diff options
Diffstat (limited to 'liboutput/encode.c')
-rw-r--r-- | liboutput/encode.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/liboutput/encode.c b/liboutput/encode.c index c0e33c2..9877340 100644 --- a/liboutput/encode.c +++ b/liboutput/encode.c @@ -1,25 +1,23 @@ -/*************************************************************************** - * encode.c +/* + * Image plugin to VDR (C++) * - * (C) Copyright 2004-2007 Andreas Brachold <anbr at users.berlios.de> + * (C) Copyright 2004-2008 Andreas Brachold <anbr at users.berlios.de> * Created: Thu Aug 5 2004 - * - ****************************************************************************/ - -/* - * This program 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 program 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 Library General Public License for more details. + * This code 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. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * This code 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html */ #include <stdio.h> @@ -45,10 +43,10 @@ AVCodec *cEncode::m_pavCodec = NULL; /******************************************************************************* */ -cEncode::cEncode() +cEncode::cEncode(unsigned int nNumberOfFramesToEncode) : m_pImageFilled(NULL) , m_pImageYUV(NULL) -, m_nNumberOfFramesToEncode(4) +, m_nNumberOfFramesToEncode(nNumberOfFramesToEncode) , m_pMPEG(NULL) , m_pImageRGB(NULL) { @@ -167,7 +165,9 @@ void cEncode::SetupEncodingParameters(AVCodecContext *context) //IPB //1 => Encode only I-Frames, bigger context->gop_size=m_nNumberOfFramesToEncode-1; - + if(context->gop_size <= 1) { + context->gop_size = 1; + } context->max_b_frames=1; context->flags |= CODEC_FLAG_QSCALE; context->pix_fmt = PIX_FMT_YUV420P; @@ -340,11 +340,11 @@ bool cEncode::Load(const char* szFileName) */ bool cEncode::Save(const char* szFileName) const { - if(m_pMPEG && m_nData) + if(Data() && Size()) { FILE * outf=fopen(szFileName, "w"); if(outf) { - fwrite(m_pMPEG, 1, m_nData, outf); + fwrite(Data(), 1, Size(), outf); fclose(outf); return true; } |