Dan Dennedy | 23 Sep 07:07 2014

Dropping support for FFmpeg < 1.0 and Libav < 9

Dear all,
I need to update the avformat module to deal with deprecation and review API usage. I think it is time to drop support for FFmpeg v0.7, FFmpeg v0.8, and Libav 0.8. Debian stable will upgrade soon and its 0.8.x version of libav will go away. Existing Debian stable users (and those who remain there for a while longer) can use v0.9.2 or older. Here is an example of the cleanup we stand to gain, and this is just for the consumer. Let me know if you think there is a problem with dropping these older versions.

diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c
index 8ed6de5..6a3221a 100644
--- a/src/modules/avformat/consumer_avformat.c
+++ b/src/modules/avformat/consumer_avformat.c
<at> <at> -43,15 +43,7 <at> <at>
 #include <libavutil/pixdesc.h>
 #include <libavutil/mathematics.h>
 #include <libavutil/samplefmt.h>
-
-#if LIBAVCODEC_VERSION_MAJOR >= 53
 #include <libavutil/opt.h>
-#define CODEC_TYPE_VIDEO      AVMEDIA_TYPE_VIDEO
-#define CODEC_TYPE_AUDIO      AVMEDIA_TYPE_AUDIO
-#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
-#else
-#include <libavcodec/opt.h>
-#endif
 
 #if LIBAVCODEC_VERSION_MAJOR < 55
 #define AV_CODEC_ID_PCM_S16LE CODEC_ID_PCM_S16LE
<at> <at> -228,11 +220,9 <at> <at> static void color_trc_from_colorspace( mlt_properties properties )
  case 470:
  mlt_properties_set_int( properties, "color_trc", AVCOL_TRC_GAMMA28 );
  break;
-#if LIBAVCODEC_VERSION_INT >= ((54<<16)+(35<<8)+0)
  case 240:
  mlt_properties_set_int( properties, "color_trc", AVCOL_TRC_SMPTE240M );
  break;
-#endif
 #if LIBAVCODEC_VERSION_INT >= ((55<<16)+(52<<8)+0)
  case 0: // sRGB
  mlt_properties_set_int( properties, "color_trc", AVCOL_TRC_IEC61966_2_1 );
<at> <at> -333,13 +323,7 <at> <at> static int consumer_start( mlt_consumer consumer )
  mlt_properties_set_data( properties, "acodec", codecs, 0, (mlt_destructor) mlt_properties_close, NULL );
  mlt_properties_set_data( doc, "audio_codecs", codecs, 0, NULL, NULL );
  while ( ( codec = av_codec_next( codec ) ) )
-#if (defined(FFUDIV) && LIBAVCODEC_VERSION_INT >= ((54<<16)+(56<<8)+100)) || (LIBAVCODEC_VERSION_INT >= ((54<<16)+(27<<8)+0))
- if ( codec->encode2 && codec->type == CODEC_TYPE_AUDIO )
-#elif LIBAVCODEC_VERSION_INT >= ((54<<16)+(0<<8)+0)
- if ( ( codec->encode || codec->encode2 ) && codec->type == CODEC_TYPE_AUDIO )
-#else
- if ( codec->encode && codec->type == CODEC_TYPE_AUDIO )
-#endif
+ if ( codec->encode2 && codec->type == AVMEDIA_TYPE_AUDIO )
  {
  snprintf( key, sizeof(key), "%d", mlt_properties_count( codecs ) );
  mlt_properties_set( codecs, key, codec->name );
<at> <at> -361,13 +345,7 <at> <at> static int consumer_start( mlt_consumer consumer )
  mlt_properties_set_data( properties, "vcodec", codecs, 0, (mlt_destructor) mlt_properties_close, NULL );
  mlt_properties_set_data( doc, "video_codecs", codecs, 0, NULL, NULL );
  while ( ( codec = av_codec_next( codec ) ) )
-#if (defined(FFUDIV) && LIBAVCODEC_VERSION_INT >= ((54<<16)+(56<<8)+100)) || (LIBAVCODEC_VERSION_INT >= ((54<<16)+(27<<8)+0))
- if ( codec->encode2 && codec->type == CODEC_TYPE_VIDEO )
-#elif LIBAVCODEC_VERSION_INT >= ((54<<16)+(0<<8)+0)
- if ( (codec->encode || codec->encode2) && codec->type == CODEC_TYPE_VIDEO )
-#else
- if ( codec->encode && codec->type == CODEC_TYPE_VIDEO )
-#endif
+ if ( codec->encode2 && codec->type == AVMEDIA_TYPE_VIDEO )
  {
  snprintf( key, sizeof(key), "%d", mlt_properties_count( codecs ) );
  mlt_properties_set( codecs, key, codec->name );
<at> <at> -447,35 +425,20 <at> <at> static void apply_properties( void *obj, mlt_properties properties, int flags )
 {
  int i;
  int count = mlt_properties_count( properties );
-#if LIBAVUTIL_VERSION_INT < ((51<<16)+(12<<8)+0)
- int alloc = 1;
-#endif
 
  for ( i = 0; i < count; i++ )
  {
  const char *opt_name = mlt_properties_get_name( properties, i );
-#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 );
-#endif
 
  // If option not found, see if it was prefixed with a or v (-vb)
  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)+(10<<8)+0)
  opt = av_opt_find( obj, ++opt_name, NULL, flags, flags );
-#else
- opt = av_find_opt( obj, ++opt_name, NULL, flags, flags );
-#endif
  // Apply option if found
  if ( opt )
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(12<<8)+0)
  av_opt_set( obj, opt_name, mlt_properties_get_value( properties, i), 0 );
-#else
- av_set_string3( obj, opt_name, mlt_properties_get_value( properties, i), alloc, NULL );
-#endif
  }
 }
 
