// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/grab/ColorGenerator.java
// public interface ColorGenerator extends Generator {
//     ImageMetaData getMetaData();
// }
// 
// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/grab/ContextFactory.java
// public interface ContextFactory {
//     Context createContext() throws GeneralException;
// }
// 
// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/grab/DepthGenerator.java
// public interface DepthGenerator extends Generator {
//     DepthMetaData getMetaData();
// }


import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
import android.util.Log;
import android.view.SurfaceHolder;
import org.pointclouds.onirec.grab.ColorGenerator;
import org.pointclouds.onirec.grab.ContextFactory;
import org.pointclouds.onirec.grab.DepthGenerator;
import org.OpenNI.*;
import java.io.File;
                                        }
                                    });
                                }
                            });

                        ++frameCount;
                        final long new_time = SystemClock.uptimeMillis();
                        if (new_time >= lastUpdateTime + 500) {
                            final double fps = frameCount / (double) (new_time - lastUpdateTime) * 1000;

                            uiHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    feedback.setFps(fps);
                                }
                            });

                            frameCount = 0;
                            lastUpdateTime = new_time;
                        }

                        handler.post(processFrame);
                    }
                });
            } catch (Timer.ReturnException ignored) {
            }
        }
    };

    public CaptureThreadManager(SurfaceHolder holderColor, SurfaceHolder holderDepth, Feedback feedback,
// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/grab/ColorGenerator.java
// public interface ColorGenerator extends Generator {
//     ImageMetaData getMetaData();
// }
// 
// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/grab/ContextFactory.java
// public interface ContextFactory {
//     Context createContext() throws GeneralException;
// }
// 
// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/grab/DepthGenerator.java
// public interface DepthGenerator extends Generator {
//     DepthMetaData getMetaData();
// }


// Path: apps/android/ONIRecorder/src/org/pointclouds/onirec/CaptureThreadManager.java
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
import android.util.Log;
import android.view.SurfaceHolder;
import org.pointclouds.onirec.grab.ColorGenerator;
import org.pointclouds.onirec.grab.ContextFactory;
import org.pointclouds.onirec.grab.DepthGenerator;
import org.OpenNI.*;
import java.io.File;

                                        }
                                    });
                                }
                            });

                        ++frameCount;
                        final long new_time = SystemClock.uptimeMillis();
                        if (new_time >= lastUpdateTime + 500) {
                            final double fps = frameCount / (double) (new_time - lastUpdateTime) * 1000;

                            uiHandler.post(new Runnable() {
                                @Override
                                public void run() {
                                    feedback.setFps(fps);
                                }
                            });

                            frameCount = 0;
                            lastUpdateTime = new_time;
                        }

                        handler.post(processFrame);
                    }
                });
            } catch (Timer.ReturnException ignored) {
            }
        }
    };

    public CaptureThreadManager(SurfaceHolder holderColor, SurfaceHolder holderDepth, Feedback feedback,
                                final ContextFactory contextFactory, boolean enableVisualization) {