Java Code Examples for android.media.MediaCodecInfo#CodecCapabilities

The following examples show how to use android.media.MediaCodecInfo#CodecCapabilities . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MediaCodecUtils.java    From libcommon with Apache License 2.0 6 votes vote down vote up
/**
 * codecがサポートしているカラーフォーマットの中から最初に使用可能なものを選択して返す
 * 使用可能なカラーフォーマットはrecognizedFormatsに設定する(Encoderで設定しているのはYUV420PlanarかYUV420SemiPlanar)
 * 使用可能なものが無ければ0を返す
 */
public static final int selectColorFormat(final MediaCodecInfo codecInfo, final String mimeType) {
	int result = 0;
	final MediaCodecInfo.CodecCapabilities capabilities = getCodecCapabilities(codecInfo, mimeType);
	final int[] colorFormats = capabilities.colorFormats;
	final int n = colorFormats.length;
	int colorFormat;
	for (int i = 0; i < n; i++) {
		colorFormat = colorFormats[i];
		if (isRecognizedVideoFormat(colorFormat)) {
			result = colorFormat;
			break;	// if (!DEBUG) break;
		}
	}
       return result;
   }
 
Example 2
Source File: MediaVideoBufferEncoder.java    From AndroidUSBCamera with Apache License 2.0 6 votes vote down vote up
protected static final int selectColorFormat(final MediaCodecInfo codecInfo, final String mimeType) {
if (DEBUG) Log.i(TAG, "selectColorFormat: ");
  	int result = 0;
  	final MediaCodecInfo.CodecCapabilities caps;
  	try {
  		Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
  		caps = codecInfo.getCapabilitiesForType(mimeType);
  	} finally {
  		Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
  	}
      int colorFormat;
      for (int i = 0; i < caps.colorFormats.length; i++) {
      	colorFormat = caps.colorFormats[i];
          if (isRecognizedViewoFormat(colorFormat)) {
          	if (result == 0)
          		result = colorFormat;
              break;
          }
      }
      if (result == 0)
      	Log.e(TAG, "couldn't find a good color format for " + codecInfo.getName() + " / " + mimeType);
      return result;
  }
 
Example 3
Source File: MediaVideoEncoder.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
/**
 * select color format available on specific codec and we can use.
 *
 * @return 0 if no colorFormat is matched
 */
protected static final int selectColorFormat(final MediaCodecInfo codecInfo, final String mimeType) {
    if (DEBUG) Log.i(TAG, "selectColorFormat: " + mimeType);
    int result = 0;
    final MediaCodecInfo.CodecCapabilities caps;
    try {
        Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
        caps = codecInfo.getCapabilitiesForType(mimeType);
    } finally {
        Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
    }
    int colorFormat;
    for (int i = 0; i < caps.colorFormats.length; i++) {
        colorFormat = caps.colorFormats[i];
        if (isRecognizedViewoFormat(colorFormat)) {
            if (result == 0)
                result = colorFormat;
            break;
        }
    }
    if (result == 0)
        Log.e(TAG, "couldn't find a good color format for " + codecInfo.getName() + " / " + mimeType);
    return result;
}
 
