Ejemplo n.º 1
0
 /*     */ public synchronized boolean a(String paramString) /*     */ {
   /* 362 */ a.a("playWAV start :" + paramString);
   /*     */
   /* 364 */ if (!c(paramString)) {
     /* 365 */ a.b("file not exist");
     /* 366 */ return false;
     /*     */ }
   /*     */
   /* 369 */ String str1 = paramString.trim();
   /* 370 */ String str2 = str1.substring(str1.lastIndexOf(".") + 1);
   /* 371 */ str2 = str2.toLowerCase();
   /* 372 */ if (!str2.equalsIgnoreCase("wav")) {
     /* 373 */ a.b("file not wav file");
     /* 374 */ g();
     /* 375 */ return false;
     /*     */ }
   /*     */
   /* 378 */ MediaExtractor localMediaExtractor = null;
   /*     */ try {
     /* 380 */ localMediaExtractor = new MediaExtractor();
     /*     */ } catch (RuntimeException localRuntimeException1) {
     /* 382 */ localRuntimeException1.printStackTrace();
     /* 383 */ a.b("MediaExtractor error");
     /*     */ }
   /*     */ try
   /*     */ {
     /* 387 */ localMediaExtractor.setDataSource(paramString);
     /*     */ } catch (IOException localIOException) {
     /* 389 */ localIOException.printStackTrace();
     /* 390 */ a.b("setDataSource error");
     /* 391 */ return false;
     /*     */ }
   /*     */
   /* 394 */ MediaFormat localMediaFormat = null;
   /* 395 */ int i1 = localMediaExtractor.getTrackCount();
   /* 396 */ if (i1 > 0) {
     /*     */ try {
       /* 398 */ localMediaFormat = localMediaExtractor.getTrackFormat(0);
       /*     */ } catch (RuntimeException localRuntimeException2) {
       /* 400 */ localRuntimeException2.printStackTrace();
       /* 401 */ a.b("getTrackFormat error");
       /* 402 */ return false;
       /*     */ }
     /*     */
     /*     */
     /* 406 */ int i2 = localMediaFormat.getInteger("sample-rate");
     /*     */
     /* 408 */ this.j = localMediaFormat.getLong("durationUs");
     /*     */
     /* 410 */ if (i2 < n) {
       /* 411 */ g();
       /* 412 */ return false;
       /*     */ }
     /*     */
     /* 415 */ return PlayWav(paramString);
     /*     */ }
   /* 417 */ return false;
   /*     */ }
Ejemplo n.º 2
0
 /*     */ public synchronized boolean a(String paramString, int paramInt) {
   /*  52 */ a.a("play start :" + paramString + " startTime :" + paramInt);
   /*     */
   /*  54 */ if (!c(paramString)) {
     /*  55 */ this.l = true;
     /*  56 */ a.b("file not exist");
     /*  57 */ return false;
     /*     */ }
   /*     */
   /*  60 */ String str1 = paramString.trim();
   /*  61 */ String str2 = str1.substring(str1.indexOf(".") + 1);
   /*  62 */ str2 = str2.toLowerCase();
   /*  63 */ if ((!str2.equalsIgnoreCase("mp3"))
       && (!str2.equalsIgnoreCase("wav"))
       &&
       /*  64 */ (!str2.equalsIgnoreCase("flac"))
       && (!str2.equalsIgnoreCase("acc"))
       &&
       /*  65 */ (!str2.equalsIgnoreCase("m4a"))
       && (!str2.equalsIgnoreCase("ogg"))) {
     /*  66 */ this.l = true;
     /*  67 */ g();
     /*  68 */ return false;
     /*     */ }
   /*     */
   /*  71 */ if (this.k) {
     /*  72 */ c();
     /*     */ }
   /*     */
   /*  75 */ while (!this.l) {
     /*     */ try {
       /*  77 */ a.a("waiting thread exit :" + this.k);
       /*  78 */ Thread.sleep(500L);
       /*     */ } catch (InterruptedException localInterruptedException) {
       /*  80 */ localInterruptedException.printStackTrace();
       /*     */ }
     /*     */ }
   /*  83 */ this.l = false;
   /*     */
   /*  85 */ boolean bool = b(paramString);
   /*  86 */ if (!bool) {
     /*  87 */ this.l = true;
     /*  88 */ a.b("configAudioPlayer fail");
     /*  89 */ return false;
     /*     */ }
   /*     */
   /*  92 */ this.k = true;
   /*  93 */ a.a(true);
   /*     */
   /*  95 */ if (paramInt != 0) {
     /*  96 */ a(paramInt * 1000000);
     /*  97 */ if (!PlayAtTime(paramInt)) {
       /*  98 */ this.l = true;
       /*  99 */ a.a("PlayAtTime error");
       /* 100 */ return false;
       /*     */ }
     /*     */ }
   /* 103 */ else if (!Play()) {
     /* 104 */ this.l = true;
     /* 105 */ a.a("play error");
     /* 106 */ return false;
     /*     */ }
   /*     */
   /*     */
   /* 110 */ if (this.o == null) {
     /* 111 */ this.o = new a();
     /*     */ }
   /* 113 */ new Thread(this.o).start();
   /*     */
   /* 115 */ a.a("play end");
   /* 116 */ return true;
   /*     */ }
