]> git.sesse.net Git - mlt/commitdiff
Merge branch 'pez'
authorDan Dennedy <dan@dennedy.org>
Mon, 6 Feb 2012 04:11:39 +0000 (20:11 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 6 Feb 2012 04:11:39 +0000 (20:11 -0800)
src/framework/mlt_service.c
src/modules/avformat/consumer_avformat.c
src/modules/avformat/filter_avcolour_space.c
src/modules/avformat/filter_avdeinterlace.c
src/modules/avformat/filter_avresample.c
src/modules/avformat/producer_avformat.c
src/modules/core/producer_consumer.c
src/modules/xml/consumer_xml.c

index 3e6aa1a104831b0712105c97ac8edfd42d7f2dab..bfcc91349870699a4cc030ac88e25862f60c8c44 100644 (file)
@@ -265,7 +265,7 @@ int mlt_service_connect_producer( mlt_service self, mlt_service producer, int in
 
 /** Disconnect a service from its consumer.
  *
- * \public \memberof mlt_service_s
+ * \private \memberof mlt_service_s
  * \param self a service
  */
 
index 5fdf9b3d700e43fe7188e628e75334f56579d4c1..9b70cebee0e7fa07ef38c67bab09d04f877b46c6 100644 (file)
 #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(8<<8)+0)
 #include <libavutil/pixdesc.h>
 #endif
+#include <libavutil/mathematics.h>
+
 #if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0)
-#include <libavutil/samplefmt.h>
+#  include <libavutil/samplefmt.h>
+#else
+#  define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
+#  define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+#  define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32
+#  define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT
 #endif
-#include <libavutil/mathematics.h>
 
 #if LIBAVUTIL_VERSION_INT < (50<<16)
 #define PIX_FMT_RGB32 PIX_FMT_RGBA32
@@ -388,7 +394,7 @@ static void apply_properties( void *obj, mlt_properties properties, int flags )
        for ( i = 0; i < count; i++ )
        {
                const char *opt_name = mlt_properties_get_name( properties, i );
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(7<<8)+0)
+#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(10<<8)+0)
                const AVOption *opt = av_opt_find( obj, opt_name, NULL, flags, flags );
 #else
                const AVOption *opt = av_find_opt( obj, opt_name, NULL, flags, flags );
@@ -398,7 +404,7 @@ static void apply_properties( void *obj, mlt_properties properties, int flags )
                if ( !opt && (
                        ( opt_name[0] == 'v' && ( flags & AV_OPT_FLAG_VIDEO_PARAM ) ) ||
                        ( opt_name[0] == 'a' && ( flags & AV_OPT_FLAG_AUDIO_PARAM ) ) ) )
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(7<<8)+0)
+#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(10<<8)+0)
                        opt = av_opt_find( obj, ++opt_name, NULL, flags, flags );
 #else
                        opt = av_find_opt( obj, ++opt_name, NULL, flags, flags );
@@ -1495,15 +1501,16 @@ static void *consumer_thread( void *arg )
                                        fifo = sample_fifo_init( frequency, channels );
                                        mlt_properties_set_data( properties, "sample_fifo", fifo, 0, ( mlt_destructor )sample_fifo_close, NULL );
                                }
+                               if ( pcm )
+                               {
+                                       // Silence if not normal forward speed
+                                       if ( mlt_properties_get_double( frame_properties, "_speed" ) != 1.0 )
+                                               memset( pcm, 0, samples * channels * sample_bytes );
 
-                               // Silence if not normal forward speed
-                               if ( mlt_properties_get_double( frame_properties, "_speed" ) != 1.0 )
-                                       memset( pcm, 0, samples * channels * sample_bytes );
-
-                               // Append the samples
-                               sample_fifo_append( fifo, pcm, samples * channels * sample_bytes );
-                               total_time += ( samples * 1000000 ) / frequency;
-
+                                       // Append the samples
+                                       sample_fifo_append( fifo, pcm, samples * channels * sample_bytes );
+                                       total_time += ( samples * 1000000 ) / frequency;
+                               }
                                if ( !video_st )
                                        mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
                        }
@@ -1694,7 +1701,7 @@ static void *consumer_thread( void *arg )
 
                                                // Do the colour space conversion
 #ifdef SWSCALE
-                                               int flags = SWS_BILINEAR;
+                                               int flags = SWS_BICUBIC;
 #ifdef USE_MMX
                                                flags |= SWS_CPU_CAPS_MMX;
 #endif
index 6396f887c10ad70e016c090d9124f75eaaa7b7e1..f812146a2162e114e1a65197ea46dd244d5e0023 100644 (file)
@@ -117,7 +117,7 @@ static void av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt
        AVPicture input;
        AVPicture output;
 #ifdef SWSCALE
