[MPlayer-users] OSD problems with DVDs
Nico Sabbi
nicola_sabbi at fastwebnet.it
Thu Feb 23 23:44:54 CET 2006
Davide Capodaglio wrote:
>Alle 23:16, giovedì 23 febbraio 2006, Davide Capodaglio ha scritto:
>
>
>>Alle 23:50, giovedì 19 gennaio 2006, Davide Capodaglio ha scritto:
>>
>>
>>>Alle 00:02, giovedì 19 gennaio 2006, Nico Sabbi ha scritto:
>>>
>>>
>>>>Davide Capodaglio wrote:
>>>>
>>>>
>>>>>Hi everybody, these are the problems I have with DVDs and OSD:
>>>>>
>>>>>- sometimes the total time is lower than real time, for all the film
>>>>>length - sometimes the total time is lower than real time, but at a
>>>>>certain point of the film it becomes the correct time
>>>>>- sometimes the current time at a certain point goes back to 0: e.g.
>>>>>00:00-31:00, then resets to 00:00, then 00:00-28:32, reset to 00:00,
>>>>>etc. (VOB boundary??).
>>>>>
>>>>>
>>>>no: crazy authoring techniques seconded by a foolish standard (mpeg)
>>>>
>>>>
>>>>
>>>>>(For this I produced a patch, and now the current time follow the
>>>>>total time, but if this is wrong I'm stuck again)
>>>>>
>>>>>
>>>>where?
>>>>
>>>>
>>>Here's the patch, it's against MPlayer 1.0-pre7try2, but as I said it
>>>does not work at all; it's based on the idea that the percentage when
>>>seeking seems correct (at least aligned with the total time).
>>>
>>>So, is this a problem known to developers?
>>>
>>>
>>I finally succeded in calculating both the current and total time !!!
>>It calculates the total time in libmpdemux/open.c,open_stream() using
>>
>>dvd_playback_time = dvdtime2sec(&d->cur_pgc->playback_time);
>>
>>and the current time using
>>
>>pts = dvd_playback_time * (demuxer->filepos - demuxer->movi_start) /
>>(demuxer->movi_end - demuxer->movi_start);
>>
>>Here's the patch for 1.0-pre7try2, it works perfectly for me.
>>
>>Any comment/feedback is appreciated...
>>
>>
>>
>
>Ops forgotten the attachment
>
>
>------------------------------------------------------------------------
>
>diff -ur old/libmpdemux/open.c new/libmpdemux/open.c
>--- old/libmpdemux/open.c 2006-02-23 21:17:26.000000000 +0100
>+++ new/libmpdemux/open.c 2006-02-23 21:42:23.000000000 +0100
>@@ -70,6 +70,22 @@
> #include "cue_read.h"
>
>
>+int dvd_playback_time;
>+
>+int dvdtime2sec(dvd_time_t *dt)
>+{
>+ double frames_per_s[4] = {-1.0, 25.00, -1.0, 29.97};
>+ double fps = frames_per_s[(dt->frame_u & 0xc0) >> 6];
>+ long ms;
>+ ms = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600;
>+ ms += (((dt->minute & 0xf0) >> 3) * 5 + (dt->minute & 0x0f)) * 60;
>+ ms += (((dt->second & 0xf0) >> 3) * 5 + (dt->second & 0x0f)) * 1;
>+
>+ if(fps > 0)
>+ ms += ((dt->frame_u & 0x30) >> 3) * 5 + (dt->frame_u & 0x0f) * 1.0 / fps;
>+
>+ return ms;
>+}
>
>
don't mess with open.c (at a time I was about to cvs remove it);
eventually use this code to implement an appropriare DEMUXER_CTRL in
stream_dvd.c
(isn't there already something similar?)
>
> // Define function about auth the libsmbclient library
> // FIXME: I really do not not is this function is properly working
>@@ -439,6 +457,9 @@
> pgc_id = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgcn; // local
> pgn = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgn; // local
> d->cur_pgc = vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc;
>+
>+ dvd_playback_time = dvdtime2sec(&d->cur_pgc->playback_time);
>+
> d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here
> d->packs_left=-1; // for Navi stuff
> d->angle_seek=0;
>diff -ur old/mplayer.c new/mplayer.c
>--- old/mplayer.c 2006-02-23 21:17:08.000000000 +0100
>+++ new/mplayer.c 2006-02-23 21:17:59.000000000 +0100
>@@ -389,6 +389,8 @@
> #define INITED_VCODEC 2048
> #define INITED_ALL 0xFFFF
>
>+extern int dvd_playback_time;
>+
>
>
another global? bad. See above
> static void uninit_player(unsigned int mask){
> mask=inited_flags&mask;
>
>@@ -2908,6 +2910,7 @@
> osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1);
> else
> osd_level= v > MAX_OSD_LEVEL ? MAX_OSD_LEVEL : v;
>+ if (osd_level==0) osd_level = 1;
> }
> #endif
> } break;
>@@ -4022,6 +4024,13 @@
> snprintf(percentage_text, 9, " (%d%%)", percentage);
> else
> percentage_text[0] = 0;
>+
>+ if (demuxer->type == DEMUXER_TYPE_MPEG_PS && stream->type == STREAMTYPE_DVD && dvd_playback_time)
>+ {
>+ len = dvd_playback_time;
>
>
there's DEMUXER_CTRL_GET_TIME_LENGTH for this job
>+ pts = dvd_playback_time * (demuxer->filepos - demuxer->movi_start) / (demuxer->movi_end - demuxer->movi_start);
>+ }
>+
>
>
bad, you are tricking with the timestamps and adding yet another special
case.
Nico
More information about the MPlayer-users
mailing list