home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 139 / cd-rom 139.iso / capa / mcoder / MediaCoder-0.5.1-r3.exe / htdocs / extensions / archos / main.js < prev   
Encoding:
JavaScript  |  2006-11-02  |  1.9 KB  |  70 lines

  1. /*************************************************************************
  2. * MediaCoder extension - Archos AV Series
  3. * Distributed under GPL license
  4. * Copyright (c) 2005-06 Stanley Huang <stanleyhuangyc@yahoo.com.cn
  5. * All rights reserved.
  6. *************************************************************************/
  7.  
  8. function SetModel(model)
  9. {
  10.     SendCommand("stop_play");
  11.     // switch picture
  12.     var imgbox = document.getElementById("devimg");
  13.     if (model == 0) {
  14.         // resize window
  15.         window.innerWidth = 910;
  16.         window.innerHeight = 400;
  17.         imgbox.src = "av700.png";
  18.     } else {
  19.         imgbox.src = "av500.png";
  20.         window.innerWidth = 910;
  21.         window.innerHeight = 460;
  22.     }
  23.     ApplyParams();
  24. }
  25.  
  26. function GetScreenRect()
  27. {
  28.     var model = document.getElementById("model").value;
  29.     if (model == 0) {
  30.         return "338,108,480,272";
  31.     } else {
  32.         return "276,153,480,272";
  33.     }
  34. }
  35.  
  36. function ApplyParams()
  37. {
  38.     var doc = NewXML("MediaCoderPref");
  39.     if (!doc) {
  40.         alert("Error creating config XML");
  41.         return;
  42.     }
  43.     
  44.     var model = document.getElementById("model").value;
  45.     var format = document.getElementById("format").value;
  46.     
  47.     AddPrefNode(doc, "overall.video.format", format);
  48.     AddPrefNode(doc, "overall.video.bitrate", document.getElementById("vb").value);
  49.     AddPrefNode(doc, "audioenc.lame.quality", document.getElementById("aq").value);
  50.     AddPrefNode(doc, "videofilter.frame.fps", document.getElementById("fps").value);
  51.     
  52.     if (model == 0) {
  53.         AddPrefNode(doc, "videofilter.scale.width", 480);
  54.         AddPrefNode(doc, "videofilter.scale.height", 234);
  55.     } else {
  56.         AddPrefNode(doc, "videofilter.scale.width", 480);
  57.         AddPrefNode(doc, "videofilter.scale.height", 272);
  58.     }
  59.     AddPrefNode(doc, "videofilter.crop.mode", document.getElementById("crop").value);
  60.     
  61.     // post settings to MediaCoder
  62.     PostPrefXML(doc);
  63. }
  64.  
  65. function Unload()
  66. {
  67.     // stop playback
  68.     SendCommand("stop_play");
  69. }
  70.