首页
社区
课程
招聘
[下载][分享][原创]世界上最强解码器FFMpeg4.4.1还是原来配方,还是原来的味道
发表于: 2022-4-1 12:56 8742

[下载][分享][原创]世界上最强解码器FFMpeg4.4.1还是原来配方,还是原来的味道

2022-4-1 12:56
8742

万能播放器
一个编译后大小不足10兆的万能解码播放器
更多惊喜:https://bbs.pediy.com/user-854079-1.htm
思考:(可在帖子下方留言)
吃苹果需要要知道树是怎么栽不
海洋关心河流是从哪里汇入的不

 

ffmpeg5.0目前只能播放本地视频,改进完成后,将发布
支持https播放
ffmpeg-4.4.1 + OPEN-SSL1.0.2t
一个jar + SO 播放类型市面上99%类型的视频
全世界最强大的解码器,没有之一,目前各种系统平台下的播放均是在ffmpg基本上开发的

 

运行效果
Activity

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
 
import com.z.media.MediaFileDown;
import com.z.media.MediaFileDown.OnCallCompleteListener;
import com.z.media.MediaFileDown.OnDownloadingListener;
import com.z.media.MediaPlayer;
import com.z.media.listener.OnBufferingUpdateListener;
import com.z.media.listener.OnCompleteListener;
import com.z.media.listener.OnErrorListener;
import com.z.media.listener.OnLoadListener;
import com.z.media.listener.OnParparedListener;
import com.z.media.listener.OnTimeInfoListener;
import com.z.media.listener.OnValumeDBListener;
import com.z.media.listener.TimeInfoBean;
import com.z.media.mutee.ScaleType;
import com.z.utils.PermissionUtil;
import com.z.utils.T;
import com.z.view.VideoView;
 
import android.app.Activity;
import android.media.MediaCodec;
import android.os.Bundle;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
/**
 *
 * @ClassName:     MainActivity.java
 * @author         zcs
 * @version        V1.0 
 * @Date           2019116日 上午9:47:17
 * @Description:   网络播放包括 {rtmp,http}
 * //ffmpeg :  file,ftp,http,https,httpproxy,hls,mmsh,mmst,pipe,rtmp,rtmps,rtmpt,rtmpts,rtp,sctp,srtp,tcp,udp
 *
 */
public class MainActivity extends Activity {
    private MediaPlayer mediaPlayer;
    private MediaFileDown fileDown;
    String TAG = "MainActivity";
    TextView tvTime;
    int posttion;
    SeekBar seekBar;
    SeekBar seekBar_volume;
    boolean isTouch;
    private boolean isSeekBarDown = false;
    private EditText inputView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        inputView = (EditText) findViewById(R.id.et_input);
        boolean check = PermissionUtil.check(this, PermissionUtil.READ_EXTERNAL_STORAGE);
        if(check) {
            T.showShort(this, "有读写权限");
        }else {
            T.showShort(this, "没有读写权限");
        }
        String url =  Environment.getExternalStorageDirectory()+File.separator+"1234.mp4";
        inputView.setText(url);
 
