#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>

#define REAL_CAMERASERVER "/data/adb/modules/camera-hook/cameraserver-real"
#define HOOK_LIB "/data/local/camera_magic/libcamera_hook.so"

int main(int argc, char *argv[]) {
    setenv("LD_PRELOAD", HOOK_LIB, 1);
    execv(REAL_CAMERASERVER, argv);
    fprintf(stderr, "CameraHook: execv(%s) failed: %s\n", REAL_CAMERASERVER, strerror(errno));
    return 1;
}