-       int flags = SWS_BILINEAR | SWS_ACCURATE_RND;
+       int flags = SWS_BICUBIC | SWS_ACCURATE_RND;
 
        if ( out_fmt == PIX_FMT_YUYV422 )
                flags |= SWS_FULL_CHR_H_INP;
index b75117453652b3e0427c7435b4452204f7773008..aa1327817b0f866d8744106b14e189d639c97cd7 100644 (file)
@@ -31,7 +31,7 @@
 #include "mmx.h"
 #else
 #define MAX_NEG_CROP 1024
-extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
+static uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0,};
 #endif
 
 #ifdef USE_MMX
@@ -346,6 +346,17 @@ static mlt_frame deinterlace_process( mlt_filter filter, mlt_frame frame )
 
 mlt_filter filter_avdeinterlace_init( void *arg )
 {
+#ifndef USE_MMX
+       if ( ff_cropTbl[MAX_NEG_CROP + 1] == 0 )
+       {
+               int i;
+               for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i;
+               for(i=0;i<MAX_NEG_CROP;i++) {
+                       ff_cropTbl[i] = 0;
+                       ff_cropTbl[i + MAX_NEG_CROP + 256] = 255;
+               }
+       }
+#endif
        mlt_filter filter = mlt_filter_new( );
        if ( filter != NULL )
                filter->process = deinterlace_process;
index 340d22512350b6e6f905268ff1fddc7c415d0b49..65ea354e9ea6862d5c8aa99785a2f7b9ad8c0b16 100644 (file)
 
 // ffmpeg Header files
 #include <libavformat/avformat.h>
+#if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0)
+#  include <libavutil/samplefmt.h>
+#else
+#  define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+#endif
 
 /** Get the audio.
 */
@@ -79,7 +84,7 @@ static int resample_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
                        // Create the resampler
 #if (LIBAVCODEC_VERSION_INT >= ((52<<16)+(15<<8)+0))
                        resample = av_audio_resample_init( *channels, *channels, output_rate, *frequency,
-                               SAMPLE_FMT_S16, SAMPLE_FMT_S16, 16, 10, 0, 0.8 );
+                               AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, 16, 10, 0, 0.8 );
 #else
                        resample = audio_resample_init( *channels, *channels, output_rate, *frequency );
 #endif
index d5d87749e8389f0048c0a375a2fdd7fd6fe16cd1..87b87afa8736e2a03fb33e713369a228e29c86aa 100644 (file)
 #ifdef SWSCALE
 #  include <libswscale/swscale.h>
 #endif
-#if LIBAVCODEC_VERSION_MAJOR >= 53
-#include <libavutil/samplefmt.h>
-#elif (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))
+
+#if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0)
+#  include <libavutil/samplefmt.h>
+#else
+#  define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+#  define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32
+#  define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT
+#  if (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))
 const char *avcodec_get_sample_fmt_name(int sample_fmt);
+#  endif
 #endif
+
 #ifdef VDPAU
 #  include <libavcodec/vdpau.h>
 #endif
@@ -358,7 +365,7 @@ static mlt_properties find_default_streams( producer_avformat self )
                                if ( self->audio_index < 0 )
                                        self->audio_index = i;
                                mlt_properties_set( meta_media, key, "audio" );
-#if LIBAVCODEC_VERSION_MAJOR >= 53
+#if LIBAVUTIL_VERSION_INT >= ((50<<16)+(38<<8)+0)
                                snprintf( key, sizeof(key), "meta.media.%d.codec.sample_fmt", i );
                                mlt_properties_set( meta_media, key, av_get_sample_fmt_name( codec_context->sample_fmt ) );
 #elif (LIBAVCODEC_VERSION_INT >= ((51<<16)+(71<<8)+0))
