AnsweredAssumed Answered

incorrect charset in method MediaPreferencePanel.scanDevices on Windows 2000(CHN)

Question asked by yujiaao on Oct 25, 2009
Latest reply on Oct 29, 2009 by wroot

MediaPreferencePanel.scanDevices

 

It can fixed by code below:

 

private String convertSysString(String src){
        String res = src;  
        try {
            res = new String(src.getBytes("ISO-8859-1"),Charset.defaultCharset());
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return res;
    }
    
    public void scanDevices()
    {
        // Remove all Items
        audioDevice.removeAllItems();
        videoDevice.removeAllItems();
        
        // FMJ
        RegistryDefaults.registerAll(RegistryDefaults.FMJ | RegistryDefaults.FMJ_NATIVE);

        // Add Device
        GlobalCaptureDevicePlugger.addCaptureDevices(); 

        // LOG ALL Devices
        final Vector<CaptureDeviceInfo> vectorDevices = CaptureDeviceManager.getDeviceList(null);
        for ( CaptureDeviceInfo infoCaptureDevice : vectorDevices )
        {
            System.err.println(convertSysString(infoCaptureDevice.getName()));
            for (Format format : infoCaptureDevice.getFormats())
            {
                System.err.println(format);
            }        
        }
        
        vectorAudioDevices = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR));    
        for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices)
        {                 
            audioDevice.addItem(convertSysString(infoCaptureDevice.getName()));
        }
        
        vectorVideoDevices = CaptureDeviceManager.getDeviceList(new VideoFormat(VideoFormat.RGB));
        for (  CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices )
        {
            videoDevice.addItem(convertSysString(infoCaptureDevice.getName()));        
        }
    }

Outcomes