Commit 0a5c22db authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Added a new ImageClipWorkflow class to handle image rendering.

It works, though it will required refactoring to work with resize /
split / everything actually...
It just works for a 10s image, period.
parent 04ca6f33
/*****************************************************************************
* ImageClipWorkflow.cpp : Will extract a frame from an image
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* 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 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ImageClipWorkflow.h"
#define IMAGE_DURATION 10000
ImageClipWorkflow::ImageClipWorkflow( Clip* clip ) : VideoClipWorkflow( clip )
{
}
void ImageClipWorkflow::initVlcOutput()
{
char buffer[32];
sprintf( buffer, ":fake-duration=%d", IMAGE_DURATION );
m_vlcMedia->addOption( buffer );
sprintf( buffer, ":fake-fps=%f", m_clip->getParent()->getFps() );
m_vlcMedia->addOption( buffer );
VideoClipWorkflow::initVlcOutput();
}
/*****************************************************************************
* ImageClipWorkflow.h : Will extract a frame from an image
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* 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 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef IMAGECLIPWORKFLOW_H
#define IMAGECLIPWORKFLOW_H
#include "VideoClipWorkflow.h"
class ImageClipWorkflow : public VideoClipWorkflow
{
public:
ImageClipWorkflow( Clip* clip );
virtual void initVlcOutput();
private:
};
#endif // IMAGECLIPWORKFLOW_H
......@@ -25,6 +25,7 @@
#include "vlmc.h"
#include "TrackWorkflow.h"
#include "VideoClipWorkflow.h"
#include "ImageClipWorkflow.h"
#include "AudioClipWorkflow.h"
TrackWorkflow::TrackWorkflow( unsigned int trackId, MainWorkflow::TrackType type ) :
......@@ -61,7 +62,12 @@ void TrackWorkflow::addClip( Clip* clip, qint64 start )
start = 0;
ClipWorkflow* cw;
if ( m_trackType == MainWorkflow::VideoTrack )
cw = new VideoClipWorkflow( clip );
{
if ( clip->getParent()->getFileType() == Media::Video )
cw = new VideoClipWorkflow( clip );
else
cw = new ImageClipWorkflow( clip );
}
else
cw = new AudioClipWorkflow( clip );
addClip( cw, start );
......
......@@ -22,8 +22,6 @@
#include "VideoClipWorkflow.h"
#define IMAGE_DURATION 10000
VideoClipWorkflow::VideoClipWorkflow( Clip* clip ) : ClipWorkflow( clip )
{
m_buffer = new LightVideoFrame( VIDEOHEIGHT * VIDEOWIDTH * Pixel::NbComposantes );
......@@ -46,13 +44,6 @@ void VideoClipWorkflow::initVlcOutput()
m_vlcMedia->setVideoUnlockCallback( reinterpret_cast<void*>( getUnlockCallback() ) );
m_vlcMedia->addOption( ":sout-transcode-vcodec=RV24" );
m_vlcMedia->addOption( ":sout-transcode-acodec=s16l" );
if ( m_clip->getParent()->getFileType() == Media::Image )
{
sprintf( buffer, ":fake-duration=%d", IMAGE_DURATION );
m_vlcMedia->addOption( buffer );
sprintf( buffer, ":fake-fps=%f", m_clip->getParent()->getFps() );
m_vlcMedia->addOption( buffer );
}
// m_vlcMedia->addOption( ":no-sout-keep" );
if ( m_fullSpeedRender == true )
......
......@@ -35,9 +35,11 @@ class VideoClipWorkflow : public ClipWorkflow
void* getUnlockCallback();
virtual void* getOutput();
protected:
virtual void initVlcOutput();
private:
LightVideoFrame* m_buffer;
virtual void initVlcOutput();
static void lock( VideoClipWorkflow* clipWorkflow, void** pp_ret, int size );
static void unlock( VideoClipWorkflow* clipWorkflow, void* buffer, int width, int height, int bpp, int size );
};
......
HEADERS += AudioClipWorkflow.h \
ClipWorkflow.h \
MainWorkflow.h \
TrackHandler.h \
TrackWorkflow.h \
VideoClipWorkflow.h
SOURCES += AudioClipWorkflow.cpp \
ClipWorkflow.cpp \
MainWorkflow.cpp \
TrackHandler.cpp \
TrackWorkflow.cpp \
VideoClipWorkflow.cpp
HEADERS += AudioClipWorkflow.h \
ClipWorkflow.h \
MainWorkflow.h \
TrackHandler.h \
TrackWorkflow.h \
VideoClipWorkflow.h \
ImageClipWorkflow.h
SOURCES += AudioClipWorkflow.cpp \
ClipWorkflow.cpp \
MainWorkflow.cpp \
TrackHandler.cpp \
TrackWorkflow.cpp \
VideoClipWorkflow.cpp \
ImageClipWorkflow.cpp
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment