show media format data

show media format data
pull/107/head
xufulong 5 years ago
parent 16c095f5c7
commit 45ef85b772
  1. 9
      app/src/main/java/com/frank/ffmpeg/activity/ProbeFormatActivity.java
  2. 12
      app/src/main/java/com/frank/ffmpeg/handler/FFmpegHandler.java
  3. 2
      app/src/main/res/layout/activity_probe.xml

@ -13,6 +13,8 @@ import android.widget.TextView;
import com.frank.ffmpeg.R;
import com.frank.ffmpeg.handler.FFmpegHandler;
import com.frank.ffmpeg.model.MediaBean;
import com.frank.ffmpeg.tool.JsonParseTool;
import com.frank.ffmpeg.util.FFmpegUtil;
import com.frank.ffmpeg.util.FileUtil;
@ -44,9 +46,10 @@ public class ProbeFormatActivity extends BaseActivity {
case MSG_FINISH:
progressProbe.setVisibility(View.GONE);
layoutProbe.setVisibility(View.VISIBLE);
String result = (String) msg.obj;
if (!TextUtils.isEmpty(result) && txtProbeFormat != null) {
txtProbeFormat.setText(result);
MediaBean result = (MediaBean) msg.obj;
String resultFormat = JsonParseTool.stringFormat(result);
if (!TextUtils.isEmpty(resultFormat) && txtProbeFormat != null) {
txtProbeFormat.setText(resultFormat);
}
break;
default:

@ -5,6 +5,8 @@ import android.util.Log;
import com.frank.ffmpeg.FFmpegCmd;
import com.frank.ffmpeg.listener.OnHandleListener;
import com.frank.ffmpeg.model.MediaBean;
import com.frank.ffmpeg.tool.JsonParseTool;
/**
* Handler消息处理器
@ -78,12 +80,12 @@ public class FFmpegHandler {
@Override
public void onEnd(int resultCode, String resultMsg) {
Log.e(TAG, "handle ffprobe onEnd result=" + resultMsg);
if(isContinue) {
mHandler.obtainMessage(MSG_CONTINUE).sendToTarget();
}else {
mHandler.obtainMessage(MSG_FINISH, resultMsg).sendToTarget();
Log.i(TAG, "handle ffprobe onEnd result=" + resultMsg);
MediaBean mediaBean = null;
if(resultMsg != null && !resultMsg.isEmpty()) {
mediaBean = JsonParseTool.parseMediaFormat(resultMsg);
}
mHandler.obtainMessage(MSG_FINISH, mediaBean).sendToTarget();
}
});
}

@ -21,6 +21,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textColor="@color/colorPrimary"
android:textSize="16sp"
android:layout_below="@+id/btn_probe_format"
android:layout_centerHorizontal="true"/>
</RelativeLayout>

Loading…
Cancel
Save