demux: assume correct-pts mode by default

All demuxers make a reasonable effort to set packet timestamps, and thus
support correct-pts mode. This commit also implicitly switches
demux_rawvideo to correct-pts mode.

We still allow demuxers to disable correct-pts mode in theory.
This commit is contained in:
wm4 2013-07-12 22:12:31 +02:00
parent 6c414f8c7a
commit 879c7a101b
6 changed files with 4 additions and 13 deletions

View File

@ -4233,9 +4233,9 @@ goto_reopen_demuxer: ;
// Decide correct-pts mode based on first segment of video track
opts->correct_pts = opts->user_correct_pts;
if (opts->correct_pts < 0) {
opts->correct_pts =
demux_control(mpctx->demuxer, DEMUXER_CTRL_CORRECT_PTS,
NULL) == DEMUXER_CTRL_OK;
int val = 1;
demux_control(mpctx->demuxer, DEMUXER_CTRL_CORRECT_PTS, &val);
opts->correct_pts = val;
}
mpctx->initialized_flags |= INITIALIZED_DEMUXER;

View File

@ -63,7 +63,7 @@ enum timestamp_type {
#define DEMUXER_CTRL_RESYNC 13
#define DEMUXER_CTRL_SWITCH_VIDEO 14
#define DEMUXER_CTRL_IDENTIFY_PROGRAM 15
#define DEMUXER_CTRL_CORRECT_PTS 16
#define DEMUXER_CTRL_CORRECT_PTS 16 // int* (write 1 for ok, 0 for no)
#define SEEK_ABSOLUTE (1 << 0)
#define SEEK_FACTOR (1 << 1)

View File

@ -778,8 +778,6 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
lavf_priv_t *priv = demuxer->priv;
switch (cmd) {
case DEMUXER_CTRL_CORRECT_PTS:
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_TIME_LENGTH:
if (priv->seek_by_bytes) {
/* Our bitrate estimate may be better than would be used in

View File

@ -235,9 +235,6 @@ static int demux_control_mf(demuxer_t *demuxer, int cmd, void *arg) {
*((double *)arg) = (double)mf->nr_of_files / mf->sh->fps;
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_CORRECT_PTS:
return DEMUXER_CTRL_OK;
default:
return DEMUXER_CTRL_NOTIMPL;
}

View File

@ -2704,8 +2704,6 @@ static int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg)
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
switch (cmd) {
case DEMUXER_CTRL_CORRECT_PTS:
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_TIME_LENGTH:
if (mkv_d->duration == 0)
return DEMUXER_CTRL_DONTKNOW;

View File

@ -1380,8 +1380,6 @@ static int d_control(struct demuxer *demuxer, int cmd, void *arg)
{
struct priv *p = demuxer->priv;
switch (cmd) {
case DEMUXER_CTRL_CORRECT_PTS:
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_TIME_LENGTH:
*((double *) arg) = demux_packet_list_duration(p->pkts, p->num_pkts);
return DEMUXER_CTRL_OK;