Get current video aspect ratio.
    @param p_mi: the media player.
    @return: the video aspect ratio or NULL if unspecified (the result must be released with free() or L{libvlc_free}()).
348828
def libvlc_video_get_aspect_ratio(p_mi):
    '''
    '''
    f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \
        _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result,
                    ctypes.c_void_p, MediaPlayer)
    return f(p_mi)
1133073
public static int getPixelFromDp(Context context, int dp) {
		// Get the screen's density scale		
		float scale = context.getResources().getDisplayMetrics().density;

		// Convert the dps to pixels, based on density scale
		// because dp*scale is cast as an integer value, this will cause the result to be truncated.
		// Therefore, Adding ROUND_FACTOR helps the result to have properly rounded integer value.
		return (int)(dp * scale + ROUND_FACTOR);
	}
1030924
public float getPixelSize() {
    if (mVectorState == null && mVectorState.mVPathRenderer == null ||
        mVectorState.mVPathRenderer.mBaseWidth == 0 ||
        mVectorState.mVPathRenderer.mBaseHeight == 0 ||
        mVectorState.mVPathRenderer.mViewportHeight == 0 ||
        mVectorState.mVPathRenderer.mViewportWidth == 0) {
      return 1; // fall back to 1:1 pixel mapping.
    }
    float intrinsicWidth = mVectorState.mVPathRenderer.mBaseWidth;
    float intrinsicHeight = mVectorState.mVPathRenderer.mBaseHeight;
    float viewportWidth = mVectorState.mVPathRenderer.mViewportWidth;
    float viewportHeight = mVectorState.mVPathRenderer.mViewportHeight;
    float scaleX = viewportWidth / intrinsicWidth;
    float scaleY = viewportHeight / intrinsicHeight;
    return Math.min(scaleX, scaleY);
  }
586936
def libvlc_video_set_marquee_string(p_mi, option, psz_text):
    '''
    '''
    f = _Cfunctions.get('libvlc_video_set_marquee_string', None) or \
        _Cfunction('libvlc_video_set_marquee_string', ((1,), (1,), (1,),), None,
                    None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p)
    return f(p_mi, option, psz_text)
825369
private static List<Dimension> getVideoResolutions(ImageFormat format) {

		if (format == null) {
			throw new IllegalArgumentException("Image format cannot be null!");
		}

		ResolutionInfo info = format.getResolutionInfo();
		ResolutionInfo.Type type = info.getType();

		switch (type) {
			case DISCRETE:
				return getResolutionsDiscrete(info);
			case STEPWISE:
				return getResolutionsStepwise(info);
			case UNSUPPORTED:
				return getResolutionsUnsupported(info);
			default:
				throw new WebcamException("Unknown resolution type " + type);
		}
	}
1278563
private static void choosePreviewSize(Camera.Parameters parms, int width, int height) {
        // We should make sure that the requested MPEG size is less than the preferred
        // size, and has the same aspect ratio.
        Camera.Size ppsfv = parms.getPreferredPreviewSizeForVideo();
        if (ppsfv != null && VERBOSE) {
            Log.d(TAG, "Camera preferred preview size for video is " +
                    ppsfv.width + "x" + ppsfv.height);
        }

        for (Camera.Size size : parms.getSupportedPreviewSizes()) {
            if (size.width == width && size.height == height) {
                parms.setPreviewSize(width, height);
                return;
            }
        }

        Log.w(TAG, "Unable to set preview size to " + width + "x" + height);
        if (ppsfv != null) {
            parms.setPreviewSize(ppsfv.width, ppsfv.height);
        }
        // else use whatever the default size is
    }
1083705
private int getFrame(long pos) {
        int sample = 1;
        int len = frames.size();
        MP4Frame frame = null;
        for (int f = 0; f < len; f++) {
            frame = frames.get(f);
            if (pos == frame.getOffset()) {
                sample = f;
                break;
            }
        }
        return sample;
    }
1174038
def libvlc_media_player_get_nsobject(p_mi):
    '''
    '''
    f = _Cfunctions.get('libvlc_media_player_get_nsobject', None) or \
        _Cfunction('libvlc_media_player_get_nsobject', ((1,),), None,
                    ctypes.c_void_p, MediaPlayer)
    return f(p_mi)
564174
public static int getDpFromPixel(Context context, int pixel) {
		float scale = context.getResources().getDisplayMetrics().density; // get display density

		return (int)(pixel / scale);
	}
