// Path: player-android/src/org/videolan/libvlc/util/AndroidUtil.java
// public class AndroidUtil {
//     public static boolean isFroyoOrLater() {
//         return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;
//     }
// 
//     public static boolean isGingerbreadOrLater() {
//         return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD;
//     }
// 
//     public static boolean isHoneycombOrLater() {
//         return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
//     }
// 
//     public static boolean isHoneycombMr1OrLater() {
//         return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
//     }
// 
//     public static boolean isICSOrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
//     }
// 
//     public static boolean isJellyBeanOrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
//     }
// 
//     public static boolean isJellyBeanMR1OrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
//     }
// 
//     public static boolean isJellyBeanMR2OrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
//     }
// 
//     public static File UriToFile(Uri uri) {
//         return new File(uri.getPath().replaceFirst("file://", ""));
//     }
// 
//     /**
//      * Quickly converts path to URIs, which are mandatory in libVLC.
//      *
//      * @param path The path to be converted.
//      * @return A URI representation of path
//      */
//     public static Uri PathToUri(String path) {
//         return Uri.fromFile(new File(path));
//     }
// 
//     public static Uri LocationToUri(String location) {
//         Uri uri = Uri.parse(location);
//         if (uri.getScheme() == null)
//             throw new IllegalArgumentException("location has no scheme");
//         return uri;
//     }
// 
//     public static Uri FileToUri(File file) {
//         return Uri.fromFile(file);
//     }
// }


import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import org.videolan.libvlc.util.AndroidUtil;
import android.annotation.TargetApi;
import android.graphics.SurfaceTexture;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
                onSurfaceDestroyed();
            }
        };

        @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
        private TextureView.SurfaceTextureListener createSurfaceTextureListener() {
            return new TextureView.SurfaceTextureListener() {
                @Override
                public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
                    setSurface(new Surface(surfaceTexture));
                }

                @Override
                public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {

                }

                @Override
                public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
                    onSurfaceDestroyed();
                    return true;
                }

                @Override
                public void onSurfaceTextureUpdated(SurfaceTexture surface) {
                }
            };
        }

        private final TextureView.SurfaceTextureListener mSurfaceTextureListener =
// Path: player-android/src/org/videolan/libvlc/util/AndroidUtil.java
// public class AndroidUtil {
//     public static boolean isFroyoOrLater() {
//         return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO;
//     }
// 
//     public static boolean isGingerbreadOrLater() {
//         return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD;
//     }
// 
//     public static boolean isHoneycombOrLater() {
//         return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB;
//     }
// 
//     public static boolean isHoneycombMr1OrLater() {
//         return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1;
//     }
// 
//     public static boolean isICSOrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
//     }
// 
//     public static boolean isJellyBeanOrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
//     }
// 
//     public static boolean isJellyBeanMR1OrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
//     }
// 
//     public static boolean isJellyBeanMR2OrLater() {
//         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
//     }
// 
//     public static File UriToFile(Uri uri) {
//         return new File(uri.getPath().replaceFirst("file://", ""));
//     }
// 
//     /**
//      * Quickly converts path to URIs, which are mandatory in libVLC.
//      *
//      * @param path The path to be converted.
//      * @return A URI representation of path
//      */
//     public static Uri PathToUri(String path) {
//         return Uri.fromFile(new File(path));
//     }
// 
//     public static Uri LocationToUri(String location) {
//         Uri uri = Uri.parse(location);
//         if (uri.getScheme() == null)
//             throw new IllegalArgumentException("location has no scheme");
//         return uri;
//     }
// 
//     public static Uri FileToUri(File file) {
//         return Uri.fromFile(file);
//     }
// }


// Path: player-android/src/org/videolan/libvlc/AWindow.java
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import org.videolan.libvlc.util.AndroidUtil;
import android.annotation.TargetApi;
import android.graphics.SurfaceTexture;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;

                onSurfaceDestroyed();
            }
        };

        @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
        private TextureView.SurfaceTextureListener createSurfaceTextureListener() {
            return new TextureView.SurfaceTextureListener() {
                @Override
                public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
                    setSurface(new Surface(surfaceTexture));
                }

                @Override
                public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {

                }

                @Override
                public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
                    onSurfaceDestroyed();
                    return true;
                }

                @Override
                public void onSurfaceTextureUpdated(SurfaceTexture surface) {
                }
            };
        }

        private final TextureView.SurfaceTextureListener mSurfaceTextureListener =
                AndroidUtil.isICSOrLater() ? createSurfaceTextureListener() : null;