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:
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.
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.
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
Break
Case Ec_dvd_parental_level_change:
Ncurparentallevel = Param1;
Do something
Break
Handle any other events of your are interested in
Default
Break
}
}
</SCRIPT>
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.
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;
Else
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?
if (Timecode2frames (currentdvdtime) >= Dvdtriggerpoints[dvdtimeindex]) {
If trigger point has passed, execute the associated function
Eval (dvdtriggerprocs[dvdtimeindex++]);
}
}
}
Break
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 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:
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
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
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:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.