Skip to content
Snippets Groups Projects
VideoMediaStreamImpl.java 38.1 KiB
Newer Older
    /**
     * Gets the <tt>QualityControl</tt> of this <tt>VideoMediaStream</tt>.
     *
     * @return the <tt>QualityControl</tt> of this <tt>VideoMediaStream</tt>
     */
    public QualityControl getQualityControl()
    {
        return qualityControl;
    }

    /**
     * Updates the <tt>QualityControl</tt> of this <tt>VideoMediaStream</tt>.
     *
     * @param advancedParams parameters of advanced attributes that may affect
     * quality control
     */
    public void updateQualityControl(
        Map<String, String> advancedParams)
    {
        for(Map.Entry<String, String> entry : advancedParams.entrySet())
        {
            if(entry.getKey().equals("imageattr"))
            {
                Dimension res[] = parseSendRecvResolution(entry.getValue());

                if(res != null)
                {
                    qualityControl.setRemoteSendMaxPreset(
                    qualityControl.setRemoteReceiveResolution(
                    outputSize = res[1];
                    ((VideoMediaDeviceSession)getDeviceSession())
                        .setOutputSize(outputSize);
                }
            }
        }
    }

    /**
     * Move origin of a partial desktop streaming <tt>MediaDevice</tt>.
     *
     * @param x new x coordinate origin
     * @param y new y coordinate origin
     */
    public void movePartialDesktopStreaming(int x, int y)
    {
        MediaDeviceImpl dev = (MediaDeviceImpl)getDevice();

        if (!dev.getCaptureDeviceInfo().getLocator().getProtocol().equals(
                DeviceSystem.LOCATOR_PROTOCOL_IMGSTREAMING))
            return;

        DataSource captureDevice = getDeviceSession().getCaptureDevice();
        Object imgStreamingControl
            = captureDevice.getControl(ImgStreamingControl.class.getName());
        if (imgStreamingControl == null)
            return;
        // Makes the screen detection with a point inside a real screen i.e.
        // x and y are both greater than or equal to 0.
        ScreenDevice screen
            = NeomediaServiceUtils.getMediaServiceImpl().getScreenForPoint(
                    new Point((x < 0) ? 0 : x, (y < 0) ? 0 : y));
        if (screen != null)
        {
            Rectangle bounds = ((ScreenDeviceImpl) screen).getBounds();
            ((ImgStreamingControl) imgStreamingControl).setOrigin(
                    0,
                    screen.getIndex(),
                    x - bounds.x, y - bounds.y);