@@ -52,7 +52,7 @@ public class HookMain implements IXposedHookLoadPackage {
5252
5353 public static Camera data_camera ;
5454 public static Camera start_preview_camera ;
55- public static volatile byte [] data_buffer ;
55+ public static volatile byte [] data_buffer = { 0 } ;
5656 public static byte [] input ;
5757 public static int mhight ;
5858 public static int mwidth ;
@@ -104,7 +104,7 @@ protected void beforeHookedMethod(MethodHookParam param) {
104104 if (param .args [0 ] == null ) {
105105 return ;
106106 }
107- if (param .args [0 ].equals (c1_fake_texture )) {
107+ if (param .args [0 ].equals (c1_fake_texture )){
108108 return ;
109109 }
110110 if (reallycamera != null && reallycamera .equals (param .thisObject )) {
@@ -144,6 +144,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
144144 if (!file .exists ()) {
145145 if (toast_content != null ) {
146146 Toast .makeText (toast_content , "不存在替换视频" , Toast .LENGTH_SHORT ).show ();
147+ return ;
147148 }
148149 }
149150 XposedBridge .log ("1位参数初始化相机,类:" + c2_state_callback .toString ());
@@ -165,6 +166,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
165166 if (!file .exists ()) {
166167 if (toast_content != null ) {
167168 Toast .makeText (toast_content , "不存在替换视频" , Toast .LENGTH_SHORT ).show ();
169+ return ;
168170 }
169171 }
170172 c2_state_callback = param .args [2 ].getClass ();
@@ -216,11 +218,13 @@ protected void beforeHookedMethod(MethodHookParam param) {
216218 @ Override
217219 protected void afterHookedMethod (MethodHookParam param ) {
218220 XposedBridge .log ("4参数拍照" );
219- if (param .args [1 ] == null ) {
220- process_a_shot_jpeg (param , 3 );
221- } else {
221+ if (param .args [1 ] != null ) {
222222 process_a_shot_YUV (param );
223223 }
224+
225+ if (param .args [3 ] != null ) {
226+ process_a_shot_jpeg (param , 3 );
227+ }
224228 }
225229 });
226230
@@ -236,7 +240,7 @@ protected void afterHookedMethod(MethodHookParam param) {
236240 }
237241 });*/
238242
239- XposedHelpers .findAndHookMethod ("android.media.MediaRecorder" , lpparam .classLoader , "setCamera" , Camera .class , new XC_MethodHook () {
243+ /* XposedHelpers.findAndHookMethod("android.media.MediaRecorder", lpparam.classLoader, "setCamera", Camera.class, new XC_MethodHook() {
240244 @Override
241245 protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
242246 super.beforeHookedMethod(param);
@@ -246,7 +250,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
246250 }
247251 param.args[0] = null;
248252 }
249- });
253+ });*/
250254
251255 XposedHelpers .findAndHookMethod ("android.app.Instrumentation" , lpparam .classLoader , "callApplicationOnCreate" , Application .class , new XC_MethodHook () {
252256 @ Override
@@ -261,6 +265,13 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
261265 XposedHelpers .findAndHookMethod ("android.hardware.Camera" , lpparam .classLoader , "startPreview" , new XC_MethodHook () {
262266 @ Override
263267 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
268+ File file = new File (Environment .getExternalStorageDirectory ().getPath () + "/DCIM/Camera1/virtual.mp4" );
269+ if (!file .exists ()) {
270+ if (toast_content != null ) {
271+ Toast .makeText (toast_content , "不存在替换视频" , Toast .LENGTH_SHORT ).show ();
272+ return ;
273+ }
274+ }
264275 is_someone_playing = false ;
265276 XposedBridge .log ("开始预览" );
266277 start_preview_camera = (Camera ) param .thisObject ;
@@ -349,6 +360,13 @@ public void onPrepared(MediaPlayer mp) {
349360 @ Override
350361 protected void beforeHookedMethod (MethodHookParam param ) throws Throwable {
351362 XposedBridge .log ("添加Surfaceview预览" );
363+ File file = new File (Environment .getExternalStorageDirectory ().getPath () + "/DCIM/Camera1/virtual.mp4" );
364+ if (!file .exists ()) {
365+ if (toast_content != null ) {
366+ Toast .makeText (toast_content , "不存在替换视频" , Toast .LENGTH_SHORT ).show ();
367+ return ;
368+ }
369+ }
352370 mcamera1 = (Camera ) param .thisObject ;
353371 ori_holder = (SurfaceHolder ) param .args [0 ];
354372 if (c1_fake_texture == null ) {
@@ -763,7 +781,7 @@ protected void beforeHookedMethod(MethodHookParam paramd) throws Throwable {
763781 onemhight = loaclcam .getParameters ().getPreviewSize ().height ;
764782 XposedBridge .log ("YUV拍照回调初始化:宽:" + onemwidth + "高:" + onemhight + "对应的类:" + loaclcam .toString ());
765783 if (toast_content != null ) {
766- Toast .makeText (toast_content , "发现拍照\n 宽:" + onemwidth + "\n 高:" + onemhight + "\n 格式:YUV_420_888" , Toast .LENGTH_LONG ).show ();
784+ Toast .makeText (toast_content , "发现拍照\n 宽:" + onemwidth + "\n 高:" + onemhight + "\n 格式:YUV_420_888" , Toast .LENGTH_LONG ).show ();
767785 }
768786 input = getYUVByBitmap (getBMP (Environment .getExternalStorageDirectory ().getPath () + "/DCIM/Camera1/1000.bmp" ));
769787 paramd .args [0 ] = input ;
@@ -792,7 +810,7 @@ protected void beforeHookedMethod(MethodHookParam paramd) throws Throwable {
792810 int frame_Rate = data_camera .getParameters ().getPreviewFrameRate ();
793811 XposedBridge .log ("帧预览回调初始化:宽:" + mwidth + " 高:" + mhight + " 帧率:" + frame_Rate );
794812 if (toast_content != null ) {
795- Toast .makeText (toast_content , "宽 :" + mwidth + "\n 高:" + mhight + "\n " + "帧率:" + frame_Rate , Toast .LENGTH_LONG ).show ();
813+ Toast .makeText (toast_content , "发现预览 \n 宽 :" + mwidth + "\n 高:" + mhight + "\n " + "需要完全匹配分辨率" , Toast .LENGTH_LONG ).show ();
796814 }
797815 File file = new File (Environment .getExternalStorageDirectory ().getPath () + "/DCIM/Camera1/virtual.mp4" );
798816 if (!file .exists ()) {
0 commit comments