* Copyright (C) 2003-2004 Ushodaya Enterprises Limited
* 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 General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library 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.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser 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.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "producer_libdv.h"
+#include <framework/mlt_producer.h>
#include <framework/mlt_frame.h>
#include <framework/mlt_deque.h>
#include <framework/mlt_factory.h>
+#include <framework/mlt_profile.h>
+
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
+#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.
*/
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 );
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 )
destroy = 1;
else
mlt_properties_pass( properties, MLT_PRODUCER_PROPERTIES( this->alternative ), "" );
- this->is_pal = mlt_properties_get_int( properties, "fps" ) == 25;
+ this->is_pal = ( ( int ) mlt_producer_get_fps( producer ) ) == 25;
}
else
{
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;
}
if ( result )
{
*isPAL = ( frame_buf[3] & 0x80 );
-
if ( *isPAL )
{
int diff = FRAME_SIZE_625_50 - FRAME_SIZE_525_60;
return result;
}
-static int producer_collect_info( producer_libdv this )
+static int producer_collect_info( producer_libdv this, mlt_profile profile )
{
int valid = 0;
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_properties_get_double( properties, "fps" ) == 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 )
{
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 &&