timestamp -= 2 / av_q2d( self->video_time_base );
if ( timestamp < 0 )
timestamp = 0;
- mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "seeking timestamp %"PRId64" position %d expected %d last_pos %"PRId64"\n",
+ mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "seeking timestamp %"PRId64" position " MLT_POSITION_FMT " expected "MLT_POSITION_FMT" last_pos %"PRId64"\n",
timestamp, position, self->video_expected, self->last_position );
// Seek to the timestamp
#endif
}
-static void planar_to_interleaved( uint8_t *dest, uint8_t *src, int samples, int channels, int bytes_per_sample )
+#if LIBAVCODEC_VERSION_MAJOR >= 55
+static void planar_to_interleaved( uint8_t *dest, AVFrame *src, int samples, int channels, int bytes_per_sample )
{
int s, c;
for ( s = 0; s < samples; s++ )
{
for ( c = 0; c < channels; c++ )
{
- memcpy( dest, src + ( c * samples + s ) * bytes_per_sample, bytes_per_sample );
+ memcpy( dest, &src->data[c][s * bytes_per_sample], bytes_per_sample );
dest += bytes_per_sample;
}
}
}
-
-static void planar_to_interleaved2( uint8_t *dest, AVFrame *src, int samples, int channels, int bytes_per_sample )
+#else
+static void planar_to_interleaved( uint8_t *dest, uint8_t *src, int samples, int channels, int bytes_per_sample )
{
int s, c;
for ( s = 0; s < samples; s++ )
{
for ( c = 0; c < channels; c++ )
{
- memcpy( dest, &src->data[c][s * bytes_per_sample], bytes_per_sample );
+ memcpy( dest, src + ( c * samples + s ) * bytes_per_sample, bytes_per_sample );
dest += bytes_per_sample;
}
}
}
+#endif
static int decode_audio( producer_avformat self, int *ignore, AVPacket pkt, int channels, int samples, double timecode, double fps )
{
case AV_SAMPLE_FMT_S32P:
case AV_SAMPLE_FMT_FLTP:
#if LIBAVCODEC_VERSION_MAJOR >= 55
- planar_to_interleaved2( dest, self->audio_frame, convert_samples, codec_context->channels, sizeof_sample );
+ planar_to_interleaved( dest, self->audio_frame, convert_samples, codec_context->channels, sizeof_sample );
#else
planar_to_interleaved( dest, decode_buffer, convert_samples, codec_context->channels, sizeof_sample );
#endif
audio_codec_init( self, index, properties );
}
}
- else if ( context && index > -1 && audio_codec_init( self, index, properties ) )
+ else if ( context && index > -1 && index < MAX_AUDIO_STREAMS &&
+ audio_codec_init( self, index, properties ) )
{
- // Set the frame properties
- if ( index < MAX_AUDIO_STREAMS )
- {
- mlt_properties_set_int( frame_properties, "audio_frequency", self->audio_codec[ index ]->sample_rate );
- mlt_properties_set_int( frame_properties, "audio_channels", self->audio_codec[ index ]->channels );
- }
+ mlt_properties_set_int( frame_properties, "audio_frequency", self->audio_codec[ index ]->sample_rate );
+ mlt_properties_set_int( frame_properties, "audio_channels", self->audio_codec[ index ]->channels );
}
if ( context && index > -1 )
{