        seekBar = (SeekBar) findViewById(R.id.seekBar);
        seekBar_volume = (SeekBar) findViewById(R.id.seekBar_volume);
        seekBar.setMax(100);
        seekBar.setProgress(0);
        seekBar_volume.setMax(100);
        seekBar_volume.setProgress(50);
        tvTime = (TextView) findViewById(R.id.tv_time);
        VideoView videoView = (VideoView) findViewById(R.id.gl_surface);
        mediaPlayer = new MediaPlayer();
        mediaPlayer.setEnableHardware(false);
        mediaPlayer.setWindowMode(ScaleType.STRETCH);
        //设置最大视频可缓冲时间(秒,<=0不做最大缓冲
        mediaPlayer.setNetMaxBuffer(60);
        //设置最小视频可缓冲时间(秒,不到达此时间,将不播放,<=0不做最小缓冲
        mediaPlayer.setNetMinBuffer(5);
//        mediaPlayer.setOnCheckDecodeListener(new OnCheckDecodeListener() {
////            StringBuffer sb = new StringBuffer();
//            @Override
//            public void onCheckDecode(int type, String name) {
//                if(type==1) {
////                    sb.append("VIDEO" +":"+ name);
//                    Log.e(TAG,"VIDEO "+name);
//                }else if(type==2) {
////                    sb.append("Audio" +":"+ name);
//                    Log.e(TAG,"Audio "+name);
//                }else {
////                    sb.append("Other" +":"+ name);
//                    Log.e(TAG,"Other "+name);
//                }
////                Log.e(TAG,sb.toString());
//            }
//        });
        mediaPlayer.setVideoView(videoView);
        mediaPlayer.setOnPreparedListener(new OnParparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                 Log.e(TAG,"准备好了,可以播放");
                 if(mp.isPause()) {
                     Log.e(TAG,"pause 暂停");
                 }else {
                     mp.start();
                 }
                int width = mp.getWidth();
                int height = mp.getHeight();
//                Log.e(TAG,"width:"+width +"  height:"+height);
                Log.e(TAG,"width:"+width +"  height:"+height);
                Log.e(TAG, " 硬解码:  "+mediaPlayer.isHardware());
                int fps = mp.getFps();
                Log.e(TAG,"fps: "+fps);
                if(mediaPlayer.getDuration()>0) {
                    Log.e(TAG,"播放位置:"+mediaPlayer.getCurrentPosition());
                    long curr = mediaPlayer.getCurrentPosition()/1000;
                    long total= mediaPlayer.getDuration()/1000;
                    Log.e(TAG,"播放位置:"+curr);
                    Log.e(TAG,"时长:"+total);
                    tvTime.setText(getTime(curr)+" / "+getTime(total));
    //                Log.e(TAG, "当前播放位置:           "+curr);
    //                Log.e(TAG, "总时长:       "+total);
                    if(total>0) {
                        int p = (int) (curr * 100 / total);
    //                    Log.e(TAG, "seek  "+p);
                        seekBar.setProgress(p);
                    }
                }
 
            }
        });
        mediaPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
 
            @Override
            public void onBufferingUpdate(MediaPlayer mp, int percent, long second) {
                long duration = mediaPlayer.getDuration();
//                second = second/1000;
//                Log.e(TAG, "视频时长(秒)  :       "+duration/1000);
                Log.w(TAG, "缓冲时长(秒) : "+second/1000 +"秒     "+percent+" %");
                if(duration>0) {
                    long currentPosition = mediaPlayer.getCurrentPosition();
                    int pragress = (int) (currentPosition+second);
//                    Log.e(TAG, "缓冲位置(毫秒)  :       "+pragress);
//                    Log.e(TAG, "缓冲位置  :       "+pragress);
                    float scale = pragress/(float)duration;
                    if(scale<=0)return;
//                    Log.e(TAG, "进度条缓冲占比(秒)  :       "+scale);
                    int progre = (int) (seekBar.getMax()*scale);
//                    Log.e(TAG, "设置进度条缓冲位置%  :       "+progre);
//                    Log.e(TAG, "进度条最大长度 :       "+seekBar.getMax());
//                    Log.e(TAG, "播放进度条: "+seekBar.getSecondaryProgress());
                    Log.w(TAG, "缓冲进度条: "+progre);
                    seekBar.setSecondaryProgress(progre);
//                    seekBar.setSecondaryProgress(80);
//                    pragress/(float)duration;
 
                }
//                Log.e(TAG, "缓冲进度:  %           "+percent);
//                Log.e(TAG, "缓冲总时长(秒):       "+second);
//                Log.e(TAG, "总时长(秒):           "+duration);
//                Log.e(TAG, "percent: "+percent);
//                Log.e(TAG, "second : "+second);
 
            }
        });
        mediaPlayer.setOnLoadListener(new OnLoadListener(){
            @Override
            public void onLoad(boolean load) {
                if(load){//正在加载
                    Log.w(TAG,"OnLoadListener 加载中");
                }else{//加载完成
                    Log.w(TAG,"OnLoadListener 播放中");
                }
                Log.w(TAG,"OnLoadListener pause "+mediaPlayer.isPause());
 
            }
        });
        mediaPlayer.setOnTimedTextListener(new OnTimeInfoListener() {
            @Override
            public void onTimeInfo(TimeInfoBean timeInfoBean) {
//                Log.e(TAG,timeInfoBean.toString());
//                Log.e(TAG,"onTimeInfo  "+timeInfoBean.getCurrentTime());
 
//                Log.w(TAG, "------- onTimeInfo --------");
                long curr = timeInfoBean.getCurrentTime()/1000;
                long total= timeInfoBean.getTotalTime()/1000;
                tvTime.setText(getTime(curr)+"/"+getTime(total));
//                Log.w(TAG, "当前播放位置(秒:     "+curr);
//                Log.w(TAG, "总时长:       "+total);
//                Log.w(TAG, "getCurrentPosition:       "+mediaPlayer.getCurrentPosition());
//                Log.e(TAG, "剩余时间:       "+(total - curr));
                if(!isTouch && total>0) {
                    if(isSeekBarDown)return;
                    int p = (int) (curr * 100 / total);
//                    Log.e(TAG, "seek  "+p);
                    seekBar.setProgress(p);
                }
//                handler.sendMessage(msg);
            }
        });
        mediaPlayer.setOnErrorListener(new OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mp, int code, String extra) {
                if(fileDown == null || (!fileDown.isLoading()&&!fileDown.isPause())) {
                    Log.e(TAG,"-----onError----- "+code);
                }
                Log.e(TAG,"----------");
                Log.e(TAG,"error code:"+code);
                Log.e(TAG,extra);
                Log.e(TAG,"----------");
                if(code >= 1500) {
                    Toast.makeText(MainActivity.this, "播放文件出错", Toast.LENGTH_SHORT).show();
                }else {
//                    Log.e(TAG,"is File ");
                }
//                if(code==1001) {
//                    String source = mediaPlayer.getSource();
//                    Log.e(TAG,"is File "+new File(source).isFile());
//                }
                return false;
            }
        });
        mediaPlayer.setOnCompletionListener(new OnCompleteListener() {
 
            @Override
            public void onCompletion(MediaPlayer mp) {
                Log.e(TAG,"播放结束");
                Toast.makeText(getApplicationContext(), "播放结束", Toast.LENGTH_LONG).show();
            }
        });
        mediaPlayer.setOnValumeDBListener(new OnValumeDBListener() {
            @Override
            public void onDbValue(int db) {
//                Log.e(TAG,"分贝值:"+db);
            }
        });
        //录音的监听
