Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > (HD) DVD, Blu-ray & (S)VCD > IFO/VOB Editors

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th October 2010, 11:52   #41  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
OK, I think I understand. Delete Dead Commands works as expected, but as you can see, it is at the first position in the list of actions in Remove Useless Stuff. That means that it is executed first. Then the other actions are executed as well, and if the PGC needs to be killed, the post commands (and if necessary some button or cell commands) are copied to the pre-commands area again. (Kill PGC Playback doesn't verify if it copies useless commands, and that function is called indirectly by many other functions.) It's why the useless commands are added again. It's also why I have explained elsewhere that it might be necessary to run Remove Useless Stuff twice.

Sometimes, as in your example, a function of Remove Useless Stuff changes the DVD in such a way that it is possible to simplify it further. (Here, ) But if the function that could simplify it again has already been called, it is not called again during the procedure, and you need to relaunch Remove Useless Stuff (or one of its procedures) again. Unfortunately, it is not easy to determine the best order of the functions in Remove Useless Stuff, as it depends of the authoring of each DVD, and of what the user has made manually. Also, I have to take the duration of the actions in mind. For example, I like to leave Delete Dead Commands as the first function, as it suppresses sometimes some useless commands jumping to dead PGCs, and if I leave those commands before calling Delete Uncalled PGCs, the useless PGCs will not be removed because they will still be technically referenced (although by dead commands).

I could perhaps relaunch the whole Remove Useless Stuff procedure automatically, until there is nothing that can still be removed, but that would require some hard work for me, and that might be very slow. There is also a risk of infinite loop if, for some reason, it is not possible to remove everything that needs to be removed. So, currently, you have to relaunch the procedure yourself. Can you verify if that works well?

I just saw your edit now. It seems that "Remove useless menu VOBs" restores the useless commands each time any way. That's probably a little bug, as if the VOB is not needed, the post commands should be copied to the pre-command area the first time the command is run, then removed from the post-command area. If they are not removed, they are copied again the next time. Obviously, there is a bug here. I will have a look...
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 10th October 2010, 15:31   #42  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
A simple way to repeat a process without the risk of an infinite loop is to use a flag which indicates if any changes were made by the process. Then execute the process until no changes have been made.
Code:
BOOL something_changed;

something_changed  = TRUE;    //to run the first pass
while (something_changed) {
    something_changed = FALSE;
    check_for_things_to_do();
}
or if the actions taken are so many that the while logic could get difficult to see when maintaining the code
Code:
BOOL something_changed;
//loop until no changes are made
loop: something_changed = FALSE;
         .
         .
         .
if (something_changed) goto loop;
The difficult part here would be to add code for setting the flag at every possible change, but if one is missed the worst that can happen is the user need to rerun, there would be no danger of a hang.
mpucoder is offline   Reply With Quote
Old 10th October 2010, 17:02   #43  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Thanks mpucoder. I use already that logic in the loop that searches for uncalled PGCs, and it works fine. But Remove Useless Stuff is a global macro that calls several totally independent functions. Each of these functions will have to return the flag to the main macro, but some of them have already something to return. I will have to use global flags, and I don't like that too much. Furthermore, the fact that a function finds nothing to remove doesn't mean that it will not find something during the next run (as the conditions may have changed due to another function), and therefore I can't exclude it from the loop to simplify and speed things up.

Also, the risk of infinite loop is caused by the fact that a function could try to remove something, but fail. If the flag telling that something has been removed is set anyway, the loop will be repeated again and again.

I wonder if improving that already powerful macro is really necessary. Anyway, I will add a call to Delete Dead Commands (on the current PGC) at the end of Kill PGC Playback. So, the useless post-commands copied to the pre-command area will be removed immediately, and will not interfere with the other functions. That should at least solve the little bug reported by mikenadia.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV

Last edited by r0lZ; 10th October 2010 at 17:04.
r0lZ is offline   Reply With Quote
Old 11th October 2010, 10:55   #44  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
OK, I did what I have suggested above. Now, Delete Dead Commands is called automatically after Kill PGC Playback (on the killed PGC only). This way, KillPGC playback no longer adds useless commands in the pre-command area. (The drawback is that it removes also the dead commands that were in the original pre-command area before the operation, but IMO, since the PGC is modified anyway, that doesn't matter much.)

Also, in Remove Useless Menu VOBs, PgcEdit should no longer consider a menu with button that leads to a dead end as useless. Previously, that kind of menu (that stops the navigation) was removed, but that might be a problem with parental management menus, as I suppose that sometimes that kind of menu is intentional. It might be normal to stop the navigation completely if the user is unable to provide the password to watch the DVD, after having displayed a menu that explains why the DVD will stop.
However, I don't know if that kind of parental management menu is frequent, and even if it exists, as here in Europe, it is extremely rare to find a DVD with parental management.
It is possible that the new logic will prevent to remove really useless menus in some cases, but I think it is dangerous to remove menus with buttons anyway (unless the PGC is uncalled of course). The user can manually kill it if he wish.

If someone can send me a good example of a parental management menu, I will be able to check what I did in real circumstances. Thanks in advance.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV

Last edited by r0lZ; 11th October 2010 at 10:58.
r0lZ is offline   Reply With Quote
Old 16th November 2010, 07:57   #45  |  Link
mikenadia
Registered User
 
Join Date: Nov 2007
Posts: 246
Different navigation between PGCedit and PowerDVD.
There is a gprm(15) set with sprm(preferred audio) so in PGCedit , I go to a menu that asks me to choose the preferred audio. I went to Virtual Player setup and put "en" in " Preferred audio language". It did not change anything.
By inserting " set gprm(15)=25966" in FPG-PC , both navigation are identical.

Thanks in advance.
mikenadia is offline   Reply With Quote
Old 16th November 2010, 09:44   #46  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Well, I don't understand the problem.

If you modify the language code of the "Preferred audio language" in the virtual player setup, you change the value of SPRM(16). That value cannot be modified by a nav command when the DVD is playing, so you can consider it as a constant.
If your DVD executes the command Set GPRM(15)=SPRM(16), then that value is transferred in GPRM(15). That works well in PgcEdit, I have just verified.
So, if you need to add the command Set GPRM(15)='en (which is identical to set gprm(15)=25966) in the FP-PGC, that means that the DVD does not execute the Set GPRM(15)=SPRM(16) when it should, or that that command has been modified or removed.

You can verify that PgcEdit is not responsible of the problem by changing the Set of the FP-PGC to Set GPRM(15)=SPRM(16). The result should be correct for any preferred audio language in the virtual player setup. It is preferable to use that command anyway, as the player will (theoretically) select the right audio language automatically. If you leave your command, it will select English, regardless of the setup.

So, IMO, you have found an authoring error: a missing Set command. I really don't understand why PowerDVD does not react like PgcEdit, but take in mind that there is no setup for most software players. They assume usually that the language of the Windows installation is what you want. That makes the software players useless to check if the right language is selected automatically.

BTW, I do not trust any software player, except the "Play DVD" of IfoEdit. Have you checked if IfoEdit does the same thing than PowerDVD?
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 16th November 2010, 13:49   #47  |  Link
mikenadia
Registered User
 
Join Date: Nov 2007
Posts: 246
Thank you. Solved.
The navigation required also "Preferred menu language" and " Preferred sub picture language "to be set up. If I put both of them to "en", PGCedit and PowerDVD act the same, so PowerDVD is "guessing" that they are probably set to "en" (my Windows language). It looks like that PowerDVD and IfoEdit act the same way.

Thanks a lot.

Last edited by mikenadia; 16th November 2010 at 14:02.
mikenadia is offline   Reply With Quote
Old 16th November 2010, 15:07   #48  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Thanks for the confirmation.
Maybe I'll need to set default values in the virtual player setup automatically when PgcEdit is launched for the first time, as some DVDs seem to dislike undefined language codes. But I have no precise way to find out what's the Windows installation language, and I don't want to force English by default. Anyway, a correctly authored DVD should always check if the language is not defined, and use reasonable defaults if it's the case. Unfortunately, there are exceptions. Your DVD is probably among them.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 16th November 2010, 18:39   #49  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
I can't remember if you use C++ or another language, but there is a round-about way to determine a window user's language. First get the locale identifier using GetUserDefaultLCID() (or you could use GetSystemDefaultLCID() if you want the system default instead). This gives you a number that can be cross referenced to a language and locale. The so-called LangID is in the lower word and can be isolated by simply casting the value to WORD or using LANGIDFROMLCID (which does the same thing). I found a fairly easy to read cross reference at http://www.pagedowntech.com/faq/faq.asp?faqid=21

It may seem overwhelming, but there is a way to simplify things. Only the lower 10 bits are used to define the language, bits above that define the sub-language, for example:
Code:
English ...9 
English - Australia ...3081 
English - Belize ...10249 
English - Canada ...4105 
English - Ireland ...6153 
English - Jamaica ...8201 
English - New Zealand ...5129 
English - South Africa ...7177 
English - Trinidad ...11273 
English - United Kingdom ...2057 
English - United States ...1033
After masking off the upper bits, or performing a mod 1024 operation, they all have the value of 9.

edit: I found an even easier to comprehend list at the Microsoft site. (I'm surprised)
Also This may be more helpful. I am still searching the web for a pre-defined cross reference (that is an array definition of ISO 639-2 codes indexed by LangID)
Seems a lot of people have struggled with this, I even found a script to scan the registry key HKLM\Software\CLASSES\MIME\Database\Rfc1766 (which does list all the LangID codes in effect at the time of install and their ISO code)!

Last edited by mpucoder; 16th November 2010 at 19:06.
mpucoder is offline   Reply With Quote
Old 16th November 2010, 19:01   #50  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Thanks, but unfortunately, I can't call directly Windows functions, because Tcl/Tk is a cross-platform language. Perhaps I can read the information in the registry? Anyway, I will have to find another method under Linux.
Maybe I'll just add a warning in the trace log when the trace is started and the language SPRMs are not defined. Much easier! :-)
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 16th December 2010, 00:11   #51  |  Link
IVaN_000
Registered User
 
Join Date: Nov 2007
Posts: 60
I'd like to have a macro that assumes a value for a given register, and cleans code, like "Assume gprm(x) always == y".

For example, after executing "Assume gprm(14) == 2", the following code:

[20 A4 00 0E 00 01 00 04] 1 if ( gprm(14) == 1 ) then { LinkPGCN PGC 4 }
[20 A4 00 0E 00 02 00 06] 2 if ( gprm(14) == 2 ) then { LinkPGCN PGC 6 }
[20 A4 00 0E 00 03 00 08] 3 if ( gprm(14) == 3 ) then { LinkPGCN PGC 8 }

would result in:

[00 00 00 00 00 00 00 00] 1 NOP
[20 04 00 00 00 00 00 06] 2 LinkPGCN PGC 6
[00 00 00 00 00 00 00 00] 3 NOP

That would be nice.
IVaN_000 is offline   Reply With Quote
Old 16th December 2010, 00:40   #52  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Yes, it's a good idea. I have often needed something like that, mainly to remove menus in foreign languages. But it's not really easy to write, as the gprm can be used in many different situations. Also, what should I do with the commands that set the register? Remove them? Even if they are conditional? And what should be the scope of the macro? Global to the whole DVD, or local to the current PGC or domain?
As you can see, there are still many questions. Anyway, don't expect a macro soon...
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 17th December 2010, 00:00   #53  |  Link
IVaN_000
Registered User
 
Join Date: Nov 2007
Posts: 60
Yes, in fact, it would be a dangerous thing to do, like a "do it at your own risk" thing. But as you say, it is useful for removing foreign menues. In that case, the commands that set the register can be safely kept untouched, and the scope of the macro should be the whole DVD.

Last edited by IVaN_000; 17th December 2010 at 00:33.
IVaN_000 is offline   Reply With Quote
Old 17th December 2010, 09:35   #54  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Yes, but now suppose something like that:
Code:
[61 00 00 0F 00 90 00 00]   1  Set gprm(15) =(mov) sprm(16:Preferred audio language) 
[51 00 00 81 80 00 00 00]   2  (SetSTN) Set Audio stream = 1 ; Set Sub-picture stream = 0, off 
[00 B1 00 0F 66 72 00 05]   3  if ( gprm(15) != 26226 ("fr") ) then { Goto line 5 } 
[51 00 00 80 C1 00 00 00]   4  (SetSTN) Set Audio stream = 0 ; Set Sub-picture stream = 1, on 
[00 00 00 00 00 00 00 00]   5  NOP
And suppose you have removed the subpic 1 (fr), and your preferred audio language is English. Normally, the code should be simplified to keep only line 2, but here gprm(15) is a temp register, probably used in other PGCs to hold something completely different. It cannot be replaced globally in the whole DVD, and the scope must be local to the current PGC.

Also, note the difficulty: if you assume that gprm(15) = 25966 ("en"), then the condition of the Goto becomes if ( 25966 ("en") != 26226 ("fr") ) then { Goto line 5 }, but that command is illegal, and to remove it, PgcEdit must evaluate the expression to understand that the Goto cannot be executed, and replace it with a NOP. As you can see, it's not really easy. It is even more difficult to replace the gprm if the command compares two GPRMs: if ( gprm(15) > gprm(14) ) then { Goto line 5 } cannot be replaced with if ( 10 > gprm(14) ) then { Goto line 5 }, and the condition must be inverted, like this: if ( gprm(14) <= 10 ) then { Goto line 5 }. Really not easy to do!
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 18th December 2010, 00:40   #55  |  Link
IVaN_000
Registered User
 
Join Date: Nov 2007
Posts: 60
Yes, I know what you mean. It wouldn't be a complete solution.

About the implementation, I was thinking of a simpler approach: If you assume gprm(15) = 25966 ("en"), as you say in the example, just search for the commands that compare gprm(15) against a constant value:

- If the command expects gprm(15) to be 25966, just remove at the opcode level the bits that represent the "if".
- If the command expects gprm(15) to be something else, replace the command by a NOP.

But as you say, there's nothing to do when the gprm is compared to another gprm.
IVaN_000 is offline   Reply With Quote
Old 18th December 2010, 22:04   #56  |  Link
IVaN_000
Registered User
 
Join Date: Nov 2007
Posts: 60
Did you ever consider making something similar to PgcEdit, but for editing Blu-rays?
IVaN_000 is offline   Reply With Quote
Old 19th December 2010, 00:16   #57  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Yes, but there are many difficulties. The Blu-ray format is not well known yet, and it is difficult to guess it. Also, I'm not sure I want to devote much time in developing another big program like PgcEdit. I have other interests in my life, and PgcEdit was not particularly a good way to pay my bills. Furthermore, I think that blu-rays are mainly a commercial attempt to force people to buy again the movies they have bought already several times, during the VHS and DVD times. I don't want to participate to that swindle. Furthermore, currently, I have no blu-ray drive at home...
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 19th December 2010, 20:23   #58  |  Link
HFW
Registered User
 
Join Date: Mar 2007
Location: Asuncion - Paraguay
Posts: 20
@IVaN_000
If your purpose is to take off some unwanted streams, try Clown BD BD Copier.
Regards
HFW is offline   Reply With Quote
Old 3rd February 2011, 19:12   #59  |  Link
Sir Didymus
Registered User
 
Join Date: Mar 2004
Location: Italy
Posts: 953
Feature request...

I noticed a couple of times that changing the menu type of a given pgc (e.g. Root, SubPic, Angle, ...) is possibly leading to navigation issues, since the other commands in the DVD calling the menu are not changed (or checked) accordingly...

I am not sure it is feasible...

It would be nice to have a behaviour similar to the one of remapping the title numbers: the action is carried out and the consistency of the whole navigation is maintained...

What do you think?


Cheers,
SD
Sir Didymus is offline   Reply With Quote
Old 4th February 2011, 10:54   #60  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
I agree that a way to change the menu type without affecting the navigation can be useful in some cases, but if you don't want to change the nav, why do you want to change the menu entry types? Just leave them where they are, and the nav will not be affected. In fact, I wrote that function to be able to add a new menu entry, not to change an existing one. But since it is not possible to add several times the same menu entry type, the function changes the current entry if you redefine it, and in that precise case, nav problems can occur.

Anyway, keeping the nav unmodified is not so easy.

1. It is possible to change the commands calling the Title menu to call the same VMGM PGC by its number before assigning the Title Menu entry to another PGC. Fine, but is it really what you want? If you change the Title menu, is it not to call the new PGC instead? Keep in mind that, usually, the calls to the Title Menu should do the same thing than the Title Menu button: return to the main menu. (However, I agree that it's only "usually".)

2. Furthermore, if I change the jumps to the Title menu by jumps to, say, VMGM PGC 1, and if you change your mind and decide to assign again the Title menu entry to another PGC, there will be no way to restore the jumps that have been modified the first time, since now they are pointing to a precise PGC.

3. Unfortunately, there is no practical way to fix the commands jumping from the VMG or from a Title domain to a menu entry in the same VTS, as there is no way to call a VTSM PGC by its number. So, unless you swap two menu entry types in a VTSM, I cannot automatically fix the navigation. And note that with the current GUI, it is not possible to swap two existing VTSM entries. So, currently, it is only possible to fix the nav when you change a VTSM menu entry type to another type that is not used yet: in that case, I can simply modify the jumps and calls command to call the new entry type. Of course, if the user changes the entry to another entry that exists already, then I can probably show a dialog asking if the two entries should be exchanged, and if the user answers yes, fix the jumps to them automatically.

4. It is possible to fix the jumps from the VTSM to the entry menu by replacing them with LinkPGCN commands, but again, it will not be possible to undo the change if you change your mind. (Same problem as point 2.)

So, unfortunately, there is no guarantee that PgcEdit will be able to fix the nav in all cases, and anyway, I'm not sure that doing so is always a good thing. But I agree that something is missing. I could perhaps check if the entry that is modified is called by some VM commands, and if it's the case, offer to abort the change, or display the list of calling commands so that the user can change them manually, or, when it is possible to fix all calling commands, offer to do it. But IMO, that should be an option anyway.

I will check my code to see if it's not too difficult to do...
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.