Script for DVD Development _ Other

Source: Internet
Author: User
Tags html page locale readable
As if the inclusion of forms can not be published, only the first copy to the Notepad can be, so the format is lost, sorry

This is also a long time ago, the wrong place also please forgive me. Hey, my book has not been published, put it here (the publishing house people say don't understand, oh, I almost fainted)

Script-based DVD applications

In the rapid development of the network today, the software industry more and more focus on web-based applications, down we will discuss the web-based programming. This is mainly about the development of a DVD application using the MSWebDVD control.

Insert MSWebDVD Object

The MSWebDVD object can handle all of the DVD navigation commands and display the video on a Web page. This will be a lot simpler than the original process, and the simple insert code example is as follows:

<object Classid=clsid:38ee5cee-4b62-11d3-854f-00a0c9c898e7 Id=dvd

Style= "HEIGHT:369PX; width:740px ">

<param name= "BackColor" value= "1048592" >

<param name= "Enableresetonstop" value= "-1" >

<param name= "ColorKey" value= "1048592" >


Allow users to process DVD commands

If you allow users to control DVD players, you need to provide a user interface to guide the user, such as the "Play", "Stop" button. The following code shows how to associate an HTML button with a 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 the DVD menu

When the user clicks on the screen button, MSWebDVD automatically handles the menu commands. The application does not need to handle anything to support the mouse. However, the application can not consider this automatic processing process. If you are interested in customizing your mouse, you can use the MSWebDVD method of associating menus, such as Selectandactivatebutton, Getbuttonatposition. To completely prohibit the automatic action of the mouse to deal with, then set the Disableautomouseprocessing property to be true.

Audio and child graph streams

A DVD can handle 8-channel audio streams, and each audio stream contains 6 separate channels from the 0―7. Only these flows can be activated at any time. For a child graph, there are 32 streams that are valid, from 0-31. The disc is usually made into the default audio and child graph stream, but an application allows the user to see all the valid streaming data and then choose a language that they like. The basic steps are processed and the audio is the same as the child graph stream.

1. Determine the number of valid flows for the specified caption.

2. Re-detect the properties of each stream.

3. Return the language code from the local identity and create a human-readable string.

4. Add the "Select" dialog box, or another user interface to allow users to select the preferred data stream.

(Note that audio and child graph stream tags start at 0, while most of the others start with 1)

Forcing the parent management level

Usually any title or part of a title in a DVD is labeled as a parent management layer (PML)

From 1 to 8, 8 is the most restrictive, and level 1 is the least restrictive. One idea provides a device to prevent a child from being viewed as a person's content, but the specificity of each country determines that they will not be the same. In the United States and Canada is a standard, and other countries are not the same.

The default state of the MSWebDVD object is to ignore pmls. For the application, it will notify the PML tag, so it is necessary to call Notifyparentallevels (true). When you encounter PML information on the disc, MSWEBDVD will notify your application. To enforce PMLS, your application must implement some logical passwords to connect users to different levels and respond to ec_dvd_parental_level_change events to allow or disallow access.

Saving and restoring bookmarks

A bookmark is a data structure within a MSWebDVD object that can be used to create a snapshot of the current user task, including information such as the current disc location, private parent level management, audio and child graph streaming, and so on. This means that the user can save the current DVD state and then continue viewing it from this state next time.

The Savebookmark method allows the user to save the location of their discs, and the Restorebookmark method allows the same user to then view the last stored position.

Only one bookmark can be stored at a time. If you call Savebookmark two times, the first bookmark will be overwritten by a second bookmark. Bookmarks are special to computers. Running the same HTML page on a different computer and then calling Restorebookmark will restore the most recent bookmark of that store, or return a flag error that was not previously stored.

Handling DVD Notification Events

When an event occurs, the MSWebDVD object sends a specific notification event to the application, such as when the DVD's domain has changed, when a new parent layer management is encountered, and so on. Event arguments can obtain additional information about the event. Both the error message and the warning message are sent in this way. To get a change to the DVD event bulletin, add the following code to the HTML script.

<script language= "JScript" For=dvd event= "dvdnotify (EventCode, Param1, Param2)" >

Processdvdevent (EventCode, Param1, PARAM2)


Then, in the script, you define the event code and the Processdvdevent function, and the following code shows its usage. (You can give your event handler function any name)

<script language= "JScript" >

DVD event codes are valued 257 through 283

var ec_dvdbase = 256;

var Ec_dvd_domain_change = (ec_dvdbase + 1);

var Ec_dvd_title_change = (ec_dvdbase + 2);

var Ec_dvd_chapter_start = (ec_dvdbase + 3);

var Ec_dvd_audio_stream_change = (ec_dvdbase + 4);

var Ec_dvd_subpicture_stream_change = (ec_dvdbase + 5);

var Ec_dvd_angle_change = (ec_dvdbase + 6);

var Ec_dvd_button_change = (ec_dvdbase + 7);

var Ec_dvd_valid_uops_change = (ec_dvdbase + 8);

var ec_dvd_still_on = (ec_dvdbase + 9);

var Ec_dvd_still_off = (ec_dvdbase + 10);

var ec_dvd_current_time = (ec_dvdbase + 11); Not used by MSWebDVD

var ec_dvd_error = (ec_dvdbase + 12);

var ec_dvd_warning = (ec_dvdbase + 13);

var ec_dvd_chapter_autostop = (ec_dvdbase + 14);

var EC_DVD_NO_FP_PGC = (ec_dvdbase + 15);

var Ec_dvd_playback_rate_change = (ec_dvdbase + 16);

var Ec_dvd_parental_level_change = (ec_dvdbase + 17);

var ec_dvd_playback_stopped = (ec_dvdbase + 18);

var ec_dvd_angles_available = (ec_dvdbase + 19);

var ec_dvd_playperiod_autostop = (ec_dvdbase + 20);

var ec_dvd_button_auto_activated = (ec_dvdbase + 21);

var Ec_dvd_cmd_start = (ec_dvdbase + 22); Not used by MSWebDVD

var ec_dvd_cmd_end = (ec_dvdbase + 23); Not used by MSWebDVD

var ec_dvd_disc_ejected = (ec_dvdbase + 24);

var ec_dvd_disc_inserted = (ec_dvdbase + 25);

var ec_dvd_current_hmsf_time = (ec_dvdbase + 26);

var Ec_dvd_karaoke_mode = (ec_dvdbase + 27);

var Ncurdomain;

var ncurparentallevel;

function Processdvdevent (EventCode, Param1, PARAM2)


Switch (EventCode)


Case Ec_dvd_domain_change:

Ncurdomain = Param1;

Do something


Case Ec_dvd_parental_level_change:

Ncurparentallevel = Param1;

Do something


Handle any other events of your are interested in






Handling User's event notifications

When a specific user operation is allowed or prohibited, the MSWebDVD object sends a UOP notification message to the application. Each user action has its own events, but they are all a Boolean amount that is used only to identify that the operation is now allowed or prohibited.

For each event you wish to handle, the specified event handler shows some code that the reader can refer to.

<script language= "JScript" For=dvd event= "Playforwards (benabled)" >

Playforwardseventhandler (benabled)


Now define your handler the "to" respond appropriately to the event. Assume that "button_play" variable this is the ID of the ' Play ' button in your application.

function Playforwardseventhander (benabled)


if (benabled = = True)

button_play.disabled = false;


Button_play.disabled = true;


Synchronize video that meets HTML requirements

By handling the event encoding event for the disc, a Web application can synchronize the video that satisfies the HTML. For example, you can make images and text change at a specified point on this page's video. The following code shows a call that synchronizes the Jscipt function through a time coded event.

Dvdtriggerpoints array holds frame count for each trigger. Must is in the 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 is 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) {

Case Ec_dvd_current_hmsf_time:

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 (0,2) *108000

+ timecode.substring (3,5) *1800

+ timecode.substring (6,8) *30

+ timecode.substring (9,11);

} else {

return 0;



Work with a LCIDs

LCID, or it can be called "locale identifer", is a 32-bit data type that helps us identify different locale code languages. One of these values is the primary language identifier, which can be used to identify the basic locale language. For example, English, Spanish and so on.

MSWebDVD requires a fully valid LCID as input parameters for the following two methods: Selectdefaultaudiolanguage and Selectdefaultsubpicturelanguage. These can be any valid LCID that can be identified by Windows, or even not be recognized by Windows. (hosts do not necessarily support local machine fonts, keyboard mappings, and so on) the following list writes out some generic LCIDs and MSWebDVD LCIDs that are not recognized by Windows default state but are valid for the. The table is not a complete LCIDs list.

Some effective 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 (Kong) 0x0c04 Chinese (PRC) 0x0804

Chinese (Singapore) 0x1004 Chinese (Taiwan) 0x0404 Croatian 0x041a

Czech 0x0405 Danish 0x0406 Dutch Belgian (0x0813)

Dutch (Standard) 0x0413 中文版 (Australian) 0x0c09 中文版 (Belize) 0x2809

中文版 (Canadian) 0x1009 中文版 (Caribbean) 0x2409 中文版 (Ireland) 0x1809

中文版 (Jamaica) 0x2009 中文版 (New Zealand) 0x1409 中文版 (South Africa) 0x1c09

中文版 (Trinidad) 0x2c09 中文版 (United Kingdom) 0x0809 Chinese (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 Greek 0x0408

Hebrew 0x040d Hungarian 0x040e Icelandic 0x040f

Indonesian 0x0421 Italian (Standard) 0x0410 Italian (Swiss) 0x0810

Japanese 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 (Brazilian) 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) 0x440a 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) 0x380a Spanish (Venezuela) 0x200a Swahili 0x0441