Example 4
Source File: RecorderConfigActivity.java    From SoloPi with Apache License 2.0 6 votes vote down vote up
private void onResolutionChanged(int selectedPosition, String resolution) {
    String codecName = getSelectedVideoCodec();
    MediaCodecInfo codec = getVideoCodecInfo(codecName);
    if (codec == null) return;
    MediaCodecInfo.CodecCapabilities capabilities = codec.getCapabilitiesForType(ScreenRecorder.VIDEO_AVC);
    MediaCodecInfo.VideoCapabilities videoCapabilities = capabilities.getVideoCapabilities();
    String[] xes = resolution.split("x");
    if (xes.length != 2) throw new IllegalArgumentException();
    int width = Integer.parseInt(xes[1]);
    int height = Integer.parseInt(xes[0]);

    double selectedFramerate = getSelectedFramerate();
    int resetPos = Math.max(selectedPosition - 1, 0);
    if (!videoCapabilities.isSizeSupported(width, height)) {
        mVideoResolution.setSelectedPosition(resetPos);
        toastShort(getString(R.string.codec_config__unsupport_size,
                codecName, width, height));
        LogUtil.w(TAG, codecName +
                " height range: " + videoCapabilities.getSupportedHeights() +
                "\n width range: " + videoCapabilities.getSupportedHeights());
    } else if (!videoCapabilities.areSizeAndRateSupported(width, height, selectedFramerate)) {
        mVideoResolution.setSelectedPosition(resetPos);
        toastShort(getString(R.string.codec_config__unsupport_size_framerate,
                codecName, width, height, (int) selectedFramerate));
    }
}
 
Example 5
Source File: MediaCodecUtils.java    From libcommon with Apache License 2.0 6 votes vote down vote up
/**
 * プロファイル・レベルが低ければtrueを返す
 * @param mimeType
 * @param info
 * @return
 */
public static boolean checkProfileLevel(final String mimeType,
	final MediaCodecInfo info) {

	if (info != null) {
		if (mimeType.equalsIgnoreCase("video/avc")) {
			final MediaCodecInfo.CodecCapabilities caps = getCodecCapabilities(info, mimeType);
			final MediaCodecInfo.CodecProfileLevel[] profileLevel = caps.profileLevels;
			for (int j = 0; j < profileLevel.length; j++) {
				if (profileLevel[j].level >= MediaCodecInfo.CodecProfileLevel.AVCLevel5)
					return false;
			}
		}
	}
	return true;
}
 
Example 6
Source File: MediaCodecUtil.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
  * Needed on M and older to get correct information about VP9 support.
  * @param profileLevels The CodecProfileLevelList to add supported profile levels to.
  * @param videoCapabilities The MediaCodecInfo.VideoCapabilities used to infer support.
  */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void addVp9CodecProfileLevels(CodecProfileLevelList profileLevels,
        MediaCodecInfo.CodecCapabilities codecCapabilities) {
    // https://www.webmproject.org/vp9/levels
    final int[][] bitrateMapping = {
            {200, 10}, {800, 11}, {1800, 20}, {3600, 21}, {7200, 30}, {12000, 31}, {18000, 40},
            {30000, 41}, {60000, 50}, {120000, 51}, {180000, 52},
    };
    VideoCapabilities videoCapabilities = codecCapabilities.getVideoCapabilities();
    for (int[] entry : bitrateMapping) {
        int bitrate = entry[0];
        int level = entry[1];
        if (videoCapabilities.getBitrateRange().contains(bitrate)) {
            // Assume all platforms before N only support VP9 profile 0.
            profileLevels.addCodecProfileLevel(
                    VideoCodec.CODEC_VP9, VideoCodecProfile.VP9PROFILE_PROFILE0, level);
        }
    }
}
 
Example 7
Source File: MediaCodecHelper.java    From libcommon with Apache License 2.0 6 votes vote down vote up
/**
 * プロファイル・レベルが低ければtrueを返す
 * @param mimeType
 * @param info
 * @return
 */
@Deprecated
public static boolean checkProfileLevel(final String mimeType,
	final MediaCodecInfo info) {

	if (info != null) {
		if (mimeType.equalsIgnoreCase("video/avc")) {
			//noinspection deprecation
			final MediaCodecInfo.CodecCapabilities caps = getCodecCapabilities(info, mimeType);
			final MediaCodecInfo.CodecProfileLevel[] profileLevel = caps.profileLevels;
			for (int j = 0; j < profileLevel.length; j++) {
				if (profileLevel[j].level >= MediaCodecInfo.CodecProfileLevel.AVCLevel5)
					return false;
			}
		}
	}
	return true;
}
 
