import android.media.MediaRecorder;

 

MediaRecorder.AudioSource

  • public static final int DEFAULT  /  Constant Value: 0 (0x00000000)
    • Default audio source
  • public static final int MIC / Constant Value: 1 (0x00000001)
    • Microphone audio source
  • public static final int VOICE_UPLINK  / Constant Value: 2 (0x00000002)
    • Voice call uplink (Tx) audio source
  • public static final int VOICE_DOWNLINK / Constant Value: 3 (0x00000003)
    • Voice call downlink (Rx) audio source
  • public static final int VOICE_CALL  / Constant Value: 4 (0x00000004)
    • Voice call uplink + downlink audio source
  • public static final int CAMCORDER  / Constant Value: 5 (0x00000005)
    • Microphone audio source with same orientation as camera if available, the main device microphone otherwise
  • public static final int VOICE_RECOGNITION / Constant Value: 6 (0x00000006)
    • Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise.
  • public static final int VOICE_COMMUNICATION / Constant Value: 7 (0x00000007)
    • icrophone audio source tuned for voice communications such as VoIP.
    • It will for instance take advantage of echo cancellation or automatic gain control if available. It otherwise behaves like DEFAULT if no voice processing is applied.
  • public static final int REMOTE_SUBMIX  /  Constant Value: 8 (0x00000008)
    • Audio source for a submix of audio streams to be presented remotely.

 

MediaRecorder.OutputFormat

  • public static final int DEFAULT / Constant Value: 0 (0x00000000)
  • public static final int THREE_GPP / Constant Value: 1 (0x00000001)
    • 3GPP media file format
  • public static final int MPEG_4 / Constant Value: 2 (0x00000002)
    • MPEG4 media file format
  • public static final int AMR_NB / Constant Value: 3 (0x00000003)
    • AMR NB file format
  • public static final int RAW_AMR / Constant Value: 3 (0x00000003)
    • Deprecated in favor of MediaRecorder.OutputFormat.AMR_NB
    • AMR NB file format
  • public static final int AMR_WB / Constant Value: 4 (0x00000004)
    • AMR WB file format
  • public static final int AAC_ADTS / Constant Value: 6 (0x00000006)
    • AAC ADTS file format
  • public static final int WEBM / Constant Value: 9 (0x00000009)
    • VP8/VORBIS data in a WEBM container

 

MediaRecorder.AudioEncoder

  • public static final int DEFAULT / Constant Value: 0 (0x00000000)
  • public static final int AMR_NB / Constant Value: 1 (0x00000001)
    • AMR (Narrowband) audio codec
  • public static final int AMR_WB / Constant Value: 2 (0x00000002)
    • AMR (Wideband) audio codec
  • public static final int AAC / Constant Value: 3 (0x00000003)
    • AAC Low Complexity (AAC-LC) audio codec
  • public static final int HE_AAC / Constant Value: 4 (0x00000004)
    • High Efficiency AAC (HE-AAC) audio codec
  • public static final int AAC_ELD / Constant Value: 5 (0x00000005)
    • Enhanced Low Delay AAC (AAC-ELD) audio codec
  • public static final int VORBIS / Constant Value: 6 (0x00000006)
    • Ogg Vorbis audio codec

 

 

http://developer.android.com/reference/android/media/MediaRecorder.OutputFormat.html

http://colorscripter.com/

 

 

private void Recoders_Init(String paramString)
{
this.file_ext = ".mp4";
SharedData._recorder.setAudioSource(SharedData._Rec_Type); //오디오 디바이스 선택 SharedData._Rec_Type = 4
SharedData._recorder.setOutputFormat(2); //포맷방식 2 = MPEG4
SharedData._recorder.setAudioEncoder(1); //인코더 1 = AMR audio codec
SharedData._recorder.setOutputFile(paramString + ".mp4"); //저장 pramString.mp4
Log.w("call record path", paramString + ".mp4");
Log.w("call", "record init");
}
 
private void Recorder_Prepare()
{
try
{
SharedData._recorder.prepare(); // 레코딩 준비
SharedData._recorder.start(); // 레코딩 시작
Log.w("call", "start record");
return;
}
catch (IllegalStateException localIllegalStateException) // 예외 처리
{
localIllegalStateException.printStackTrace();
return;
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
}
}
 
private void Recorders_Stop()
{
for (;;)
{
try
{
SharedData._recorder.stop(); // 레코딩 정지
SharedData._recorder.reset(); // 레코더 초기화
Log.w("callfile", "record stop");
File localFile = new File(SharedData.TM_Path + this.call_file + this.file_ext);
Boolean localBoolean = Boolean.valueOf(false);
if (localFile.exists()) {
localBoolean = Boolean.valueOf(localFile.renameTo(new File(SharedData.Call_Path + this.call_file + this.file_ext)));
}
if (!localBoolean.booleanValue()) {
continue;
}
Log.w("Record", "File moving success");
localFile.delete();
}
catch (IllegalStateException localIllegalStateException)
{
continue;
}
SharedData._Recording = false;
return;
Log.w("Record", "File moving failed");
}
}
 
@SuppressLint({"SimpleDateFormat"})
private String SanityDate()
{
return new SimpleDateFormat("yyMMdd_HHmm").format(new Date());
}
 
private String SanityNum(String paramString)
{
String str = "";
char[] arrayOfChar = paramString.toCharArray();
int j = arrayOfChar.length;
int i = 0;
for (paramString = str;; paramString = str)
{
if (i >= j) {
return paramString;
}
char c = arrayOfChar[i];
str = paramString;
switch (c)
{
default:
str = paramString + c;
}
i += 1;
}
}
 
public void onCallStateChanged(int paramInt, String paramString)
{
super.onCallStateChanged(paramInt, paramString);
Log.w("call income", paramString.toString());
switch (paramInt)
{
default:
case 0:
do
{
return;
Log.w("call income", "CALL_STATE_IDLE");
} while (!SharedData._Recording);
Recorders_Stop();
return;
case 1:
this.incomeNum = paramString;
Log.w("call income", "CALL_STATE_RINGING");
return;
}
Log.w("call income", "CALL_STATE_OFFHOOK");
String str1 = SanityDate();
if (this.incomeNum != null) {}
for (paramString = "in" + SanityNum(this.incomeNum);; paramString = "out")
{
String str4 = SharedData.TM_Path;
String str3 = SharedData.Call_Path;
String str2 = SharedData.TM_Path + paramString + "_" + str1;
this.call_file = (paramString + "_" + str1);
Log.w("calldate", str1);
Log.w("callnum", paramString);
Log.w("callrootdir", str4);
Log.w("calldir", str3);
Log.w("callfile", str2);
if (!SharedData._Recording)
{
SharedData._Recording = true;
paramString = new File(str4 + "text.txt").getParentFile();
if ((!paramString.exists()) && (!paramString.mkdirs())) {
break;
}
paramString = new File(str3 + "text.txt").getParentFile();
if ((!paramString.exists()) && (!paramString.mkdirs())) {
break;
}
Log.w("call", "ready end");
Recoders_Init(str2);
Recorder_Prepare();
}
Log.v("DEBUG", "2 ST.CallRecorder - Recording Started " + paramInt);
return;
}
}
}
 

 

반응형

'Information Security' 카테고리의 다른 글

E-Mail Header Analysis  (0) 2015.07.10