shithub: h264bsd

Download patch

ref: 6866ab687ccd1b19d21f2125d63c9bd4c75735e9
parent: e0f46e9a44dec8725438a23708679494c315e2b6
author: Chris Jarabek <chris.jarabek@gmail.com>
date: Tue Feb 11 05:42:13 EST 2014

Fixed getCroppingInfo to return correct meta data.  Also modified event params to send back both w / h and macroblock w / h

--- a/js/h264bsd.js
+++ b/js/h264bsd.js
@@ -194,13 +194,19 @@
 		    encoding: 'YUV',
 		    picture: bytes, 
 		    height: croppingInfo.height, 
-		    width: croppingInfo.width};
+		    width: croppingInfo.width,
+		    mbWidth: (H264Decoder.h264bsdPicWidth_(self.Module, self.pStorage)*16),
+		    mbHeight: (H264Decoder.h264bsdPicHeight_(self.Module, self.pStorage)*16)
+		};		
     }else{
 		ret = {
 			encoding: 'RGB',
 		    picture: H264Decoder.convertYUV2RGB_(bytes, croppingInfo, self), 
 		    height: croppingInfo.height, 
-		    width: croppingInfo.width};
+		    width: croppingInfo.width,
+  		    mbWidth: (H264Decoder.h264bsdPicWidth_(self.Module, self.pStorage)*16),
+		    mbHeight: (H264Decoder.h264bsdPicHeight_(self.Module, self.pStorage)*16)
+		};
     }
     
     return ret; 
@@ -209,11 +215,36 @@
 
 H264Decoder.getCroppingInfo_ = function(Module, pStorage){
 	var self = this;
+	
+	var pCroppingFlag = H264Decoder.malloc_(Module, 4);
+	var croppingFlag = 0;
+
+	var pLeftOffset = H264Decoder.malloc_(Module, 4);
+	var leftOffset = 0;
+
+	var pWidth = H264Decoder.malloc_(Module, 4);
+	var width = 0;
+
+	var pTopOffset = H264Decoder.malloc_(Module, 4);
+	var topOffset = 0;
+
+	var pHeight = H264Decoder.malloc_(Module, 4);
+	var height = 0;
+
+
+	H264Decoder.h264bsdCroppingParams_(Module, pStorage, pCroppingFlag, pLeftOffset, pWidth, pTopOffset, pHeight);
+	
+	croppingFlag = Module.getValue(pCroppingFlag, 'i32');	
+	leftOffset = Module.getValue(pLeftOffset, 'i32');	
+	width = Module.getValue(pWidth, 'i32');
+	topOffset = Module.getValue(pTopOffset, 'i32');
+	height = Module.getValue(pHeight, 'i32');
+
 	var result = {
-		'width': (H264Decoder.h264bsdPicWidth_(Module, pStorage)*16),
-		'height': (H264Decoder.h264bsdPicHeight_(Module, pStorage)*16),
-		'top': 0,
-		'left': 0
+		'width': width,
+		'height': height,
+		'top': topOffset,
+		'left': leftOffset
 	};
 	return result;
 };