X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fdv%2Fproducer_libdv.c;h=3e0db780384f229ed0cbe928167975f56bc0a8a7;hb=027dc39ab6e64c5b50901996c4977dc45cadb1c3;hp=a7c10b34dc3a1e8cdf88470c1f2c9e4ad2577f0f;hpb=a07c3da76259d6ba479d800ffecc5617a9ad158f;p=melted diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index a7c10b3..3e0db78 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -18,10 +18,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "producer_libdv.h" +#include #include #include #include +#include + #include #include #include @@ -32,6 +34,9 @@ #include #include +#define FRAME_SIZE_525_60 10 * 150 * 80 +#define FRAME_SIZE_625_50 12 * 150 * 80 + /** To conserve resources, we maintain a stack of dv decoders. */ @@ -129,9 +134,9 @@ struct producer_libdv_s static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index ); static void producer_close( mlt_producer parent ); -static int producer_collect_info( producer_libdv this ); +static int producer_collect_info( producer_libdv this, mlt_profile profile ); -mlt_producer producer_libdv_init( char *filename ) +mlt_producer producer_libdv_init( mlt_profile profile, mlt_service_type type, const char *id, char *filename ) { producer_libdv this = calloc( sizeof( struct producer_libdv_s ), 1 ); @@ -156,7 +161,8 @@ mlt_producer producer_libdv_init( char *filename ) strncasecmp( strrchr( filename, '.' ), ".mov", 4 ) == 0 ) ) { // Load via an alternative mechanism - this->alternative = mlt_factory_producer( "kino", filename ); + mlt_profile profile = mlt_service_profile( MLT_PRODUCER_SERVICE( producer ) ); + this->alternative = mlt_factory_producer( profile, "kino", filename ); // If it's unavailable, then clean up if ( this->alternative == NULL ) @@ -171,7 +177,7 @@ mlt_producer producer_libdv_init( char *filename ) this->fd = open( filename, O_RDONLY ); // Collect info - if ( this->fd == -1 || !producer_collect_info( this ) ) + if ( this->fd == -1 || !producer_collect_info( this, profile ) ) destroy = 1; } @@ -195,7 +201,6 @@ static int read_frame( int fd, uint8_t* frame_buf, int *isPAL ) if ( result ) { *isPAL = ( frame_buf[3] & 0x80 ); - if ( *isPAL ) { int diff = FRAME_SIZE_625_50 - FRAME_SIZE_525_60; @@ -206,7 +211,7 @@ static int read_frame( int fd, uint8_t* frame_buf, int *isPAL ) return result; } -static int producer_collect_info( producer_libdv this ) +static int producer_collect_info( producer_libdv this, mlt_profile profile ) { int valid = 0; @@ -240,8 +245,8 @@ static int producer_collect_info( producer_libdv this ) this->frames_in_file = this->file_size / this->frame_size; // Calculate default in/out points - double fps = this->is_pal ? 25 : 30000.0 / 1001.0; - if ( mlt_producer_get_fps( &this->parent ) == fps ) + int fps = 1000 * ( this->is_pal ? 25 : ( 30000.0 / 1001.0 ) ); + if ( ( int )( mlt_profile_fps( profile ) * 1000 ) == fps ) { if ( this->frames_in_file > 0 ) { @@ -427,7 +432,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i data = mlt_pool_alloc( FRAME_SIZE_625_50 ); // Create an empty frame - *frame = mlt_frame_init( ); + *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) ); // Seek and fetch if ( this->fd != 0 &&