Example 8
Source File: MediaCodecHelper.java    From libcommon with Apache License 2.0 6 votes vote down vote up
/**
 * codecがサポートしているカラーフォーマットの中から最初に使用可能なものを選択して返す
 * 使用可能なカラーフォーマットはrecognizedFormatsに設定する(Encoderで設定しているのはYUV420PlanarかYUV420SemiPlanar)
 * 使用可能なものが無ければ0を返す
 */
@Deprecated
public static final int selectColorFormat(final MediaCodecInfo codecInfo, final String mimeType) {
	int result = 0;
	//noinspection deprecation
	final MediaCodecInfo.CodecCapabilities capabilities = getCodecCapabilities(codecInfo, mimeType);
	final int[] colorFormats = capabilities.colorFormats;
	final int n = colorFormats.length;
	int colorFormat;
	for (int i = 0; i < n; i++) {
		colorFormat = colorFormats[i];
		//noinspection deprecation
		if (isRecognizedVideoFormat(colorFormat)) {
			result = colorFormat;
			break;	// if (!DEBUG) break;
		}
	}
       return result;
   }
 
Example 9
Source File: AvcEncoder.java    From videocreator with Apache License 2.0 6 votes vote down vote up
public int[] getMediaCodecList() {
    //获取解码器列表
    int numCodecs = MediaCodecList.getCodecCount();
    MediaCodecInfo codecInfo = null;
    for (int i = 0; i < numCodecs && codecInfo == null; i++) {
        MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
        if (!info.isEncoder()) {
            continue;
        }
        String[] types = info.getSupportedTypes();
        boolean found = false;
        //轮训所要的解码器
        for (int j = 0; j < types.length && !found; j++) {
            if (types[j].equals("video/avc")) {
                found = true;
            }
        }
        if (!found) {
            continue;
        }
        codecInfo = info;
    }
    Log.d(TAG, "found" + codecInfo.getName() + "supporting" + " video/avc");
    MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType("video/avc");
    return capabilities.colorFormats;
}
 
Example 10
Source File: Api21Builder.java    From jellyfin-androidtv with GNU General Public License v2.0 5 votes vote down vote up
private void addVideoCapabilities(MediaCodecInfo.CodecCapabilities codecCapabilities, CodecProfile profile) {
    MediaCodecInfo.VideoCapabilities videoCaps = codecCapabilities.getVideoCapabilities();

    ArrayList<ProfileCondition> conditions = new ArrayList<>();

    conditions.add(new ProfileCondition(ProfileConditionType.NotEquals, ProfileConditionValue.IsAnamorphic, "true"));

    if (profile.getCodec() != null && profile.getCodec().toLowerCase().contains(CodecTypes.H264)) {
        conditions.add(new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitDepth, "8"));
    }

    // Video max bitrate
    Range<Integer> bitrateRange = videoCaps.getBitrateRange();
    String maxBitrate = String.valueOf(bitrateRange.getUpper());
    conditions.add(new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.VideoBitrate, maxBitrate));

    // Video min bitrate
    String minBitrate = String.valueOf(bitrateRange.getLower());
    conditions.add(new ProfileCondition(ProfileConditionType.GreaterThanEqual, ProfileConditionValue.VideoBitrate, minBitrate));

    // Video max height
    Range<Integer> heightRange = videoCaps.getSupportedHeights();
    String maxHeight = String.valueOf(heightRange.getUpper());
    //conditions.add(new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Height, maxHeight));

    // Video min height
    String minHeight = String.valueOf(heightRange.getLower());
    conditions.add(new ProfileCondition(ProfileConditionType.GreaterThanEqual, ProfileConditionValue.Height, minHeight));

    // Video max width
    Range<Integer> widthRange = videoCaps.getSupportedHeights();
    conditions.add(new ProfileCondition(ProfileConditionType.LessThanEqual, ProfileConditionValue.Width, String.valueOf(widthRange.getUpper())));

    // Video min width
    conditions.add(new ProfileCondition(ProfileConditionType.GreaterThanEqual, ProfileConditionValue.Width, String.valueOf(widthRange.getLower())));

    profile.setConditions(conditions.toArray(new ProfileCondition[conditions.size()]));

    AddProfileLevels(codecCapabilities, profile);
}
 
