Script DVD Development

Source: Internet
Author: User

It seems that a table cannot be published. You can only copy it to notepad first, so the format is lost. Sorry.

This is a long time ago. We apologize for the inaccuracy. ah, I have not published a book, so I will put it here (people in the publishing house can't understand it, Haha, I'm almost dizzy)

Script-based dvd Application
With the rapid development of the network, the software industry is paying more and more attention to network-based applications. Next we will discuss web-based programming. This section describes how to use the mswebdvd control to develop a dvd application.
Insert an MSWebDVD object
MSWebDVD objects can process all the dvd navigation commands and display videos on the web page. This is much simpler than the original processing process. A simple example of inserting code is as follows:
<Object classid = clsid: 38EE5CEE-4B62-11D3-854F-00A0C9C898E7 ID = DVD
STYLE = "height: pixel PX; width: 740px">
<Param name = "BackColor" VALUE = "1048592">
<Param name = "EnableResetOnStop" VALUE = "-1">
& Lt; param name = "ColorKey" VALUE = "1048592" & gt;
Allows users to process dvd commands
To allow users to control the dvd player, you must provide a user interface to guide users, such as the "play" and "stop" buttons. The following code shows how to associate an html button with an mswebdvd object.
<Input id = button1 NAME = "button1" TYPE = button VALUE = "Play" onClick = 'play (); '>
<Input id = button2 NAME = "button2" TYPE = button VALUE = "Pause" onClick = 'pause (); '>