//        mediaPlayer.setOnRecordTimeListener(new OnRecordTimeListener(){
//            @Override
//            public void onRecordTime(int recordTime) {
//
//                Log.e(TAG,"录制时间 "+recordTime);
//            }
//        });
//        mediaPlayer.setOnPcmInfoListener(new OnPcmInfoListener() {
//            @Override
//            public void onPcmInfo(byte[] buffer, int bufsize) {
//                Log.e(TAG,bufsize+"");
//
//            }
//            @Override
//            public void onPcmRate(int samplerate,int bit,int channels) {//采样率
//                Log.e(TAG,"采样率 "+samplerate);
//            }
//        });
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
                isSeekBarDown = b;
                if(b) {
//                    mediaPlayer.pause();
                    int progress = i * 100 /seekBar.getMax();
                    progress = (int) (mediaPlayer.getDuration() * progress /100);
                    tvTime.setText(getTime(progress/1000));
                }
//                if(b&&mediaPlayer.getDuration()>0) {
//                    int progress = i * 100 /seekBar.getMax();
//                    progress = (int) (mediaPlayer.getDuration() * progress /100);
//                   
//                     tvTime.setText(getTime(progress/1000));
//                }
//                posttion = (int) (i/100.f *mediaPlayer.getDuration());
                System.out.printf(""+posttion);
