]> git.sesse.net Git - mlt/commitdiff
Added the response object
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 19 Sep 2004 11:49:06 +0000 (11:49 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 19 Sep 2004 11:49:06 +0000 (11:49 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@431 d19143bc-622f-0410-bfdd-b5b2a6649095

mlt++/src/Makefile
mlt++/src/Mlt.h
mlt++/src/MltMiracle.cpp
mlt++/src/MltMiracle.h
mlt++/src/MltResponse.cpp [new file with mode: 0644]
mlt++/src/MltResponse.h [new file with mode: 0644]
mlt++/swig/mltpp.i

index 5f3df886122a64a2d2bcde6a00387ef6ac652512..ea24b2799ec808ef24c0c2658ea9831bbeb0417b 100644 (file)
@@ -12,14 +12,15 @@ OBJS = MltConsumer.o \
           MltFilter.o \
           MltFilteredConsumer.o \
           MltFrame.o \
+          MltMiracle.o \
           MltMultitrack.o \
           MltPlaylist.o \
           MltProducer.o \
           MltProperties.o \
+          MltResponse.o \
           MltService.o \
           MltTractor.o \
-          MltTransition.o \
-          MltMiracle.o
+          MltTransition.o
 
 SRCS = $(OBJS:.o=.cpp)
 
index 7cb85af84263e95afc648844cb7a6952e2d2346c..c5ba6274c3985155542f0fcbaeffc249b09e3bb8 100644 (file)
 #include "MltFilter.h"
 #include "MltFilteredConsumer.h"
 #include "MltFrame.h"
+#include "MltMiracle.h"
 #include "MltMultitrack.h"
 #include "MltPlaylist.h"
 #include "MltProducer.h"
 #include "MltProperties.h"
+#include "MltResponse.h"
 #include "MltService.h"
 #include "MltTractor.h"
 #include "MltTransition.h"
-#include "MltMiracle.h"
 
 #endif
index ef884496ec92deb2f70a018987b9c2c5f839bcd1..c7b5fa2602b7f688910e72e105dc94783e442189 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "MltMiracle.h"
 #include "MltService.h"
+#include "MltResponse.h"
 using namespace Mlt;
 
 #include <time.h>
@@ -29,7 +30,10 @@ static valerie_response mlt_miracle_execute( void *arg, char *command )
        Miracle *miracle = ( Miracle * )arg;
        if ( miracle != NULL )
        {
-               return miracle->execute( command );
+               Response *response = miracle->execute( command );
+               valerie_response real = valerie_response_clone( response->get_response( ) );
+               delete response;
+               return real;
        }
        else
        {
@@ -45,7 +49,10 @@ static valerie_response mlt_miracle_push( void *arg, char *command, mlt_service
        if ( miracle != NULL )
        {
                Service input( service );
-               return miracle->push( command, &input );
+               Response *response = miracle->push( command, &input );
+               valerie_response real = valerie_response_clone( response->get_response( ) );
+               delete response;
+               return real;
        }
        else
        {
@@ -84,14 +91,14 @@ bool Miracle::is_running( )
        return server->shutdown == 0;
 }
 
-valerie_response Miracle::execute( char *command )
+Response *Miracle::execute( char *command )
 {
-       return _execute( _real, command );
+       return new Response( _execute( _real, command ) );
 }
 
-valerie_response Miracle::push( char *command, Service *service )
+Response *Miracle::push( char *command, Service *service )
 {
-       return _push( _real, command, service->get_service( ) );
+       return new Response( _push( _real, command, service->get_service( ) ) );
 }
 
 void Miracle::wait_for_shutdown( )
index 60161593ad9dd767131c3dd29ae622c92743f6fe..7e6938d3eebf0f66e4d3bd1dde8ff6937f973a3b 100644 (file)
@@ -27,6 +27,7 @@
 namespace Mlt
 {
        class Service;
+       class Response;
 
        class Miracle
        {
@@ -40,8 +41,8 @@ namespace Mlt
                        virtual ~Miracle( );
                        bool start( );
                        bool is_running( );
-                       virtual valerie_response execute( char *command );
-                       virtual valerie_response push( char *command, Service *service );
+                       virtual Response *execute( char *command );
+                       virtual Response *push( char *command, Service *service );
                        void wait_for_shutdown( );
        };
 }
diff --git a/mlt++/src/MltResponse.cpp b/mlt++/src/MltResponse.cpp
new file mode 100644 (file)
index 0000000..31dc002
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ * MltResponse.cpp - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltResponse.h"
+using namespace Mlt;
+
+Response::Response( valerie_response response ) :
+       _response( response )
+{
+}
+
+Response::~Response( )
+{
+       valerie_response_close( _response );
+}
+
+valerie_response Response::get_response( )
+{
+       return _response;
+}
+
+int Response::error_code( )
+{
+       return valerie_response_get_error_code( get_response( ) );
+}
+
+char *Response::error_string( )
+{
+       return valerie_response_get_error_string( get_response( ) );
+}
+
+char *Response::get( int index )
+{
+       return valerie_response_get_line( get_response( ), index );
+}
+
+int Response::count( )
+{
+       return valerie_response_count( get_response( ) );
+}
+
+
diff --git a/mlt++/src/MltResponse.h b/mlt++/src/MltResponse.h
new file mode 100644 (file)
index 0000000..2c97a71
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * MltResponse.h - MLT Wrapper
+ * Copyright (C) 2004-2005 Charles Yates
+ * Author: Charles Yates <charles.yates@pandora.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_RESPONSE_H_
+#define _MLTPP_RESPONSE_H_
+
+#include <valerie/valerie_response.h>
+
+namespace Mlt
+{
+       class Response
+       {
+               private:
+                       valerie_response _response;
+               public:
+                       Response( valerie_response response );
+                       ~Response( );
+                       valerie_response get_response( );
+                       int error_code( );
+                       char *error_string( );
+                       char *get( int );
+                       int count( );
+       };
+}
+
+#endif
index 29499b21a26576301feb361de47e73cbb78b3667..8f49724825fc3fed36ddda374bb147738ba060f4 100644 (file)
@@ -45,6 +45,8 @@ namespace Mlt {
 %newobject Tractor::multitrack( );
 %newobject Tractor::field( );
 %newobject Tractor::track( int );
+%newobject Miracle::execute( char * );
+%newobject Miracle::push( char *, Service & );
 }
 
 /** Classes to wrap.
@@ -67,6 +69,7 @@ namespace Mlt {
 %include <MltTractor.h>
 %include <MltFilteredConsumer.h>
 %include <MltMiracle.h>
+%include <MltResponse.h>
 
 #if defined(SWIGRUBY)