Example 11
Source File: VideoEncoder.java    From rtmp-rtsp-stream-client-java with Apache License 2.0 5 votes vote down vote up
/**
 * choose the video encoder by mime.
 */
@Override
protected MediaCodecInfo chooseEncoder(String mime) {
  List<MediaCodecInfo> mediaCodecInfoList;
  if (force == CodecUtil.Force.HARDWARE) {
    mediaCodecInfoList = CodecUtil.getAllHardwareEncoders(mime);
  } else if (force == CodecUtil.Force.SOFTWARE) {
    mediaCodecInfoList = CodecUtil.getAllSoftwareEncoders(mime);
  } else {
    mediaCodecInfoList = CodecUtil.getAllEncoders(mime);
  }
  for (MediaCodecInfo mci : mediaCodecInfoList) {
    Log.i(TAG, String.format("VideoEncoder %s", mci.getName()));
    MediaCodecInfo.CodecCapabilities codecCapabilities = mci.getCapabilitiesForType(mime);
    for (int color : codecCapabilities.colorFormats) {
      Log.i(TAG, "Color supported: " + color);
      if (formatVideoEncoder == FormatVideoEncoder.SURFACE) {
        if (color == FormatVideoEncoder.SURFACE.getFormatCodec()) return mci;
      } else {
        //check if encoder support any yuv420 color
        if (color == FormatVideoEncoder.YUV420PLANAR.getFormatCodec()
            || color == FormatVideoEncoder.YUV420SEMIPLANAR.getFormatCodec()) {
          return mci;
        }
      }
    }
  }
  return null;
}
 
Example 12
Source File: MediaController.java    From talk-android with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
public static int selectColorFormat(MediaCodecInfo codecInfo, String mimeType) {
    MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
    int lastColorFormat = 0;
    for (int i = 0; i < capabilities.colorFormats.length; i++) {
        int colorFormat = capabilities.colorFormats[i];
        if (isRecognizedFormat(colorFormat)) {
            lastColorFormat = colorFormat;
            if (!(codecInfo.getName().equals("OMX.SEC.AVC.Encoder") && colorFormat == 19)) {
                return colorFormat;
            }
        }
    }
    return lastColorFormat;
}
 
Example 13
Source File: MainActivity.java    From AndroidPlayground with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    findViewById(R.id.mCameraCapture).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(final View v) {
            startActivity(new Intent(MainActivity.this, CameraCaptureActivity.class));
        }
    });

    TextView tvInfo = (TextView) findViewById(R.id.mTvInfo);

    MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, 1080, 720);

    // Set some properties.  Failing to specify some of these can cause the MediaCodec
    // configure() call to throw an unhelpful exception.
    format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
            MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
    format.setInteger(MediaFormat.KEY_BIT_RATE, 100000);
    format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
    format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);

    MediaCodecInfo codecInfo = selectCodec(MIME_TYPE);
    MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(MIME_TYPE);

    tvInfo.setText(
            "MaxSupportedInstances: " + capabilities.getMaxSupportedInstances() + "\n"
    );
}
 
Example 14
Source File: EncodeDecode.java    From videocreator with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a color format that is supported by the codec and by this test
 * code. If no match is found, this throws a test failure -- the set of
 * formats known to the test should be expanded for new platforms.
 */
private static int selectColorFormat(MediaCodecInfo codecInfo,
                                     String mimeType) {
    MediaCodecInfo.CodecCapabilities capabilities = codecInfo
            .getCapabilitiesForType(mimeType);
    for (int i = 0; i < capabilities.colorFormats.length; i++) {
        int colorFormat = capabilities.colorFormats[i];
        if (isRecognizedFormat(colorFormat)) {
            return colorFormat;
        }
    }
    return 0; // not reached
}
 
