{
mlt_properties_set( properties, "normalisation", "PAL" );
mlt_properties_set_double( properties, "fps", 25.0 );
- mlt_properties_set_int( properties, "frame_rate_den", 25 );
- mlt_properties_set_int( properties, "frame_rate_num", 1 );
+ mlt_properties_set_int( properties, "frame_rate_num", 25 );
+ mlt_properties_set_int( properties, "frame_rate_den", 1 );
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 576 );
mlt_properties_set_int( properties, "progressive", 0 );
mlt_properties_set_double( properties, "aspect_ratio", 59.0 / 54.0 );
+ mlt_properties_set_int( properties, "aspect_ratio_num", 59 );
+ mlt_properties_set_int( properties, "aspect_ratio_den", 54 );
+ mlt_properties_set_double( properties, "display_ratio", 4.0 / 3.0 );
+ mlt_properties_set_int( properties, "display_ratio_num", 4 );
+ mlt_properties_set_int( properties, "display_ratio_den", 3 );
}
else
{
mlt_properties_set( properties, "normalisation", "NTSC" );
mlt_properties_set_double( properties, "fps", 30000.0 / 1001.0 );
- mlt_properties_set_int( properties, "frame_rate_den", 30000 );
- mlt_properties_set_int( properties, "frame_rate_num", 1001 );
+ mlt_properties_set_int( properties, "frame_rate_num", 30000 );
+ mlt_properties_set_int( properties, "frame_rate_den", 1001 );
mlt_properties_set_int( properties, "width", 720 );
mlt_properties_set_int( properties, "height", 480 );
mlt_properties_set_int( properties, "progressive", 0 );
mlt_properties_set_double( properties, "aspect_ratio", 10.0 / 11.0 );
+ mlt_properties_set_int( properties, "aspect_ratio_num", 10 );
+ mlt_properties_set_int( properties, "aspect_ratio_den", 11 );
+ mlt_properties_set_double( properties, "display_ratio", 4.0 / 3.0 );
+ mlt_properties_set_int( properties, "display_ratio_num", 4 );
+ mlt_properties_set_int( properties, "display_ratio_den", 3 );
}
// Default rescaler for all consumers
// Determine if there's a test card producer
char *test_card = mlt_properties_get( properties, "test_card" );
+ // Handle profiles
+ char *profile = mlt_properties_get( properties, "profile" );
+ int profile_ok = mlt_consumer_profile( properties, profile );
+
+ // Check that everything is OK
+ if ( !profile_ok )
+ fprintf( stderr, "Unrecognised profile %s - continuing with defaults.\n", mlt_properties_get( properties, "profile" ) );
+ else if ( profile_ok < 0 )
+ fprintf( stderr, "Recognised profile %s with warnings - trying to continue with some defaults.\n", mlt_properties_get( properties, "profile" ) );
+
// Just to make sure nothing is hanging around...
mlt_frame_close( this->put );
this->put = NULL;
return time1->tv_sec * 1000000 + time1->tv_usec - time2.tv_sec * 1000000 - time2.tv_usec;
}
+int mlt_consumer_profile( mlt_properties properties, char *profile )
+{
+ double fps = mlt_properties_get_double( properties, "fps" );
+ int recognised = 1;
+ double display_num = 0;
+ double display_den = 0;
+ double pixel_num = 0;
+ double pixel_den = 0;
+ int width = 0;
+ int height = 0;
+
+ if ( fps == 25.0 && profile != NULL )
+ {
+ width = 720;
+ height = 576;
+ display_num = 4;
+ display_den = 3;
+ pixel_num = 59;
+ pixel_den = 54;
+
+ if ( !strcmp( profile, "dv_wide" ) )
+ {
+ display_num = 16;
+ display_den = 9;
+ pixel_num = 118;
+ pixel_den = 81;
+ }
+ else if ( !strncmp( profile, "square_wide", 11 ) )
+ {
+ display_num = 16;
+ display_den = 9;
+ pixel_num = 1;
+ pixel_den = 1;
+ width = 1024;
+ height = 576;
+ }
+ else if ( !strncmp( profile, "square", 6 ) )
+ {
+ pixel_num = 1;
+ pixel_den = 1;
+ width = 768;
+ height = 576;
+ }
+ else if ( !strncmp( profile, "vcd", 3 ) )
+ {
+ width = 352;
+ height = 288;
+ }
+ else if ( !strncmp( profile, "cvd", 3 ) )
+ {
+ width = 352;
+ height = 576;
+ pixel_num = 59;
+ pixel_den = 27;
+ }
+ else if ( !strncmp( profile, "svcd_wide", 9 ) )
+ {
+ width = 480;
+ height = 576;
+ pixel_num = 59;
+ pixel_den = 27;
+ display_num = 16;
+ display_den = 9;
+ }
+ else if ( !strncmp( profile, "svcd", 4 ) )
+ {
+ width = 480;
+ height = 576;
+ pixel_num = 59;
+ pixel_den = 36;
+ }
+ else if ( strncmp( profile, "frame", 5 ) && strcmp( profile, "dv" ) )
+ {
+ recognised = 0;
+ }
+ }
+ else if ( profile != NULL )
+ {
+ width = 720;
+ height = 480;
+ display_num = 4;
+ display_den = 3;
+ pixel_num = 10;
+ pixel_den = 11;
+
+ if ( !strcmp( profile, "dv_wide" ) )
+ {
+ display_num = 16;
+ display_den = 9;
+ pixel_num = 40;
+ pixel_den = 33;
+ }
+ else if ( !strncmp( profile, "square_wide", 11 ) )
+ {
+ display_num = 16;
+ display_den = 9;
+ pixel_num = 1;
+ pixel_den = 1;
+ width = 854;
+ height = 480;
+ }
+ else if ( !strncmp( profile, "square", 6 ) )
+ {
+ pixel_num = 1;
+ pixel_den = 1;
+ width = 640;
+ height = 480;
+ }
+ else if ( !strncmp( profile, "vcd", 3 ) )
+ {
+ width = 352;
+ height = 240;
+ }
+ else if ( !strncmp( profile, "cvd", 3 ) )
+ {
+ width = 352;
+ height = 480;
+ pixel_num = 20;
+ pixel_den = 11;
+ }
+ else if ( !strncmp( profile, "svcd_wide", 9 ) )
+ {
+ width = 480;
+ height = 480;
+ pixel_num = 20;
+ pixel_den = 11;
+ display_num = 16;
+ display_den = 9;
+ }
+ else if ( !strncmp( profile, "svcd", 4 ) )
+ {
+ width = 480;
+ height = 480;
+ pixel_num = 15;
+ pixel_den = 11;
+ }
+ else if ( strncmp( profile, "frame", 5 ) && strcmp( profile, "dv" ) )
+ {
+ recognised = 0;
+ }
+ }
+
+ // If width (or any of the above are 0), we use defaults otherwise we switch to recognised
+ if ( width != 0 && recognised )
+ {
+ if ( recognised && strchr( profile, ':' ) )
+ if ( sscanf( strchr( profile, ':' ) + 1, "%dx%d", &width, &height ) != 2 )
+ recognised = -1;
+
+ mlt_properties_set_int( properties, "width", width );
+ mlt_properties_set_int( properties, "height", height );
+ mlt_properties_set_double( properties, "aspect_ratio", pixel_num / pixel_den );
+ mlt_properties_set_int( properties, "aspect_ratio_num", pixel_num );
+ mlt_properties_set_int( properties, "aspect_ratio_den", pixel_den );
+ mlt_properties_set_double( properties, "display_ratio", display_num / display_den );
+ mlt_properties_set_int( properties, "display_ratio_num", display_num );
+ mlt_properties_set_int( properties, "display_ratio_den", display_den );
+ }
+
+ return recognised;
+}
+
static void *consumer_read_ahead_thread( void *arg )
{
// The argument is the consumer
// Continue to read ahead
while ( this->ahead )
{
+ // Fetch width/height again
+ width = mlt_properties_get_int( properties, "width" );
+ height = mlt_properties_get_int( properties, "height" );
+
// Put the current frame into the queue
pthread_mutex_lock( &this->mutex );
while( this->ahead && mlt_deque_count( this->queue ) >= buffer )
extern int mlt_consumer_is_stopped( mlt_consumer self );
extern void mlt_consumer_stopped( mlt_consumer self );
extern void mlt_consumer_close( mlt_consumer );
+extern int mlt_consumer_profile( mlt_properties properties, char *profile );
#endif
if ( normalisation == NULL || strcmp( normalisation, "NTSC" ) )
{
mlt_properties_set_double( properties, "fps", 25.0 );
- mlt_properties_set_int( properties, "frame_rate_den", 25 );
- mlt_properties_set_int( properties, "frame_rate_num", 1 );
+ mlt_properties_set_int( properties, "frame_rate_num", 25 );
+ mlt_properties_set_int( properties, "frame_rate_den", 1 );
mlt_properties_set_double( properties, "aspect_ratio", 59.0 / 54.0 );
}
else
{
mlt_properties_set_double( properties, "fps", 30000.0 / 1001.0 );
- mlt_properties_set_int( properties, "frame_rate_den", 30000 );
- mlt_properties_set_int( properties, "frame_rate_num", 1001 );
+ mlt_properties_set_int( properties, "frame_rate_num", 30000 );
+ mlt_properties_set_int( properties, "frame_rate_den", 1001 );
mlt_properties_set_double( properties, "aspect_ratio", 10.0 / 11.0 );
}
mlt_properties_set_double( properties, "_speed", 1.0 );
{
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
mlt_multitrack multitrack = mlt_properties_get_data( properties, "multitrack", NULL );
+ mlt_consumer consumer = mlt_properties_get_data( properties, "transport_consumer", NULL );
mlt_properties_set_int( properties, "stats_off", 0 );
}
break;
}
+
+ mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( consumer ), "refresh", 1 );
}
mlt_properties_set_int( properties, "stats_off", 0 );
mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
mlt_properties_set_data( properties, "transport_callback", transport_action, 0, NULL, NULL );
mlt_properties_set_data( properties, "transport_producer", producer, 0, NULL, NULL );
+ mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( producer ), "transport_consumer", consumer, 0, NULL, NULL );
}
return consumer;
}
mlt_properties_set_int( properties, "audio_bit_rate", 128000 );
mlt_properties_set_int( properties, "video_bit_rate", 200 * 1000 );
mlt_properties_set_int( properties, "video_bit_rate_tolerance", 4000 * 1000 );
- mlt_properties_set_int( properties, "frame_rate_base", 1 );
mlt_properties_set_int( properties, "gop_size", 12 );
mlt_properties_set_int( properties, "b_frames", 0 );
mlt_properties_set_int( properties, "mb_decision", FF_MB_DECISION_SIMPLE );
c->bit_rate = mlt_properties_get_int( properties, "audio_bit_rate" );
c->sample_rate = mlt_properties_get_int( properties, "frequency" );
c->channels = mlt_properties_get_int( properties, "channels" );
+
+ // Allow the user to override the audio fourcc
+ if ( mlt_properties_get( properties, "afourcc" ) )
+ {
+ char *tail = NULL;
+ char *arg = mlt_properties_get( properties, "afourcc" );
+ int tag = strtol( arg, &tail, 0);
+ if( !tail || *tail )
+ tag = arg[ 0 ] + ( arg[ 1 ] << 8 ) + ( arg[ 2 ] << 16 ) + ( arg[ 3 ] << 24 );
+ c->codec_tag = tag;
+ }
}
else
{
c->bit_rate_tolerance = mlt_properties_get_int( properties, "video_bit_rate_tolerance" );
c->width = mlt_properties_get_int( properties, "width" );
c->height = mlt_properties_get_int( properties, "height" );
- c->time_base.den = mlt_properties_get_int( properties, "frame_rate_den" );
- c->time_base.num = mlt_properties_get_int( properties, "frame_rate_num" );
+ c->time_base.num = mlt_properties_get_int( properties, "frame_rate_den" );
+ c->time_base.den = mlt_properties_get_int( properties, "frame_rate_num" );
c->gop_size = mlt_properties_get_int( properties, "gop_size" );
c->pix_fmt = PIX_FMT_YUV420P;
}
c->mb_decision = mlt_properties_get_int( properties, "mb_decision" );
- c->sample_aspect_ratio = av_d2q( mlt_properties_get_double( properties, "aspect_ratio" ), 255 );
+ c->sample_aspect_ratio = av_d2q( mlt_properties_get_double( properties, "display_ratio" ) * c->height / c->width, 255 );
c->mb_cmp = mlt_properties_get_int( properties, "mb_cmp" );
c->ildct_cmp = mlt_properties_get_int( properties, "ildct_cmp" );
c->me_sub_cmp = mlt_properties_get_int( properties, "sub_cmp" );
st->quality = FF_QP2LAMBDA * mlt_properties_get_double( properties, "qscale" );
}
- // Some formats want stream headers to be seperate (hmm)
- if( !strcmp( oc->oformat->name, "mp4" ) ||
- !strcmp( oc->oformat->name, "mov" ) ||
- !strcmp( oc->oformat->name, "3gp" ) )
+ // Allow the user to override the video fourcc
+ if ( mlt_properties_get( properties, "vfourcc" ) )
+ {
+ char *tail = NULL;
+ const char *arg = mlt_properties_get( properties, "vfourcc" );
+ int tag = strtol( arg, &tail, 0);
+ if( !tail || *tail )
+ tag = arg[ 0 ] + ( arg[ 1 ] << 8 ) + ( arg[ 2 ] << 16 ) + ( arg[ 3 ] << 24 );
+ c->codec_tag = tag;
+ }
+
+ // Some formats want stream headers to be seperate
+ if ( oc->oformat->flags & AVFMT_GLOBALHEADER )
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
c->rc_max_rate = mlt_properties_get_int( properties, "video_rc_max_rate" );
if( codec && codec->supported_framerates )
{
const AVRational *p = codec->supported_framerates;
- AVRational req = ( AVRational ){ video_enc->time_base.den, video_enc->time_base.num };
+ AVRational req = ( AVRational ){ video_enc->time_base.num, video_enc->time_base.den };
const AVRational *best = NULL;
AVRational best_error = (AVRational){ INT_MAX, 1 };
for( ; p->den!=0; p++ )
best = p;
}
}
- video_enc->time_base.den = best->num;
- video_enc->time_base.num = best->den;
+ video_enc->time_base.num = best->num;
+ video_enc->time_base.den = best->den;
}
if( codec && codec->pix_fmts )
int owidth = *width;
int oheight = *height;
+ // Check for the special case - no aspect ratio means no problem :-)
+ if ( mlt_frame_get_aspect_ratio( this ) == 0 )
+ mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
+
// Hmmm...
char *rescale = mlt_properties_get( properties, "rescale.interp" );
if ( rescale != NULL && !strcmp( rescale, "none" ) )
real_height = mlt_properties_get_int( properties, "height" );
double input_ar = mlt_frame_get_aspect_ratio( this ) * real_width / real_height;
double output_ar = mlt_properties_get_double( properties, "consumer_aspect_ratio" ) * owidth / oheight;
+
//fprintf( stderr, "normalised %dx%d output %dx%d %f %f\n", normalised_width, normalised_height, owidth, oheight, ( float )output_ar, ( float )mlt_properties_get_double( properties, "consumer_aspect_ratio" ) * owidth / oheight );
scaled_width = normalised_width;
scaled_height = output_ar / input_ar * normalised_height + 0.5;
}
-
+
// Now calculate the actual image size that we want
owidth = scaled_width * owidth / normalised_width;
oheight = scaled_height * oheight / normalised_height;
// Obtain properties of producer
mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
- // Determine if we're producing PAL or NTSC
- int is_pal = mlt_properties_get_double( producer_props, "fps" ) == 25.0;
-
// Set the producer on the frame properties
mlt_properties_set_data( properties, "producer_colour", producer, 0, NULL, NULL );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 0 );
// colour is an alias for resource
if ( mlt_properties_get( producer_props, "colour" ) != NULL )
// Obtain properties of frame
mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
- // Obtain properties of producer
- mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( this );
-
- // Determine if we're producing PAL or NTSC
- int is_pal = mlt_properties_get_double( producer_props, "fps" ) == 25.0;
-
- // Aspect ratio is 1?
- mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 );
+ // Aspect ratio is whatever it needs to be
+ mlt_properties_set_double( properties, "aspect_ratio", 0 );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
time_t start = time( NULL );
int height = mlt_properties_get_int( this_properties, "height" );
int is_pal = height == 576;
- int is_wide = mlt_properties_get_double( frame_properties, "fps" ) == ( ( double ) 16.0 / 9.0 );
+ int is_wide = mlt_properties_get_int( this_properties, "display_ratio_num" ) == 16;
// Temporary - audio buffer allocation
int16_t *audio_buffers[ 4 ];
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", 1 );
+ mlt_properties_set_double( properties, "aspect_ratio", 0 );
// Set alpha call back
( *frame )->get_alpha_mask = producer_get_alpha_mask;
// Obtain properties of frame and producer
mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
- // Determine if we're rendering for PAL or NTSC
- int is_pal = mlt_properties_get_int( properties, "normalised_height" ) == 576;
-
// Set the producer on the frame properties
mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL );
// Set producer-specific frame properties
mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 );
+ mlt_properties_set_double( properties, "aspect_ratio", 1 );
// Set alpha call back
( *frame )->get_alpha_mask = producer_get_alpha_mask;
LDFLAGS+=`lqt-config --libs`
endif
+ifdef HAVE_LIBDV
+CFLAGS += `pkg-config --cflags libdv`
+LDFLAGS += `pkg-config --libs libdv`
+endif
+
+
SRCS := $(OBJS:.o=.c) $(CPPOBJS:.o=.cc)
all: $(TARGET)
* Change log:
*
* $Log$
+* Revision 1.2 2005/06/21 20:59:39 lilo_booter
+* src/framework/mlt_consumer.c src/framework/mlt_consumer.h
+* + Added a general profile handling for size, aspect ratio and display ratio
+*
+* src/framework/mlt_producer.c
+* + Correction to aspect ratio properties
+*
+* src/inigo/inigo.c
+* + Minimalist support for sdl_preview (still not very good)
+*
+* src/modules/avformat/consumer_avformat.c
+* + Takes consumer profile into account
+*
+* src/modules/core/filter_resize.c
+* + Corrections for synthesised producers and aspect ratio (inherits from consumer)
+*
+* src/modules/core/producer_colour.c
+* src/modules/core/producer_noise.c
+* src/modules/gtk2/producer_pango.c
+* + Ensures that resize picks up consumer aspect ratio
+*
+* src/modules/dv/consumer_libdv.c
+* + Honour wide screen output
+*
+* src/modules/gtk2/producer_pixbuf.c
+* + Correction for 1:1 aspect ratio
+*
+* src/modules/kino/Makefile
+* src/modules/kino/avi.cc
+* src/modules/kino/avi.h
+* src/modules/kino/configure
+* src/modules/kino/filehandler.cc
+* + Attempt to allow mov dv files to provide audio
+*
+* src/modules/sdl/consumer_sdl.c
+* src/modules/sdl/consumer_sdl_preview.c
+* src/modules/sdl/consumer_sdl_still.c
+* + Takes consumer profile into account
+*
* Revision 1.1 2005/04/15 14:28:26 lilo_booter
* Initial version
*
{
indx[ i ] ->wLongsPerEntry = 4;
indx[ i ] ->bIndexSubType = 0;
- indx[ i ] ->bIndexType = AVI_INDEX_OF_INDEXES;
+ indx[ i ] ->bIndexType = KINO_AVI_INDEX_OF_INDEXES;
indx[ i ] ->nEntriesInUse = 0;
indx[ i ] ->dwReserved[ 0 ] = 0;
indx[ i ] ->dwReserved[ 1 ] = 0;
ix[ stream ] ->wLongsPerEntry = 2;
ix[ stream ] ->bIndexSubType = 0;
- ix[ stream ] ->bIndexType = AVI_INDEX_OF_CHUNKS;
+ ix[ stream ] ->bIndexType = KINO_AVI_INDEX_OF_CHUNKS;
ix[ stream ] ->nEntriesInUse = 0;
ix[ stream ] ->dwChunkId = indx[ stream ] ->dwChunkId;
ix[ stream ] ->qwBaseOffset = offset + length;
* Change log:
*
* $Log$
+* Revision 1.3 2005/06/21 20:59:39 lilo_booter
+* src/framework/mlt_consumer.c src/framework/mlt_consumer.h
+* + Added a general profile handling for size, aspect ratio and display ratio
+*
+* src/framework/mlt_producer.c
+* + Correction to aspect ratio properties
+*
+* src/inigo/inigo.c
+* + Minimalist support for sdl_preview (still not very good)
+*
+* src/modules/avformat/consumer_avformat.c
+* + Takes consumer profile into account
+*
+* src/modules/core/filter_resize.c
+* + Corrections for synthesised producers and aspect ratio (inherits from consumer)
+*
+* src/modules/core/producer_colour.c
+* src/modules/core/producer_noise.c
+* src/modules/gtk2/producer_pango.c
+* + Ensures that resize picks up consumer aspect ratio
+*
+* src/modules/dv/consumer_libdv.c
+* + Honour wide screen output
+*
+* src/modules/gtk2/producer_pixbuf.c
+* + Correction for 1:1 aspect ratio
+*
+* src/modules/kino/Makefile
+* src/modules/kino/avi.cc
+* src/modules/kino/avi.h
+* src/modules/kino/configure
+* src/modules/kino/filehandler.cc
+* + Attempt to allow mov dv files to provide audio
+*
+* src/modules/sdl/consumer_sdl.c
+* src/modules/sdl/consumer_sdl_preview.c
+* src/modules/sdl/consumer_sdl_still.c
+* + Takes consumer profile into account
+*
* Revision 1.2 2005/04/15 14:37:03 lilo_booter
* Minor correction
*
#define AVI_SMALL_INDEX (0x01)
#define AVI_LARGE_INDEX (0x02)
-#define AVI_INDEX_OF_INDEXES (0x00)
-#define AVI_INDEX_OF_CHUNKS (0x01)
+#define KINO_AVI_INDEX_OF_INDEXES (0x00)
+#define KINO_AVI_INDEX_OF_CHUNKS (0x01)
#define AVI_INDEX_2FIELD (0x01)
enum { AVI_PAL, AVI_NTSC, AVI_AUDIO_48KHZ, AVI_AUDIO_44KHZ, AVI_AUDIO_32KHZ };
lqt-config --prefix > /dev/null 2>&1
lqt_disabled=$?
+ pkg-config libdv 2> /dev/null
+ libdv_disabled=$?
+
echo > config.h
[ "$lqt_disabled" = "0" ] && echo "#define HAVE_LIBQUICKTIME" >> config.h
+ [ "$libdv_disabled" = "0" ] && echo "#define HAVE_LIBDV" >> config.h
echo > config.mak
[ "$lqt_disabled" = "0" ] && echo "HAVE_LIBQUICKTIME=1" >> config.mak
+ [ "$libdv_disabled" = "0" ] && echo "HAVE_LIBDV=1" >> config.mak
[ "$lqt_disabled" != "0" ] && echo "- libquicktime not found: only enabling dv avi support"
+ [ "$libdv_disabled" != 0 -a "$lqt_disabled" = "0" ] && echo "- libdv not found: mov dv may not have audio"
echo "kino libmltkino$LIBSUF" >> ../producers.dat
fi
#include <time.h>
#include <sys/time.h>
+// libdv header files
+#ifdef HAVE_LIBDV
+#include <libdv/dv.h>
+#endif
+
#include "filehandler.h"
#include "error.h"
#include "riff.h"
quicktime_set_video_position( fd, frameNum, 0 );
quicktime_read_frame( fd, data, 0 );
-#if 0
+#ifdef HAVE_LIBDV
if ( quicktime_has_audio( fd ) )
{
- AudioInfo info;
- double samples;
-
if ( ! isFullyInitialized )
- {
- cerr << ">>> using audio from separarate Quicktime audio track" << endl;
AllocateAudioBuffers();
- }
- info.channels = channels;
- info.frequency = quicktime_sample_rate( fd, 0 );
- samples = info.frequency / quicktime_frame_rate( fd, 0 );
- info.samples = (int) samples;
+ int frequency = quicktime_sample_rate( fd, 0 );
+ int samples = ( int )( frequency / quicktime_frame_rate( fd, 0 ) );
for ( int i = 0; i < channels; i++ )
{
quicktime_set_audio_position( fd, ( int64_t )( frameNum * samples ), 0 );
quicktime_decode_audio( fd, audioChannelBuffer[ i ], NULL, (long) samples, i );
}
- frame.EncodeAudio( info, audioChannelBuffer );
+ dv_encoder_t *encoder = dv_encoder_new( 0, 0, 0 );
+ encoder->samples_this_frame = samples;
+ dv_encode_full_audio( encoder, audioChannelBuffer, channels, frequency, data );
+ dv_encoder_free( encoder );
}
- frame.ExtractHeader();
#endif
return 0;
pthread_cond_t video_cond;
int window_width;
int window_height;
- float aspect_ratio;
- float display_aspect;
- double last_frame_aspect;
+ int previous_width;
+ int previous_height;
int width;
int height;
int playing;
mlt_service service = MLT_CONSUMER_SERVICE( parent );
this->properties = MLT_SERVICE_PROPERTIES( service );
+ // Default display aspect ratio
+ double display_ratio = mlt_properties_get_double( this->properties, "display_ratio" );
+
// Set the default volume
mlt_properties_set_double( this->properties, "volume", 1.0 );
// Default audio buffer
mlt_properties_set_int( this->properties, "audio_buffer", 512 );
- // Get sample aspect ratio
- this->aspect_ratio = mlt_properties_get_double( this->properties, "aspect_ratio" );
-
// Ensure we don't join on a non-running object
this->joined = 1;
- // Default display aspect ratio
- this->display_aspect = 4.0 / 3.0;
-
// process actual param
if ( arg == NULL || sscanf( arg, "%dx%d", &this->width, &this->height ) != 2 )
{
}
// Default window size
- this->window_width = ( float )this->height * this->display_aspect;
+ this->window_width = ( float )this->height * display_ratio;
this->window_height = this->height;
// Set the sdl flags
mlt_properties_set_int( this->properties, "width", this->width );
mlt_properties_set_int( this->properties, "height", this->height );
}
+ else
+ {
+ this->width = mlt_properties_get_int( this->properties, "width" );
+ this->height = mlt_properties_get_int( this->properties, "height" );
+ }
pthread_create( &this->thread, NULL, consumer_thread, this );
}
// Determine window's new display aspect ratio
float this_aspect = ( float )this->window_width / this->window_height;
+ // Get the display aspect ratio
+ double display_ratio = mlt_properties_get_double( properties, "display_ratio" );
+
// Determine frame's display aspect ratio
float frame_aspect = mlt_frame_get_aspect_ratio( frame ) * width / height;
+
+ // Store the width and height received
this->width = width;
this->height = height;
if ( mlt_properties_get( properties, "rescale" ) != NULL &&
!strcmp( mlt_properties_get( properties, "rescale" ), "none" ) )
{
- // Special case optimisation to negate odd effect of sample aspect ratio
- // not corresponding exactly with image resolution.
- if ( ( (int)( this_aspect * 1000 ) == (int)( this->display_aspect * 1000 ) ) &&
- ( (int)( mlt_frame_get_aspect_ratio( frame ) * 1000 ) == (int)( this->aspect_ratio * 1000 ) ) )
+ // Use hardware scaler to normalise display aspect ratio
+ this->rect.w = frame_aspect / this_aspect * this->window_width;
+ this->rect.h = this->window_height;
+ if ( this->rect.w > this->window_width )
{
this->rect.w = this->window_width;
- this->rect.h = this->window_height;
- }
- else
- {
- // Use hardware scaler to normalise display aspect ratio
- this->rect.w = frame_aspect / this_aspect * this->window_width;
- this->rect.h = this->window_height;
- if ( this->rect.w > this->window_width )
- {
- this->rect.w = this->window_width;
- this->rect.h = this_aspect / frame_aspect * this->window_height;
- }
+ this->rect.h = this_aspect / frame_aspect * this->window_height;
}
}
// Special case optimisation to negate odd effect of sample aspect ratio
// not corresponding exactly with image resolution.
- else if ( (int)( this_aspect * 1000 ) == (int)( this->display_aspect * 1000 ) )
+ else if ( (int)( this_aspect * 1000 ) == (int)( display_ratio * 1000 ) )
{
this->rect.w = this->window_width;
this->rect.h = this->window_height;
}
// Use hardware scaler to normalise sample aspect ratio
- else if ( this->window_height * this->display_aspect > this->window_width )
+ else if ( this->window_height * display_ratio > this->window_width )
{
this->rect.w = this->window_width;
- this->rect.h = this->window_width / this->display_aspect;
+ this->rect.h = this->window_width / display_ratio;
}
else
{
- this->rect.w = this->window_height * this->display_aspect;
+ this->rect.w = this->window_height * display_ratio;
this->rect.h = this->window_height;
}
SDL_SetClipRect( this->sdl_screen, &this->rect );
SDL_Flip( this->sdl_screen );
sdl_lock_display();
- this->sdl_overlay = SDL_CreateYUVOverlay( this->width, this->height, SDL_YUY2_OVERLAY, this->sdl_screen );
+ this->sdl_overlay = SDL_CreateYUVOverlay( width, height, SDL_YUY2_OVERLAY, this->sdl_screen );
sdl_unlock_display();
}
mlt_properties_set_int( still, "width", mlt_properties_get_int( properties, "width" ) );
mlt_properties_set_int( play, "height", mlt_properties_get_int( properties, "height" ) );
mlt_properties_set_int( still, "height", mlt_properties_get_int( properties, "height" ) );
+ mlt_properties_set_double( play, "aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
+ mlt_properties_set_double( still, "aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
+ mlt_properties_set_double( play, "display_ratio", mlt_properties_get_double( properties, "display_ratio" ) );
+ mlt_properties_set_double( still, "display_ratio", mlt_properties_get_double( properties, "display_ratio" ) );
mlt_properties_set_int( play, "progressive", progressive );
mlt_properties_set_int( still, "progressive", progressive );
int running;
int window_width;
int window_height;
- float aspect_ratio;
- float display_aspect;
- double last_frame_aspect;
int width;
int height;
int playing;
// Get the parent consumer object
mlt_consumer parent = &this->parent;
- // We have stuff to clean up, so override the close method
- parent->close = consumer_close;
-
// get a handle on properties
mlt_service service = MLT_CONSUMER_SERVICE( parent );
this->properties = MLT_SERVICE_PROPERTIES( service );
+ // Get the default display ratio
+ double display_ratio = mlt_properties_get_double( this->properties, "display_ratio" );
+
+ // We have stuff to clean up, so override the close method
+ parent->close = consumer_close;
+
// Default scaler (for now we'll use nearest)
mlt_properties_set( this->properties, "rescale", "nearest" );
// Default progressive true
mlt_properties_set_int( this->properties, "progressive", 1 );
- // Get sample aspect ratio
- this->aspect_ratio = mlt_properties_get_double( this->properties, "aspect_ratio" );
-
// Ensure we don't join on a non-running object
this->joined = 1;
- // Default display aspect ratio
- this->display_aspect = 4.0 / 3.0;
-
// process actual param
if ( arg == NULL || sscanf( arg, "%dx%d", &this->width, &this->height ) != 2 )
{
}
// Default window size
- this->window_width = ( float )this->height * this->display_aspect;
+ this->window_width = ( float )this->height * display_ratio;
this->window_height = this->height;
// Set the sdl flags
mlt_properties_set_int( this->properties, "height", this->height );
}
- //this->width = this->height * this->display_aspect;
-
pthread_create( &this->thread, NULL, consumer_thread, this );
}
int width = this->width;
uint8_t *image = NULL;
int changed = 0;
+ double display_ratio = mlt_properties_get_double( this->properties, "display_ratio" );
void ( *lock )( void ) = mlt_properties_get_data( properties, "app_lock", NULL );
void ( *unlock )( void ) = mlt_properties_get_data( properties, "app_unlock", NULL );
this->last_producer = mlt_properties_get_data( MLT_FRAME_PROPERTIES( frame ), "_producer", NULL );
// Get the image, width and height
- if ( image == NULL )
- {
- mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
-
- // I would like to provide upstream scaling here, but this is incorrect
- // Something? (or everything?) is too sensitive to aspect ratio
- //width = this->rect.w;
- //height = this->rect.h;
- //mlt_properties_set( MLT_FRAME_PROPERTIES( frame ), "distort", "true" );
- //mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "normalised_width", width );
- //mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "normalised_height", height );
-
- mlt_frame_get_image( frame, &image, &vfmt, &width, &height, 0 );
- }
+ mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
+ mlt_frame_get_image( frame, &image, &vfmt, &width, &height, 0 );
if ( image != NULL )
{
char *rescale = mlt_properties_get( properties, "rescale" );
if ( rescale != NULL && strcmp( rescale, "none" ) )
{
- float this_aspect = this->display_aspect / ( ( float )this->window_width / ( float )this->window_height );
+ float this_aspect = display_ratio / ( ( float )this->window_width / ( float )this->window_height );
this->rect.w = this_aspect * this->window_width;
this->rect.h = this->window_height;
if ( this->rect.w > this->window_width )