package com.tencent.mm.pluginsdk.ui.tools;

import android.graphics.SurfaceTexture;
import android.view.Surface;
import android.view.TextureView.SurfaceTextureListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;

class VideoTextureView$9 implements SurfaceTextureListener {
    final /* synthetic */ VideoTextureView vvO;

    VideoTextureView$9(VideoTextureView videoTextureView) {
        this.vvO = videoTextureView;
    }

    public final void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        AppMethodBeat.i(118017);
        ab.d("MicroMsg.VideoTextureView", "on surface texture updated");
        if (VideoTextureView.j(this.vvO)) {
            if (VideoTextureView.a(this.vvO) != null) {
                VideoTextureView.a(this.vvO).pause();
                if (VideoTextureView.m(this.vvO)) {
                    VideoTextureView.a(this.vvO).setVolume(0.0f, 0.0f);
                } else {
                    VideoTextureView.a(this.vvO).setVolume(1.0f, 1.0f);
                }
            }
            VideoTextureView.a(this.vvO, false);
        }
        if (VideoTextureView.n(this.vvO) > 0 && VideoTextureView.o(this.vvO) != null) {
            VideoTextureView.o(this.vvO).bQL();
            VideoTextureView.p(this.vvO);
        }
        VideoTextureView.a(this.vvO, System.currentTimeMillis());
        if (VideoTextureView.q(this.vvO)) {
            ab.i("MicroMsg.VideoTextureView", "%d flush surface pause now time[%d]", new Object[]{Integer.valueOf(this.vvO.hashCode()), Integer.valueOf(this.vvO.getCurrentPosition())});
            if (VideoTextureView.a(this.vvO) != null) {
                VideoTextureView.a(this.vvO).pause();
                this.vvO.setMute(VideoTextureView.m(this.vvO));
            }
            VideoTextureView.r(this.vvO);
        }
        AppMethodBeat.o(118017);
    }

    public final void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
        AppMethodBeat.i(118018);
        ab.i("MicroMsg.VideoTextureView", "on texture size changed width : " + i + " height : " + i2);
        if (VideoTextureView.a(this.vvO) != null && VideoTextureView.s(this.vvO) && VideoTextureView.b(this.vvO) == i && VideoTextureView.c(this.vvO) == i2) {
            VideoTextureView.a(this.vvO).start();
        }
        AppMethodBeat.o(118018);
    }

    public final boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
        AppMethodBeat.i(118019);
        ab.i("MicroMsg.VideoTextureView", "%d on texture destroyed mIsPrepared[%b]", new Object[]{Integer.valueOf(this.vvO.hashCode()), Boolean.valueOf(VideoTextureView.s(this.vvO))});
        VideoTextureView.a(this.vvO, null);
        if (VideoTextureView.a(this.vvO) == null || !VideoTextureView.s(this.vvO)) {
            VideoTextureView.t(this.vvO);
            VideoTextureView.b(this.vvO, false);
        } else if (this.vvO.isPlaying()) {
            VideoTextureView.b(this.vvO, true);
            VideoTextureView.a(this.vvO).pause();
        }
        AppMethodBeat.o(118019);
        return false;
    }

    public final void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
        AppMethodBeat.i(118020);
        VideoTextureView.d(this.vvO, i);
        VideoTextureView.e(this.vvO, i2);
        this.vvO.dAh();
        VideoTextureView.a(this.vvO, new Surface(surfaceTexture));
        ab.i("MicroMsg.VideoTextureView", "%d on texture available %d*%d mIsPrepared[%b] mSurface[%d] ", new Object[]{Integer.valueOf(this.vvO.hashCode()), Integer.valueOf(i), Integer.valueOf(i2), Boolean.valueOf(VideoTextureView.s(this.vvO)), Integer.valueOf(VideoTextureView.u(this.vvO).hashCode())});
        if (VideoTextureView.a(this.vvO) == null || !VideoTextureView.s(this.vvO)) {
            VideoTextureView.v(this.vvO);
        } else {
            VideoTextureView.a(this.vvO).setSurface(VideoTextureView.u(this.vvO));
            if (VideoTextureView.w(this.vvO)) {
                VideoTextureView.a(this.vvO).start();
            } else {
                VideoTextureView.a(this.vvO, true);
                VideoTextureView.a(this.vvO).setVolume(0.0f, 0.0f);
                VideoTextureView.a(this.vvO).start();
            }
            VideoTextureView.b(this.vvO, false);
        }
        if (VideoTextureView.x(this.vvO) != null) {
            VideoTextureView.x(this.vvO).akY();
        }
        AppMethodBeat.o(118020);
    }
}
