{
mrl[0] = 0;
char *name = strdup( ++mrl );
- char *value = strchr( name, '=' );
+ char *value = strchr( name, ':' );
if ( value )
{
value[0] = 0;
mlt_position expected = mlt_properties_get_position( properties, "video_expected" );
// Calculate the real time code
- double real_timecode = producer_time_of_frame( this, position ) + mlt_properties_get_double( properties, "_v_pts_offset" );
+ double real_timecode = producer_time_of_frame( this, position );
// Get the video stream
AVStream *stream = context->streams[ index ];
if ( got_picture )
{
if ( pkt.pts != AV_NOPTS_VALUE && pkt.pts != 0 )
- {
- if ( current_time == 0 )
- {
- mlt_properties_set_double( properties, "_v_pts_offset", ( double )( pkt.pts / 1000000 ) );
- real_timecode += pkt.pts / 1000000;
- }
current_time = ( double )pkt.pts / 1000000.0;
- }
else
current_time = real_timecode;
pthread_mutex_lock( &avformat_mutex );
// Check for resample and create if necessary
- if ( resample == NULL )
+ if ( resample == NULL && codec_context->channels <= 2 )
{
// Create the resampler
resample = audio_resample_init( *channels, codec_context->channels, *frequency, codec_context->sample_rate );
// And store it on properties
mlt_properties_set_data( properties, "audio_resample", resample, 0, ( mlt_destructor )audio_resample_close, NULL );
}
+ else if ( resample == NULL )
+ {
+ *channels = codec_context->channels;
+ *frequency = codec_context->sample_rate;
+ }
// Check for audio buffer and create if necessary
if ( audio_buffer == NULL )
uint8_t *ptr = pkt.data;
int data_size;
- // We only deal with video from the selected video_index
+ // We only deal with audio from the selected audio_index
while ( ptr != NULL && ret >= 0 && pkt.stream_index == index && len > 0 )
{
// Decode the audio
if ( data_size > 0 )
{
- int size_out = audio_resample( resample, &audio_buffer[ audio_used * *channels ], temp, data_size / ( codec_context->channels * sizeof( int16_t ) ) );
-
- audio_used += size_out;
+ if ( resample != NULL )
+ {
+ audio_used += audio_resample( resample, &audio_buffer[ audio_used * *channels ], temp, data_size / ( codec_context->channels * sizeof( int16_t ) ) );
+ }
+ else
+ {
+ memcpy( &audio_buffer[ audio_used * *channels ], temp, data_size );
+ audio_used += data_size / ( codec_context->channels * sizeof( int16_t ) );
+ }
// Handle ignore
while ( ignore && audio_used > *samples )