//                if(mediaPlayer.getDuration()>0&&b) {//手动触发
//                }
            }
 
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                //滑动时
                isTouch = true;
            }
 
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                isSeekBarDown = false;
                int progress = seekBar.getProgress() * 100 /seekBar.getMax();
                progress = (int) (mediaPlayer.getDuration() * progress /100);
                Log.e(TAG,"快进(毫秒)-->   "+ progress/1000);
                if(mediaPlayer.getDuration()>0) {
//                    if(posttion<mediaPlayer.getCurrentPosition()) {
//                        seekBar.setSecondaryProgress(0);
//                    }
//                    Log.e(TAG,"seekBar 获取播放位置   "+ mediaPlayer.getCurrentPosition());
                    Log.e(TAG,"视频总时长   "+ mediaPlayer.getDuration()/1000);
                    mediaPlayer.seek(progress/1000);
                }
                isTouch = false;
            }
        });
        seekBar_volume.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
                    mediaPlayer.setVolume(i);
            }
 
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
//                //滑动时
            }
 
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
//                mediaPlayer.seek(posttion);
//                isTouch = false;
            }
        });
    }
 
    /**
     * 开始解析按钮
     * @param view
     */
    public void begin(View view) {
//        if(mediaPlayer.isPlaying()) {
//            Log.e(TAG,"正在播放中... "+mediaPlayer.getCurrentPosition());
//            return;
//        }
        if(mediaPlayer.isPause()) {
            mediaPlayer.resume();
            return;
        }
        seekBar.setSecondaryProgress(0);
        seekBar.setProgress(0);
        mediaPlayer.setWindowMode(ScaleType.FIT_ADAPT);//显示方式,默认即可
 
 
        String CPU_ABI = android.os.Build.CPU_ABI;
        Toast.makeText(this, CPU_ABI, Toast.LENGTH_SHORT).show();
        Log.e(TAG,CPU_ABI);
        String url = inputView.getText().toString();
        if(TextUtils.isEmpty(url)) {
            T.showShort(this, "没有播放地址");
            return;
        }
        Log.e(TAG, "start:"+url);
        mediaPlayer.setSource(url.trim());//设置要播放的链接
        mediaPlayer.prepare();
//        mediaPlayer.setSaveVideoFile(Environment.getExternalStorageDirectory()+File.separator+System.currentTimeMillis()+".mp4");
 
    }
 
    private String getUrl() {
        String url = "http://mpge.5nd.com/2015/2015-11-26/69708/1.mp3" ;
        return url;
    }
    public void next(View view) {
//        mediaPlayer.setWindowMode(ScaleType.CENTRE);
        seekBar.setProgress(0);
        MediaCodec mediaCodec = mediaPlayer.getMediaCodec();
        System.out.println(mediaCodec);
        //下一个
        String url = Environment.getExternalStorageDirectory()+ File.separator+".mov";
//       
        mediaPlayer.playNext(url);
    }
    /**
     * /硬解码切换
     * @param view
     */
    public void switch_decode(View view) {
//        boolean hardware = mediaPlayer.isHardware();
        mediaPlayer.setEnableHardware(!mediaPlayer.isEnadblHardware());
        Log.e(TAG,"setEnableHardware : "+mediaPlayer.isEnadblHardware());
    }
 
    /**
     * 暂停
     * @param view
     */
    public void pause(View view) {
        mediaPlayer.pause();
    }
 
    /**
     * 播放
     * @param view
     */
    public void resume(View view) {
        mediaPlayer.resume();
    }
    /**
     *
     * @param time 秒
     * @return
     */
    private String getTime(long time) {
//        String string = "";
//        System.out.printf(String.format("00",1));
        if (time > 60 * 60) { //小时
            return time / 3600 + ":" + (time % 3600 / 60) + ":" + (time % 3600 % 60);
        } else if (time > 60) {//分钟
            return time / 60 + ":" + time % 60;
        } else if(time<0){
            return "长度未知";
        }else{
            return "00:" + time;
        }
    }
 
    public void stop(View view) {
        mediaPlayer.stop();
    }
 
    public void seek(View view) {
        int l = (int) (mediaPlayer.getDuration()/1000-10);
        l = (int) (mediaPlayer.getCurrentPosition()/1000+10);
        Log.e(TAG, "MainActivity seek  "+l+"");
        mediaPlayer.seekTo(l);
 
//        mediaPlayer.seek(3*60+35);//2分钟
    }
 
    @Override
    protected void onPause() {
        super.onPause();
        Log.e(TAG, "onPause");
        mediaPlayer.pause();
      //暂停下载
        if(fileDown!=null) {
//            fileDown.pause();
        }
    }
 
    @Override
    protected void onDestroy() {
        mediaPlayer.stop();
//        new android.media.MediaPlayer().release();
        mediaPlayer.release();
        super.onDestroy();
    }
 
 
 
    public void center(View view) {
        //立体声
//        media.setMute(MuteEnum.MUTE_CENTER);
 
    }
 
    public void left(View view) {
        //左声道
//        media.setMute(MuteEnum.MUTE_LEFT);
    }
 
    public void right(View view) {
        //右声道
//        wlPlayer.setMute(MuteEnum.MUTE_RIGHT);
    }
    public void pitch(View view) {
        mediaPlayer.setSpeed(1f);
        mediaPlayer.setPicth(1.5f);
    }
    public void speed(View view) {
        mediaPlayer.setSpeed(1.5f);
        mediaPlayer.setPicth(1f);
    }
 
    public void speed_pitch(View view) {
        mediaPlayer.setSpeed(1.5f);
        mediaPlayer.setPicth(1.5f);
    }
 
    public void normal_vol(View view) {
        mediaPlayer.setSpeed(1f);
        mediaPlayer.setPicth(1f);
    }
 
 
    public void start_record(View view) {
        //开如录音
//        File file = new File(Environment.getExternalStorageDirectory()+File.separator+"test_player.aac");
//        wlPlayer.startRecord(file);
    }
 
    public void pause_record(View view) {
        //暂停录音
//        wlPlayer.pauseRecord();
    }
 
    public void goon_record(View view) {
        //继续录音
//        wlPlayer.resumeRcord();
 
    }
 
    public void stop_record(View view) {
        //停止录音
//        wlPlayer.stopRecord();
    }
    public void startLu(View view) {
        boolean check = PermissionUtil.check(this, PermissionUtil.READ_EXTERNAL_STORAGE);
        if(!check) {
            T.showShort(this, "没有读写权限");
            PermissionUtil.requestPermission(this, PermissionUtil.READ_EXTERNAL_STORAGE);
            return;
        }
        //录制视频
        mediaPlayer.setSaveVideoFile(Environment.getExternalStorageDirectory()+File.separator+"_"+System.currentTimeMillis()+".mp4");
    }
    public void stopLu(View view) {
        //停止录制视频
        mediaPlayer.stopSaveVideo();
 
    }
    private void updateDownTime() {
        if(fileDown!=null) {
            int duration = fileDown.getDuration();
            int currPos = fileDown.getCurrPos();
            String time = getTime(duration/1000);
            String time2 = getTime(currPos/1000);
            tvTime.setText(time2+" / "+time);
        }
 
    }
    public void startDown(View view) {
        boolean check = PermissionUtil.check(this, PermissionUtil.READ_EXTERNAL_STORAGE);
        if(!check) {
            T.showShort(this, "没有读写权限");
            PermissionUtil.requestPermission(this, PermissionUtil.READ_EXTERNAL_STORAGE);
            return;
        }
        if(fileDown==null) {
            fileDown = new MediaFileDown();
            fileDown.setDownListener(null, new OnCallCompleteListener() {
 
                @Override
                public void onCallComplete(boolean isFull) {//下载完成
                    if(isFull) {
                        Log.e(TAG, "完整下载");
                    }else {
                        Log.e(TAG, "非完整下载");
                    }
                    T.showShort(getApplication(), "下载完成");
 
                }
            }, new OnDownloadingListener() {
 
                @Override
                public void onDownloadingListener(int curr, int duration) {
                    if(duration==0) {
                        if(curr!=0 && curr %100 ==0) {
                            runOnUiThread(new Thread() {
                                @Override
                                public void run() {
                                    updateDownTime();
                                }
                            });
                        }
                        return;
                    }
                    int leng = curr*100 /duration;
                    Log.e(TAG, "下载进度-->"+leng+"%  curr:"+curr+"  dur:"+duration);
                    seekBar.setProgress(leng);
                    if(leng!=0 && leng %2 ==0) {
                        runOnUiThread(new Thread() {
                            @Override
                            public void run() {
                                updateDownTime();
                            }
                        });
                    }
 
                }
            }, new MediaFileDown.OnErrorListener() {
 
                @Override
                public void onError(int code) {
                    // TODO Auto-generated method stub
                    T.showShort(getApplication(), "下载出错");
                    runOnUiThread(new Thread() {
                        @Override
                        public void run() {
                            Toast.makeText(getApplicationContext(), "下载出错", Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            });
        }
        String url = "";
 
        Log.e(TAG, file);
        boolean loading = fileDown.isLoading();
        String string = inputView.getText().toString();
        if(!TextUtils.isEmpty(string)) {
            url = string;
        }
        Log.e(TAG, "下载:"+url);
        fileDown.setDownload(url.trim(), file);
        fileDown.start();
 
    }
    public void stopDown(View view) {
        //停止录制视频
        if(fileDown!=null) {
            Log.e(TAG, "stop");
            fileDown.stop();
        }
    }
    public void pauseDown(View view) {
        //暂停下载
        if(fileDown!=null) {
            Log.e(TAG, "pause");
            fileDown.pause();
        }
    }
 
 
}

Layout.XML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:keepScreenOn="true"
    android:orientation="vertical"
    tools:context=".MainActivity" >
 
    <com.z.view.VideoView
        android:id="@+id/gl_surface"
        android:layout_width="match_parent"
        android:layout_height="210dp" />
 
    <TextView
        android:id="@+id/tv_time"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#CCC"
        android:gravity="center"
        android:padding="5dp"
        android:text="00:00" />
    <EditText
        android:hint="url"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/et_input"
        />
 
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
 
        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="testFFmpeg"
            android:text="测试"
            android:visibility="gone" />
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="begin"
            android:text="开始" />
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="pause"
            android:text="暂停" />
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="resume"
            android:text="播放" />
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="stop"
            android:text="停止" />
 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="seek"
            android:text="最后" />
    </LinearLayout>
 
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingBottom="40dp" >
 
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="进度" />
 
            <SeekBar
                android:id="@+id/seekBar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
 
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="音量" />
 
            <SeekBar
                android:id="@+id/seekBar_volume"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:max="100" />
 
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="next"
                android:text="切换" />
 
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="left"
                    android:text="左声道" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="right"
                    android:text="右声道" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="center"
                    android:text="立体声" />
            </LinearLayout>
 
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="speed"
                    android:text="变速" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="pitch"
                    android:text="变调" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="speed_pitch"
                    android:text="变速变调" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="normal_vol"
                    android:text="正常" />
            </LinearLayout>
 
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:visibility="gone" >
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="start_record"
                    android:text="开始录音" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="pause_record"
                    android:text="暂停录音" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="goon_record"
                    android:text="继续录音" />
 
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:onClick="stop_record"
                    android:text="停止录音" />
            </LinearLayout>
 
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:onClick="cut_pcm"
                android:text="裁剪音频"
                android:visibility="gone" />
 
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="switch_decode"
                android:text="软/硬解码" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="startLu"
                android:text="开始录制" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="stopLu"
                android:text="停止录制" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="startDown"
                android:text="开始下载" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="stopDown"
                android:text="结束下载" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="pauseDown"
                android:text="暂停下载" />
        </LinearLayout>
    </ScrollView>
 
</LinearLayout>

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

最后于 2022-4-1 12:59 被富到流油^-^编辑 ,原因: 补充
上传的附件:
收藏
免费 2
支持
分享
最新回复 (8)
雪    币: 2317
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
2
问句外行话,拿这个.so替换我原播放器里的低版本so 有影响不~
2022-4-15 19:00
0
雪    币: 506
活跃值: (3313)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
dtsky 问句外行话,拿这个.so替换我原播放器里的低版本so 有影响不~
如果你用的是我之前的开源,没有影响API没有改变
2022-5-1 16:21
0
雪    币: 15003
活跃值: (6213)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
AVC1能解码?
2022-5-1 16:48
0
雪    币: 506
活跃值: (3313)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
tDasm AVC1能解码?
mediaPlayer.setOnCheckDecodeListener 打开被注释的这个回调,可查看所有支持类型
2022-5-3 15:22
0
雪    币: 15003
活跃值: (6213)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
富到流油^-^ mediaPlayer.setOnCheckDecodeListener 打开被注释的这个回调,可查看所有支持类型
有这么回答的?看来你也是拿来主义。
因为你自己都不确定,要别人去看。如果直接回答是或否,答错了就更.....
2022-5-3 20:47
0
雪    币: 506
活跃值: (3313)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
tDasm 有这么回答的?看来你也是拿来主义。 因为你自己都不确定,要别人去看。如果直接回答是或否,答错了就更.....
大家都是拿来主义吧,我不至于自己搞解码算法吧,谁也不会自己搞个手机系统吧,不想用的话,这个问题我也不想回答,不想当拿来主义,可以自己去下载源码,或自己写解码
2022-5-10 09:02
0
雪    币: 15003
活跃值: (6213)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
富到流油^-^ 大家都是拿来主义吧,我不至于自己搞解码算法吧,谁也不会自己搞个手机系统吧,不想用的话,这个问题我也不想回答,不想当拿来主义,可以自己去下载源码,或自己写解码
不全是拿来主义。如果推荐的东西自己都不完全了解,那就不应该推荐?
2022-5-10 10:58
0
雪    币: 506
活跃值: (3313)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
tDasm 不全是拿来主义。如果推荐的东西自己都不完全了解,那就不应该推荐?
不好意思,不清楚你什么目地,我搞这个,是为了方便大家可以更轻松的开发属于自己的视频播放,不知为何你要纠结这个问题上,有能力的人可以自己去编译解码工具,能力不够或想省些时间的话,可以集成我编译的。如果你也在用,可把遇到的问题放帖子下面,要是你有更好的解决方案,也可以拿出来分享一下
2022-5-10 11:49
0
游客
登录 | 注册 方可回帖
返回
//