Sync with current ffmpeg CVS and minor clean up
[melted] / src / miracle / miracle_local.c
index 9929e12..f89d90e 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
+
+/* Needed for backtrace on linux */
+#ifdef linux
 #include <execinfo.h>
+#endif
 
 /* Valerie header files */
 #include <valerie/valerie_util.h>
@@ -174,6 +178,7 @@ static command_t vocabulary[] =
        {"INSERT", miracle_insert, 1, ATYPE_STRING, "Insert a clip at the given clip index."},
        {"REMOVE", miracle_remove, 1, ATYPE_NONE, "Remove a clip at the given clip index."},
        {"CLEAN", miracle_clean, 1, ATYPE_NONE, "Clean a unit by removing all but the currently playing clip."},
+       {"CLEAR", miracle_clear, 1, ATYPE_NONE, "Clear a unit by removing all clips."},
        {"MOVE", miracle_move, 1, ATYPE_INT, "Move a clip to another clip index."},
        {"APND", miracle_append, 1, ATYPE_STRING, "Append a clip specified in absolute filename argument."},
        {"PLAY", miracle_play, 1, ATYPE_NONE, "Play a loaded clip at speed -2000 to 2000 where 1000 = normal forward speed."},
@@ -290,6 +295,7 @@ void signal_handler( int sig )
 
 static void sigsegv_handler()
 {
+#ifdef linux
        void *array[ 10 ];
        size_t size;
        char **strings;
@@ -308,6 +314,9 @@ static void sigsegv_handler()
        free( strings );
 
        miracle_log( LOG_CRIT, "\nDone dumping - exiting.\n" );
+#else
+       miracle_log( LOG_CRIT, "\a\nMiracle experienced a segmentation fault.\n" );
+#endif
        exit( EXIT_FAILURE );
 }
 
@@ -494,8 +503,10 @@ static valerie_response miracle_local_execute( miracle_local local, char *comman
 static void miracle_local_close( miracle_local local )
 {
        miracle_delete_all_units();
+#ifdef linux
        pthread_kill_other_threads_np();
        miracle_log( LOG_DEBUG, "Clean shutdown." );
        free( local );
-       //mlt_factory_close( );
+       mlt_factory_close( );
+#endif
 }