<at> <at> -504,14 +467,12 <at> <at> static int get_mlt_audio_format( int av_sample_fmt )
  return mlt_audio_s32le;
  case AV_SAMPLE_FMT_FLT:
  return mlt_audio_f32le;
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  case AV_SAMPLE_FMT_U8P:
  return mlt_audio_u8;
  case AV_SAMPLE_FMT_S32P:
  return mlt_audio_s32le;
  case AV_SAMPLE_FMT_FLTP:
  return mlt_audio_f32le;
-#endif
  default:
  return mlt_audio_s16;
  }
<at> <at> -532,12 +493,10 <at> <at> static int pick_sample_fmt( mlt_properties properties, AVCodec *codec )
  sample_fmt = AV_SAMPLE_FMT_FLT;
  else if ( !strcmp( format, "u8" ) )
  sample_fmt = AV_SAMPLE_FMT_U8;
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  else if ( !strcmp( format, "s32" ) )
  sample_fmt = AV_SAMPLE_FMT_S32P;
  else if ( !strcmp( format, "float" ) )
  sample_fmt = AV_SAMPLE_FMT_FLTP;
-#endif
  }
  // check if codec supports our mlt_audio_format
  for ( ; *p != -1; p++ )
<at> <at> -554,12 +513,10 <at> <at> static int pick_sample_fmt( mlt_properties properties, AVCodec *codec )
  case AV_SAMPLE_FMT_S16:
  case AV_SAMPLE_FMT_S32:
  case AV_SAMPLE_FMT_FLT:
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  case AV_SAMPLE_FMT_U8P:
  case AV_SAMPLE_FMT_S16P:
  case AV_SAMPLE_FMT_S32P:
  case AV_SAMPLE_FMT_FLTP:
-#endif
  return *p;
  default:
  break;
