home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / publish / directtest.script next >
Encoding:
Text File  |  2009-09-14  |  3.0 KB  |  116 lines

  1. declare vd = VirtualDub;
  2. declare vdv = vd.video;
  3. declare vdvf = vd.video.filters;
  4. declare vda = vd.audio;
  5. declare vds = vd.subset;
  6. declare log = vd.Log;
  7. declare tostr = Sylia.ToString;
  8. declare assert = Sylia.Assert;
  9. declare validate = vdv.__ValidateFrames;
  10.  
  11. // override the default mode to make sure we aren't tripped by saved settings
  12. vdv.SetInputFormat(0);
  13. vdv.SetOutputFormat(0);
  14.  
  15. // create test file
  16. vd.Open("", "TestId", 0);
  17. assert(vdv.width == 8);
  18. assert(vdv.height == 4);
  19.  
  20. // test frames [0,9] via selection
  21. vd.Open("", "TestId", 0);
  22. vdv.SetMode(0);
  23. vdv.SetRange(0, 9000);
  24. vd.SaveAVI("__test0.avi");
  25. vd.Open("__test0.avi");
  26.  
  27. validate(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
  28.  
  29. // test frames [5, 9] via selection
  30. vd.Open("", "TestId", 0);
  31. vdv.SetRange(500, 9000);
  32. vd.SaveAVI("__test0.avi");
  33. vd.Open("__test0.avi");
  34.  
  35. validate(5, 6, 7, 8, 9);
  36.  
  37. // test frames [4, 7] -> [0, 7] via selection
  38. vd.Open("", "TestId", 0);
  39. vdv.SetRange(400, 9200);
  40. vd.SaveAVI("__test0.avi");
  41. vd.Open("__test0.avi");
  42.  
  43. validate(0, 1, 2, 3, 4, 5, 6, 7);
  44.  
  45. // test frames [0,9] via subset
  46. vd.Open("", "TestId", 0);
  47. vdv.SetMode(0);
  48. vdv.SetRange();
  49. vds.Clear();
  50. vds.AddRange(0, 10);
  51. vd.SaveAVI("__test0.avi");
  52. vd.Open("__test0.avi");
  53.  
  54. validate(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
  55.  
  56. // test frames [5, 9] via subset
  57. vd.Open("", "TestId", 0);
  58. vds.Clear();
  59. vds.AddRange(5, 5);
  60. vd.SaveAVI("__test0.avi");
  61. vd.Open("__test0.avi");
  62.  
  63. validate(5, 6, 7, 8, 9);
  64.  
  65. // test frames [4, 7] -> [0, 7] via subset
  66. vd.Open("", "TestId", 0);
  67. vds.Clear();
  68. vds.AddRange(4, 4);
  69. vd.SaveAVI("__test0.avi");
  70. vd.Open("__test0.avi");
  71.  
  72. validate(0, 1, 2, 3, 4, 5, 6, 7);
  73.  
  74. // Test frame extraction with selection after deleting key frame via subset.
  75.  
  76. vd.Open("", "TestId", 0);
  77. vds.Clear();
  78. vds.AddRange(15, 10);
  79. vdv.SetRange(200, 600);
  80. vd.SaveAVI("__test0.avi");
  81. vd.Open("__test0.avi");
  82.  
  83. validate(15, 16, 17, 18);
  84.  
  85. // Versions <1.7.X had a bug where they would do a nearest-keyframe check using the
  86. // video source on the start point, even though the start point was in timeline
  87. // frames. This then got fixed up _again_ on the timeline itself, resulting in more
  88. // frames included than necessary. This only happened if you had both the subset and
  89. // selection active.
  90. //
  91. // In this case, we use [13, 23] as the subset, and then select timeline frames [2, 3].
  92. // This should give [15, 16]. However, in 1.7.8, the 2 gets looked up in the video
  93. // source to get key frame 0, backing off the selection to [0, 3]. This then produces
  94. // [13, 16], and key frame restrictions then net [10, 16].
  95.  
  96. vd.Open("", "TestId", 0);
  97. vds.Clear();
  98. vds.AddRange(13, 10);
  99. vdv.SetRange(200, 600);
  100. vd.SaveAVI("__test0.avi");
  101. vd.Open("__test0.avi");
  102.  
  103. validate(15, 16);
  104.  
  105. // Reset the mode to full and retry the first test. The same restrictions should not
  106. // be in effect.
  107. vd.Open("", "TestId", 0);
  108. vdv.SetMode(3);
  109. vds.Clear();
  110. vds.AddRange(15, 10);
  111. vdv.SetRange(200, 600);
  112. vd.SaveAVI("__test0.avi");
  113. vd.Open("__test0.avi");
  114.  
  115. assert(vdv.length == 2);
  116.