int video_index;
double start_time;
int first_pts;
- int last_position;
+ int64_t last_position;
int seekable;
- int current_position;
+ int64_t current_position;
mlt_position nonseek_position;
int got_picture;
int top_field_first;
}
static int seek_video( producer_avformat self, mlt_position position,
- int req_position, int must_decode, int use_new_seek, int *ignore )
+ int64_t req_position, int must_decode, int use_new_seek, int *ignore )
{
mlt_producer producer = self->parent;
int paused = 0;
{
timestamp = ( req_position - 0.1 / source_fps ) /
( av_q2d( stream->time_base ) * source_fps );
- mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), "pos %d pts %"PRId64" ", req_position, timestamp );
+ mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), "pos %"PRId64" pts %"PRId64" ", req_position, timestamp );
if ( self->first_pts > 0 )
timestamp += self->first_pts;
else if ( context->start_time != AV_NOPTS_VALUE )
timestamp -= AV_TIME_BASE;
if ( timestamp < 0 )
timestamp = 0;
- mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "seeking timestamp %"PRId64" position %d expected %d last_pos %d\n",
+ mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "seeking timestamp %"PRId64" position %d expected %d last_pos %"PRId64"\n",
timestamp, position, self->video_expected, self->last_position );
// Seek to the timestamp
mlt_properties_get_double( properties, "meta.media.frame_rate_den" );
// This is the physical frame position in the source
- int req_position = ( int )( position / mlt_producer_get_fps( producer ) * source_fps + 0.5 );
+ int64_t req_position = ( int64_t )( position / mlt_producer_get_fps( producer ) * source_fps + 0.5 );
// Determines if we have to decode all frames in a sequence
// Temporary hack to improve intra frame only
else
{
int ret = 0;
- int int_position = 0;
+ int64_t int_position = 0;
int decode_errors = 0;
int got_picture = 0;
pts -= self->first_pts;
else if ( context->start_time != AV_NOPTS_VALUE )
pts -= context->start_time;
- int_position = ( int )( av_q2d( stream->time_base ) * pts * source_fps + 0.1 );
+ int_position = ( int64_t )( av_q2d( stream->time_base ) * pts * source_fps + 0.1 );
if ( pkt.pts == AV_NOPTS_VALUE )
{
self->invalid_pts_counter++;
{
self->invalid_pts_counter = 0;
}
- mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.pts %"PRId64" req_pos %d cur_pos %d pkt_pos %d\n",
+ mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.pts %"PRId64" req_pos %"PRId64" cur_pos %"PRId64" pkt_pos %"PRId64"\n",
pkt.pts, req_position, self->current_position, int_position );
}
else
if ( pkt.dts != AV_NOPTS_VALUE )
{
double delay = mlt_properties_get_double( properties, "video_delay" );
- int_position = ( int )( ( av_q2d( stream->time_base ) * pkt.dts + delay ) * source_fps + 0.5 );
+ int_position = ( int64_t )( ( av_q2d( stream->time_base ) * pkt.dts + delay ) * source_fps + 0.5 );
if ( context->start_time != AV_NOPTS_VALUE )
- int_position -= ( int )( context->start_time * source_fps / AV_TIME_BASE + 0.5 );
+ int_position -= ( int64_t )( context->start_time * source_fps / AV_TIME_BASE + 0.5 );
if ( int_position == self->last_position )
int_position = self->last_position + 1;
}
- mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.dts %"PRId64" req_pos %d cur_pos %d pkt_pos %d\n",
+ mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "pkt.dts %"PRId64" req_pos %"PRId64" cur_pos %"PRId64" pkt_pos %"PRId64"\n",
pkt.dts, req_position, self->current_position, int_position );
// Make a dumb assumption on streams that contain wild timestamps
if ( abs( req_position - int_position ) > 999 )
pts -= self->first_pts;
else if ( context->start_time != AV_NOPTS_VALUE )
pts -= context->start_time;
- int_position = ( int )( av_q2d( stream->time_base) * pts * source_fps + 0.1 );
- mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "got frame %d, key %d\n", int_position, self->av_frame->key_frame );
+ int_position = ( int64_t )( av_q2d( stream->time_base) * pts * source_fps + 0.1 );
+ mlt_log_debug( MLT_PRODUCER_SERVICE(producer), "got frame %"PRId64", key %d\n", int_position, self->av_frame->key_frame );
}
// Handle ignore
if ( int_position < req_position )
if ( pkt.pts >= 0 )
{
double current_pts = av_q2d( context->streams[ index ]->time_base ) * pkt.pts;
- int req_position = ( int )( timecode * fps + 0.5 );
- int int_position = ( int )( current_pts * fps + 0.5 );
+ int64_t req_position = ( int64_t )( timecode * fps + 0.5 );
+ int64_t int_position = ( int64_t )( current_pts * fps + 0.5 );
if ( context->start_time != AV_NOPTS_VALUE )
- int_position -= ( int )( fps * context->start_time / AV_TIME_BASE + 0.5 );
+ int_position -= ( int64_t )( fps * context->start_time / AV_TIME_BASE + 0.5 );
if ( *ignore == 0 )
{