@@ -285,7 +285,7 @@ private void startEncode()
285285 String resolution = (String )resolutionSpinner .getSelectedItem ();
286286 AudioCodec audioCodec = (AudioCodec ) audioCodecSpinner .getSelectedItem ();
287287 Integer audioBitrate = (Integer ) audioBitrateSpinner .getSelectedItem ();
288- String audioSampleRate = (String ) audioSampleRateSpinner .getSelectedItem ();
288+ Integer audioSampleRate = (Integer ) audioSampleRateSpinner .getSelectedItem ();
289289 String audioChannel = (String ) audioChannelSpinner .getSelectedItem ();
290290 int videoBitrate ;
291291
@@ -389,7 +389,7 @@ private void startEncode()
389389
390390 // Sample rate
391391 command .add ("-ar" );
392- command .add (audioSampleRate );
392+ command .add (Integer . toString ( audioSampleRate ) );
393393
394394 // Channels
395395 command .add ("-ac" );
@@ -549,10 +549,18 @@ public void onNothingSelected(AdapterView<?> parentView)
549549 }
550550 });
551551
552- String [] fps = new String [] {"24" , "23.98" , "25" , "29.97" , "30" , "50" };
552+ LinkedList <String > fps = new LinkedList <>(Arrays .asList ("24" , "23.98" , "25" , "29.97" , "30" , "50" ));
553+ if (videoInfo .videoFramerate != null && fps .contains (videoInfo .videoFramerate ) == false )
554+ {
555+ fps .addFirst (videoInfo .videoFramerate );
556+ }
553557 fpsSpinner .setAdapter (new ArrayAdapter <>(this , R .layout .spinner_textview , fps ));
554558
555- String [] resolution = new String [] {"176x144" , "320x240" , "480x360" , "640x360" , "640x480" , "800x600" , "960x720" , "1024x768" , "1280x720" , "1920x1080" , "2048x1080" , "2048x858" , "2560x1440" , "2560x1600" , "4096x2160" };
559+ LinkedList <String > resolution = new LinkedList <>(Arrays .asList ("176x144" , "320x240" , "480x360" , "640x360" , "640x480" , "800x600" , "960x720" , "1024x768" , "1280x720" , "1920x1080" , "2048x1080" , "2048x858" , "2560x1440" , "2560x1600" , "4096x2160" ));
560+ if (videoInfo .videoResolution != null && resolution .contains (videoInfo .videoResolution ) == false )
561+ {
562+ resolution .addFirst (videoInfo .videoResolution );
563+ }
556564 resolutionSpinner .setAdapter (new ArrayAdapter <>(this , R .layout .spinner_textview , resolution ));
557565
558566 audioCodecSpinner .setOnItemSelectedListener (new AdapterView .OnItemSelectedListener ()
@@ -584,7 +592,12 @@ public void onNothingSelected(AdapterView<?> parentView)
584592 }
585593 audioBitrateSpinner .setAdapter (new ArrayAdapter <>(this , R .layout .spinner_textview , audioBitrate ));
586594
587- String [] sampleRate = new String [] {"8000" , "11025" , "16000" , "22050" , "24000" , "32000" , "44100" , "48000" };
595+ List <Integer > sampleRate = new ArrayList <>(Arrays .asList (8000 , 11025 , 16000 , 22050 , 24000 , 32000 , 44100 , 48000 ));
596+ if (videoInfo .audioSampleRate != null && audioBitrate .contains (videoInfo .audioSampleRate ) == false )
597+ {
598+ sampleRate .add (videoInfo .audioSampleRate );
599+ Collections .sort (sampleRate );
600+ }
588601 audioSampleRateSpinner .setAdapter (new ArrayAdapter <>(this , R .layout .spinner_textview , sampleRate ));
589602
590603 String [] channels = new String [] {"1" , "2" };
0 commit comments