Skip to content

Commit 45ef85b

Browse files
committed
show media format data
show media format data
1 parent 16c095f commit 45ef85b

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

app/src/main/java/com/frank/ffmpeg/activity/ProbeFormatActivity.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import com.frank.ffmpeg.R;
1414
import com.frank.ffmpeg.handler.FFmpegHandler;
1515

16+
import com.frank.ffmpeg.model.MediaBean;
17+
import com.frank.ffmpeg.tool.JsonParseTool;
1618
import com.frank.ffmpeg.util.FFmpegUtil;
1719
import com.frank.ffmpeg.util.FileUtil;
1820

@@ -44,9 +46,10 @@ public void handleMessage(Message msg) {
4446
case MSG_FINISH:
4547
progressProbe.setVisibility(View.GONE);
4648
layoutProbe.setVisibility(View.VISIBLE);
47-
String result = (String) msg.obj;
48-
if (!TextUtils.isEmpty(result) && txtProbeFormat != null) {
49-
txtProbeFormat.setText(result);
49+
MediaBean result = (MediaBean) msg.obj;
50+
String resultFormat = JsonParseTool.stringFormat(result);
51+
if (!TextUtils.isEmpty(resultFormat) && txtProbeFormat != null) {
52+
txtProbeFormat.setText(resultFormat);
5053
}
5154
break;
5255
default:

app/src/main/java/com/frank/ffmpeg/handler/FFmpegHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
import com.frank.ffmpeg.FFmpegCmd;
77
import com.frank.ffmpeg.listener.OnHandleListener;
8+
import com.frank.ffmpeg.model.MediaBean;
9+
import com.frank.ffmpeg.tool.JsonParseTool;
810

911
/**
1012
* Handler消息处理器
@@ -78,12 +80,12 @@ public void onBegin() {
7880

7981
@Override
8082
public void onEnd(int resultCode, String resultMsg) {
81-
Log.e(TAG, "handle ffprobe onEnd result=" + resultMsg);
82-
if(isContinue) {
83-
mHandler.obtainMessage(MSG_CONTINUE).sendToTarget();
84-
}else {
85-
mHandler.obtainMessage(MSG_FINISH, resultMsg).sendToTarget();
83+
Log.i(TAG, "handle ffprobe onEnd result=" + resultMsg);
84+
MediaBean mediaBean = null;
85+
if(resultMsg != null && !resultMsg.isEmpty()) {
86+
mediaBean = JsonParseTool.parseMediaFormat(resultMsg);
8687
}
88+
mHandler.obtainMessage(MSG_FINISH, mediaBean).sendToTarget();
8789
}
8890
});
8991
}

app/src/main/res/layout/activity_probe.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
android:layout_width="wrap_content"
2222
android:layout_height="wrap_content"
2323
android:layout_marginTop="20dp"
24+
android:textColor="@color/colorPrimary"
25+
android:textSize="16sp"
2426
android:layout_below="@+id/btn_probe_format"
2527
android:layout_centerHorizontal="true"/>
2628
</RelativeLayout>

0 commit comments

Comments
 (0)