mpl

+#define IRE_DUMP
+#ifdef IRE_DUMP
+    static int dump_i = 0;
+    static FILE *fp_before = NULL;
+    static FILE *fp_after = NULL;
+    LOGD("Begin to dump data, %d x %d -> %d x %d, dump_i=%d",
+         vsrc.width, vsrc.height, vdst.width, vdst.height, dump_i);
+
+    if ( 0 == dump_i && access("/data/before.yuv", R_OK) != 0) {
+        fp_before = fopen("/data/before.yuv", "w");
+        if (fp_before == NULL){
+            LOGE("%s: Cannot dump due to %s", __FUNCTION__, strerror(errno));
+        } else {
+            fp_after = fopen("/data/after.yuv", "w");
+            if (fp_after == NULL){
+                LOGE("%s: Cannot dump due to %s", __FUNCTION__, strerror(errno));
+                fclose(fp_before);
+                fp_before = NULL;
+            }
+        }
+        dump_i++;
+    }
+
+    if ( fp_before != NULL ) {
+        fwrite(vsrc.start[0], 1, vsrc.length[0], fp_before);
+    }
+#endif
 
     ire_process(&ctx->ireHandle, &vsrc, &vdst);
 
+#ifdef IRE_DUMP
+
+    if ( fp_after != NULL ) {
+        fwrite(vdst.start[0], 1, vdst.length[0], fp_after);
+        dump_i++;
+    }
+
+    if ( 50 == dump_i) {
+        if (fclose(fp_before) != 0) {
+            LOGE("%s: fclose(fp_before) failed: %s", __FUNCTION__, strerror(errno));
+        }
+
+        if (fclose(fp_after) != 0) {
+            LOGE("%s: fclose(fp_after) failed: %s", __FUNCTION__, strerror(errno));
+        }
+
+        fp_before = NULL;
+        fp_after = NULL;
+        dump_i = 0; // End the dump.
+    }
+#endif
+
     TRACE("%s x", __FUNCTION__);
     return 0;

 

mplayer -demuxer rawvideo -rawvideo w=400:h=300:i420:fps=10 before.yuv

你可能感兴趣的:(function,File,null,Access,FP)