secret
Created

DVD audio/subs

  • Download Gist
gistfile1.md
Markdown

Some issues that I've noticed and don't know how to handle correctly, so comments are highly appreciated!

There's a mismatch between some audio formats: in dvdnav.c/h we have:

#define DVDNAV_FORMAT_AC3 0
#define DVDNAV_FORMAT_MPEGAUDIO 3
#define DVDNAV_FORMAT_LPCM 4
#define DVDNAV_FORMAT_DTS 5
#define DVDNAV_FORMAT_SDDS 6

uint16_t dvdnav_audio_stream_format(dvdnav_t *this, uint8_t stream) {
....

switch(attr.audio_format) {
  case 0:
    format = DVDNAV_FORMAT_AC3;
    break;
  case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
  case 3: /* MPEG-2 with extension bitstream. */
    format = DVDNAV_FORMAT_MPEGAUDIO;
    break;
  case 4:
    format = DVDNAV_FORMAT_LPCM;
    break;
  case 6:
    format = DVDNAV_FORMAT_DTS;
    break;
  case 7:
    format = DVDNAV_FORMAT_SDDS;
    break;
  default:
    format = 0xffff;
    break;
  }

whereas in dvd_types.h we have:

typedef enum {
  DVD_AUDIO_FORMAT_AC3       = 0,
  DVD_AUDIO_FORMAT_MPEG1     = 1,
  DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
  DVD_AUDIO_FORMAT_MPEG2     = 3,
  DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
  DVD_AUDIO_FORMAT_LPCM      = 5,
  DVD_AUDIO_FORMAT_DTS       = 6,
  DVD_AUDIO_FORMAT_SDDS      = 7,
  DVD_AUDIO_FORMAT_Other     = 8
} DVDAudioFormat_t;

Since we directly use audio_attr_t audio_attributes we check for DVD_AUDIO_FORMAT_*. So there shouldn't be a problem. But there are at least two situation in which this is wrong. First one mp2 is reported as "2" --> mp1. Second one lpcm is reported as 4 --> mp2. Both are correctly reported by the dvdplayer ("o" during playback).

Minor issues:

  • DTS-ES 6.1 is reported to have 5 channels...

  • The subtitle "directors comments" is reported as "3" (ChildrensCaptions) whereas we check for "15" (ChildrensDirectorsComments)... This can be an dvd error also, mediainfo also shows children.

I'm not sure i follow the problem. If we are using the wrong defines that should be fixed obviously. We should trust dvdnav for that they mean. Not this is just IFO data so they could easily be set wrong -> we should not rely on it for anything but display.

Sorry for being imprecise. The problem is that the first (dvdnav.c/h) is too coarse and wrong: dts is 6 in fact not 5;
the second (dvd_types.h) one is wrong.
But both are shipped with libdvd, if I see this correct: in fact 4 is lpcm and 2 is mpeg2.
Since I have no dvds with mpeg1, mpeg1_drc, mpeg2_drc or sdds , I can't give a 100% correct enum, but I think this one is more precise:

typedef enum {
  DVD_AUDIO_FORMAT_AC3       = 0,
  DVD_AUDIO_FORMAT_MPEG1     = 1,
====DVD_AUDIO_FORMAT_MPEG2     = 2, =====
====DVD_AUDIO_FORMAT_MPEG2_DRC = 3, =====
====DVD_AUDIO_FORMAT_LPCM      = 4, =====
  DVD_AUDIO_FORMAT_DTS       = 6,
  DVD_AUDIO_FORMAT_SDDS      = 7,
  DVD_AUDIO_FORMAT_Other     = 8
} DVDAudioFormat_t;

I.e., drop DVD_AUDIO_FORMAT_MPEG1_DRC = 2, and adapt the ==== marked ones. No idea what 5 is...

Regarding: "DTS-ES 6.1 is reported to have 5 channels..." I have no idea what to do about that, do you have one?

I hope the problem is a bit clearer now ;)

The reported data is just something somebody manually put in when they mastered the DVD. Ie it is mainly manual stuff.

Download ifoedit and check how it has it setup. Feel it aught to have them correctly defined.

OK, checked it with ifoedit and the newer pgcedit. The correct enum is:

/* The audio format */
typedef enum {
  DVD_AUDIO_FORMAT_AC3        = 0,
  DVD_AUDIO_FORMAT_UNKNOWN_1  = 1,
  DVD_AUDIO_FORMAT_MPEG       = 2,
  DVD_AUDIO_FORMAT_MPEG2_ext  = 3,
  DVD_AUDIO_FORMAT_LPCM       = 4,
  DVD_AUDIO_FORMAT_UNKNOWN_5  = 5,
  DVD_AUDIO_FORMAT_DTS        = 6,
  DVD_AUDIO_FORMAT_SDDS       = 7
} DVDAudioFormat_t;

the include comes from xbmc\cores\dvdplayer\DVDInputStreams\dvdnav\dvd_types.h . Is it sufficient to only change it there? The other files are lib\libdvd\includes\dvdnav\dvd_types.h and lib\libdvd\libdvdnav\src\dvdnav\dvd_types.h

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.