fabnicol / dvda-author

Free DVD-AUDIO authoring tool
GNU General Public License v3.0
6 stars 7 forks source link

Time elapsed #6

Open sosh72 opened 1 year ago

sosh72 commented 1 year ago

Hello, I managed to compile dvda-author on MacOS (and MacPorts) and created a DVD with 3 groups. It's audio-only and created from wav files (i.e. no fancy conversion etc.)

Now my DVD player (Denon DVD-1600) plays the disc just fine, but the time display behaves strangely. For the odd numbered tracks it's fine, i.e. it starts at 0:00 at the beginning of each track. But for the even tracks it starts at what looks like the total time elapsed within the group.

The output summary of dvda-author looks as below. Notably, the field "First_PTS" is zero for all even-numbered tracks. Is this related to the behaviour of the player (as it seems)?

If yes, is this a bug or a user error?

Cheers!

Group   Title  Track  First_Sect   Last_Sect  First_PTS  PTS_length cga

    1   01/01     1           0       18777           0    19160400   1
    1   01/01     2       18778       43041           0    24759600   1
    1   01/01     3       43042       67002    43919347    24450000   1
    1   01/01     4       67003       84127           0    17474400   1
    1   01/01     5       84128      121745    85843837    38385600   1
    1   01/01     6      121746      147352           0    26130000   1
    1   01/01     7      147353      169658   150359102    22760400   1
    1   01/01     8      169659      189189           0    19929600   1
    1   01/01     9      189190      205925   193049959    17078400   1
    1   01/01    10      205926      234243           0    28896000   1
    2   01/01     1           0       27912           0    28482000   1
    2   01/01     2       27913       44549           0    16976400   1
    2   01/01     3       44550       63668    45458122    19509600   1
    2   01/01     4       63669       86761           0    23564400   1
    2   01/01     5       86762      114049    88531592    27844800   1
    2   01/01     6      114050      140006           0    26486400   1
    2   01/01     7      140007      161771   142863184    22209600   1
    2   01/01     8      161772      181326           0    19953600   1
    2   01/01     9      181327      207441   185026449    26648400   1
    2   01/01    10      207442      225225           0    18146400   1
    2   01/01    11      225226      243797   229821388    18951600   1
    2   01/01    12      243798      258981           0    15493200   1
    2   01/01    13      258982      323788   264266286    66129600   1
    2   01/01    14      323789      354385           0    31221600   1
    2   01/01    15      354386      398910   361617306    45434400   1
    3   01/01     1           0       22946           0    23414400   1
    3   01/01     2       22947       43941           0    21423600   1
    3   01/01     3       43942       79017    44837714    35792400   1
    3   01/01     4       79018      107006           0    28560000   1
    3   01/01     5      107007      129650   109189714    23106000   1
    3   01/01     6      129651      153938           0    24783600   1
    3   01/01     7      153939      172174   157079510    18608400   1
    3   01/01     8      172175      204994           0    33489600   1
    3   01/01     9      204995      223524   209177469    18908400   1
    3   01/01    10      223525      250137           0    27156000   1
    3   01/01    11      250138      271687   255241796    21990000   1
    3   01/01    12      271688      299115           0    27987600   1
    3   01/01    13      299116      321285   305219347    22622400   1
    3   01/01    14      321286      345223           0    24426000   1
    3   01/01    15      345224      370657   352268327    25953600   1
    3   01/01    16      370658      388576           0    18284400   1
sosh72 commented 1 year ago

I think the logic around the flag wait_for_next_pack in write_pes_packet() in ats.c is flawed.

If wait_for_next_pack is set to true, this will not result in first_PTS being set the next time write_pes_packet() is called, because then start_of_file will be false.

This code results in first_PTS being assigned only at the beginning of every second file.

Do you agree?

static bool wait_for_next_pack;
//...
if (start_of_file)
    {
      if (pack_in_title == 0 || wait_for_next_pack)
        {
          info->first_PTS = PTS;
          wait_for_next_pack = false;
        }
      else
        wait_for_next_pack = true;
    }
sosh72 commented 1 year ago

I took another look at it and replaced the above code snippet with the following:

  if (pack_in_title == 0 || wait_for_next_pack)
    {
      info->first_PTS = PTS;
      wait_for_next_pack = false;
    }
  else if (start_of_file)
    {   
      wait_for_next_pack = true;
    }

This seems to have fixed the problem. The time display of the DVD player behaves normally now.

However, what I don't understand is that the computed values differ from the previous ones. Here is the output summary for the exact same set of audio tracks:

Group   Title  Track  First_Sect   Last_Sect  First_PTS  PTS_length cga

    1   01/01     1           0       18777           0    19160400   1
    1   01/01     2       18778       43041    19161143    24759600   1
    1   01/01     3       43042       67002    43920327    24450000   1
    1   01/01     4       67003       84127    68370367    17474400   1
    1   01/01     5       84128      121745    85844816    38385600   1
    1   01/01     6      121746      147352   124230531    26130000   1
    1   01/01     7      147353      169658   150360163    22760400   1
    1   01/01     8      169659      189189   173121388    19929600   1
    1   01/01     9      189190      205925   193050939    17078400   1
    1   01/01    10      205926      234243   210128490    28896000   1
    2   01/01     1           0       27912           0    28482000   1
    2   01/01     2       27913       44549    28482612    16976400   1
    2   01/01     3       44550       63668    45459102    19509600   1
    2   01/01     4       63669       86761    64968327    23564400   1
    2   01/01     5       86762      114049    88532571    27844800   1
    2   01/01     6      114050      140006   116377469    26486400   1
    2   01/01     7      140007      161771   142864245    22209600   1
    2   01/01     8      161772      181326   165073388    19953600   1
    2   01/01     9      181327      207441   185027510    26648400   1
    2   01/01    10      207442      225225   211675429    18146400   1
    2   01/01    11      225226      243797   229822367    18951600   1
    2   01/01    12      243798      258981   248773388    15493200   1
    2   01/01    13      258982      323788   264267265    66129600   1
    2   01/01    14      323789      354385   330396898    31221600   1
    2   01/01    15      354386      398910   361618286    45434400   1
    3   01/01     1           0       22946           0    23414400   1
    3   01/01     2       22947       43941    23415265    21423600   1
    3   01/01     3       43942       79017    44838694    35792400   1
    3   01/01     4       79018      107006    80630531    28560000   1
    3   01/01     5      107007      129650   109190776    23106000   1
    3   01/01     6      129651      153938   132296898    24783600   1
    3   01/01     7      153939      172174   157080571    18608400   1
    3   01/01     8      172175      204994   175688735    33489600   1
    3   01/01     9      204995      223524   209178531    18908400   1
    3   01/01    10      223525      250137   228086694    27156000   1
    3   01/01    11      250138      271687   255242776    21990000   1
    3   01/01    12      271688      299115   277232571    27987600   1
    3   01/01    13      299116      321285   305220327    22622400   1
    3   01/01    14      321286      345223   327842776    24426000   1
    3   01/01    15      345224      370657   352269306    25953600   1
    3   01/01    16      370658      388576   378222367    18284400   1
fabnicol commented 1 year ago

Thanks for posting and proposing fixes. I will look into this soon.