/** Disconnect a service from its consumer.
*
- * \public \memberof mlt_service_s
+ * \private \memberof mlt_service_s
* \param self a service
*/
#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
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 );
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 );
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 );
}
// Do the colour space conversion
#ifdef SWSCALE
- int flags = SWS_BILINEAR;
+ int flags = SWS_BICUBIC;
#ifdef USE_MMX
flags |= SWS_CPU_CAPS_MMX;
#endif
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;
#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
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;
// 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.
*/
// 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
#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
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))
{
#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;
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 );
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,
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 ] );
}
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;
// 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 );
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) );
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 );
}
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 );
}