Ejemplo n.º 3
0
 /*     */ private synchronized boolean b(String paramString) {
   /* 120 */ a.a("configAudioPlayer start");
   /*     */
   /* 122 */ if (this.b == null) {
     /* 123 */ this.b = new MediaExtractor();
     /*     */ } else {
     /* 125 */ this.b.release();
     /* 126 */ this.b = null;
     /* 127 */ this.b = new MediaExtractor();
     /*     */ }
   /*     */ try {
     /* 130 */ this.b.setDataSource(paramString);
     /*     */ } catch (IOException localIOException1) {
     /* 132 */ localIOException1.printStackTrace();
     /* 133 */ return false;
     /*     */ }
   /*     */
   /* 136 */ int i1 = this.b.getTrackCount();
   /*     */ try {
     /* 138 */ this.f = this.b.getTrackFormat(0);
     /*     */ } catch (RuntimeException localRuntimeException) {
     /* 140 */ localRuntimeException.printStackTrace();
     /* 141 */ return false;
     /*     */ }
   /*     */
   /* 144 */ String str1 = this.f.getString("mime");
   /* 145 */ int i2 = this.f.getInteger("sample-rate");
   /* 146 */ this.j = this.f.getLong("durationUs");
   /* 147 */ int i3 = this.f.getInteger("channel-count");
   /*     */
   /*     */
   /* 150 */ a.a("===========================");
   /* 151 */ a.a("url " + paramString);
   /* 152 */ a.a("mime type : " + str1);
   /* 153 */ a.a("numTracks : " + i1);
   /* 154 */ a.a("sample rate : " + i2);
   /* 155 */ a.a("channelCnt : " + i3);
   /* 156 */ a.a("duration : " + this.j);
   /* 157 */ a.a("===========================");
   /*     */
   /* 159 */ if (i2 < n) {
     /* 160 */ a.b("sample rate : " + i2 + "< 44100");
     /* 161 */ g();
     /* 162 */ return false;
     /*     */ }
   /*     */
   /* 165 */ if (this.a != null) {
     /* 166 */ this.a.release();
     /* 167 */ this.a = null;
     /*     */ }
   /*     */ try {
     /* 170 */ this.a = MediaCodec.createDecoderByType(str1);
     /*     */ } catch (IOException localIOException2) {
     /* 172 */ localIOException2.printStackTrace();
     /* 173 */ return false;
     /*     */ }
   /*     */
   /* 176 */ this.a.configure(this.f, null, null, 0);
   /* 177 */ this.a.start();
   /*     */
   /* 179 */ this.g = this.a.getInputBuffers();
   /* 180 */ this.h = this.a.getOutputBuffers();
   /*     */
   /* 182 */ this.b.selectTrack(0);
   /*     */
   /* 184 */ if (this.c == null) {
     /* 185 */ this.c = new MediaCodec.BufferInfo();
     /*     */ } else {
     /* 187 */ this.c = null;
     /* 188 */ this.c = new MediaCodec.BufferInfo();
     /*     */ }
   /*     */
   /* 191 */ String str2 = paramString.trim();
   /* 192 */ String str3 = str2.substring(str2.lastIndexOf("/") + 1);
   /* 193 */ String str4 = str3.substring(0, str3.lastIndexOf("."));
   /* 194 */ SetAudioFile(paramString, str4, this.j, 16, i2, i3);
   /*     */
   /* 196 */ a.a("configAudioPlayer end");
   /* 197 */ return true;
   /*     */ }