<at> <at> -600,11 +557,7 <at> <at> static AVStream *add_audio_stream( mlt_consumer consumer, AVFormatContext *oc, A
  mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
 
  // Create a new stream
-#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(10<<8)+0)
  AVStream *st = avformat_new_stream( oc, codec );
-#else
- AVStream *st = av_new_stream( oc, oc->nb_streams );
-#endif
 
  // If created, then initialise from properties
  if ( st != NULL ) 
<at> <at> -612,14 +565,10 <at> <at> static AVStream *add_audio_stream( mlt_consumer consumer, AVFormatContext *oc, A
  AVCodecContext *c = st->codec;
 
  // Establish defaults from AVOptions
-#if LIBAVCODEC_VERSION_MAJOR >= 53
  avcodec_get_context_defaults3( c, codec );
-#else
- avcodec_get_context_defaults2( c, CODEC_TYPE_AUDIO );
-#endif
 
  c->codec_id = codec->id;
- c->codec_type = CODEC_TYPE_AUDIO;
+ c->codec_type = AVMEDIA_TYPE_AUDIO;
  c->sample_fmt = pick_sample_fmt( properties, codec );
 
 #if 0 // disabled until some audio codecs are multi-threaded
<at> <at> -660,9 +609,6 <at> <at> static AVStream *add_audio_stream( mlt_consumer consumer, AVFormatContext *oc, A
  {
  c->flags |= CODEC_FLAG_QSCALE;
  c->global_quality = FF_QP2LAMBDA * audio_qscale;
-#if LIBAVFORMAT_VERSION_MAJOR < 53
- st->quality = c->global_quality;
-#endif
  }
 
  // Set parameters controlled by MLT
<at> <at> -671,11 +617,7 <at> <at> static AVStream *add_audio_stream( mlt_consumer consumer, AVFormatContext *oc, A
  c->channels = channels;
 
  if ( mlt_properties_get( properties, "alang" ) != NULL )
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0)
  av_dict_set( &oc->metadata, "language", mlt_properties_get( properties, "alang" ), 0 );
-#else
- av_metadata_set2( &oc->metadata, "language", mlt_properties_get( properties, "alang" ), 0 );
-#endif
  }
  else
  {
<at> <at> -720,11 +662,7 <at> <at> static int open_audio( mlt_properties properties, AVFormatContext *oc, AVStream
  }
 
  // Continue if codec found and we can open it
-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
  if ( codec && avcodec_open2( c, codec, NULL ) >= 0 )
-#else
- if ( codec && avcodec_open( c, codec ) >= 0 )
-#endif
  {
  // ugly hack for PCM codecs (will be removed ASAP with new PCM
  // support to compute the input frame size in samples
<at> <at> -739,7 +677,6 <at> <at> static int open_audio( mlt_properties properties, AVFormatContext *oc, AVStream
  case AV_CODEC_ID_PCM_U16BE:
  audio_input_frame_size >>= 1;
  break;
-#if LIBAVCODEC_VERSION_INT >= ((54<<16)+(59<<8)+0)
  case AV_CODEC_ID_PCM_S24LE:
  case AV_CODEC_ID_PCM_S24BE:
  case AV_CODEC_ID_PCM_U24LE:
<at> <at> -752,7 +689,6 <at> <at> static int open_audio( mlt_properties properties, AVFormatContext *oc, AVStream
  case AV_CODEC_ID_PCM_U32BE:
  audio_input_frame_size >>= 2;
  break;
-#endif
  default:
  break;
  }
<at> <at> -792,11 +728,7 <at> <at> static AVStream *add_video_stream( mlt_consumer consumer, AVFormatContext *oc, A
  mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
 
  // Create a new stream
-#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(10<<8)+0)
  AVStream *st = avformat_new_stream( oc, codec );
-#else
- AVStream *st = av_new_stream( oc, oc->nb_streams );
-#endif
 
  if ( st != NULL ) 
  {
<at> <at> -804,25 +736,17 <at> <at> static AVStream *add_video_stream( mlt_consumer consumer, AVFormatContext *oc, A
  AVCodecContext *c = st->codec;
 
  // Establish defaults from AVOptions
-#if LIBAVCODEC_VERSION_MAJOR >= 53
  avcodec_get_context_defaults3( c, codec );
-#else
- avcodec_get_context_defaults2( c, CODEC_TYPE_VIDEO );
-#endif
 
  c->codec_id = codec->id;
- c->codec_type = CODEC_TYPE_VIDEO;
+ c->codec_type = AVMEDIA_TYPE_VIDEO;
 
  // Setup multi-threading
  int thread_count = mlt_properties_get_int( properties, "threads" );
  if ( thread_count == 0 && getenv( "MLT_AVFORMAT_THREADS" ) )
  thread_count = atoi( getenv( "MLT_AVFORMAT_THREADS" ) );
  if ( thread_count > 1 )
-#if LIBAVCODEC_VERSION_MAJOR >= 53
  c->thread_count = thread_count;
-#else
- avcodec_thread_init( c, thread_count );
-#endif
 
  // Process properties as AVOptions
  char *vpre = mlt_properties_get( properties, "vpre" );
<at> <at> -908,9 +832,6 <at> <at> static AVStream *add_video_stream( mlt_consumer consumer, AVFormatContext *oc, A
  {
  c->flags |= CODEC_FLAG_QSCALE;
  c->global_quality = FF_QP2LAMBDA * mlt_properties_get_double( properties, "qscale" );
-#if LIBAVFORMAT_VERSION_MAJOR < 53
- st->quality = c->global_quality;
-#endif
  }
 
  // Allow the user to override the video fourcc
<at> <at> -1107,11 +1028,7 <at> <at> static int open_video( mlt_properties properties, AVFormatContext *oc, AVStream
  video_enc->pix_fmt = codec->pix_fmts[ 0 ];
  }
 
-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
  int result = codec && avcodec_open2( video_enc, codec, NULL ) >= 0;
-#else
- int result = codec && avcodec_open( video_enc, codec ) >= 0;
-#endif
 
  return result;
 }
<at> <at> -1358,11 +1275,7 <at> <at> static void *consumer_thread( void *arg )
  {
  markup[0] = '\0';
  if ( !strstr( key, ".stream." ) )
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0)
  av_dict_set( &oc->metadata, key, mlt_properties_get_value( properties, i ), 0 );
-#else
- av_metadata_set2( &oc->metadata, key, mlt_properties_get_value( properties, i ), 0 );
-#endif
  }
  free( key );
  }
<at> <at> -1441,16 +1354,9 <at> <at> static void *consumer_thread( void *arg )
  sample_bytes = sample_bytes ? sample_bytes : 1; // prevent divide by zero
 
  // Set the parameters (even though we have none...)
-#if LIBAVFORMAT_VERSION_INT < ((53<<16)+(2<<8)+0)
- if ( av_set_parameters(oc, NULL) >= 0 )
-#endif
  {
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
  if ( mlt_properties_get( properties, "muxpreload" ) && ! mlt_properties_get( properties, "preload" ) )
  mlt_properties_set_double( properties, "preload", mlt_properties_get_double( properties, "muxpreload" ) );
-#else
- oc->preload = ( int )( mlt_properties_get_double( properties, "muxpreload" ) * AV_TIME_BASE );
-#endif
  oc->max_delay= ( int )( mlt_properties_get_double( properties, "muxdelay" ) * AV_TIME_BASE );
 
  // Process properties as AVOptions
<at> <at> -1492,17 +1398,11 <at> <at> static void *consumer_thread( void *arg )
  {
  int buffer_size = 32768;
  unsigned char *buffer = av_malloc( buffer_size );
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
  AVIOContext* io = avio_alloc_context( buffer, buffer_size, 1, properties, NULL, mlt_write, NULL );
-#else
- ByteIOContext* io = av_alloc_put_byte( buffer, buffer_size, 1, properties, NULL, mlt_write, NULL );
-#endif
  if ( buffer && io )
  {
  oc->pb = io;
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
  oc->flags |= AVFMT_FLAG_CUSTOM_IO;
-#endif
  mlt_properties_set_data( properties, "avio_buffer", buffer, buffer_size, av_free, NULL );
  mlt_properties_set_data( properties, "avio_context", io, 0, av_free, NULL );
  mlt_events_register( properties, "avformat-write", (mlt_transmitter) write_transmitter );
<at> <at> -1516,11 +1416,7 <at> <at> static void *consumer_thread( void *arg )
  // Open the output file, if needed
  else if ( !( fmt->flags & AVFMT_NOFILE ) )
  {
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
  if ( avio_open( &oc->pb, filename, AVIO_FLAG_WRITE ) < 0 )
-#else
- if ( url_fopen( &oc->pb, filename, URL_WRONLY ) < 0 )
-#endif
  {
  mlt_log_error( MLT_CONSUMER_SERVICE( consumer ), "Could not open '%s'\n", filename );
  mlt_events_fire( properties, "consumer-fatal-error", NULL );
<at> <at> -1529,14 +1425,6 <at> <at> static void *consumer_thread( void *arg )
  }
 
  }
-#if LIBAVFORMAT_VERSION_INT < ((53<<16)+(2<<8)+0)
- else
- {
- mlt_log_error( MLT_CONSUMER_SERVICE( consumer ), "Invalid output format parameters\n" );
- mlt_events_fire( properties, "consumer-fatal-error", NULL );
- goto on_fatal_error;
- }
-#endif
 
  // Last check - need at least one stream
  if ( !audio_st[0] && !video_st )
<at> <at> -1549,7 +1437,6 <at> <at> static void *consumer_thread( void *arg )
  if ( video_st )
  converted_avframe = alloc_picture( video_st->codec->pix_fmt, width, height );
 
-#if LIBAVCODEC_VERSION_MAJOR >= 54
  // Allocate audio AVFrame
  if ( audio_st[0] )
  {
<at> <at> -1565,7 +1452,6 <at> <at> static void *consumer_thread( void *arg )
  goto on_fatal_error;
  }
  }
-#endif
 
  // Get the starting time (can ignore the times above)
  gettimeofday( &ante, NULL );
<at> <at> -1593,28 +1479,16 <at> <at> static void *consumer_thread( void *arg )
  if ( vitc && vitc[0] )
  {
  mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "timecode=[%s]\n", vitc );
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0)
  av_dict_set
-#else
- av_metadata_set2
-#endif
  ( &oc->metadata, "timecode", vitc, 0 );
 
  if ( video_st )
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0)
  av_dict_set
-#else
- av_metadata_set2
-#endif
  ( &video_st->metadata, "timecode", vitc, 0 );
  };
  };
 
-#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)
  if ( avformat_write_header( oc, NULL ) < 0 )
-#else
- if ( av_write_header( oc ) < 0 )
-#endif
  {
  mlt_log_error( MLT_CONSUMER_SERVICE( consumer ), "Could not write header '%s'\n", filename );
  mlt_events_fire( properties, "consumer-fatal-error", NULL );
<at> <at> -1713,7 +1587,6 <at> <at> static void *consumer_thread( void *arg )
  if ( !audio_st[1] && !mlt_properties_count( frame_meta_properties ) )
  {
  void* p = audio_buf_1;
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  if ( codec->sample_fmt == AV_SAMPLE_FMT_FLTP )
  p = interleaved_to_planar( samples, channels, p, sizeof( float ) );
  else if ( codec->sample_fmt == AV_SAMPLE_FMT_S16P )
<at> <at> -1722,8 +1595,6 <at> <at> static void *consumer_thread( void *arg )
  p = interleaved_to_planar( samples, channels, p, sizeof( int32_t ) );
  else if ( codec->sample_fmt == AV_SAMPLE_FMT_U8P )
  p = interleaved_to_planar( samples, channels, p, sizeof( uint8_t ) );
-#endif
-#if LIBAVCODEC_VERSION_MAJOR >= 54
  audio_avframe->nb_samples = FFMAX( samples, audio_input_nb_samples );
 #if LIBAVCODEC_VERSION_MAJOR >= 55
  audio_avframe->pts = sample_count[i];
<at> <at> -1737,17 +1608,9 <at> <at> static void *consumer_thread( void *arg )
  pkt.size = ret;
  else if ( !got_packet )
  pkt.size = 0;
-#else
- codec->frame_size = FFMAX( samples, audio_input_nb_samples );
- pkt.size = avcodec_encode_audio( codec, audio_outbuf, audio_outbuf_size, p );
- pkt.pts = codec->coded_frame? codec->coded_frame->pts : AV_NOPTS_VALUE;
- pkt.flags |= PKT_FLAG_KEY;
-#endif
 
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  if ( p != audio_buf_1 )
  mlt_pool_release( p );
-#endif
  }
  else
  {
<at> <at> -1814,7 +1677,6 <at> <at> static void *consumer_thread( void *arg )
  dest_offset += current_channels;
  }
  }
-#if LIBAVCODEC_VERSION_MAJOR >= 54
  audio_avframe->nb_samples = FFMAX( samples, audio_input_nb_samples );
 #if LIBAVCODEC_VERSION_MAJOR >= 55
  audio_avframe->pts = sample_count[i];
<at> <at> -1828,12 +1690,6 <at> <at> static void *consumer_thread( void *arg )
  pkt.size = ret;
  else if ( !got_packet )
  pkt.size = 0;
-#else
- codec->frame_size = FFMAX( samples, audio_input_nb_samples );
- pkt.size = avcodec_encode_audio( codec, audio_outbuf, audio_outbuf_size, (short*) audio_buf_2 );
- pkt.pts = codec->coded_frame? codec->coded_frame->pts : AV_NOPTS_VALUE;
- pkt.flags |= PKT_FLAG_KEY;
-#endif
  }
 
  if ( pkt.size > 0 )
<at> <at> -1970,13 +1826,11 <at> <at> static void *consumer_thread( void *arg )
  // Set frame interlace hints
  c->coded_frame->interlaced_frame = !mlt_properties_get_int( frame_properties, "progressive" );
  c->coded_frame->top_field_first = mlt_properties_get_int( frame_properties, "top_field_first" );
-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(61<<8)+100)
  if ( mlt_properties_get_int( frame_properties, "progressive" ) )
  c->field_order = AV_FIELD_PROGRESSIVE;
  else
  c->field_order = (mlt_properties_get_int( frame_properties, "top_field_first" )) ? AV_FIELD_TT : AV_FIELD_BB;
-#endif
- pkt.flags |= PKT_FLAG_KEY;
+ pkt.flags |= AV_PKT_FLAG_KEY;
  pkt.stream_index = video_st->index;
  pkt.data = (uint8_t *)converted_avframe;
  pkt.size = sizeof(AVPicture);
<at> <at> -2003,14 +1857,12 <at> <at> static void *consumer_thread( void *arg )
  // Set frame interlace hints
  converted_avframe->interlaced_frame = !mlt_properties_get_int( frame_properties, "progressive" );
  converted_avframe->top_field_first = mlt_properties_get_int( frame_properties, "top_field_first" );
-#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(61<<8)+100)
  if ( mlt_properties_get_int( frame_properties, "progressive" ) )
  c->field_order = AV_FIELD_PROGRESSIVE;
  else if ( c->codec_id == AV_CODEC_ID_MJPEG )
  c->field_order = (mlt_properties_get_int( frame_properties, "top_field_first" )) ? AV_FIELD_TT : AV_FIELD_BB;
  else
  c->field_order = (mlt_properties_get_int( frame_properties, "top_field_first" )) ? AV_FIELD_TB : AV_FIELD_BT;
-#endif
 
  // Encode the image
 #if LIBAVCODEC_VERSION_MAJOR >= 55
<at> <at> -2024,7 +1876,7 <at> <at> static void *consumer_thread( void *arg )
  pkt.size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, converted_avframe );
  pkt.pts = c->coded_frame? c->coded_frame->pts : AV_NOPTS_VALUE;
  if ( c->coded_frame && c->coded_frame->key_frame )
- pkt.flags |= PKT_FLAG_KEY;
+ pkt.flags |= AV_PKT_FLAG_KEY;
 #endif
 
  // If zero size, it means the image was buffered
<at> <at> -2115,7 +1967,6 <at> <at> static void *consumer_thread( void *arg )
  int samples = FFMIN( FFMIN( channels * audio_input_nb_samples, sample_fifo_used( fifo ) / sample_bytes ), AUDIO_ENCODE_BUFFER_SIZE );
  sample_fifo_fetch( fifo, audio_buf_1, samples * sample_bytes );
  void* p = audio_buf_1;
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  if ( c->sample_fmt == AV_SAMPLE_FMT_FLTP )
  p = interleaved_to_planar( audio_input_nb_samples, channels, p, sizeof( float ) );
  else if ( c->sample_fmt == AV_SAMPLE_FMT_S16P )
<at> <at> -2124,8 +1975,6 <at> <at> static void *consumer_thread( void *arg )
  p = interleaved_to_planar( audio_input_nb_samples, channels, p, sizeof( int32_t ) );
  else if ( c->sample_fmt == AV_SAMPLE_FMT_U8P )
  p = interleaved_to_planar( audio_input_nb_samples, channels, p, sizeof( uint8_t ) );
-#endif
-#if LIBAVCODEC_VERSION_MAJOR >= 54
  pkt.size = audio_outbuf_size;
  audio_avframe->nb_samples = FFMAX( samples / channels, audio_input_nb_samples );
 #if LIBAVCODEC_VERSION_MAJOR >= 55
<at> <at> -2140,21 +1989,14 <at> <at> static void *consumer_thread( void *arg )
  pkt.size = ret;
  else if ( !got_packet )
  pkt.size = 0;
-#else
- c->frame_size = FFMAX( samples / channels, audio_input_nb_samples );
- pkt.size = avcodec_encode_audio( c, audio_outbuf, audio_outbuf_size, p );
-#endif
-#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(17<<8)+0)
  if ( p != audio_buf_1 )
  mlt_pool_release( p );
-#endif
  mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "flushing audio size %d\n", pkt.size );
  }
  else
  {
  // Drain the codec
  if ( pkt.size <= 0 ) {
-#if LIBAVCODEC_VERSION_MAJOR >= 54
  pkt.size = audio_outbuf_size;
  int got_packet = 0;
  int ret = avcodec_encode_audio2( c, &pkt, NULL, &got_packet );
<at> <at> -2162,11 +2004,6 <at> <at> static void *consumer_thread( void *arg )
  pkt.size = ret;
  else if ( !got_packet )
  pkt.size = 0;
-#else
- pkt.size = avcodec_encode_audio( c, audio_outbuf, audio_outbuf_size, NULL );
- pkt.pts = c->coded_frame? c->coded_frame->pts : AV_NOPTS_VALUE;
- pkt.flags |= PKT_FLAG_KEY;
-#endif
  }
  mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "flushing audio size %d\n", pkt.size );
  if ( pkt.size <= 0 )