Swedish 0x041d Swedish (Finland) 0x081d Thai

Turkish 0x041f Ukrainian 0x0422

Some MSWebDVD methods and properties return the LCID to specify that the identity is valid on the track or caption. In order to use this information, your application will need to select the primary language identity from the return LCID. In order to achieve this goal, we can ilcid and 0x3ff to the bitwise AND operation. The following code excerpt demonstrates this implementation process. (The primary language ID contains at least 10 digits in the LCID)

Iprimarylang = ilcid & 0x3ff;

To get a human-readable string from the main language identifier, call Getlangfromlangid, the code is as follows:

Slanguage = DVD. Getlangfromlangid (Iprimarylang);

The following list shows the primary language identity in the 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

中文版 0x09 Estonian 0x25 Faeroese 0x38 Farsi

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 DVD-video disc that has the same navigation structure as a DVD video disc. Songs are stored in a general section format, and sections can be combined into a chapter, which is the basic playback unit.

The biggest difference between a karaoke disc and a regular DVD is the difference between the audio stream. The karaoke disc contains all the multi-channel audio, usually Dolby AC-3. Channels 0 and 1 generally include background sound effects, and 2 to 5 channels contain voice, synthetic, and other audio. A karaoke application can control the volume and destination speakers and control the mix channel.

