Welcome to mirror list, hosted at ThFree Co, Russian Federation.

VideoTimer.cpp « maps « mapswithme « com « jni « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5a418c2878b5f49bb9bab47864928bffe014d125 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "VideoTimer.hpp"

#include "../core/jni_helper.hpp"

#include "../../../../../base/assert.hpp"
#include "../../../../../base/logging.hpp"


android::VideoTimer * g_timer = 0;

namespace android
{
  VideoTimer::VideoTimer(TFrameFn frameFn)
    : ::VideoTimer(frameFn)
  {
    ASSERT(g_timer == 0, ());
    g_timer = this;
  }

  VideoTimer::~VideoTimer()
  {
    stop();
    g_timer = 0;
  }

  void VideoTimer::SetParentObject(jobject videoTimer)
  {
    m_videoTimer = videoTimer;
  }

  void VideoTimer::start()
  {
    /*JNIEnv * env;
    m_javaVM->AttachCurrentThread(&env, NULL);
    env->CallVoidMethod(m_videoTimer, jni::GetJavaMethodID(env, m_videoTimer, "start", "()V"));*/
    m_state = ERunning;
  }

  void VideoTimer::resume()
  {
    /*JNIEnv * env;
    m_javaVM->AttachCurrentThread(&env, NULL);
    env->CallVoidMethod(m_videoTimer, jni::GetJavaMethodID(env, m_videoTimer, "resume", "()V"));*/
    m_state = ERunning;
  }

  void VideoTimer::pause()
  {
    /*JNIEnv * env;
    m_javaVM->AttachCurrentThread(&env, NULL);
    env->CallVoidMethod(m_videoTimer, jni::GetJavaMethodID(env, m_videoTimer, "pause", "()V"));*/
    m_state = EPaused;
  }

  void VideoTimer::stop()
  {
    /*JNIEnv * env;
    m_javaVM->AttachCurrentThread(&env, NULL);
    env->CallVoidMethod(m_videoTimer, jni::GetJavaMethodID(env, m_videoTimer, "stop", "()V"));*/
    m_state = EStopped;
  }

  void VideoTimer::perform()
  {
    //m_frameFn();
  }
}

extern "C"
{
  JNIEXPORT void JNICALL
  Java_com_mapswithme_maps_VideoTimer_nativeRun(JNIEnv * env, jobject thiz)
  {
    ASSERT ( g_timer, ());
    g_timer->perform();
  }

  JNIEXPORT void JNICALL
  Java_com_mapswithme_maps_VideoTimer_nativeInit(JNIEnv * env, jobject thiz)
  {
    ASSERT ( g_timer, ());
    g_timer->SetParentObject(thiz);
  }
}