<at> <at> -2216,7 +2053,7 <at> <at> static void *consumer_thread( void *arg )
  pkt.size = avcodec_encode_video( c, video_outbuf, video_outbuf_size, NULL );
  pkt.pts = c->coded_frame? c->coded_frame->pts : AV_NOPTS_VALUE;
  if( c->coded_frame && c->coded_frame->key_frame )
- pkt.flags |= PKT_FLAG_KEY;
+ pkt.flags |= AV_PKT_FLAG_KEY;
 #endif
  mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "flushing video size %d\n", pkt.size );
  if ( pkt.size <= 0 )
<at> <at> -2266,11 +2103,7 <at> <at> on_fatal_error:
  if ( !( fmt->flags & AVFMT_NOFILE ) &&
  !mlt_properties_get_int( properties, "redirect" ) )
  {
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
  if ( oc->pb  ) avio_close( oc->pb );
-#else
- if ( oc->pb  ) url_fclose( oc->pb );
-#endif
  }
 
  // Clean up input and output frames

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 23 Sep 06:23 2014

[mltframework/mlt] 3ac020: Fix audio encoding with libav. (Debian-761593)

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: 3ac0201b2526e2d11280005f67a63979fb5c783c
      https://github.com/mltframework/mlt/commit/3ac0201b2526e2d11280005f67a63979fb5c783c
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/modules/avformat/consumer_avformat.c

  Log Message:
  -----------
  Fix audio encoding with libav. (Debian-761593)

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 23 Sep 05:09 2014

