mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 13:32:16 +00:00
Use defines to give names to the different seek flags.
A better solution should be considered later, esp. for the many broken demuxers that do not treat these flags correctly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25911 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
da8ab92c7d
commit
5960ddb8e5
@ -218,7 +218,7 @@ static void demux_aac_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_
|
||||
|
||||
ds_free_packs(d_audio);
|
||||
|
||||
time = (flags & 1) ? rel_seek_secs - priv->last_pts : rel_seek_secs;
|
||||
time = (flags & SEEK_ABSOLUTE) ? rel_seek_secs - priv->last_pts : rel_seek_secs;
|
||||
if(time < 0)
|
||||
{
|
||||
stream_seek(demuxer->stream, demuxer->movi_start);
|
||||
|
@ -522,7 +522,7 @@ static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
|
||||
//================= seek in ASF ==========================
|
||||
float p_rate=asf->packetrate; // packets / sec
|
||||
off_t rel_seek_packs=(flags&2)? // FIXME: int may be enough?
|
||||
off_t rel_seek_packs=(flags&SEEK_FACTOR)? // FIXME: int may be enough?
|
||||
(rel_seek_secs*(demuxer->movi_end-demuxer->movi_start)/asf->packetsize):
|
||||
(rel_seek_secs*p_rate);
|
||||
off_t rel_seek_bytes=rel_seek_packs*asf->packetsize;
|
||||
@ -530,7 +530,7 @@ static void demux_seek_asf(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
//printf("ASF: packs: %d duration: %d \n",(int)fileh.packets,*((int*)&fileh.duration));
|
||||
// printf("ASF_seek: %d secs -> %d packs -> %d bytes \n",
|
||||
// rel_seek_secs,rel_seek_packs,rel_seek_bytes);
|
||||
newpos=((flags&1)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes;
|
||||
newpos=((flags&SEEK_ABSOLUTE)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes;
|
||||
if(newpos<0 || newpos<demuxer->movi_start) newpos=demuxer->movi_start;
|
||||
// printf("\r -- asf: newpos=%d -- \n",newpos);
|
||||
stream_seek(demuxer->stream,newpos);
|
||||
|
@ -646,8 +646,8 @@ static void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_
|
||||
s = demuxer->stream;
|
||||
priv = demuxer->priv;
|
||||
|
||||
if(priv->frmt == MP3 && hr_mp3_seek && !(flags & 2)) {
|
||||
len = (flags & 1) ? rel_seek_secs - priv->next_pts : rel_seek_secs;
|
||||
if(priv->frmt == MP3 && hr_mp3_seek && !(flags & SEEK_FACTOR)) {
|
||||
len = (flags & SEEK_ABSOLUTE) ? rel_seek_secs - priv->next_pts : rel_seek_secs;
|
||||
if(len < 0) {
|
||||
stream_seek(s,demuxer->movi_start);
|
||||
len = priv->next_pts + len;
|
||||
@ -658,8 +658,8 @@ static void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_
|
||||
return;
|
||||
}
|
||||
|
||||
base = flags&1 ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags&2)
|
||||
base = flags&SEEK_ABSOLUTE ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags&SEEK_FACTOR)
|
||||
pos = base + ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs);
|
||||
else
|
||||
pos = base + (rel_seek_secs*sh_audio->i_bps);
|
||||
|
@ -571,12 +571,12 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int
|
||||
int video_chunk_pos=d_video->pos;
|
||||
int i;
|
||||
|
||||
if(flags&1){
|
||||
if(flags&SEEK_ABSOLUTE){
|
||||
// seek absolute
|
||||
video_chunk_pos=0;
|
||||
}
|
||||
|
||||
if(flags&2){
|
||||
if(flags&SEEK_FACTOR){
|
||||
rel_seek_frames=rel_seek_secs*priv->numberofframes;
|
||||
}
|
||||
|
||||
|
@ -418,10 +418,8 @@ static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs, float audio_
|
||||
|
||||
//mp_msg(MSGT_DEMUX, MSGL_V, "AVS: seek rel_seek_secs = %f - flags = %x\n", rel_seek_secs, flags);
|
||||
|
||||
// seek absolute
|
||||
if (flags&1) video_pos=0;
|
||||
// seek precent
|
||||
if (flags&2) rel_seek_secs *= duration;
|
||||
if (flags&SEEK_ABSOLUTE) video_pos=0;
|
||||
if (flags&SEEK_FACTOR) rel_seek_secs *= duration;
|
||||
|
||||
video_pos += rel_seek_secs;
|
||||
if (video_pos < 0) video_pos = 0;
|
||||
|
@ -49,9 +49,9 @@ typedef struct film_data_t
|
||||
static void demux_seek_film(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
|
||||
{
|
||||
film_data_t *film_data = (film_data_t *)demuxer->priv;
|
||||
int new_current_chunk=(flags&1)?0:film_data->current_chunk;
|
||||
int new_current_chunk=(flags&SEEK_ABSOLUTE)?0:film_data->current_chunk;
|
||||
|
||||
if(flags&2)
|
||||
if(flags&SEEK_FACTOR)
|
||||
new_current_chunk += rel_seek_secs * film_data->total_chunks; // 0..1
|
||||
else
|
||||
new_current_chunk += rel_seek_secs * film_data->chunks_per_second; // secs
|
||||
|
@ -25,8 +25,8 @@ typedef struct {
|
||||
static void demux_seek_fli(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
|
||||
fli_frames_t *frames = (fli_frames_t *)demuxer->priv;
|
||||
sh_video_t *sh_video = demuxer->video->sh;
|
||||
int newpos=(flags&1)?0:frames->current_frame;
|
||||
if(flags&2){
|
||||
int newpos=(flags&SEEK_ABSOLUTE)?0:frames->current_frame;
|
||||
if(flags&SEEK_FACTOR){
|
||||
// float 0..1
|
||||
newpos+=rel_seek_secs*frames->num_frames;
|
||||
} else {
|
||||
|
@ -614,12 +614,12 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio
|
||||
int avsflags = 0;
|
||||
mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags);
|
||||
|
||||
if (flags & 1) { // absolute seek
|
||||
if (flags & SEEK_ABSOLUTE) {
|
||||
priv->last_pts = priv->avfc->start_time;
|
||||
} else {
|
||||
if (rel_seek_secs < 0) avsflags = AVSEEK_FLAG_BACKWARD;
|
||||
}
|
||||
if (flags & 2) { // percent seek
|
||||
if (flags & SEEK_FACTOR) {
|
||||
if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
|
||||
return;
|
||||
priv->last_pts += rel_seek_secs * priv->avfc->duration;
|
||||
|
@ -18,9 +18,9 @@
|
||||
static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
|
||||
mf_t * mf = (mf_t *)demuxer->priv;
|
||||
sh_video_t * sh_video = demuxer->video->sh;
|
||||
int newpos = (flags & 1)?0:mf->curr_frame - 1;
|
||||
int newpos = (flags & SEEK_ABSOLUTE)?0:mf->curr_frame - 1;
|
||||
|
||||
if ( flags & 2 ) newpos+=rel_seek_secs*(mf->nr_of_files - 1);
|
||||
if ( flags & SEEK_FACTOR ) newpos+=rel_seek_secs*(mf->nr_of_files - 1);
|
||||
else newpos+=rel_seek_secs * sh_video->fps;
|
||||
if ( newpos < 0 ) newpos=0;
|
||||
if( newpos >= mf->nr_of_files) newpos=mf->nr_of_files - 1;
|
||||
|
@ -2534,7 +2534,8 @@ demux_mkv_open (demuxer_t *demuxer)
|
||||
mkv_d->has_first_tc = 1;
|
||||
}
|
||||
demux_mkv_seek (demuxer,
|
||||
demuxer->chapters[dvd_chapter-1].start/1000.0, 0.0, 1);
|
||||
demuxer->chapters[dvd_chapter-1].start/1000.0, 0.0,
|
||||
SEEK_ABSOLUTE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3289,14 +3290,14 @@ static void
|
||||
demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
|
||||
{
|
||||
free_cached_dps (demuxer);
|
||||
if (!(flags & 2)) /* time in secs */
|
||||
if (!(flags & SEEK_FACTOR)) /* time in secs */
|
||||
{
|
||||
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
|
||||
stream_t *s = demuxer->stream;
|
||||
int64_t target_timecode = 0, diff, min_diff=0xFFFFFFFFFFFFFFFLL;
|
||||
int i;
|
||||
|
||||
if (!(flags & 1)) /* relative seek */
|
||||
if (!(flags & SEEK_ABSOLUTE)) /* relative seek */
|
||||
target_timecode = (int64_t) (mkv_d->last_pts * 1000.0);
|
||||
target_timecode += (int64_t)(rel_seek_secs * 1000.0);
|
||||
if (target_timecode < 0)
|
||||
@ -3371,7 +3372,7 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int
|
||||
diff = target_timecode + mkv_d->first_tc -
|
||||
(int64_t) mkv_d->indexes[i].timecode * mkv_d->tc_scale / 1000000.0;
|
||||
|
||||
if ((flags & 1 || target_timecode <= mkv_d->last_pts*1000)) {
|
||||
if ((flags & SEEK_ABSOLUTE || target_timecode <= mkv_d->last_pts*1000)) {
|
||||
// Absolute seek or seek backward: find the last index
|
||||
// position before target time
|
||||
if (diff < 0 || diff >= min_diff)
|
||||
@ -3408,7 +3409,7 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int
|
||||
|
||||
demux_mkv_fill_buffer(demuxer, NULL);
|
||||
}
|
||||
else if ((demuxer->movi_end <= 0) || !(flags & 1))
|
||||
else if ((demuxer->movi_end <= 0) || !(flags & SEEK_ABSOLUTE))
|
||||
mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
|
||||
else
|
||||
{
|
||||
|
@ -2202,19 +2202,19 @@ if(trak->pos==0 && trak->stream_header_len>0){
|
||||
static float mov_seek_track(mov_track_t* trak,float pts,int flags){
|
||||
|
||||
// printf("MOV track seek called %5.3f \n",pts);
|
||||
if(flags&2) pts*=trak->length; else pts*=(float)trak->timescale;
|
||||
if(flags&SEEK_FACTOR) pts*=trak->length; else pts*=(float)trak->timescale;
|
||||
|
||||
if(trak->samplesize){
|
||||
int sample=pts/trak->duration;
|
||||
// printf("MOV track seek - chunk: %d (pts: %5.3f dur=%d) \n",sample,pts,trak->duration);
|
||||
if(!(flags&1)) sample+=trak->chunks[trak->pos].sample; // relative
|
||||
if(!(flags&SEEK_ABSOLUTE)) sample+=trak->chunks[trak->pos].sample; // relative
|
||||
trak->pos=0;
|
||||
while(trak->pos<trak->chunks_size && trak->chunks[trak->pos].sample<sample) ++trak->pos;
|
||||
if (trak->pos == trak->chunks_size) return -1;
|
||||
pts=(float)(trak->chunks[trak->pos].sample*trak->duration)/(float)trak->timescale;
|
||||
} else {
|
||||
unsigned int ipts;
|
||||
if(!(flags&1)) pts+=trak->samples[trak->pos].pts;
|
||||
if(!(flags&SEEK_ABSOLUTE)) pts+=trak->samples[trak->pos].pts;
|
||||
if(pts<0) pts=0;
|
||||
ipts=pts;
|
||||
//printf("MOV track seek - sample: %d \n",ipts);
|
||||
|
@ -156,9 +156,9 @@ static void demux_mpc_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
da_priv_t* priv = demuxer->priv;
|
||||
stream_t* s = demuxer->stream;
|
||||
float target = rel_seek_secs;
|
||||
if (flags & 2)
|
||||
if (flags & SEEK_FACTOR)
|
||||
target *= priv->length;
|
||||
if (!(flags & 1))
|
||||
if (!(flags & SEEK_ABSOLUTE))
|
||||
target += priv->last_pts;
|
||||
if (target < priv->last_pts) {
|
||||
stream_seek(s, demuxer->movi_start);
|
||||
|
@ -893,14 +893,14 @@ void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,float audio_delay, in
|
||||
float oldpts = 0;
|
||||
off_t oldpos = demuxer->filepos;
|
||||
float newpts = 0;
|
||||
off_t newpos = (flags & 1) ? demuxer->movi_start : oldpos;
|
||||
off_t newpos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : oldpos;
|
||||
|
||||
if(mpg_d)
|
||||
oldpts = mpg_d->last_pts;
|
||||
newpts = (flags & 1) ? 0.0 : oldpts;
|
||||
newpts = (flags & SEEK_ABSOLUTE) ? 0.0 : oldpts;
|
||||
//================= seek in MPEG ==========================
|
||||
//calculate the pts to seek to
|
||||
if(flags & 2) {
|
||||
if(flags & SEEK_FACTOR) {
|
||||
if (mpg_d && mpg_d->first_to_final_pts_len > 0.0)
|
||||
newpts += mpg_d->first_to_final_pts_len * rel_seek_secs;
|
||||
else
|
||||
@ -909,7 +909,7 @@ void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,float audio_delay, in
|
||||
newpts += rel_seek_secs;
|
||||
if (newpts < 0) newpts = 0;
|
||||
|
||||
if(flags&2){
|
||||
if(flags&SEEK_FACTOR){
|
||||
// float seek 0..1
|
||||
newpos+=(demuxer->movi_end-demuxer->movi_start)*rel_seek_secs;
|
||||
} else {
|
||||
|
@ -247,12 +247,12 @@ static void demux_seek_nut(demuxer_t * demuxer, float time_pos, float audio_dela
|
||||
int ret;
|
||||
const int tmp[] = { 0, -1 };
|
||||
|
||||
if (!(flags & 1)) {
|
||||
if (!(flags & SEEK_ABSOLUTE)) {
|
||||
nutflags |= 1; // relative
|
||||
if (time_pos > 0) nutflags |= 2; // forwards
|
||||
}
|
||||
|
||||
if (flags & 2) // percent
|
||||
if (flags & SEEK_FACTOR)
|
||||
time_pos *= priv->s[0].max_pts *
|
||||
(double)priv->s[0].time_base.num /
|
||||
priv->s[0].time_base.den;
|
||||
|
@ -1366,8 +1366,8 @@ static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
old_pos = ogg_d->pos;
|
||||
|
||||
//calculate the granulepos to seek to
|
||||
gp = flags & 1 ? 0 : os->lastpos;
|
||||
if(flags & 2) {
|
||||
gp = flags & SEEK_ABSOLUTE ? 0 : os->lastpos;
|
||||
if(flags & SEEK_FACTOR) {
|
||||
if (ogg_d->final_granulepos > 0)
|
||||
gp += ogg_d->final_granulepos * rel_seek_secs;
|
||||
else
|
||||
@ -1392,8 +1392,8 @@ static void demux_ogg_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
pos = ogg_d->syncpoints[sp].page_pos;
|
||||
precision = 0;
|
||||
} else {
|
||||
pos = flags & 1 ? 0 : ogg_d->pos;
|
||||
if(flags & 2)
|
||||
pos = flags & SEEK_ABSOLUTE ? 0 : ogg_d->pos;
|
||||
if(flags & SEEK_FACTOR)
|
||||
pos += (demuxer->movi_end - demuxer->movi_start) * rel_seek_secs;
|
||||
else {
|
||||
if (ogg_d->final_granulepos > 0) {
|
||||
|
@ -84,8 +84,8 @@ static void demux_rawaudio_seek(demuxer_t *demuxer,float rel_seek_secs,float aud
|
||||
sh_audio_t* sh_audio = demuxer->audio->sh;
|
||||
off_t base,pos;
|
||||
|
||||
base = (flags & 1) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & 2)
|
||||
base = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & SEEK_FACTOR)
|
||||
pos = base + ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs);
|
||||
else
|
||||
pos = base + (rel_seek_secs*sh_audio->i_bps);
|
||||
|
@ -38,8 +38,8 @@ static void demux_seek_rawdv(demuxer_t *demuxer,float rel_seek_secs,float audio_
|
||||
{
|
||||
rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
|
||||
sh_video_t *sh_video = demuxer->video->sh;
|
||||
off_t newpos=(flags&1)?0:frames->current_frame;
|
||||
if(flags&2)
|
||||
off_t newpos=(flags&SEEK_ABSOLUTE)?0:frames->current_frame;
|
||||
if(flags&SEEK_FACTOR)
|
||||
{
|
||||
// float 0..1
|
||||
newpos+=rel_seek_secs*frames->frame_number;
|
||||
|
@ -124,8 +124,8 @@ static void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,float aud
|
||||
sh_video_t* sh_video = demuxer->video->sh;
|
||||
off_t pos;
|
||||
|
||||
pos = (flags & 1) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & 2)
|
||||
pos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & SEEK_FACTOR)
|
||||
pos += ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs);
|
||||
else
|
||||
pos += (rel_seek_secs*sh_video->i_bps);
|
||||
|
@ -1813,10 +1813,9 @@ static void demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, float audio
|
||||
if (!streams)
|
||||
return;
|
||||
|
||||
if (flags & 1)
|
||||
/* seek absolute */
|
||||
if (flags & SEEK_ABSOLUTE)
|
||||
priv->current_apacket = priv->current_vpacket = 0;
|
||||
if (flags & 2) // percent seek
|
||||
if (flags & SEEK_FACTOR)
|
||||
rel_seek_secs *= priv->duration;
|
||||
|
||||
if ((streams & 1) && priv->current_vpacket >= priv->index_table_size[vid])
|
||||
|
@ -3107,8 +3107,8 @@ static void demux_seek_ts(demuxer_t *demuxer, float rel_seek_secs, float audio_d
|
||||
video_stats = sh_video->i_bps;
|
||||
}
|
||||
|
||||
newpos = (flags & 1) ? demuxer->movi_start : demuxer->filepos;
|
||||
if(flags & 2) // float seek 0..1
|
||||
newpos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : demuxer->filepos;
|
||||
if(flags & SEEK_FACTOR) // float seek 0..1
|
||||
newpos+=(demuxer->movi_end-demuxer->movi_start)*rel_seek_secs;
|
||||
else
|
||||
{
|
||||
|
@ -760,9 +760,9 @@ static void demux_seek_ty( demuxer_t *demuxer, float rel_seek_secs, float audio_
|
||||
//================= seek in MPEG ==========================
|
||||
demuxer->filepos = stream_tell( demuxer->stream );
|
||||
|
||||
newpos = ( flags & 1 ) ? demuxer->movi_start : demuxer->filepos;
|
||||
newpos = ( flags & SEEK_ABSOLUTE ) ? demuxer->movi_start : demuxer->filepos;
|
||||
|
||||
if( flags & 2 )
|
||||
if( flags & SEEK_FACTOR )
|
||||
// float seek 0..1
|
||||
newpos += ( demuxer->movi_end - demuxer->movi_start ) * rel_seek_secs;
|
||||
else
|
||||
|
@ -186,8 +186,8 @@ static void demux_seek_vqf(demuxer_t *demuxer,float rel_seek_secs,float audio_de
|
||||
sh_audio_t* sh_audio = demuxer->audio->sh;
|
||||
off_t base,pos;
|
||||
|
||||
base = (flags & 1) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & 2)
|
||||
base = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : stream_tell(s);
|
||||
if(flags & SEEK_FACTOR)
|
||||
pos = base + ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs);
|
||||
else
|
||||
pos = base + (rel_seek_secs*sh_audio->i_bps);
|
||||
|
@ -350,8 +350,8 @@ static void demux_xmms_seek(demuxer_t *demuxer,float rel_seek_secs,
|
||||
|
||||
if(priv->ip->get_time()<0) return;
|
||||
|
||||
pos = (flags & 1) ? 0 : priv->spos / sh_audio->wf->nAvgBytesPerSec;
|
||||
if (flags & 2)
|
||||
pos = (flags & SEEK_ABSOLUTE) ? 0 : priv->spos / sh_audio->wf->nAvgBytesPerSec;
|
||||
if (flags & SEEK_FACTOR)
|
||||
pos+= rel_seek_secs*xmms_length;
|
||||
else
|
||||
pos+= rel_seek_secs;
|
||||
|
@ -980,7 +980,7 @@ if(!demuxer->seekable){
|
||||
if(sh_video) sh_video->timer=0; // !!!!!!
|
||||
#endif
|
||||
|
||||
if(flags & 1) // absolute seek
|
||||
if(flags & SEEK_ABSOLUTE)
|
||||
pts = 0.0f;
|
||||
else {
|
||||
if(demuxer->stream_pts == MP_NOPTS_VALUE)
|
||||
@ -988,7 +988,7 @@ if(!demuxer->seekable){
|
||||
pts = demuxer->stream_pts;
|
||||
}
|
||||
|
||||
if(flags & 2) { // percent seek
|
||||
if(flags & SEEK_FACTOR) {
|
||||
if(stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, &tmp) == STREAM_UNSUPPORTED)
|
||||
goto dmx_seek;
|
||||
pts += tmp * rel_seek_secs;
|
||||
|
@ -83,6 +83,9 @@
|
||||
#define DEMUXER_CTRL_SWITCH_VIDEO 14
|
||||
#define DEMUXER_CTRL_IDENTIFY_PROGRAM 15
|
||||
|
||||
#define SEEK_ABSOLUTE (1 << 0)
|
||||
#define SEEK_FACTOR (1 << 1)
|
||||
|
||||
// Holds one packet/frame/whatever
|
||||
typedef struct demux_packet_st {
|
||||
int len;
|
||||
|
@ -2483,8 +2483,8 @@ static void edl_update(MPContext *mpctx)
|
||||
}
|
||||
|
||||
|
||||
// style & 1 == 0 means seek relative to current position, == 1 means absolute
|
||||
// style & 2 == 0 means amount in seconds, == 2 means fraction of file length
|
||||
// style & SEEK_ABSOLUTE == 0 means seek relative to current position, == 1 means absolute
|
||||
// style & SEEK_FACTOR == 0 means amount in seconds, == 2 means fraction of file length
|
||||
// return -1 if seek failed (non-seekable stream?), 0 otherwise
|
||||
static int seek(MPContext *mpctx, double amount, int style)
|
||||
{
|
||||
@ -3626,7 +3626,7 @@ if(play_n_frames==0){
|
||||
}
|
||||
|
||||
if (seek_to_sec) {
|
||||
seek(mpctx, seek_to_sec, 1);
|
||||
seek(mpctx, seek_to_sec, SEEK_ABSOLUTE);
|
||||
end_at.pos += seek_to_sec;
|
||||
}
|
||||
|
||||
@ -3831,7 +3831,7 @@ if(step_sec>0) {
|
||||
if(mpctx->loop_times==1) mpctx->loop_times=-1;
|
||||
play_n_frames=play_n_frames_mf;
|
||||
mpctx->eof=0;
|
||||
abs_seek_pos=1; rel_seek_secs=seek_to_sec;
|
||||
abs_seek_pos=SEEK_ABSOLUTE; rel_seek_secs=seek_to_sec;
|
||||
loop_seek = 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user