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.R;
import com.frank.ffmpeg.handler.FFmpegHandler; 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.FFmpegUtil;
import com.frank.ffmpeg.util.FileUtil; import com.frank.ffmpeg.util.FileUtil;
@ -44,9 +46,10 @@ public class ProbeFormatActivity extends BaseActivity {
case MSG_FINISH: case MSG_FINISH:
progressProbe.setVisibility(View.GONE); progressProbe.setVisibility(View.GONE);
layoutProbe.setVisibility(View.VISIBLE); layoutProbe.setVisibility(View.VISIBLE);
String result = (String) msg.obj; MediaBean result = (MediaBean) msg.obj;
if (!TextUtils.isEmpty(result) && txtProbeFormat != null) { String resultFormat = JsonParseTool.stringFormat(result);
txtProbeFormat.setText(result); if (!TextUtils.isEmpty(resultFormat) && txtProbeFormat != null) {
txtProbeFormat.setText(resultFormat);
} }
break; break;
default: default:

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

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

Loading…
Cancel
Save