<Script language = "JScript">
Function Play (){
DVD. Play ();

Function Pause (){
DVD. Pause ();

Work with a dvd menu
When you click the button on the screen, Mswebdvd automatically processes the menu command. The application does not need to handle anything to support the mouse. However, the application may ignore this automatic processing process. If you are very interested in customizing the mouse, you can use the mswebdvd associated menu method, such as SelectAndActivateButton and GetButtonAtPosition. To completely disable automatic mouse action processing, you can set the DisableAutoMouseProcessing attribute to true.
Audio and subgraph streams
A dvd can process eight audio streams, ranging from 0 to 7. Each audio stream contains six independent channels. Only these streams can be activated at any time. For subgraphs, 32 streams are valid, from 0 to 31. A disc is usually made into a default audio and subgraph stream, but an application allows users to see all valid stream data and then select a language they like. The basic steps are the same as the sub-stream.
1. determine the number of valid streams for the specified title.
2. redetect the attributes of each stream.
3. Return the language code from the local ID and create a readable string.
4. Add the "select" dialog box or other user interfaces to allow users to select the preferred data stream.
(Note that the audio and subgraph stream tags start from 0, but most of them start from 1)
Force Parent Management
Generally, any title or part of the title in a dvd disc is labeled as a parent management layer (PML)
Levels from 1 to 8 are the most restrictive, while levels 1 is the least restrictive. There is an idea that provides a device to prevent children from reading Adult content, but the particularity of each country determines that they will not be the same. It is a standard in the United States and Canada, and it is not the same as other countries.
MSWebDVD objects are in the pmls state by default. For an application, it will report the pml mark, so it must call policyparentallevels (true ). MSWebDVD notifies you of the application when you encounter the pml information on the disc. To force pmls, your application must implement some logic passwords to associate users with different levels and respond to the EC_DVD_PARENTAL_LEVEL_CHANGE event to allow or disable access.
Save and restore bookmarks
Bookmarks are the internal data structure of an MSWebDVD object. They can be used to create a snapshot of the current user task, including information about the current disk location, and private parent layer management level, select audio and subgraph streams. This means that the user can save the current dvd status and continue watching from this status next time.
The SaveBookmark method allows users to save the location of their discs. The RestoreBookmark method allows the same user to view the last stored location.
Only one Bookmarks can be stored at a time. If you call SaveBookmark twice, the first bookmark will be overwritten by the second one. Bookmarks are special for computers. Run the same html page on different computers, and then call RestoreBookmark to restore the last stored bookmarks, or return a flag error that was not previously stored.
Handling dvd notification events
When an event occurs, the MSWebDVD object will send a specific notification event to the application, for example, when the DVD domain changes and a new parent layer management. Event parameters can obtain additional event-related information. Both error messages and warning messages are sent in this way. Add the following code to html SCRIPT to capture the updated dvd event notification.
<Script language = "JScript" FOR = dvd event = "DVDNotify (EventCode, Param1, Param2)">
ProcessDVDEvent (EventCode, Param1, Param2)
Then, define the Event code and ProcessDVDEvent function in the script. The following code shows its usage. (You can give your event handler any name)
<Script language = "JScript">

// DVD event codes are valued 257 through 283
Var EC_DVDBASE = 256;

Var EC_DVD_CURRENT_TIME = (EC_DVDBASE + 11); // not used by MSWebDVD
Var ec_dvd_1__start = (EC_DVDBASE + 22); // not used by MSWebDVD
Var ec_dvd_wash_end = (EC_DVDBASE + 23); // not used by MSWebDVD

Var nCurDomain;
Var nCurParentalLevel;

Function ProcessDVDEvent (EventCode, Param1, Param2)
Switch (EventCode)
NCurDomain = Param1;
// Do something
NCurParentalLevel = Param1;
// Do something

// Handle any other events you are interested in

Handle user Event Notifications
When a specific user operation is permitted or prohibited, the MSWebDVD object sends a uop notification to the application. Each user operation has its own events, but they are all Boolean values, used only to identify whether the operation is permitted or disabled.
For each event you want to process, the specified event handler shows some code. For more information, see.
<Script language = "JScript" FOR = dvd event = "PlayForwards (bEnabled)">
PlayForwardsEventHandler (bEnabled)
Now define your handler method to respond appropriately to the event. Assume that the "button_Play" variable here is the id attribute of the "Play" button in your application.
Function PlayForwardsEventHander (bEnabled)
If (bEnabled = true)
Button_Play.disabled = false;
Button_Play.disabled = true;
Synchronize videos that meet html requirements
By processing the disc event encoding event, a web application can synchronize html videos. For example, you can change the image and text at the specified point in the video on this page. The following code shows a call to synchronize the jscipt function through time Encoding events.
// DVDTriggerPoints array holds frame count for each trigger. Must be in ascending order.
// Use timecode2frames () to convert timecodes (hh: mm: ss: ff) to total number of frames.

Var DVDTriggerPoints = new Array (
Timecode2frames ("01: 15: 24: 00 "),
Timecode2frames ("01: 23: 02: 00 "));

// DVDTriggerProcs array holds functions to be called at each trigger point defined in DVDTimePoints.
Var DVDTriggerProcs = new Array (
"ShowDogPic ();",
"ShowCatPic ();");

// DVDTriggerIndex keeps track of current trigger (it indexes DVDTriggerPoints and DVDTriggerProcs ).
Var DVDTriggerIndex = 0;

// Handle DVD Events
Function ProcessDVDEvent (EventCode, Param1, Param2 ){
Switch (EventCode ){
If (MSWebDVD. CurrentDomain = 4) {// Don't bother checking unless disc is playing.
If (DVDTriggerIndex <DVDTimePoints. length) {// Are there trigger points left to check?
CurrentDVDTime = (MSWebDVD. DVDTimeCode2bstr (Param1 ));
If (timecode2frames (currentDVDTime)> = DVDTriggerPoints [DVDTimeIndex]) {
// If trigger point has passed, execute the associated function
Eval (DVDTriggerProcs [DVDTimeIndex ++]);

// Handle other events

Function timecode2frames (timeCode ){

If (timeCode! = "Undefined "){
Return timeCode. substring (108000) *
+ TimeCode. substring (3, 5) * 1800
+ TimeCode. substring (6, 8) * 30
+ TimeCode. substring (9, 11 );
} Else {
Return 0;
Work with LCIDs
LCID, or "locale identifer", is a 32-bit data type to help us identify different regional code languages. One of these values is the "main language identifier", which can be used to identify basic regional languages. For example, English or Spanish.
MSWebDVD requires a valid LCID as the input parameters for the following two methods: SelectDefaultAudioLanguage and selectdefasubsubpicturelanguage. These can be any valid LCID that can be recognized by Windows, or even not recognized by Windows. (The host does not have to support fonts and keyboard ing on the local machine.) The following lists some general LCIDs and non-General LCIDs that are not recognized by the default Windows State but are valid for MSWebDVD. This table is not a complete list of LCIDs.
Some valid LCIDs
Afrikaans 0x0436 Albanian 0x041c Arabic (Algeria) 0x1401
Arabic (Bahrain) 0x3c01 Arabic (Egypt) 0x0c01 Arabic (Iraq) 0x0801
Arabic (Jordan) 0x2c01 Arabic (Kuwait) 0x3401 Arabic (Lebanon) 0x3001
Arabic (Libya) 0x1001 Arabic (Morocco) 0x1801 Arabic (Oman) 0x2001
Arabic (Qatar) 0x4001 Arabic (Saudi Arabia) 0x0401 Arabic (Syria) 0x2801
Arabic (Tunisia) 0x1c01 Arabic (U. A. E.) 0x3801 Arabic (Yemen) 0x2401
Basque 0x042d Belarusian 0x0423 Bulgarian 0x0402
Catalan 0x0403 Chinese (Hong Kong) 0x0c04 Chinese (PRC) 0x0804
Chinese (Singapore) 0x1004 Chinese (Taiwan) 0x0404 Croatian 0x041a
Czech 0x0405 Danish 0x0406 Dutch (Belgian) 0x0813
Dutch (Standard) 0x0413 English (English) 0x0c09 English (Belize) 0x2809
English (Canadian) 0x1009 English (Caribbean) 0x2409 English (Ireland) 0x1809
English (Jamaica) 0x2009 English (New Zealand) 0x1409 English (South Africa) 0x1c09
English (Trinidad) 0x2c09 English (United Kingdom) 0x0809 English (United States) 0x0409
Estonian 0x0425 Faeroese 0x0438 Farsi 0x0429
Finnish 0x040b French (Belgian) 0x080c French (Canadian) 0x0c0c
French (Luxembourg) 0x140c French (Standard) 0x040c French (Swiss) 0x100c
German (Austrian) 0x0c07 German (Liechtenstein) 0x1407 German (Luxembourg) 0x1007
German (Standard) 0x0407 German (Swiss) 0x0807 greak 0x0408
Hebrew 0x040d Hungarian 0x040e Icelandic 0x040f
Indonesian 0x0421 Italian (Standard) 0x0410 Italian (Swiss) 0x0810
Japan 0x0411 Korean 0x0412 Korean (Johab) 0x0812
Latvian 0x0426 Lithuanian 0x0427 Malay (Malaysian) 0x043e
Malay (Brunei) 0x083e Norwegian (Bokmal) 0x0414 Norwegian (Nynorsk) 0x0814
Polish 0x0415 Portuguese (invalid Ilian) 0x0416 Portuguese (Standard) 0x0816
Romanian 0x0418 Russian 0x0419 Serbian (Cyrillic) 0x0c1a
Serbian (Latin) 0x081a Slovak 0x041b Slovenian 0x0424
Spanish (Argentina) 0x2c0a Spanish (Bolivia) 0x400a Spanish (Chile) 0x340a
Spanish (Colombia) 0x240a Spanish (Costa Rica) 0x140a Spanish (Dominican Republic) 0x1c0a
Spanish (Ecuador) 0x300a Spanish (El Salvador) 0x0000a Spanish (Guatemala) 0x100a
Spanish (Honduras) 0x480a Spanish (Mexican) 0x080a Spanish (Modern Sort) 0x0c0a
Spanish (Nicaragua) 0x4c0a Spanish (Panama) 0x180a Spanish (Paraguay) 0x3c0a
Spanish (Peru) 0x280a Spanish (Puerto Rico) 0x500a Spanish (Traditional Sort) 0x040a
Spanish (Uruguay) 0x0000a Spanish (Venezuela) 0x200a Swahili 0x0441
Swedish 0x041d Swedish (Finland) 0x081d Thai 0x041e
Turkish 0x041f Ukrainian 0x0422
The LCID returned by some MSWebDVD methods and attributes can specify that the identifier is valid on the audio track or subtitle. To use this information, your application will need to select the primary language Identifier from the returned LCID. To achieve this goal, we can perform bitwise AND operations on iLCID and 0x3ff. The following code excerpt demonstrates this implementation process. (The primary language identifier contains at least 10 bits in LCID)
IPrimaryLang = iLCID & 0x3FF;
To obtain a readable string from the primary language identifier, call GetLangFromLangID. The Code is as follows:
SLanguage = DVD. GetLangFromLangID (iPrimaryLang );
The following list shows the primary language ID in LCID.
Some Valid Primary Language IDs
Afrikaans 0x36 Albanian 0x1c Arabic 0x01 Basque 0x2d
Belarusian 0x23 Bulgarian 0x02 Catalan 0x03 Chinese 0x04
Croatian 0x1a Czech 0x05 Danish 0x06 Dutch 0x13
English 0x09 Estonian 0x25 Faeroese 0x38 Farsi 0x29
Finnish 0x0b French 0x0c German 0x07 Greek 0x08
Hebrew 0x0d Hungarian 0x0e Icelandic 0x0f Indonesian 0x21
Italian 0x10 Japanese 0x11 Korean 0x12 Latvian 0x26
Lithuanian 0x27 Malay 0x3e Norwegian 0x14 Polish 0x15
Portuguese 0x16 Romanian 0x18 Russian 0x19 Serbian 0x1a
Slovak 0x1b Slovenian 0x24 Spanish 0x0a Swahili 0x41
Swedish 0x1d Thai 0x1e Turkish 0x1f Ukrainian 0x22
Play Karaoke discs
A karaoke disc is a type of dvd Video Disc. It has the same navigation structure as a dvd video disc. A song is stored in the format of a general section. A section can be merged into a unit, which is the basic unit of playback.
The biggest difference between a karaoke disc and an ordinary dvd disc is the audio stream. Karaoke discs are included in all the multi-channel audios, typically Dolby AC-3. Channels 0 and 1 generally include background sound effects, while channels 2 to 5 contain audio, such as voice and synthesis. A karaoke application can control the volume and target speakers and sound mixing channels.
Karaoke playback requires an audio decoder that supports multi-channel karaoke mixing information. The decoder must support the attribute setting (AM_PROPERTY_DVDKARAOKE) of the dvd karaoke bar ).
When the content of karaoke is detected in the DVD navigation disk, it automatically enters the karaoke mode and notifies the Three audio mixing channels on the decoder to be muted, until they are opened by the application.
1. Determine their content and the number of audio mixing channels.
2. A user interface is provided to display the channel content, allowing you to switch the sound mixing channel at any time.
Dvd text
Dvd discs, especially karaoke discs, may contain a database of text information to supplement the video and audio content. Such text may include the title, art name, record tag, and so on of a karaoke disc. These words can be translated into different languages. These strings are optional, and they are not required on the disc. Now their organizational structure is achieved through the logical-level approximate image method of the dvd volume label.
There are two basic types of strings: Structure identifier and content identifier. These types Use the values from 0x01 to 0x20 as the structure identifier. They are empty strings, and numeric codes are used to identify the logical structure, indicating that the content string belongs to that logical structure. This structure is very consistent with the logical structure of the content of the dvd disc: The volume label, title, chapter, and so on. The remaining content identifier is a string used to display the user interface information.
Historically, the text strings on a DVD disc are unique, and most of these discs use 0x01 and 0x02 structure identifiers and 0x30 content strings. But not so now (1) more and more types of DVD-Video discs contain text strings (2) to provide detailed descriptions of the disc content, these strings are organized in a more complex way. The following code demonstrates how to determine the number of text string language blocks on a disc and how to retrieve readable strings that allow users to set languages. Code, the string is added to the "TextLanguageList" html select element code.
Function GetTextLanguages ()
// Get the number of text blocks
Var numLangs = DVD. GetDVDTextNumberOfLanguages ();
Var iLCID;
Var iPrimaryLang;
Var sLanguage;
Var oOption;

For (j = 0; j <numLangs; j ++)
// Get the locale identifier for the language block
ILCID = DVD. GetDVDTextLanguageLCID (j );

// Get the primary language ID from the LCID
IPrimaryLang = iLCID & 0x3FF;

// Get the human-readable string from the primary language ID
SLanguage = DVD. GetLangFromLangID (iPrimaryLang );

// Add it to the SELECT element on the HTML page
OOption = document. createElement ("OPTION ");
OOption. text = sLanguage;
Document. all. TextLanguageList. add (oOption );

} // End function GetTextStrings
The following check Code demonstrates how to enumerate strings and check the types of text strings. The result is displayed in the html textarea element named "myTextArea". Therefore, you can see how the numeric string type is used to organize the content string. The program creates its own data structure to contain strings or display strings to users.
// ILanguage is the 0-based index for the language block
Function GetTextStrings (iLanguage)

Var numStrings, stringType, j;

NumStrings = DVD. GetDVDTextNumberOfStrings (iLanguage );

For (j = 0; j <numStrings; j ++)
StringType = DVD. GetDVDTextStringType (iLanguage, j );

If (stringType> 0x20) // there is actually some text to read here
MyTextArea. value + = (stringType + ":" + DVD. GetDVDTextString (iLanguage, j) + "\ n ");
Else // It's a node indicating what level of the volume structure
// The following strings will apply
MyTextArea. value + = (stringType + "\ n ");

} // End function GetTextStrings

Dvd text string type
This table lists the subset of the dvd text string type. Strings less than 0x20 are content strings. Most song names and titles are 0x30.
Structure identifier
Volume 0x01 indicates that the string belongs to the DVD Volume
Title 0x02 Title
ParentalID 0x03 indicates that the string belongs to a specific parent ID.
Chapter 0x04
Cell 0x05 indicates that the string belongs to a unit (a scene in a movie)
Stream identifier
Audio 0x10 indicates that the string belongs to the Audio stream.
Subpicture 0x11 indicates that the string belongs to the subgraph stream.
Angle 0x12 indicates that the string belongs to the Angle block.
Audio channel identifier
Channel 0x20 indicates that the string belongs to a Channel reserved for audio.
Common Content string
Name 0x30 general identifier of Title Name, Chapter Name, and song Name
Comments 0x31 general content of titles, chapters, and songs
Title content string
Series 0x38 additional information of titles, chapters, and songs
Movie 0x39 additional information about the title or chapter of a Movie
Additional information about the title or chapter of a Video 0x3a
Additional information about the title or chapter of the Album 0x3b Album
Additional information about the title or chapter of a Song 0x3c Song
Other 0x3f additional information of Other titles or chapters
Second Title content string
Series 0x40 additional title, chapter, and song Information
Movie 0x41 additional information about the title or chapter of a Movie
Video 0x42 additional information of the title or chapter of a Video
Album 0x43 additional information of the Album title or chapter
Song 0x44 additional information of the title or chapter of the Song.
Other 0x45 additional information for Other titles or chapters
Original content string
Series 0x48 additional title, chapter, and song Information
Movie 0x49 additional information about the title or chapter of a Movie
Video 0x4a additional information of the title or chapter of a Video
Additional information about the title or chapter of the Album 0x4b Album
The title or additional information of the Song 0x4c Song.
Other 0x4f additional information of Other titles or chapters
Other information content string
Other Scene 0x50 additional information for the title or chapter of an optional scenario
Other Cut 0x51 additional information for the title or chapter of an optional clip
Other Take 0x52 additional information on the optional screen of the title or chapter

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.