Skip to content

Commit

Permalink
Restore avresample filter when build against FFmpeg.
Browse files Browse the repository at this point in the history
This provides a LGPL audio resampler, but it is using deprecated APIs.
Support for swresample or libav avresampler is another project.
  • Loading branch information
ddennedy committed Mar 23, 2013
1 parent 6cfe849 commit 41d22df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/modules/avformat/factory.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void *create_service( mlt_profile profile, mlt_service_type type, const c
return filter_avcolour_space_init( arg );
if ( !strcmp( id, "avdeinterlace" ) )
return filter_avdeinterlace_init( arg );
#if LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0)
#if defined(FFUDIV) || (LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0))
if ( !strcmp( id, "avresample" ) )
return filter_avresample_init( arg );
#endif
Expand Down Expand Up @@ -373,7 +373,7 @@ MLT_REPOSITORY
MLT_REGISTER( filter_type, "avcolour_space", create_service );
MLT_REGISTER( filter_type, "avcolor_space", create_service );
MLT_REGISTER( filter_type, "avdeinterlace", create_service );
#if LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0)
#if defined(FFUDIV) || (LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0))
MLT_REGISTER( filter_type, "avresample", create_service );
#endif
MLT_REGISTER( filter_type, "swscale", create_service );
Expand Down
9 changes: 6 additions & 3 deletions src/modules/avformat/filter_avresample.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
#include <libavformat/avformat.h>
#include <libavutil/samplefmt.h>

#if LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0)
#if defined(FFUDIV) || (LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0))

#define MAX_AUDIO_FRAME_SIZE (192000) // 1 second of 48khz 32bit audio


/** Get the audio.
*/
Expand Down Expand Up @@ -148,7 +151,7 @@ mlt_filter filter_avresample_init( char *arg )
if ( filter != NULL )
{
// Calculate size of the buffer
int size = AVCODEC_MAX_AUDIO_FRAME_SIZE * sizeof( int16_t );
int size = MAX_AUDIO_FRAME_SIZE * sizeof( int16_t );

// Allocate the buffer
int16_t *buffer = mlt_pool_alloc( size );
Expand All @@ -170,4 +173,4 @@ mlt_filter filter_avresample_init( char *arg )
return filter;
}

#endif // LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0)
#endif // defined(FFUDIV) || (LIBAVCODEC_VERSION_INT < ((54<<16)+(26<<8)+0))

0 comments on commit 41d22df

Please sign in to comment.