static Title* titleclass;
static QApplication *app;
-extern "C" {
- void init_qt (const char* c){
- titleclass=new Title(QString(c));
- }
- void refresh_kdenlivetitle( uint8_t* buffer, int width, int height , double position){
- titleclass->drawKdenliveTitle(buffer,width,height,position);
- }
+extern "C"
+{
+ void init_qt( const char* c )
+ {
+ titleclass=new Title( QString( c ) );
+ }
+ void refresh_kdenlivetitle( uint8_t* buffer, int width, int height , double position )
+ {
+ titleclass->drawKdenliveTitle( buffer,width,height,position );
+ }
}
-Title::Title(const QString& filename):m_filename(filename),m_scene(NULL){
- //must be extracted from kdenlive title
- start =new QGraphicsPolygonItem(QPolygonF(QRectF(100, 100, 600, 600)));;
- end=new QGraphicsPolygonItem(QPolygonF(QRectF(0, 0, 300, 300)));;
+Title::Title( const QString& filename ):m_filename( filename ),m_scene( NULL )
+{
+ //must be extracted from kdenlive title
+ start =new QGraphicsPolygonItem( QPolygonF( QRectF( 100, 100, 600, 600 ) ) );
+ ;
+ end=new QGraphicsPolygonItem( QPolygonF( QRectF( 0, 0, 300, 300 ) ) );
+ ;
}
-void Title::drawKdenliveTitle(uint8_t * buffer ,int width,int height,double position){
- if (!m_scene){
- int argc=0;
- char* argv[1];
- argv[0]="xxx";
- if (! QApplication::activeWindow())
- //if (!app)
- app=new QApplication(argc,argv);
- m_scene=new QGraphicsScene;
- loadDocument(m_filename,start,end);
- }
- //must be extracted from kdenlive title
-
- QImage *img=new QImage(width,height,QImage::Format_ARGB32);
- img->fill(0);
- QRectF rstart=start->boundingRect();
- QRectF rend=end->boundingRect();
- QPointF topleft=rstart.topLeft()+(rend.topLeft()-rstart.topLeft())*position;
- QPointF bottomRight=rstart.bottomRight()+(rend.bottomRight()-rstart.bottomRight())*position;
- QPainter p1;
- p1.begin(img);
- p1.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing);//|QPainter::SmoothPixmapTransform );
- m_scene->render(&p1,QRect(0,0,width,height),QRectF(topleft,bottomRight));
- p1.end();
- uint8_t *pointer=img->bits();
- QRgb* src = (QRgb*) pointer;
- for (int i=0;i<width*height*4;i+=4){
- *buffer++=qRed(*src);
- *buffer++=qGreen(*src);
- *buffer++=qBlue(*src);
- *buffer++=qAlpha(*src);
- src++;
- }
- delete img;
+void Title::drawKdenliveTitle( uint8_t * buffer ,int width,int height,double position )
+{
+ if ( !m_scene )
+ {
+ int argc=0;
+ char* argv[1];
+ argv[0]="xxx";
+ if ( ! QApplication::activeWindow() )
+ //if (!app)
+ app=new QApplication( argc,argv );
+ m_scene=new QGraphicsScene;
+ loadDocument( m_filename,start,end );
+ }
+ //must be extracted from kdenlive title
+
+ QImage *img=new QImage( width,height,QImage::Format_ARGB32 );
+ img->fill( 0 );
+ QRectF rstart=start->boundingRect();
+ QRectF rend=end->boundingRect();
+ QPointF topleft=rstart.topLeft()+( rend.topLeft()-rstart.topLeft() )*position;
+ QPointF bottomRight=rstart.bottomRight()+( rend.bottomRight()-rstart.bottomRight() )*position;
+ QPainter p1;
+ p1.begin( img );
+ p1.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing );//|QPainter::SmoothPixmapTransform );
+ m_scene->render( &p1,QRect( 0,0,width,height ),QRectF( topleft,bottomRight ) );
+ p1.end();
+ uint8_t *pointer=img->bits();
+ QRgb* src = ( QRgb* ) pointer;
+ for ( int i=0;i<width*height*4;i+=4 )
+ {
+ *buffer++=qRed( *src );
+ *buffer++=qGreen( *src );
+ *buffer++=qBlue( *src );
+ *buffer++=qAlpha( *src );
+ src++;
+ }
+ delete img;
}
-int Title::loadDocument(const QString& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv)
+int Title::loadDocument( const QString& url, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv )
{
- QDomDocument doc;
- if (!m_scene)
- return -1;
+ QDomDocument doc;
+ if ( !m_scene )
+ return -1;
- QFile file(url);
- if (file.open(QIODevice::ReadOnly)) {
- doc.setContent(&file, false);
- file.close();
- }
- return loadFromXml(doc, startv, endv);
+ QFile file( url );
+ if ( file.open( QIODevice::ReadOnly ) )
+ {
+ doc.setContent( &file, false );
+ file.close();
+ }
+ return loadFromXml( doc, startv, endv );
}
-int Title::loadFromXml(QDomDocument doc, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv)
+int Title::loadFromXml( QDomDocument doc, QGraphicsPolygonItem* startv, QGraphicsPolygonItem* endv )
{
- QDomNodeList titles = doc.elementsByTagName("kdenlivetitle");
- int maxZValue = 0;
- if (titles.size()) {
+ QDomNodeList titles = doc.elementsByTagName( "kdenlivetitle" );
+ int maxZValue = 0;
+ if ( titles.size() )
+ {
- QDomNodeList items = titles.item(0).childNodes();
- for (int i = 0; i < items.count(); i++) {
- QGraphicsItem *gitem = NULL;
- int zValue = items.item(i).attributes().namedItem("z-index").nodeValue().toInt();
- if (zValue > -1000) {
- if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsTextItem") {
- QDomNamedNodeMap txtProperties = items.item(i).namedItem("content").attributes();
- QFont font(txtProperties.namedItem("font").nodeValue());
- font.setBold(txtProperties.namedItem("font-bold").nodeValue().toInt());
- font.setItalic(txtProperties.namedItem("font-italic").nodeValue().toInt());
- font.setUnderline(txtProperties.namedItem("font-underline").nodeValue().toInt());
- // Older Kdenlive version did not store pixel size but point size
- if (txtProperties.namedItem("font-pixel-size").isNull()) {
- QFont f2;
- f2.setPointSize(txtProperties.namedItem("font-size").nodeValue().toInt());
- font.setPixelSize(QFontInfo(f2).pixelSize());
- } else
- font.setPixelSize(txtProperties.namedItem("font-pixel-size").nodeValue().toInt());
- QColor col(stringToColor(txtProperties.namedItem("font-color").nodeValue()));
- QGraphicsTextItem *txt = m_scene->addText(items.item(i).namedItem("content").firstChild().nodeValue(), font);
- txt->setDefaultTextColor(col);
- txt->setTextInteractionFlags(Qt::NoTextInteraction);
- if (txtProperties.namedItem("alignment").isNull() == false) {
- txt->setTextWidth(txt->boundingRect().width());
- QTextCursor cur = txt->textCursor();
- QTextBlockFormat format = cur.blockFormat();
- format.setAlignment((Qt::Alignment) txtProperties.namedItem("alignment").nodeValue().toInt());
- cur.select(QTextCursor::Document);
- cur.setBlockFormat(format);
- txt->setTextCursor(cur);
- cur.clearSelection();
- txt->setTextCursor(cur);
- }
+ QDomNodeList items = titles.item( 0 ).childNodes();
+ for ( int i = 0; i < items.count(); i++ )
+ {
+ QGraphicsItem *gitem = NULL;
+ int zValue = items.item( i ).attributes().namedItem( "z-index" ).nodeValue().toInt();
+ if ( zValue > -1000 )
+ {
+ if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsTextItem" )
+ {
+ QDomNamedNodeMap txtProperties = items.item( i ).namedItem( "content" ).attributes();
+ QFont font( txtProperties.namedItem( "font" ).nodeValue() );
+ font.setBold( txtProperties.namedItem( "font-bold" ).nodeValue().toInt() );
+ font.setItalic( txtProperties.namedItem( "font-italic" ).nodeValue().toInt() );
+ font.setUnderline( txtProperties.namedItem( "font-underline" ).nodeValue().toInt() );
+ // Older Kdenlive version did not store pixel size but point size
+ if ( txtProperties.namedItem( "font-pixel-size" ).isNull() )
+ {
+ QFont f2;
+ f2.setPointSize( txtProperties.namedItem( "font-size" ).nodeValue().toInt() );
+ font.setPixelSize( QFontInfo( f2 ).pixelSize() );
+ }
+ else
+ font.setPixelSize( txtProperties.namedItem( "font-pixel-size" ).nodeValue().toInt() );
+ QColor col( stringToColor( txtProperties.namedItem( "font-color" ).nodeValue() ) );
+ QGraphicsTextItem *txt = m_scene->addText( items.item( i ).namedItem( "content" ).firstChild().nodeValue(), font );
+ txt->setDefaultTextColor( col );
+ txt->setTextInteractionFlags( Qt::NoTextInteraction );
+ if ( txtProperties.namedItem( "alignment" ).isNull() == false )
+ {
+ txt->setTextWidth( txt->boundingRect().width() );
+ QTextCursor cur = txt->textCursor();
+ QTextBlockFormat format = cur.blockFormat();
+ format.setAlignment(( Qt::Alignment ) txtProperties.namedItem( "alignment" ).nodeValue().toInt() );
+ cur.select( QTextCursor::Document );
+ cur.setBlockFormat( format );
+ txt->setTextCursor( cur );
+ cur.clearSelection();
+ txt->setTextCursor( cur );
+ }
- if (!txtProperties.namedItem("kdenlive-axis-x-inverted").isNull()) {
- //txt->setData(OriginXLeft, txtProperties.namedItem("kdenlive-axis-x-inverted").nodeValue().toInt());
- }
- if (!txtProperties.namedItem("kdenlive-axis-y-inverted").isNull()) {
- //txt->setData(OriginYTop, txtProperties.namedItem("kdenlive-axis-y-inverted").nodeValue().toInt());
- }
+ if ( !txtProperties.namedItem( "kdenlive-axis-x-inverted" ).isNull() )
+ {
+ //txt->setData(OriginXLeft, txtProperties.namedItem("kdenlive-axis-x-inverted").nodeValue().toInt());
+ }
+ if ( !txtProperties.namedItem( "kdenlive-axis-y-inverted" ).isNull() )
+ {
+ //txt->setData(OriginYTop, txtProperties.namedItem("kdenlive-axis-y-inverted").nodeValue().toInt());
+ }
- gitem = txt;
- } else if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsRectItem") {
- QString rect = items.item(i).namedItem("content").attributes().namedItem("rect").nodeValue();
- QString br_str = items.item(i).namedItem("content").attributes().namedItem("brushcolor").nodeValue();
- QString pen_str = items.item(i).namedItem("content").attributes().namedItem("pencolor").nodeValue();
- double penwidth = items.item(i).namedItem("content").attributes().namedItem("penwidth").nodeValue().toDouble();
- QGraphicsRectItem *rec = m_scene->addRect(stringToRect(rect), QPen(QBrush(stringToColor(pen_str)), penwidth), QBrush(stringToColor(br_str)));
- gitem = rec;
- } else if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsPixmapItem") {
- QString url = items.item(i).namedItem("content").attributes().namedItem("url").nodeValue();
- QPixmap pix(url);
- QGraphicsPixmapItem *rec = m_scene->addPixmap(pix);
- rec->setData(Qt::UserRole, url);
- gitem = rec;
- } else if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsSvgItem") {
- QString url = items.item(i).namedItem("content").attributes().namedItem("url").nodeValue();
- //QGraphicsSvgItem *rec = new QGraphicsSvgItem(url);
- //m_scene->addItem(rec);
- //rec->setData(Qt::UserRole, url);
- //gitem = rec;
- }
- }
- //pos and transform
- if (gitem) {
- QPointF p(items.item(i).namedItem("position").attributes().namedItem("x").nodeValue().toDouble(),
- items.item(i).namedItem("position").attributes().namedItem("y").nodeValue().toDouble());
- gitem->setPos(p);
- gitem->setTransform(stringToTransform(items.item(i).namedItem("position").firstChild().firstChild().nodeValue()));
- int zValue = items.item(i).attributes().namedItem("z-index").nodeValue().toInt();
- if (zValue > maxZValue) maxZValue = zValue;
- gitem->setZValue(zValue);
- //gitem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
- }
- if (items.item(i).nodeName() == "background") {
- QColor color = QColor(stringToColor(items.item(i).attributes().namedItem("color").nodeValue()));
- //color.setAlpha(items.item(i).attributes().namedItem("alpha").nodeValue().toInt());
- QList<QGraphicsItem *> items = m_scene->items();
- for (int i = 0; i < items.size(); i++) {
- if (items.at(i)->zValue() == -1100) {
- ((QGraphicsRectItem *)items.at(i))->setBrush(QBrush(color));
- break;
- }
- }
- } else if (items.item(i).nodeName() == "startviewport" && startv) {
- QString rect = items.item(i).attributes().namedItem("rect").nodeValue();
- startv->setPolygon(stringToRect(rect));
- } else if (items.item(i).nodeName() == "endviewport" && endv) {
- QString rect = items.item(i).attributes().namedItem("rect").nodeValue();
- endv->setPolygon(stringToRect(rect));
- }
- }
- }
- return maxZValue;
+ gitem = txt;
+ }
+ else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsRectItem" )
+ {
+ QString rect = items.item( i ).namedItem( "content" ).attributes().namedItem( "rect" ).nodeValue();
+ QString br_str = items.item( i ).namedItem( "content" ).attributes().namedItem( "brushcolor" ).nodeValue();
+ QString pen_str = items.item( i ).namedItem( "content" ).attributes().namedItem( "pencolor" ).nodeValue();
+ double penwidth = items.item( i ).namedItem( "content" ).attributes().namedItem( "penwidth" ).nodeValue().toDouble();
+ QGraphicsRectItem *rec = m_scene->addRect( stringToRect( rect ), QPen( QBrush( stringToColor( pen_str ) ), penwidth ), QBrush( stringToColor( br_str ) ) );
+ gitem = rec;
+ }
+ else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsPixmapItem" )
+ {
+ QString url = items.item( i ).namedItem( "content" ).attributes().namedItem( "url" ).nodeValue();
+ QPixmap pix( url );
+ QGraphicsPixmapItem *rec = m_scene->addPixmap( pix );
+ rec->setData( Qt::UserRole, url );
+ gitem = rec;
+ }
+ else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsSvgItem" )
+ {
+ QString url = items.item( i ).namedItem( "content" ).attributes().namedItem( "url" ).nodeValue();
+ //QGraphicsSvgItem *rec = new QGraphicsSvgItem(url);
+ //m_scene->addItem(rec);
+ //rec->setData(Qt::UserRole, url);
+ //gitem = rec;
+ }
+ }
+ //pos and transform
+ if ( gitem )
+ {
+ QPointF p( items.item( i ).namedItem( "position" ).attributes().namedItem( "x" ).nodeValue().toDouble(),
+ items.item( i ).namedItem( "position" ).attributes().namedItem( "y" ).nodeValue().toDouble() );
+ gitem->setPos( p );
+ gitem->setTransform( stringToTransform( items.item( i ).namedItem( "position" ).firstChild().firstChild().nodeValue() ) );
+ int zValue = items.item( i ).attributes().namedItem( "z-index" ).nodeValue().toInt();
+ if ( zValue > maxZValue ) maxZValue = zValue;
+ gitem->setZValue( zValue );
+ //gitem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ }
+ if ( items.item( i ).nodeName() == "background" )
+ {
+ QColor color = QColor( stringToColor( items.item( i ).attributes().namedItem( "color" ).nodeValue() ) );
+ //color.setAlpha(items.item(i).attributes().namedItem("alpha").nodeValue().toInt());
+ QList<QGraphicsItem *> items = m_scene->items();
+ for ( int i = 0; i < items.size(); i++ )
+ {
+ if ( items.at( i )->zValue() == -1100 )
+ {
+ (( QGraphicsRectItem * )items.at( i ) )->setBrush( QBrush( color ) );
+ break;
+ }
+ }
+ }
+ else if ( items.item( i ).nodeName() == "startviewport" && startv )
+ {
+ QString rect = items.item( i ).attributes().namedItem( "rect" ).nodeValue();
+ startv->setPolygon( stringToRect( rect ) );
+ }
+ else if ( items.item( i ).nodeName() == "endviewport" && endv )
+ {
+ QString rect = items.item( i ).attributes().namedItem( "rect" ).nodeValue();
+ endv->setPolygon( stringToRect( rect ) );
+ }
+ }
+ }
+ return maxZValue;
}
-QString Title::colorToString(const QColor& c)
+QString Title::colorToString( const QColor& c )
{
- QString ret = "%1,%2,%3,%4";
- ret = ret.arg(c.red()).arg(c.green()).arg(c.blue()).arg(c.alpha());
- return ret;
+ QString ret = "%1,%2,%3,%4";
+ ret = ret.arg( c.red() ).arg( c.green() ).arg( c.blue() ).arg( c.alpha() );
+ return ret;
}
-QString Title::rectFToString(const QRectF& c)
+QString Title::rectFToString( const QRectF& c )
{
- QString ret = "%1,%2,%3,%4";
- ret = ret.arg(c.top()).arg(c.left()).arg(c.width()).arg(c.height());
- return ret;
+ QString ret = "%1,%2,%3,%4";
+ ret = ret.arg( c.top() ).arg( c.left() ).arg( c.width() ).arg( c.height() );
+ return ret;
}
-QRectF Title::stringToRect(const QString & s)
+QRectF Title::stringToRect( const QString & s )
{
- QStringList l = s.split(',');
- if (l.size() < 4)
- return QRectF();
- return QRectF(l.at(0).toDouble(), l.at(1).toDouble(), l.at(2).toDouble(), l.at(3).toDouble()).normalized();
+ QStringList l = s.split( ',' );
+ if ( l.size() < 4 )
+ return QRectF();
+ return QRectF( l.at( 0 ).toDouble(), l.at( 1 ).toDouble(), l.at( 2 ).toDouble(), l.at( 3 ).toDouble() ).normalized();
}
-QColor Title::stringToColor(const QString & s)
+QColor Title::stringToColor( const QString & s )
{
- QStringList l = s.split(',');
- if (l.size() < 4)
- return QColor();
- return QColor(l.at(0).toInt(), l.at(1).toInt(), l.at(2).toInt(), l.at(3).toInt());;
+ QStringList l = s.split( ',' );
+ if ( l.size() < 4 )
+ return QColor();
+ return QColor( l.at( 0 ).toInt(), l.at( 1 ).toInt(), l.at( 2 ).toInt(), l.at( 3 ).toInt() );
+ ;
}
-QTransform Title::stringToTransform(const QString& s)
+QTransform Title::stringToTransform( const QString& s )
{
- QStringList l = s.split(',');
- if (l.size() < 9)
- return QTransform();
- return QTransform(
- l.at(0).toDouble(), l.at(1).toDouble(), l.at(2).toDouble(),
- l.at(3).toDouble(), l.at(4).toDouble(), l.at(5).toDouble(),
- l.at(6).toDouble(), l.at(7).toDouble(), l.at(8).toDouble()
- );
+ QStringList l = s.split( ',' );
+ if ( l.size() < 9 )
+ return QTransform();
+ return QTransform(
+ l.at( 0 ).toDouble(), l.at( 1 ).toDouble(), l.at( 2 ).toDouble(),
+ l.at( 3 ).toDouble(), l.at( 4 ).toDouble(), l.at( 5 ).toDouble(),
+ l.at( 6 ).toDouble(), l.at( 7 ).toDouble(), l.at( 8 ).toDouble()
+ );
}
#include <framework/mlt.h>
#include <stdlib.h>
#include <string.h>
+
extern void init_qt();
-extern void refresh_kdenlivetitle(uint8_t*,int,int,double);
+
+extern void refresh_kdenlivetitle( uint8_t*, int, int, double );
static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
{
- // Obtain properties of frame
- mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
-
- // Obtain the producer for this frame
- mlt_producer producer = mlt_properties_get_data( properties, "producer_kdenlivetitle", NULL );
-
- // Obtain properties of producer
- // save extra data
- //mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
- // Allocate the image
- int size = *width * ( *height ) * 4;
-
- *buffer = mlt_pool_alloc( size);
- // Update the frame
- mlt_properties_set_int( properties, "width", *width );
- mlt_properties_set_int( properties, "height", *height );
-
- // Update the frame
- mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL );
- //cache later ??
- if ( 1 )
- {
- // Allocate the image
- *format = mlt_image_rgb24a;
- mlt_position in = mlt_producer_get_in( producer );
- mlt_position out = mlt_producer_get_out( producer );
- mlt_position time = mlt_frame_get_position( frame );
- double position = ( double )( time - in ) / ( double )( out - in + 1 );
- refresh_kdenlivetitle(*buffer, *width, *height, position );
- mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "width:%d height:%d %s\n",*width,*height, mlt_image_format_name( *format ) );
- }
- return 0;
+ // Obtain properties of frame
+ mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
+
+ // Obtain the producer for this frame
+ mlt_producer producer = mlt_properties_get_data( properties, "producer_kdenlivetitle", NULL );
+
+ // Obtain properties of producer
+ // save extra data
+ //mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
+ // Allocate the image
+ int size = *width * ( *height ) * 4;
+
+ *buffer = mlt_pool_alloc( size );
+ // Update the frame
+ mlt_properties_set_int( properties, "width", *width );
+ mlt_properties_set_int( properties, "height", *height );
+
+ // Update the frame
+ mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL );
+ //cache later ??
+
+ if ( 1 )
+ {
+ // Allocate the image
+ *format = mlt_image_rgb24a;
+ mlt_position in = mlt_producer_get_in( producer );
+ mlt_position out = mlt_producer_get_out( producer );
+ mlt_position time = mlt_frame_get_position( frame );
+ double position = ( double )( time - in ) / ( double )( out - in + 1 );
+ refresh_kdenlivetitle( *buffer, *width, *height, position );
+ mlt_log_debug( MLT_PRODUCER_SERVICE( producer ), "width:%d height:%d %s\n", *width, *height, mlt_image_format_name( *format ) );
+ }
+
+ return 0;
}
int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index )
+
{
- // Generate a frame
- *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
- if ( *frame != NULL )
- {
- // Obtain properties of frame and producer
- mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
+ // Generate a frame
+ *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
- // Obtain properties of producer
- mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
+ if ( *frame != NULL )
+ {
+ // Obtain properties of frame and producer
+ mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
- // Set the producer on the frame properties
- mlt_properties_set_data( properties, "producer_kdenlivetitle", producer, 0, NULL, NULL );
+ // Obtain properties of producer
+ mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
- // Update timecode on the frame we're creating
- mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
+ // Set the producer on the frame properties
+ mlt_properties_set_data( properties, "producer_kdenlivetitle", producer, 0, NULL, NULL );
- // Set producer-specific frame properties
- mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_props, "aspect_ratio" ) );
+ // Update timecode on the frame we're creating
+ mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
- // Push the get_image method
- mlt_frame_push_get_image( *frame, producer_get_image );
- }
+ // Set producer-specific frame properties
+ mlt_properties_set_int( properties, "progressive", 1 );
+ mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_props, "aspect_ratio" ) );
- // Calculate the next timecode
- mlt_producer_prepare_next( producer );
+ // Push the get_image method
+ mlt_frame_push_get_image( *frame, producer_get_image );
+ }
- return 0;
+ // Calculate the next timecode
+ mlt_producer_prepare_next( producer );
+
+ return 0;
}
void producer_close( mlt_producer producer )
{
- producer->close = NULL;
- mlt_producer_close( producer );
+ producer->close = NULL;
+ mlt_producer_close( producer );
- free( producer );
+ free( producer );
}
+
mlt_producer producer_kdenlivetitle_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
- // Create a new producer object
- mlt_producer this = mlt_producer_new( );
-
- // Initialise the producer
- if ( this != NULL )
- {
- init_qt(arg);
- // Callback registration
- this->get_frame = producer_get_frame;
- this->close = ( mlt_destructor )producer_close;
- mlt_properties properties = MLT_PRODUCER_PROPERTIES( this );
- mlt_properties_set( properties, "resource", arg );
-
- }
- return this;
+ // Create a new producer object
+ mlt_producer this = mlt_producer_new( );
+
+ // Initialise the producer
+
+ if ( this != NULL )
+ {
+ init_qt( arg );
+ // Callback registration
+ this->get_frame = producer_get_frame;
+ this->close = ( mlt_destructor ) producer_close;
+ mlt_properties properties = MLT_PRODUCER_PROPERTIES( this );
+ mlt_properties_set( properties, "resource", arg );
+
+ }
+
+ return this;
}