@@ -1240,7 +1247,7 @@ static void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt,
 {
 #ifdef SWSCALE
        int full_range = -1;
-       int flags = SWS_BILINEAR | SWS_ACCURATE_RND;
+       int flags = SWS_BICUBIC | SWS_ACCURATE_RND;
 
 #ifdef USE_MMX
        flags |= SWS_CPU_CAPS_MMX;
@@ -1792,7 +1799,7 @@ static void apply_properties( void *obj, mlt_properties properties, int flags )
        for ( i = 0; i < count; i++ )
        {
                const char *opt_name = mlt_properties_get_name( properties, i );
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(7<<8)+0)
+#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(10<<8)+0)
                const AVOption *opt = av_opt_find( obj, opt_name, NULL, flags, flags );
 #else
                const AVOption *opt = av_find_opt( obj, opt_name, NULL, flags, flags );
@@ -2296,7 +2303,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
                                self->audio_resample[ index ] = av_audio_resample_init(
                                        self->audio_index == INT_MAX ? codec_context->channels : *channels,
                                        codec_context->channels, *frequency, codec_context->sample_rate,
-                                       SAMPLE_FMT_S16, codec_context->sample_fmt, 16, 10, 0, 0.8 );
+                                       AV_SAMPLE_FMT_S16, codec_context->sample_fmt, 16, 10, 0, 0.8 );
 #else
                                self->audio_resample[ index ] = audio_resample_init(
                                        self->audio_index == INT_MAX ? codec_context->channels : *channels,
@@ -2399,8 +2406,8 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
                        index = self->audio_index;
                        *channels = self->audio_codec[ index ]->channels;
                        *frequency = self->audio_codec[ index ]->sample_rate;
-                       *format = self->audio_codec[ index ]->sample_fmt == SAMPLE_FMT_S32 ? mlt_audio_s32le
-                               : self->audio_codec[ index ]->sample_fmt == SAMPLE_FMT_FLT ? mlt_audio_f32le
+                       *format = self->audio_codec[ index ]->sample_fmt == AV_SAMPLE_FMT_S32 ? mlt_audio_s32le
+                               : self->audio_codec[ index ]->sample_fmt == AV_SAMPLE_FMT_FLT ? mlt_audio_f32le
                                : mlt_audio_s16;
                        sizeof_sample = sample_bytes( self->audio_codec[ index ] );
                }
@@ -2410,8 +2417,8 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
                        for ( index = 0; index < index_max; index++ )
                                if ( self->audio_codec[ index ] && !self->audio_resample[ index ] )
                                {
-                                       *format = self->audio_codec[ index ]->sample_fmt == SAMPLE_FMT_S32 ? mlt_audio_s32le
-                                               : self->audio_codec[ index ]->sample_fmt == SAMPLE_FMT_FLT ? mlt_audio_f32le
+                                       *format = self->audio_codec[ index ]->sample_fmt == AV_SAMPLE_FMT_S32 ? mlt_audio_s32le
+                                               : self->audio_codec[ index ]->sample_fmt == AV_SAMPLE_FMT_FLT ? mlt_audio_f32le
                                                : mlt_audio_s16;
                                        sizeof_sample = sample_bytes( self->audio_codec[ index ] );
                                        break;
index 1f6e812a0961a199cd10806c577e822e4db41845..ab11b4ded82c56f94c25f645c2585a269dcfda26 100644 (file)
@@ -141,6 +141,7 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index )
 
                // Since we control the seeking, prevent it from seeking on its own
                mlt_producer_set_speed( cx->producer, 0 );
+               cx->audio_position = -1;
 
                // We will encapsulate a consumer
                cx->consumer = mlt_consumer_new( cx->profile );
index 2b0f6bc493da54916027fe06056c1ba6f2d3d8e3..3e1544b54e60a2ad2f0bcd414bbb879a234959f6 100644 (file)
@@ -60,11 +60,11 @@ static int consumer_is_stopped( mlt_consumer this );
 static void *consumer_thread( void *arg );
 static void serialise_service( serialise_context context, mlt_service service, xmlNode *node );
 
-static void* filter_restricted( const char *in )
+static char* filter_restricted( const char *in )
 {
        if ( !in ) return NULL;
        size_t n = strlen( in );
-       char *out = calloc( 1, n );
+       char *out = calloc( 1, n + 1 );
        char *p = out;
        mbstate_t mbs;
        memset( &mbs, 0, sizeof(mbs) );
@@ -235,9 +235,11 @@ static void serialise_properties( serialise_context context, mlt_properties prop
                        if ( value )
                        {
                                int rootlen = strlen( context->root );
+                               // convert absolute path to relative
                                if ( rootlen && !strncmp( value, context->root, rootlen ) && value[ rootlen ] == '/' )
-                                       value += rootlen + 1;
-                               p = xmlNewTextChild( node, NULL, _x("property"), _x(value) );
+                                       p = xmlNewTextChild( node, NULL, _x("property"), _x(value + rootlen + 1 ) );
+                               else
+                                       p = xmlNewTextChild( node, NULL, _x("property"), _x(value) );
                                xmlNewProp( p, _x("name"), _x(name) );
                                free( value );
                        }
@@ -260,9 +262,11 @@ static void serialise_store_properties( serialise_context context, mlt_propertie
                        if ( value )
                        {
                                int rootlen = strlen( context->root );
+                               // convert absolute path to relative
                                if ( rootlen && !strncmp( value, context->root, rootlen ) && value[ rootlen ] == '/' )
-                                       value += rootlen + 1;
-                               p = xmlNewTextChild( node, NULL, _x("property"), _x(value) );
+                                       p = xmlNewTextChild( node, NULL, _x("property"), _x(value + rootlen + 1) );
+                               else
+                                       p = xmlNewTextChild( node, NULL, _x("property"), _x(value) );
                                xmlNewProp( p, _x("name"), _x(name) );
                                free( value );
                        }