Example 15
Source File: MediaController.java    From react-native-video-helper with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
public static int selectColorFormat(MediaCodecInfo codecInfo, String mimeType) {
    MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
    int lastColorFormat = 0;
    for (int i = 0; i < capabilities.colorFormats.length; i++) {
        int colorFormat = capabilities.colorFormats[i];
        if (isRecognizedFormat(colorFormat)) {
            lastColorFormat = colorFormat;
            if (!(codecInfo.getName().equals("OMX.SEC.AVC.Encoder") && colorFormat == 19)) {
                return colorFormat;
            }
        }
    }
    return lastColorFormat;
}
 
Example 16
Source File: RecorderConfigActivity.java    From SoloPi with Apache License 2.0 5 votes vote down vote up
private void onVideoCodecSelected(String codecName) {
    MediaCodecInfo codec = getVideoCodecInfo(codecName);
    if (codec == null) {
        return;
    }
    MediaCodecInfo.CodecCapabilities capabilities = codec.getCapabilitiesForType(ScreenRecorder.VIDEO_AVC);
    //todo
}
 
Example 17
Source File: MediaPlayerGrabber.java    From VIA-AI with MIT License 5 votes vote down vote up
private boolean isColorFormatSupported(int colorFormat, MediaCodecInfo.CodecCapabilities caps) {
    for (int c : caps.colorFormats) {
        if (c == colorFormat) {
            return true;
        }
    }
    return false;
}
 
Example 18
Source File: CodecManager.java    From spydroid-ipcamera with GNU General Public License v3.0 4 votes vote down vote up
/** 
 * Returns an associative array of the supported color formats and the names of the encoders for a given mime type
 * This can take up to sec on certain phones the first time you run it...
 **/
@SuppressLint("NewApi")
static private void findSupportedColorFormats(String mimeType) {
	SparseArray<ArrayList<String>> softwareCodecs = new SparseArray<ArrayList<String>>();
	SparseArray<ArrayList<String>> hardwareCodecs = new SparseArray<ArrayList<String>>();

	if (sSoftwareCodecs.containsKey(mimeType)) {
		return; 
	}

	Log.v(TAG,"Searching supported color formats for mime type \""+mimeType+"\"...");

	// We loop through the encoders, apparently this can take up to a sec (testes on a GS3)
	for(int j = MediaCodecList.getCodecCount() - 1; j >= 0; j--){
		MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(j);
		if (!codecInfo.isEncoder()) continue;

		String[] types = codecInfo.getSupportedTypes();
		for (int i = 0; i < types.length; i++) {
			if (types[i].equalsIgnoreCase(mimeType)) {
				MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);

				boolean software = false;
				for (int k=0;k<SOFTWARE_ENCODERS.length;k++) {
					if (codecInfo.getName().equalsIgnoreCase(SOFTWARE_ENCODERS[i])) {
						software = true;
					}
				}

				// And through the color formats supported
				for (int k = 0; k < capabilities.colorFormats.length; k++) {
					int format = capabilities.colorFormats[k];
					if (software) {
						if (softwareCodecs.get(format) == null) softwareCodecs.put(format, new ArrayList<String>());
						softwareCodecs.get(format).add(codecInfo.getName());
					} else {
						if (hardwareCodecs.get(format) == null) hardwareCodecs.put(format, new ArrayList<String>());
						hardwareCodecs.get(format).add(codecInfo.getName());
					}
				}

			}
		}
	}

	// Logs the supported color formats on the phone
	StringBuilder e = new StringBuilder();
	e.append("Supported color formats on this phone: ");
	for (int i=0;i<softwareCodecs.size();i++) e.append(softwareCodecs.keyAt(i)+", ");
	for (int i=0;i<hardwareCodecs.size();i++) e.append(hardwareCodecs.keyAt(i)+(i==hardwareCodecs.size()-1?".":", "));
	Log.v(TAG, e.toString());

	sSoftwareCodecs.put(mimeType, softwareCodecs);
	sHardwareCodecs.put(mimeType, hardwareCodecs);
	return;
}
 
