r48131 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48130‎ | r48131 | r48132 >
Date:15:19, 7 March 2009
Author:maikmerten
Status:deferred
Tags:
Comment:
enable aspect-ratio correction as indicated by the video file. Add "ignoreAspect" to fall back to old behaviour (forced square pixels).
Modified paths:
  • /trunk/cortado/src/com/fluendo/player/Cortado.java (modified) (history)
  • /trunk/cortado/src/com/fluendo/player/CortadoPipeline.java (modified) (history)
  • /trunk/cortado/src/com/fluendo/plugin/VideoSink.java (modified) (history)

Diff [purge]

Index: trunk/cortado/src/com/fluendo/player/CortadoPipeline.java
@@ -32,6 +32,7 @@
3333 private String password;
3434 private boolean enableAudio;
3535 private boolean enableVideo;
 36+ private boolean ignoreAspect;
3637 private int enableKate;
3738 private Component component;
3839 private int bufferSize = -1;
@@ -111,7 +112,7 @@
112113 v_queue = ElementFactory.makeByName("queue", "v_queue");
113114 if (v_queue == null) {
114115 noSuchElement ("queue");
115 - return;
 116+ return;
116117 }
117118
118119 if (!setupVideoDec ("theoradec"))
@@ -329,6 +330,9 @@
330331 public void setUserId(String aUserId) {
331332 userId = aUserId;
332333 }
 334+ public void setIgnoreAspect(boolean ignore) {
 335+ ignoreAspect = ignore;
 336+ }
333337 public void setPassword(String aPassword) {
334338 password = aPassword;
335339 }
@@ -559,6 +563,9 @@
560564 noSuchElement ("videosink");
561565 return false;
562566 }
 567+
 568+ videosink.setProperty("ignore-aspect", ignoreAspect ? "true" : "false");
 569+
563570 videosink.setProperty ("component", component);
564571 resize(component.getSize());
565572
Index: trunk/cortado/src/com/fluendo/player/Cortado.java
@@ -37,6 +37,7 @@
3838 private int kateIndex;
3939 private boolean showSpeaker;
4040 private boolean keepAspect;
 41+ private boolean ignoreAspect;
4142 private boolean autoPlay;
4243 private int bufferSize;
4344 private String userId;
@@ -110,6 +111,8 @@
111112 {"showSpeaker", "boolean", "Show a speaker icon when audio is available (default true)"},
112113 {"keepAspect", "boolean",
113114 "Use aspect ratio of video (default true)"},
 115+ {"ignoreAspect", "boolean",
 116+ "Ignore the aspect ratio as signalled by the video, always assume square pixels (default false)"},
114117 {"bufferSize", "int",
115118 "The size of the prebuffer in Kbytes (default 100)"},
116119 {"bufferLow", "int", "Percent of empty buffer (default 10)"},
@@ -232,6 +235,7 @@
233236 hideTimeout = getIntParam("hideTimeout", 3);
234237 showSpeaker = getBoolParam("showSpeaker", true);
235238 keepAspect = getBoolParam("keepAspect", true);
 239+ ignoreAspect = getBoolParam("ignoreAspect", false);
236240 bufferSize = getIntParam("bufferSize", 200);
237241 bufferLow = getIntParam("bufferLow", 10);
238242 bufferHigh = getIntParam("bufferHigh", 70);
@@ -260,6 +264,7 @@
261265 pipeline.setPassword(password);
262266 pipeline.enableAudio(audio);
263267 pipeline.enableVideo(video);
 268+ pipeline.setIgnoreAspect(ignoreAspect);
264269 pipeline.enableKateIndex(kateIndex);
265270 pipeline.setBufferSize(bufferSize);
266271 pipeline.setBufferLow(bufferLow);
Index: trunk/cortado/src/com/fluendo/plugin/VideoSink.java
@@ -27,6 +27,7 @@
2828 {
2929 private Component component;
3030 private boolean keepAspect;
 31+ private boolean ignoreAspect;
3132 private boolean scale;
3233 private Frame frame;
3334
@@ -56,17 +57,16 @@
5758 aspectX = caps.getFieldInt("aspect_x", 1);
5859 aspectY = caps.getFieldInt("aspect_y", 1);
5960
60 - /*
61 - Debug.log(Debug.DEBUG, this+" dimension: "+width+"x"+height+", aspect: "+aspectX+"/"+aspectY);
 61+ if(!ignoreAspect) {
 62+ Debug.log(Debug.DEBUG, this+" dimension: "+width+"x"+height+", aspect: "+aspectX+"/"+aspectY);
6263
63 - if (aspectY > aspectX) {
64 - height = height * aspectY / aspectX;
 64+ if (aspectY > aspectX) {
 65+ height = height * aspectY / aspectX;
 66+ } else {
 67+ width = width * aspectX / aspectY;
 68+ }
 69+ Debug.log(Debug.DEBUG, this+" scaled source: "+width+"x"+height);
6570 }
66 - else {
67 - width = width * aspectX / aspectY;
68 - }
69 - Debug.log(Debug.DEBUG, this+" scaled source: "+width+"x"+height);
70 - */
7171
7272 component.setVisible(true);
7373
@@ -166,8 +166,9 @@
167167 }
168168 else if (name.equals("keep-aspect")) {
169169 keepAspect = String.valueOf(value).equals("true");
170 - }
171 - else if (name.equals("scale")) {
 170+ } else if(name.equals("ignore-aspect")) {
 171+ ignoreAspect = value.toString().equals("true");
 172+ } else if (name.equals("scale")) {
172173 scale = String.valueOf(value).equals("true");
173174 } else if (name.equals("bounds")) {
174175 bounds = (Rectangle) value;

Status & tagging log