[mltframework/mlt] f615c1: Fix initialization of aspect ratio and meta.media....

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: f615c1e0fa9c2778bf88ec963bc0571258783d25
      https://github.com/mltframework/mlt/commit/f615c1e0fa9c2778bf88ec963bc0571258783d25
  Author: Jean-Baptiste Mardelle <jb <at> kdenlive.org>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/modules/qt/kdenlivetitle_wrapper.cpp
    M src/modules/qt/producer_kdenlivetitle.c

  Log Message:
  -----------
  Fix initialization of aspect ratio and meta.media.width/height

  Commit: dd8920c6eab74c3efa8b083f1b92598584b4e4c3
      https://github.com/mltframework/mlt/commit/dd8920c6eab74c3efa8b083f1b92598584b4e4c3
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/modules/qt/kdenlivetitle_wrapper.cpp
    M src/modules/qt/producer_kdenlivetitle.c

  Log Message:
  -----------
  Merge branch 'master' of git://github.com/j-b-m/mlt

Compare: https://github.com/mltframework/mlt/compare/b02303ac9e3c...dd8920c6eab7
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 23 Sep 05:01 2014

[mltframework/mlt] b02303: Fix a couple of compiler warnings in avformat unre...

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: b02303ac9e3cd9d805af484b972b4808f9e3bdcd
      https://github.com/mltframework/mlt/commit/b02303ac9e3cd9d805af484b972b4808f9e3bdcd
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/modules/avformat/consumer_avformat.c
    M src/modules/avformat/producer_avformat.c

  Log Message:
  -----------
  Fix a couple of compiler warnings in avformat unrelated to API.

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 23 Sep 05:00 2014