Example 19
Source File: CodecManager.java    From libstreaming with Apache License 2.0 4 votes vote down vote up
/**
 * Lists all encoders that claim to support a color format that we know how to use.
 * @return A list of those encoders
 */
@SuppressLint("NewApi")
public synchronized static Codec[] findEncodersForMimeType(String mimeType) {
	if (sEncoders != null) return sEncoders;

	ArrayList<Codec> encoders = new ArrayList<>();

	// We loop through the encoders, apparently this can take up to a sec (testes on a GS3)
	for(int j = MediaCodecList.getCodecCount() - 1; j >= 0; j--){
		MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(j);
		if (!codecInfo.isEncoder()) continue;

		String[] types = codecInfo.getSupportedTypes();
		for (int i = 0; i < types.length; i++) {
			if (types[i].equalsIgnoreCase(mimeType)) {
				try {
					MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
					Set<Integer> formats = new HashSet<>();

					// And through the color formats supported
					for (int k = 0; k < capabilities.colorFormats.length; k++) {
						int format = capabilities.colorFormats[k];

						for (int l=0;l<SUPPORTED_COLOR_FORMATS.length;l++) {
							if (format == SUPPORTED_COLOR_FORMATS[l]) {
								formats.add(format);
							}
						}
					}
					
					Codec codec = new Codec(codecInfo.getName(), (Integer[]) formats.toArray(new Integer[formats.size()]));
					encoders.add(codec);
				} catch (Exception e) {
					Log.wtf(TAG,e);
				}
			}
		}
	}

	sEncoders = (Codec[]) encoders.toArray(new Codec[encoders.size()]);
	return sEncoders;

}
 
Example 20
Source File: CodecManager.java    From VideoMeeting with Apache License 2.0 4 votes vote down vote up
/**
 * Lists all encoders that claim to support a color format that we know how to use.
 * @return A list of those encoders
 */
@SuppressLint("NewApi")
public synchronized static Codec[] findEncodersForMimeType(String mimeType) {
    if (sEncoders != null) return sEncoders;

    ArrayList<Codec> encoders = new ArrayList<Codec>();

    // We loop through the encoders, apparently this can take up to a sec (testes on a GS3)
    for(int j = MediaCodecList.getCodecCount() - 1; j >= 0; j--){
        MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(j);
        if (!codecInfo.isEncoder()) continue;

        String[] types = codecInfo.getSupportedTypes();
        for (int i = 0; i < types.length; i++) {
            if (types[i].equalsIgnoreCase(mimeType)) {
                try {
                    MediaCodecInfo.CodecCapabilities capabilities = codecInfo.getCapabilitiesForType(mimeType);
                    Set<Integer> formats = new HashSet<Integer>();

                    // And through the color formats supported
                    for (int k = 0; k < capabilities.colorFormats.length; k++) {
                        int format = capabilities.colorFormats[k];

                        for (int l=0;l<SUPPORTED_COLOR_FORMATS.length;l++) {
                            if (format == SUPPORTED_COLOR_FORMATS[l]) {
                                formats.add(format);
                                break;
                            }
                        }
                    }

                    Codec codec = new Codec(codecInfo.getName(), (Integer[]) formats.toArray(new Integer[formats.size()]));
                    encoders.add(codec);
                } catch (Exception e) {
                    Log.wtf(TAG,e);
                }
            }
        }
    }

    sEncoders = (Codec[]) encoders.toArray(new Codec[encoders.size()]);
    if (sEncoders.length == 0) {
        sEncoders = new Codec[]{new Codec(null, new Integer[]{0})};
    }
    return sEncoders;

}