protected String [ ] getCoders ( boolean encoder , boolean audio ) throws EncoderException { ArrayList < String > res = new ArrayList <> ( ) ; FFMPEGExecutor localFFMPEG = locator . createExecutor ( ) ; localFFMPEG . addArgument ( encoder ? "-encoders" : "-decoders" ) ; try { localFFMPEG . execute ( ) ; RBufferedReader reader = new RBufferedReader ( new InputStreamReader ( localFFMPEG . getInputStream ( ) ) ) ; String line ; String format = audio ? "A" : "V" ; boolean headerFound = false ; boolean evaluateLine = false ; while ( ( line = reader . readLine ( ) ) != null ) { if ( line . trim ( ) . length ( ) == 0 ) { continue ; } if ( headerFound ) { if ( evaluateLine ) { Matcher matcher = ENCODER_DECODER_PATTERN . matcher ( line ) ; if ( matcher . matches ( ) ) { //String encoderFlag = matcher.group(2); String audioVideoFlag = matcher . group ( 1 ) ; if ( format . equals ( audioVideoFlag ) ) { String name = matcher . group ( 2 ) ; res . add ( name ) ; } } else { break ; } } else { evaluateLine = line . trim ( ) . equals ( "------" ) ; } } else if ( line . trim ( ) . equals ( encoder ? "Encoders:" : "Decoders:" ) ) { headerFound = true ; } } } catch ( IOException e ) { throw new EncoderException ( e ) ; } finally { localFFMPEG . destroy ( ) ; } int size = res . size ( ) ; String [ ] ret = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { ret [ i ] = res . get ( i ) ; } return ret ; }
Returns a list with the names of all the coders bundled with the ffmpeg distribution in use .