[mltframework/mlt] 69157e: set metadata 'timecode' from first frame's meta.at...

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: 69157e61d570ae94329dae83dd625150169b975c
      https://github.com/mltframework/mlt/commit/69157e61d570ae94329dae83dd625150169b975c
  Author: Maksym Veremeyenko <verem <at> m1.tv>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/modules/avformat/consumer_avformat.c

  Log Message:
  -----------
  set metadata 'timecode' from first frame's meta.attr.timecode.markup property

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 23 Sep 04:19 2014

[mltframework/mlt] 6237d4: introduce MLT_DEFAULT_PRODUCER_LENGTH env var to o...

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: 6237d439956b83a7f6af2cbf647e252080b8bd56
      https://github.com/mltframework/mlt/commit/6237d439956b83a7f6af2cbf647e252080b8bd56
  Author: Maksym Veremeyenko <verem <at> m1.tv>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/framework/mlt_producer.c

  Log Message:
  -----------
  introduce MLT_DEFAULT_PRODUCER_LENGTH env var to override default hardcoded value

  Commit: f833a762fa39527293daacabb5680e899c512221
      https://github.com/mltframework/mlt/commit/f833a762fa39527293daacabb5680e899c512221
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-22 (Mon, 22 Sep 2014)

  Changed paths:
    M src/framework/mlt_producer.h

  Log Message:
  -----------
  Document new MLT_DEFAULT_PRODUCER_LENGTH environment variable.

