Log in

View Full Version : How does PGCEdit's verify_num_streams_domain function work?


kumi
22nd December 2005, 04:22
From examining the streams.tcl code it seems to me that PGCEdit does something like:

1) Loop through each PGC's header, and:
2) Loop through the PGC_AST_CTL (http://dvd.sourceforge.net/dvdinfo/pgc.html) entries. Sets the "real" number of audio streams to the last stream control entry number that is non-zero.
2) Loop through the PGC_SPST_CTL (http://dvd.sourceforge.net/dvdinfo/pgc.html) entries. Sets the "real" number of subpic streams to the last stream control entry number that is non-zero.

But, I have a DVD here that shows only 1 non-zero subpicture stream in the title domain, and it's not stream #1:

[0000001c] Sub-picture stream 1 status 0 [00000000]
[00000020] Sub-picture stream 2 status -2147417856 [80010100]
[00000024] Sub-picture stream 3 status 0 [00000000]
[00000028] Sub-picture stream 4 status 0 [00000000]
[0000002c] Sub-picture stream 5 status 0 [00000000]
[00000030] Sub-picture stream 6 status 0 [00000000]
etc...
The verify_num_streams_domain procedure reports "2 subpic streams are really used by the PGCs." Sub-picture stream 1 in the above Ifoedit dump doesn't display on my SAP or DVD programs. It is reported as non-existant in SubRip. It has a non-zero value in VTSI_MAT:

[00000255] Number of sub-picture streams in VTSTT_VOBS 32 [20]
[00000256] Sub-p_01: Sub-picture stream attributes 1 0 107 111 0 0 [01 00 6b 6f 00 00 ]
Sub-picture attribute details:
Language type present
Coding mode 2-bit rle
Language Korean
Language extension [00]
Code extension (Sub-Picture caption) unspecified caption
[0000025c] Sub-p_02: Sub-picture stream attributes 1 0 101 110 0 0 [01 00 65 6e 00 00 ]
Sub-picture attribute details:
Language type present
Coding mode 2-bit rle
Language English
Language extension [00]
Code extension (Sub-Picture caption) unspecified caption
[00000262] Sub-p_03: Sub-picture stream attributes 0 0 0 0 0 0 [00 00 00 00 00 00 ]
[00000268] Sub-p_04: Sub-picture stream attributes 0 0 0 0 0 0 [00 00 00 00 00 00 ]
[0000026e] Sub-p_05: Sub-picture stream attributes 0 0 0 0 0 0 [00 00 00 00 00 00 ]
[00000274] Sub-p_06: Sub-picture stream attributes 0 0 0 0 0 0 [00 00 00 00 00 00 ]
etc...

Does a zero-value PGC_*ST_CTL entry always mean that particular stream does not exist?

thanks

Edit: Looking at r0lz's code really drives home what an amazing (and well documented!) program he's got. Kudos to you, sir :)

r0lZ
22nd December 2005, 15:13
(and well documented!)I'm not so sure! But thanks!

Well, the function loops through the PGCs of the domain, and keep track of the highest stream defined in the PGC_SPST_CTL table (ie the highest entry in the table with bit 15 set.) This value is then compared to the number of streams defined in the VTSI_MAT table, and the option to fix the table is displayed if there is a difference.

In your PGC, the first stream is not defined. (Maybe because you have removed the stream with DVDShrink with the option to remap the streams OFF?)
To be able to define the language code and characteristics of the second stream, there must be 2 entries in the VTSI_MAT table, even if the first one is unused.

But take care: I know that an empty, unused stream in the list can cause some players to fail when displaying the list of streams, or even when switching streams with the remote. So, this situation should be avoided if possible, or you should set the PUO to inhibit the direct selection of the stream with the remote.
You may also copy stream 1 to stream 0, in both the PGCs and the VTSI_MAT table, and then disable stream 1 and fix the number of streams to get rid of the second stream. But of course, you will have to change the SetSTN commands accordingly. Easy to do for direct SetSTNs. (You can check that with the DVDShrink plugin.) If it's too difficult, I suggest to copy stream 1 to 0, but leave the two streams in place. This way, SetSTW will still work, and you will be able to use the remote on all players, though streams 0 and 1 will be identical.

kumi
22nd December 2005, 21:04
(ie the highest entry in the table with bit 15 set.)
Sorry, you mean the bit labelled "1 = stream available" on this (http://dvd.sourceforge.net/dvdinfo/pgc.html) page, right?

or you should set the PUO to inhibit the direct selection of the stream with the remote.
Good tip, thanks.

r0lZ
23rd December 2005, 04:10
Sorry, you mean the bit labelled "1 = stream available" on this (http://dvd.sourceforge.net/dvdinfo/pgc.html) page, right?Yes. It's bit 7 of byte 0 of a word (which is 2 bytes long), so you can express it as bit 15 of the word. Anyway, yes, it's the flag that marks the stream as defined (or available.)

CoNS
7th January 2006, 17:14
r0lZ, I have a disc where MPC says that there are 3 available audio streams for the main movie, when there's actually only one. The first one is English and the two others (empty ones?) are unspecified. When I try to select stream no. 2 or 3 in MPC, nothing happens - it simply stays with stream no. 1.

I want to correct the audio stream info. IIRC PgcEdit usually lets me fix this. But now I suddenly can't seem to remember how?! When I load the disc, PgcEdit asks if I want to fix number of streams. But it doesn't fix the audio stream numbers I described above.

Now, if I enter the PGC Editor for that specific PGC, it says that audio stream 0 is set to "0", and the rest are set to "none" (disabled). But in the "Current domain stream attributes" there're three active audio streams??? How do I fix this?

EDIT: I worked it out with IfoEdit, by doing this: Changed "Number of audio streams in VTSTT_VOBS" from 3 to 1 in VTSI_MAT in VTS_01_0.IFO, and,
Changed "VTS_1: Number of audio streams in Title (VTSTT_VOB)" from 3 to 1 in VMG_VTS_ATRT in VIDEO_TS.IFO

But how can it be done with PgcEdit instead?

r0lZ
7th January 2006, 18:29
In PgcEdit, you must change the streams assignments in at least one PGC of the domain. In your case, you should click on the first and second button marked "none" and assign any stream number. Then, go to domain streams attributes to fix the number of streams automatically.

But honestly, it's probably useless. If the assignment is "none" in the original DVD, I guess there are no streams for this PGC in the VOB. Or it's an incredible authoring error.