75222
def libvlc_media_list_player_set_media_player(p_mlp, p_mi):
    '''
    '''
    f = _Cfunctions.get('libvlc_media_list_player_set_media_player', None) or \
        _Cfunction('libvlc_media_list_player_set_media_player', ((1,), (1,),), None,
                    None, MediaListPlayer, MediaPlayer)
    return f(p_mlp, p_mi)
258567
private VideoFormat getSizedVideoFormat(Dimension size) {

		Format[] formats = device.getFormats();
		VideoFormat format = null;

		for (Format f : formats) {

			if (!"RGB".equalsIgnoreCase(f.getEncoding()) || !(f instanceof VideoFormat)) {
				continue;
			}

			Dimension d = ((VideoFormat) f).getSize();
			if (d.width == size.width && d.height == size.height) {
				format = (VideoFormat) f;
				break;
			}
		}

		return format;
	}
1072524
public int getPixelSize(Component component) {
        if (unit == PIXEL) {
            return intValue();
        } else if (unit == POINT) {
            return Sizes.pointAsPixel(intValue(), component);
        } else if (unit == INCH) {
            return Sizes.inchAsPixel(value, component);
        } else if (unit == MILLIMETER) {
            return Sizes.millimeterAsPixel(value, component);
        } else if (unit == CENTIMETER) {
            return Sizes.centimeterAsPixel(value, component);
        } else if (unit == DIALOG_UNITS_X) {
            return Sizes.dialogUnitXAsPixel(intValue(), component);
        } else if (unit == DIALOG_UNITS_Y) {
            return Sizes.dialogUnitYAsPixel(intValue(), component);
        } else {
            throw new IllegalStateException("Invalid unit " + unit);
        }
    }
1035600
def pixel_width(self):
        
        return self.zoom_factor * ((self._finish - self._start) / self._resolution)
437024
def libvlc_video_get_chapter_description(p_mi, i_title):
    '''
    '''
    f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \
        _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None,
                    ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int)
    return f(p_mi, i_title)
427799
def libvlc_media_get_codec_description(i_type, i_codec):
    '''
    '''
    f = _Cfunctions.get('libvlc_media_get_codec_description', None) or \
        _Cfunction('libvlc_media_get_codec_description', ((1,), (1,),), None,
                    ctypes.c_char_p, TrackType, ctypes.c_uint32)
    return f(i_type, i_codec)
1077303
def libvlc_media_set_meta(p_md, e_meta, psz_value):
    '''
    '''
    f = _Cfunctions.get('libvlc_media_set_meta', None) or \
        _Cfunction('libvlc_media_set_meta', ((1,), (1,), (1,),), None,
                    None, Media, Meta, ctypes.c_char_p)
    return f(p_md, e_meta, psz_value)
584443
protected HtmlElement getFlashPlayerElement(Media media, Dimension dimension) {
    Asset asset = getDamAsset(media);
    if (asset == null) {
      return null;
    }

    com.day.cq.dam.api.Rendition rendition = asset.getRendition(new PrefixRenditionPicker(VideoConstants.RENDITION_PREFIX + H264_PROFILE));
    if (rendition == null) {
      return null;
    }

    String playerUrl = urlHandler.get("/etc/clientlibs/foundation/video/swf/StrobeMediaPlayback.swf")
        .buildExternalResourceUrl();

    // strobe specialty: path must be relative to swf file
    String renditionUrl = "../../../../.." + rendition.getPath();

    // manually apply jcr_content namespace mangling
    renditionUrl = StringUtils.replace(renditionUrl, JcrConstants.JCR_CONTENT, "_jcr_content");

    HtmlElement object = new HtmlElement("object");
    object.setAttribute("type", ContentType.SWF);
    object.setAttribute("data", playerUrl);
    object.setAttribute("width", Long.toString(dimension.getWidth()));
    object.setAttribute("height", Long.toString(dimension.getHeight()));

    // get flashvars
    Map<String, String> flashvars = new HashMap<String, String>();
    flashvars.put("src", renditionUrl);
    flashvars.putAll(getAdditionalFlashPlayerFlashVars(media, dimension));

    // get flash parameters
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("movie", playerUrl);
    parameters.put("flashvars", buildFlashVarsString(flashvars));
    parameters.putAll(getAdditionalFlashPlayerParameters(media, dimension));

    // set parameters on object element
    for (Map.Entry<String, String> entry : parameters.entrySet()) {
      HtmlElement param = object.create("param");
      param.setAttribute("name", entry.getKey());
      param.setAttribute("value", entry.getValue());
    }

    return object;
  }