Karaoke playback requires an audio decoder that requires a decoder that supports multichannel karaoke mixer information. The decoder must support the DVD Karaoke property setting (Am_property_dvdkaraoke).

When the DVD Navigator detects the contents of the karaoke on the disc, it automatically enters the karaoke mode and notifies the decoder that the three mixer channels should be muted until they are opened by the application.

1. Determine their content and number of mixing channels.

2. Provide a user interface to display the contents of the channel, allowing the user at any time to carry out the mixer channel switch.

The text of the DVD

DVDs, especially karaoke discs, may contain a database of text messages to supplement video and audio content. Text like this may include the title of the song, the art name, the record label, and so on on the karaoke disc. These words can be translated into different languages. These strings are optional and are not required on the disc to contain them. Their organizational structure is now achieved through the approximate mirroring of the logical level of the DVD label.

There are two basic types of strings: structure identification and content identification. The values of these types with 0x01 to 0x20 are structural identities. They are empty strings, and numeric codes are used to identify the logical structure, which means that the content string belongs to that logical structure. This structure is very much in line with the logical structure of the contents of the DVD disc: labels, headings, chapters, and so on. The remainder of the content identification is a string that is used to display the user interface information.

Historically, text strings on DVDs are unique, mostly using 0x01 and 0x02 structure identifiers and 0x30 type content strings. But now it's not so (1) more and more types of dvd-video discs contain text strings (2) in order to provide a detailed description of the contents of the disc, these strings are organized in more complex ways. The following example code shows how to determine the number of text string language blocks on a disc and to retrieve a readable string that lets the user set the language. 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 instrumentation code demonstrates how to enumerate strings and examine text string types. The result is in the HTML TEXTAREA element named "Mytextarea", so you can see how the number string type is used to organize the content string. The real program creates its own data structure to contain the string or to display a string to the user.

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


Mytextarea.value + = (StringType + ":" + DVD.) Getdvdtextstring (Ilanguage, j) + "\ n");


else//It´s a node indicating what level of the volume structure

The following strings would apply to


Mytextarea.value + = (stringtype + "\ n");



}//end function Gettextstrings

DVD text string type

This table lists a subset of the DVD text string type. The strings below 0x20 are content strings. Most of the song names and titles are 0x30.

Structure identifier

Volume 0x01 indicates that the string belongs to a DVD volume

Title 0X02 titles

Parentalid 0x03 indicates that the string belongs to a specific parent ID.

Chapter 0x04 Indicator string belongs to Chapter

Cell 0x05 indicates that the string belongs to the unit (a scene of the movie)

Stream designator

Audio 0x10 indicates that the string belongs to the audio stream

Subpicture 0x11 indicates that the string belongs to the child graph stream

Angle 0x12 indicates that the string belongs to a corner block

Audio channel designator

Channel 0x20 indicates that a string belongs to a channel left by the audio

Universal Content String

Name 0x30 General identifier for title, chapter, and song name

Comments 0x31 The general contents of title, chapter and song

Header content String

Series 0x38 of Title, chapter, Song

Additional information about the title or chapter of a Movie 0x39 movie

Video 0x3a Additional information about the title or chapter

Additional information about the title or chapter of the Album 0x3b album

Additional information for the title or chapter of song 0x3c songs

Additional information for other 0x3f titles or chapters

Second title content string

Series 0x40 Additional information about the title, chapter, and song

Additional information about the title or chapter of a Movie 0x41 movie

Video 0x42 Additional information about the title or chapter

Additional information about the title or chapter of the Album 0x43 album

Additional information about the title or chapter of song 0x44 songs.

Additional information for other 0X45 titles or chapters

Raw content String

Series 0x48 Additional information about the title, chapter, and song

Additional information about the title or chapter of a Movie 0x49 movie

Video 0x4a Additional information about the title or chapter

Additional information about the title or chapter of the Album 0x4b album

Additional information about the title or chapter of song 0x4c songs.

Additional information for other 0X4F titles or chapters

Other information content string

Other Scene 0x50 movie title or chapter optional scene additional information

Other cut 0x51 movie title or chapter optional clips additional information

Additional information for Take 0x52 movie title or chapter optional screen

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.