Compare: https://github.com/mltframework/mlt/compare/f146e85e8134...f833a762fa39
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
Patrick Matthäi | 22 Sep 15:33 2014
Picon

Fwd: Processed: no audio since binNMU to link against newer libav*

Hi Dan,

it seems as mlt is unable to render audio since we have updated libav to version 11-1.
Are you aware of such an issue?

Here are all information: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761593


-------- Weitergeleitete Nachricht -------- Betreff: Datum: Von: An: Kopie (CC):
Processed: no audio since binNMU to link against newer libav*
Sun, 21 Sep 2014 08:12:11 +0000
Debian Bug Tracking System <owner <at> bugs.debian.org>
Jonas Smedegaard <dr <at> jones.dk>
fabo <at> debian.org, pmatthaei <at> debian.org


Processing commands for control <at> bugs.debian.org: > reassign 761593 libmlt6 Bug #761593 [kdenlive] [kdenlive] No audio rendered Bug reassigned from package 'kdenlive' to 'libmlt6'. No longer marked as found in versions kdenlive/0.9.8-1. Ignoring request to alter fixed versions of bug #761593 to the same values previously set > found 761593 0.9.2-1+b1 Bug #761593 [libmlt6] [kdenlive] No audio rendered Marked as found in versions mlt/0.9.2-1. > notfound 761593 0.9.2-1 Bug #761593 [libmlt6] [kdenlive] No audio rendered No longer marked as found in versions mlt/0.9.2-1. > thanks Stopping processing here. Please contact me if you need assistance. -- 761593: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761593 Debian Bug Tracking System Contact owner <at> bugs.debian.org with problems

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 22 Sep 05:10 2014

