今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

598 lines
17 KiB

.class public Lcom/viatech/VrPlayer/WebSocketMediaPlayer;
.super Landroid/media/MediaPlayer;
.source "WebSocketMediaPlayer.java"
# interfaces
.implements Lcom/viatech/VrPlayer/VideoPlayer$Listener;
# instance fields
.field private TAG:Ljava/lang/String;
.field private mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
.field private mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;
.field private mOnPreparedListener:Landroid/media/MediaPlayer$OnPreparedListener;
.field private mPlayerSyncLock:Ljava/lang/Object;
.field private mSurface:Landroid/view/Surface;
.field private mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
# direct methods
.method public constructor <init>(Landroid/view/Surface;)V
.locals 2
.prologue
const/4 v1, 0x0
.line 20
invoke-direct {p0}, Landroid/media/MediaPlayer;-><init>()V
.line 8
const-string v0, "Vpai_WebSocketMediaPlayer"
iput-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
.line 10
iput-object v1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mSurface:Landroid/view/Surface;
.line 11
iput-object v1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
.line 12
iput-object v1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
.line 17
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
iput-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mPlayerSyncLock:Ljava/lang/Object;
.line 21
iput-object p1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mSurface:Landroid/view/Surface;
.line 22
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
const-string v1, "WebSocketMediaPlayer Created"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 23
return-void
.end method
# virtual methods
.method public flush()V
.locals 1
.prologue
.line 135
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_0
.line 136
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->flush()V
.line 139
:cond_0
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_1
.line 140
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->flush()V
.line 142
:cond_1
return-void
.end method
.method public isPlaying()Z
.locals 1
.prologue
.line 60
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_0
.line 61
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->isPlaying()Z
move-result v0
.line 68
:goto_0
return v0
.line 64
:cond_0
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_1
.line 65
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->isPlaying()Z
move-result v0
goto :goto_0
.line 68
:cond_1
const/4 v0, 0x0
goto :goto_0
.end method
.method public onVideoError(I)V
.locals 3
.prologue
.line 164
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "onVideoError, code="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 166
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;
if-eqz v0, :cond_0
.line 167
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;
const/4 v1, 0x0
invoke-interface {v0, p0, p1, v1}, Landroid/media/MediaPlayer$OnErrorListener;->onError(Landroid/media/MediaPlayer;II)Z
.line 169
:cond_0
return-void
.end method
.method public pause()V
.locals 1
.prologue
.line 89
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_0
.line 90
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->pause()V
.line 93
:cond_0
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_1
.line 94
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->pause()V
.line 97
:cond_1
return-void
.end method
.method public prepareAsync()V
.locals 0
.prologue
.line 56
invoke-virtual {p0}, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->resetPlayer()V
.line 57
return-void
.end method
.method public release()V
.locals 0
.prologue
.line 131
invoke-virtual {p0}, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->stop()V
.line 132
return-void
.end method
.method public resetPlayer()V
.locals 3
.prologue
const/4 v2, 0x0
.line 37
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
const-string v1, "resetPlayer"
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 38
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_0
.line 39
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->stop()I
.line 40
iput-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
.line 43
:cond_0
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_1
.line 44
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->stop()I
.line 45
iput-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
.line 48
:cond_1
new-instance v0, Lcom/viatech/VrPlayer/AudioPlayer;
invoke-direct {v0}, Lcom/viatech/VrPlayer/AudioPlayer;-><init>()V
iput-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
.line 49
new-instance v0, Lcom/viatech/VrPlayer/VideoPlayer;
iget-object v1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mSurface:Landroid/view/Surface;
iget-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-direct {v0, v1, v2}, Lcom/viatech/VrPlayer/VideoPlayer;-><init>(Landroid/view/Surface;Lcom/viatech/VrPlayer/AudioPlayer;)V
iput-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
.line 50
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0, p0}, Lcom/viatech/VrPlayer/VideoPlayer;->setListener(Lcom/viatech/VrPlayer/VideoPlayer$Listener;)V
.line 51
return-void
.end method
.method public resume()V
.locals 1
.prologue
.line 101
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_0
.line 102
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->resume()V
.line 105
:cond_0
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_1
.line 106
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->resume()V
.line 108
:cond_1
return-void
.end method
.method public setOnErrorListener(Landroid/media/MediaPlayer$OnErrorListener;)V
.locals 0
.prologue
.line 32
iput-object p1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;
.line 33
return-void
.end method
.method public setOnPreparedListener(Landroid/media/MediaPlayer$OnPreparedListener;)V
.locals 0
.prologue
.line 26
iput-object p1, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mOnPreparedListener:Landroid/media/MediaPlayer$OnPreparedListener;
.line 27
return-void
.end method
.method public start()V
.locals 3
.prologue
.line 72
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "start, a="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ",v="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 73
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_1
.line 74
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->start()I
move-result v0
if-eqz v0, :cond_1
.line 75
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
const-string v1, "AudioPlayer Start Failed"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 86
:cond_0
:goto_0
return-void
.line 80
:cond_1
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_0
.line 81
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->start()I
move-result v0
if-eqz v0, :cond_0
.line 82
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
const-string v1, "VideoPlayer Start Failed"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
.end method
.method public stop()V
.locals 4
.prologue
const/4 v3, 0x0
.line 113
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "stop, a="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
const-string v2, ",v="
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
iget-object v2, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 115
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_1
.line 116
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/AudioPlayer;->stop()I
move-result v0
if-eqz v0, :cond_0
.line 117
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
const-string v1, "AudioPlayer stop Failed"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 119
:cond_0
iput-object v3, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
.line 122
:cond_1
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_3
.line 123
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0}, Lcom/viatech/VrPlayer/VideoPlayer;->stop()I
move-result v0
if-eqz v0, :cond_2
.line 124
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->TAG:Ljava/lang/String;
const-string v1, "VideoPlayer stop Failed"
invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I
.line 126
:cond_2
iput-object v3, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
.line 128
:cond_3
return-void
.end method
.method public writeRawData([BIII)I
.locals 1
.prologue
.line 145
if-nez p1, :cond_0
.line 146
const/4 v0, -0x1
.line 159
:goto_0
return v0
.line 152
:cond_0
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
if-eqz v0, :cond_1
if-nez p3, :cond_1
.line 153
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mVideoPlayer:Lcom/viatech/VrPlayer/VideoPlayer;
invoke-virtual {v0, p1, p4}, Lcom/viatech/VrPlayer/VideoPlayer;->addVideoPacket([BI)I
.line 156
:cond_1
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
if-eqz v0, :cond_2
const/4 v0, 0x1
if-ne p3, v0, :cond_2
.line 157
iget-object v0, p0, Lcom/viatech/VrPlayer/WebSocketMediaPlayer;->mAudioPlayer:Lcom/viatech/VrPlayer/AudioPlayer;
invoke-virtual {v0, p1, p4}, Lcom/viatech/VrPlayer/AudioPlayer;->addAudioPacket([BI)V
.line 159
:cond_2
const/4 v0, 0x0
goto :goto_0
.end method