本文整理汇总了Java中com.smartdevicelink.proxy.rpc.ImageResolution类的典型用法代码示例。如果您正苦于以下问题:Java ImageResolution类的具体用法?Java ImageResolution怎么用?Java ImageResolution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageResolution类属于com.smartdevicelink.proxy.rpc包,在下文中一共展示了ImageResolution类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CameraToMpegTest
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public CameraToMpegTest(SdlProxyALM proxy, Context context) {
ImageResolution ir = null;
try {
ir = proxy.getDisplayCapabilities().getScreenParams().getImageResolution();
} catch (SdlException e) {
Log.i(TAG, "Couldn't get image resolution.");
}
this.context = context;
this.proxy = proxy;
mFPS = PREFS_DEFAULT_FPS;
if(ir != null){
mWidth = ir.getResolutionWidth();
mHeight = ir.getResolutionHeight();
}else{
mWidth = PREFS_DEFAULT_WIDTH;
mHeight = PREFS_DEFAULT_HEIGHT;
}
mBitrate = getInt("codec_bitrate",PREFS_DEFAULT_BITRATE);
mIframeRate = getInt("codec_iframe_rate",IFRAME_INTERVAL);
this.isEncryptedVideo = PREFS_DEFAULT_ENCRYPTED;
streamConnected = false;
}
示例2: StartProtocolService
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
@Override
public void StartProtocolService(SessionType sessionType, byte sessionID, boolean isEncrypted) {
SdlPacket header = SdlPacketFactory.createStartSession(sessionType, 0x00, getMajorVersionByte(), sessionID, isEncrypted);
if(sessionType.equals(SessionType.NAV)){
SdlSession videoSession = sdlconn.findSessionById(sessionID);
if(videoSession != null){
ImageResolution desiredResolution = videoSession.getDesiredVideoParams().getResolution();
VideoStreamingFormat desiredFormat = videoSession.getDesiredVideoParams().getFormat();
if(desiredResolution != null){
header.putTag(ControlFrameTags.Video.StartService.WIDTH, desiredResolution.getResolutionWidth());
header.putTag(ControlFrameTags.Video.StartService.HEIGHT, desiredResolution.getResolutionHeight());
}
if(desiredFormat != null){
header.putTag(ControlFrameTags.Video.StartService.VIDEO_CODEC, desiredFormat.getCodec().toString());
header.putTag(ControlFrameTags.Video.StartService.VIDEO_PROTOCOL, desiredFormat.getProtocol().toString());
}
}
}
handlePacketToSend(header);
}
示例3: validateImageResolution
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public static boolean validateImageResolution(ImageResolution image1, ImageResolution image2){
if(image1 == null){
return ( image2 == null );
}
if(image2 == null){
return ( image1 == null );
}
if((int) image1.getResolutionHeight() != (int) image2.getResolutionHeight()){
log("validateImageResolution",
"Height " + image1.getResolutionHeight() + " didn't match height " + image2.getResolutionHeight()
+ ".");
return false;
}
if((int) image1.getResolutionWidth() != (int) image2.getResolutionWidth()){
log("validateImageResolution",
"Width " + image1.getResolutionWidth() + " didn't match width " + image2.getResolutionWidth() + ".");
return false;
}
return true;
}
示例4: testJson
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public void testJson(){
JSONObject reference = new JSONObject();
try{
reference.put(ImageResolution.KEY_RESOLUTION_HEIGHT, Test.GENERAL_INT);
reference.put(ImageResolution.KEY_RESOLUTION_WIDTH, Test.GENERAL_INT);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
} catch(JSONException e){
fail(Test.JSON_FAIL);
}
}
示例5: VideoStreamingParameters
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public VideoStreamingParameters(){
displayDensity = DEFAULT_DENSITY;
frameRate = DEFAULT_FRAMERATE;
bitrate = DEFAULT_BITRATE;
interval = DEFAULT_INTERVAL;
resolution = new ImageResolution();
resolution.setResolutionWidth(DEFAULT_WIDTH);
resolution.setResolutionHeight(DEFAULT_HEIGHT);
format = new VideoStreamingFormat();
format.setProtocol(DEFAULT_PROTOCOL);
format.setCodec(DEFAULT_CODEC);
}
示例6: update
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
/**
* Update the values contained in the capability that should have been returned through the SystemCapabilityManager.
* This update will use the most preferred streaming format from the module.
* @param capability the video streaming capability returned from the SystemCapabilityManager
* @see com.smartdevicelink.proxy.SystemCapabilityManager
* @see VideoStreamingCapability
*/
public void update(VideoStreamingCapability capability){
if(capability.getMaxBitrate()!=null){ this.bitrate = capability.getMaxBitrate(); }
ImageResolution resolution = capability.getPreferredResolution();
if(resolution!=null){
if(resolution.getResolutionHeight()!=null && resolution.getResolutionHeight() > 0){ this.resolution.setResolutionHeight(resolution.getResolutionHeight()); }
if(resolution.getResolutionWidth()!=null && resolution.getResolutionWidth() > 0){ this.resolution.setResolutionWidth(resolution.getResolutionWidth()); }
}
List<VideoStreamingFormat> formats = capability.getSupportedFormats();
if(formats != null && formats.size()>0){
this.format = formats.get(0);
}
}
示例7: testJson
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public void testJson() {
JSONObject reference = new JSONObject();
try {
reference.put(VideoStreamingCapability.KEY_MAX_BITRATE, Test.GENERAL_INT);
reference.put(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION, Test.GENERAL_IMAGERESOLUTION);
reference.put(VideoStreamingCapability.KEY_SUPPORTED_FORMATS, Test.GENERAL_VIDEOSTREAMINGFORMAT_LIST);
reference.put(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED, Test.GENERAL_BOOLEAN);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
assertTrue(Test.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
} else if (key.equals(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION)) {
ImageResolution irReference = (ImageResolution) JsonUtils.readObjectFromJsonObject(reference, key);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(JsonUtils.readJsonObjectFromJsonObject(underTest, key));
assertTrue(Validator.validateImageResolution(irReference, new ImageResolution(hashTest)));
} else if (key.equals(VideoStreamingCapability.KEY_SUPPORTED_FORMATS)){
List<VideoStreamingFormat> vsfReference = (List<VideoStreamingFormat>) JsonUtils.readObjectFromJsonObject(reference, key);
JSONArray vsfArray = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
int i = 0;
for(VideoStreamingFormat vsf : vsfReference){
assertTrue(Validator.validateSupportedFormats(vsf, new VideoStreamingFormat(JsonRPCMarshaller.deserializeJSONObject(vsfArray.getJSONObject(i++)))));
}
}
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
}
示例8: setUp
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
@Override
public void setUp(){
msg = new ImageResolution();
msg.setResolutionHeight(Test.GENERAL_INT);
msg.setResolutionWidth(Test.GENERAL_INT);
}
示例9: testJson
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public void testJson() {
JSONObject reference = new JSONObject();
try {
reference.put(ScreenParams.KEY_RESOLUTION, Test.JSON_IMAGERESOLUTION);
reference.put(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE, Test.JSON_TOUCHEVENTCAPABILITIES);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while (iterator.hasNext()) {
String key = (String) iterator.next();
if (key.equals(ScreenParams.KEY_TOUCH_EVENT_AVAILABLE)) {
JSONObject touchEventObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject touchEventObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
assertTrue(Test.TRUE, Validator.validateTouchEventCapabilities(
new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjReference)),
new TouchEventCapabilities(JsonRPCMarshaller.deserializeJSONObject(touchEventObjTest))));
} else if (key.equals(ScreenParams.KEY_RESOLUTION)) {
JSONObject resolutionObjReference = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject resolutionObjTest = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
assertTrue(Test.TRUE, Validator.validateImageResolution(
new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjReference)),
new ImageResolution(JsonRPCMarshaller.deserializeJSONObject(resolutionObjTest))));
} else {
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
} catch (JSONException e) {
fail(Test.JSON_FAIL);
}
}
示例10: setStreamingParams
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
@SuppressWarnings("unused")
public void setStreamingParams(int displayDensity, ImageResolution resolution, int frameRate, int bitrate, int interval, VideoStreamingFormat format) {
this.streamingParams = new VideoStreamingParameters(displayDensity, frameRate, bitrate, interval, resolution, format);
}
示例11: setResolution
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public void setResolution(ImageResolution resolution){
this.resolution = resolution;
}
示例12: getResolution
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public ImageResolution getResolution() {
return resolution;
}
示例13: testJson
import com.smartdevicelink.proxy.rpc.ImageResolution; //导入依赖的package包/类
public void testJson(){
JSONObject reference = new JSONObject();
try{
reference.put(ImageField.KEY_IMAGE_RESOLUTION, Test.JSON_IMAGERESOLUTION);
reference.put(ImageField.KEY_IMAGE_TYPE_SUPPORTED, JsonUtils.createJsonArray(Test.GENERAL_FILETYPE_LIST));
reference.put(ImageField.KEY_NAME, Test.GENERAL_IMAGEFIELDNAME);
JSONObject underTest = msg.serializeJSON();
assertEquals(Test.MATCH, reference.length(), underTest.length());
Iterator<?> iterator = reference.keys();
while(iterator.hasNext()){
String key = (String) iterator.next();
if(key.equals(ImageField.KEY_IMAGE_RESOLUTION)){
JSONObject objectEquals = JsonUtils.readJsonObjectFromJsonObject(reference, key);
JSONObject testEquals = JsonUtils.readJsonObjectFromJsonObject(underTest, key);
Hashtable<String, Object> hashReference = JsonRPCMarshaller.deserializeJSONObject(objectEquals);
Hashtable<String, Object> hashTest = JsonRPCMarshaller.deserializeJSONObject(testEquals);
assertTrue(Test.TRUE, Validator.validateImageResolution( new ImageResolution(hashReference), new ImageResolution(hashTest)));
} else if(key.equals(ImageField.KEY_IMAGE_TYPE_SUPPORTED)) {
JSONArray imageTypeArrayReference = JsonUtils.readJsonArrayFromJsonObject(reference, key);
JSONArray imageTypeArrayTest = JsonUtils.readJsonArrayFromJsonObject(underTest, key);
List<FileType> imageTypeListReference = new ArrayList<FileType>();
List<FileType> imageTypeListTest = new ArrayList<FileType>();
assertEquals(Test.MATCH, imageTypeArrayReference.length(), imageTypeArrayTest.length());
for (int index = 0 ; index < imageTypeArrayReference.length(); index++) {
imageTypeListReference.add( (FileType)imageTypeArrayReference.get(index) );
imageTypeListTest.add( (FileType)imageTypeArrayTest.get(index) );
}
assertTrue(Test.TRUE, imageTypeListReference.containsAll(imageTypeListTest) && imageTypeListTest.containsAll(imageTypeListReference));
} else{
assertEquals(Test.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
}
}
}catch(JSONException e){
fail(Test.JSON_FAIL);
}
}