提交 c18e4ece authored 作者: autulin's avatar autulin

1.修改文件&log存储路径

2.修改native-lib名字
上级 071e7ad9
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.autulin.gb28181_android"> package="com.example.autulin.gb28181_android">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
......
package com.example.autulin.gb28181_android; package com.example.autulin.gb28181_android;
import android.Manifest;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
...@@ -30,6 +32,8 @@ public class DemoActivity extends AppCompatActivity implements ...@@ -30,6 +32,8 @@ public class DemoActivity extends AppCompatActivity implements
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // 防止锁屏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // 防止锁屏
setContentView(R.layout.activity_demo); setContentView(R.layout.activity_demo);
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
initData(); initData();
initView(); initView();
...@@ -49,7 +53,8 @@ public class DemoActivity extends AppCompatActivity implements ...@@ -49,7 +53,8 @@ public class DemoActivity extends AppCompatActivity implements
} }
}); });
try { try {
Runtime.getRuntime().exec("logcat -f /sdcard/DCIM/pstest/log.txt"); Log.e("log", "path: "+MediaRecorderBase.getLogOutPutPath());
Runtime.getRuntime().exec("logcat -f " + MediaRecorderBase.getLogOutPutPath());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -11,13 +11,13 @@ cmake_minimum_required(VERSION 3.4.1) ...@@ -11,13 +11,13 @@ cmake_minimum_required(VERSION 3.4.1)
# Gradle automatically packages shared libraries with your APK. # Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library. add_library( # Sets the name of the library.
native-lib gb_native
# Sets the library as a shared library. # Sets the library as a shared library.
SHARED SHARED
# Provides a relative path to your source file(s). # Provides a relative path to your source file(s).
src/main/cpp/native-lib.cpp src/main/cpp/gb_native.cpp
src/main/cpp/gb28181_muxer.cpp src/main/cpp/gb28181_muxer.cpp
src/main/cpp/gb28181_sender.cpp src/main/cpp/gb28181_sender.cpp
...@@ -165,7 +165,7 @@ find_library( # Sets the name of the path variable. ...@@ -165,7 +165,7 @@ find_library( # Sets the name of the path variable.
# build script, prebuilt third-party libraries, or system libraries. # build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library. target_link_libraries( # Specifies the target library.
native-lib gb_native
avcodec avcodec
avfilter avfilter
avformat avformat
......
...@@ -3,7 +3,7 @@ package com.autulin.gb28181library; ...@@ -3,7 +3,7 @@ package com.autulin.gb28181library;
public class JNIBridge { public class JNIBridge {
// Used to load the 'native-lib' library on application startup. // Used to load the 'native-lib' library on application startup.
static { static {
System.loadLibrary("native-lib"); System.loadLibrary("gb_native");
} }
public final static int ROTATE_0_CROP_LF=0; public final static int ROTATE_0_CROP_LF=0;
......
...@@ -724,7 +724,7 @@ public abstract class MediaRecorderBase implements Callback, PreviewCallback, IM ...@@ -724,7 +724,7 @@ public abstract class MediaRecorderBase implements Callback, PreviewCallback, IM
public MediaOutput setFileOutPut(String fileName) { public MediaOutput setFileOutPut(String fileName) {
File dcim = Environment File dcim = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); .getExternalStorageDirectory();
String path; String path;
if (DeviceUtils.isZte()) { if (DeviceUtils.isZte()) {
if (dcim.exists()) { if (dcim.exists()) {
...@@ -744,4 +744,10 @@ public abstract class MediaRecorderBase implements Callback, PreviewCallback, IM ...@@ -744,4 +744,10 @@ public abstract class MediaRecorderBase implements Callback, PreviewCallback, IM
mediaOutput = new MediaOutput("", 0, path, fileName, JNIBridge.FILE, 0); mediaOutput = new MediaOutput("", 0, path, fileName, JNIBridge.FILE, 0);
return mediaOutput; return mediaOutput;
} }
public static String getLogOutPutPath() {
File path = Environment
.getExternalStorageDirectory();
return path+FILE_DIR_DEFAULT+"/mux.log";
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论