]> git.sesse.net Git - mlt/commitdiff
insert/move/remove dvcp operations
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 17 Jan 2004 14:24:33 +0000 (14:24 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 17 Jan 2004 14:24:33 +0000 (14:24 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@85 d19143bc-622f-0410-bfdd-b5b2a6649095

docs/services.txt
mlt/docs/services.txt
mlt/src/framework/mlt_playlist.c
mlt/src/framework/mlt_playlist.h
mlt/src/framework/mlt_producer.c
mlt/src/modules/Makefile
src/framework/mlt_playlist.c
src/framework/mlt_playlist.h
src/framework/mlt_producer.c
src/modules/Makefile

index 0477176507a5b7ac69f7e333b92a4c5774f5f90a..5c72310223a8ecc4dbfcae2fe0ee54bd484ed761 100644 (file)
@@ -615,7 +615,23 @@ Consumers
                Dependencies
                Known Bugs
 
+       libdv
+       
+               Description
+               
+                       libdv dv producer.
+
+               Constructor Argument
+
+                       string video_standard - "PAL" (default) or "NTSC"
+
+               Initialisation Properties
+               Read Only Properties
+               Dependencies
+               Known Bugs
+
        sdl
+
                Description
 
                        Simple DirectMedia Layer audio and video output module.
index 0477176507a5b7ac69f7e333b92a4c5774f5f90a..5c72310223a8ecc4dbfcae2fe0ee54bd484ed761 100644 (file)
@@ -615,7 +615,23 @@ Consumers
                Dependencies
                Known Bugs
 
+       libdv
+       
+               Description
+               
+                       libdv dv producer.
+
+               Constructor Argument
+
+                       string video_standard - "PAL" (default) or "NTSC"
+
+               Initialisation Properties
+               Read Only Properties
+               Dependencies
+               Known Bugs
+
        sdl
+
                Description
 
                        Simple DirectMedia Layer audio and video output module.
index 8bdbe4bda67a069f0b3e9ed74943cf5d70109b84..bf1103df304691857df59ee5145b2c1080cb1dc0 100644 (file)
@@ -347,7 +347,7 @@ mlt_producer mlt_playlist_current( mlt_playlist this )
 
 mlt_position mlt_playlist_clip( mlt_playlist this, mlt_whence whence, int index )
 {
-       int64_t position = 0;
+       mlt_position position = 0;
        int absolute_clip = index;
        int i = 0;
 
@@ -380,6 +380,9 @@ mlt_position mlt_playlist_clip( mlt_playlist this, mlt_whence whence, int index
        return position;
 }
 
+/** Get all the info about the clip specified.
+*/
+
 int mlt_playlist_get_clip_info( mlt_playlist this, mlt_playlist_clip_info *info, int index )
 {
        int error = index < 0 || index >= this->count;
@@ -388,6 +391,7 @@ int mlt_playlist_get_clip_info( mlt_playlist this, mlt_playlist_clip_info *info,
        {
                mlt_producer producer = this->list[ index ]->producer;
                mlt_properties properties = mlt_producer_properties( producer );
+               info->clip = index;
                info->producer = producer;
                info->start = mlt_playlist_clip( this, mlt_whence_relative_start, index );
                info->resource = mlt_properties_get( properties, "resource" );
@@ -453,16 +457,111 @@ int mlt_playlist_blank( mlt_playlist this, mlt_position length )
 
 int mlt_playlist_insert( mlt_playlist this, mlt_producer producer, int where, mlt_position in, mlt_position out )
 {
-       return 0;
+       // Append to end
+       mlt_playlist_append_io( this, producer, in, out );
+
+       // Move to the position specified
+       return mlt_playlist_move( this, this->count - 1, where );
 }
 
+/** Remove an entry in the playlist.
+*/
+
 int mlt_playlist_remove( mlt_playlist this, int where )
 {
+       if ( this->count > 0 )
+       {
+               // We need to know the current clip and the position within the playlist
+               int current = mlt_playlist_current_clip( this );
+               mlt_position position = mlt_producer_position( mlt_playlist_producer( this ) );
+
+               // We need all the details about the clip we're removing
+               mlt_playlist_clip_info where_info;
+
+               // Loop variable
+               int i = 0;
+
+               // Make sure the clip to be removed is valid and correct if necessary
+               if ( where < 0 ) 
+                       where = 0;
+               if ( where >= this->count )
+                       where = this->count - 1;
+
+               // Get the clip info of the clip to be removed
+               mlt_playlist_get_clip_info( this, &where_info, where );
+
+               // Reorganise the list
+               for ( i = where + 1; i < this->count; i ++ )
+                       this->list[ i - 1 ] = this->list[ i ];
+               this->count --;
+
+               // Correct position
+               if ( where == current )
+                       mlt_producer_seek( mlt_playlist_producer( this ), where_info.start );
+               else if ( where < current && this->count > 0 )
+                       mlt_producer_seek( mlt_playlist_producer( this ), position - where_info.frame_count );
+               else if ( this->count == 0 )
+                       mlt_producer_seek( mlt_playlist_producer( this ), 0 );
+       }
+
        return 0;
 }
 
-int mlt_playlist_move( mlt_playlist this, int from, int to )
+/** Move an entry in the playlist.
+*/
+
+int mlt_playlist_move( mlt_playlist this, int src, int dest )
 {
+       int i;
+
+       /* We need to ensure that the requested indexes are valid and correct it as necessary */
+       if ( src < 0 ) 
+               src = 0;
+       if ( src >= this->count )
+               src = this->count - 1;
+
+       if ( dest < 0 ) 
+               dest = 0;
+       if ( dest >= this->count )
+               dest = this->count - 1;
+       
+       if ( src != dest && this->count > 1 )
+       {
+               int current = mlt_playlist_current_clip( this );
+               mlt_position position = mlt_producer_position( mlt_playlist_producer( this ) );
+               playlist_entry *src_entry = NULL;
+
+               // We need all the details about the current clip
+               mlt_playlist_clip_info current_info;
+
+               mlt_playlist_get_clip_info( this, &current_info, current );
+               position -= current_info.start;
+
+               if ( current == src )
+                       current = dest;
+               else if ( current > src && current < dest )
+                       current ++;
+               else if ( current == dest )
+                       current = src;
+
+               if ( src > dest )
+               {
+                       int t = dest;
+                       dest = src;
+                       src = t;
+               }
+               
+               src_entry = this->list[ src ];
+
+               for ( i = src + 1; i <= dest; i ++ )
+                       this->list[ i - 1 ] = this->list[ i ];
+
+               this->list[ dest ] = src_entry;
+
+               mlt_playlist_get_clip_info( this, &current_info, current );
+               mlt_producer_seek( mlt_playlist_producer( this ), current_info.start + position );
+       }
+
        return 0;
 }
 
index dd88959309acc80791bf8895f5b8776c80e4b8ac..7bad6db38e8ac6487fae3a7eb0f312ec27f29e46 100644 (file)
@@ -28,6 +28,7 @@
 
 typedef struct
 {
+       int clip;
        mlt_producer producer;
        mlt_position start;
        char *resource;
index c3ba4e6ba1c87410676cb8996ce987466541e6ec..21f527746692595142b6e5757227511b021da17d 100644 (file)
@@ -115,10 +115,6 @@ int mlt_producer_seek( mlt_producer this, mlt_position position )
 
 mlt_position mlt_producer_position( mlt_producer this )
 {
-       //char *resource = mlt_properties_get( mlt_producer_properties( this ), "resource" );
-       //mlt_position frame = mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
-       //mlt_position position = mlt_properties_get_position( mlt_producer_properties( this ), "position" );
-       //fprintf( stderr, "%s: %lld %lld\n", resource, frame, position );
        return mlt_properties_get_position( mlt_producer_properties( this ), "position" );
 }
 
index 48274e0d771d2bfd4fa00dca5323bd3d812b2f13..52c26fccc623c5bc94661c30aaa9f1c6d64f899d 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg inigo resample
+SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo
 
 all clean depend install:
        list='$(SUBDIRS)'; \
index 8bdbe4bda67a069f0b3e9ed74943cf5d70109b84..bf1103df304691857df59ee5145b2c1080cb1dc0 100644 (file)
@@ -347,7 +347,7 @@ mlt_producer mlt_playlist_current( mlt_playlist this )
 
 mlt_position mlt_playlist_clip( mlt_playlist this, mlt_whence whence, int index )
 {
-       int64_t position = 0;
+       mlt_position position = 0;
        int absolute_clip = index;
        int i = 0;
 
@@ -380,6 +380,9 @@ mlt_position mlt_playlist_clip( mlt_playlist this, mlt_whence whence, int index
        return position;
 }
 
+/** Get all the info about the clip specified.
+*/
+
 int mlt_playlist_get_clip_info( mlt_playlist this, mlt_playlist_clip_info *info, int index )
 {
        int error = index < 0 || index >= this->count;
@@ -388,6 +391,7 @@ int mlt_playlist_get_clip_info( mlt_playlist this, mlt_playlist_clip_info *info,
        {
                mlt_producer producer = this->list[ index ]->producer;
                mlt_properties properties = mlt_producer_properties( producer );
+               info->clip = index;
                info->producer = producer;
                info->start = mlt_playlist_clip( this, mlt_whence_relative_start, index );
                info->resource = mlt_properties_get( properties, "resource" );
@@ -453,16 +457,111 @@ int mlt_playlist_blank( mlt_playlist this, mlt_position length )
 
 int mlt_playlist_insert( mlt_playlist this, mlt_producer producer, int where, mlt_position in, mlt_position out )
 {
-       return 0;
+       // Append to end
+       mlt_playlist_append_io( this, producer, in, out );
+
+       // Move to the position specified
+       return mlt_playlist_move( this, this->count - 1, where );
 }
 
+/** Remove an entry in the playlist.
+*/
+
 int mlt_playlist_remove( mlt_playlist this, int where )
 {
+       if ( this->count > 0 )
+       {
+               // We need to know the current clip and the position within the playlist
+               int current = mlt_playlist_current_clip( this );
+               mlt_position position = mlt_producer_position( mlt_playlist_producer( this ) );
+
+               // We need all the details about the clip we're removing
+               mlt_playlist_clip_info where_info;
+
+               // Loop variable
+               int i = 0;
+
+               // Make sure the clip to be removed is valid and correct if necessary
+               if ( where < 0 ) 
+                       where = 0;
+               if ( where >= this->count )
+                       where = this->count - 1;
+
+               // Get the clip info of the clip to be removed
+               mlt_playlist_get_clip_info( this, &where_info, where );
+
+               // Reorganise the list
+               for ( i = where + 1; i < this->count; i ++ )
+                       this->list[ i - 1 ] = this->list[ i ];
+               this->count --;
+
+               // Correct position
+               if ( where == current )
+                       mlt_producer_seek( mlt_playlist_producer( this ), where_info.start );
+               else if ( where < current && this->count > 0 )
+                       mlt_producer_seek( mlt_playlist_producer( this ), position - where_info.frame_count );
+               else if ( this->count == 0 )
+                       mlt_producer_seek( mlt_playlist_producer( this ), 0 );
+       }
+
        return 0;
 }
 
-int mlt_playlist_move( mlt_playlist this, int from, int to )
+/** Move an entry in the playlist.
+*/
+
+int mlt_playlist_move( mlt_playlist this, int src, int dest )
 {
+       int i;
+
+       /* We need to ensure that the requested indexes are valid and correct it as necessary */
+       if ( src < 0 ) 
+               src = 0;
+       if ( src >= this->count )
+               src = this->count - 1;
+
+       if ( dest < 0 ) 
+               dest = 0;
+       if ( dest >= this->count )
+               dest = this->count - 1;
+       
+       if ( src != dest && this->count > 1 )
+       {
+               int current = mlt_playlist_current_clip( this );
+               mlt_position position = mlt_producer_position( mlt_playlist_producer( this ) );
+               playlist_entry *src_entry = NULL;
+
+               // We need all the details about the current clip
+               mlt_playlist_clip_info current_info;
+
+               mlt_playlist_get_clip_info( this, &current_info, current );
+               position -= current_info.start;
+
+               if ( current == src )
+                       current = dest;
+               else if ( current > src && current < dest )
+                       current ++;
+               else if ( current == dest )
+                       current = src;
+
+               if ( src > dest )
+               {
+                       int t = dest;
+                       dest = src;
+                       src = t;
+               }
+               
+               src_entry = this->list[ src ];
+
+               for ( i = src + 1; i <= dest; i ++ )
+                       this->list[ i - 1 ] = this->list[ i ];
+
+               this->list[ dest ] = src_entry;
+
+               mlt_playlist_get_clip_info( this, &current_info, current );
+               mlt_producer_seek( mlt_playlist_producer( this ), current_info.start + position );
+       }
+
        return 0;
 }
 
index dd88959309acc80791bf8895f5b8776c80e4b8ac..7bad6db38e8ac6487fae3a7eb0f312ec27f29e46 100644 (file)
@@ -28,6 +28,7 @@
 
 typedef struct
 {
+       int clip;
        mlt_producer producer;
        mlt_position start;
        char *resource;
index c3ba4e6ba1c87410676cb8996ce987466541e6ec..21f527746692595142b6e5757227511b021da17d 100644 (file)
@@ -115,10 +115,6 @@ int mlt_producer_seek( mlt_producer this, mlt_position position )
 
 mlt_position mlt_producer_position( mlt_producer this )
 {
-       //char *resource = mlt_properties_get( mlt_producer_properties( this ), "resource" );
-       //mlt_position frame = mlt_properties_get_position( mlt_producer_properties( this ), "frame" );
-       //mlt_position position = mlt_properties_get_position( mlt_producer_properties( this ), "position" );
-       //fprintf( stderr, "%s: %lld %lld\n", resource, frame, position );
        return mlt_properties_get_position( mlt_producer_properties( this ), "position" );
 }
 
index 48274e0d771d2bfd4fa00dca5323bd3d812b2f13..52c26fccc623c5bc94661c30aaa9f1c6d64f899d 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg inigo resample
+SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo
 
 all clean depend install:
        list='$(SUBDIRS)'; \