[mltframework/mlt] f146e8: Fix overriding the out point with avformat-novalid...

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: f146e85e8134c43f6d070881c38f2aeb7a902246
      https://github.com/mltframework/mlt/commit/f146e85e8134c43f6d070881c38f2aeb7a902246
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-21 (Sun, 21 Sep 2014)

  Changed paths:
    M src/modules/avformat/producer_avformat.c

  Log Message:
  -----------
  Fix overriding the out point with avformat-novalidate.

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 22 Sep 01:42 2014

[mltframework/mlt] d1a978: Set better quality defaults for lossless/FFV1 pres...

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: d1a978093a696877d2a9992e47772ccbc7a18413
      https://github.com/mltframework/mlt/commit/d1a978093a696877d2a9992e47772ccbc7a18413
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-21 (Sun, 21 Sep 2014)

  Changed paths:
    M presets/consumer/avformat/lossless/FFV1

  Log Message:
  -----------
  Set better quality defaults for lossless/FFV1 preset. (SF-220)

------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 21 Sep 23:13 2014

[mltframework/mlt] 5bfcb4: Add ProRes-Kostya preset.

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: 5bfcb4683d052ea6103c211c7b043aae110243b2
      https://github.com/mltframework/mlt/commit/5bfcb4683d052ea6103c211c7b043aae110243b2
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-21 (Sun, 21 Sep 2014)

  Changed paths:
    A presets/consumer/avformat/lossless/ProRes-Kostya

  Log Message:
  -----------
  Add ProRes-Kostya preset.

------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel
GitHub | 21 Sep 22:51 2014

[mltframework/mlt] 0b4ba6: threads=1 is no longer needed for MJPEG.

  Branch: refs/heads/master
  Home:   https://github.com/mltframework/mlt
  Commit: 0b4ba69ace543e3f804ce91f82329dab9d0a771b
      https://github.com/mltframework/mlt/commit/0b4ba69ace543e3f804ce91f82329dab9d0a771b
  Author: Dan Dennedy <dan <at> dennedy.org>
  Date:   2014-09-21 (Sun, 21 Sep 2014)

  Changed paths:
    M presets/consumer/avformat/MJPEG
    M presets/consumer/avformat/lossless/MJPEG

  Log Message:
  -----------
  threads=1 is no longer needed for MJPEG.

------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Gmane