• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #ifndef _SERVER_CONNECTION_H
17 #define _SERVER_CONNECTION_H
18 
19 #include "GLEncoder.h"
20 #include "GL2Encoder.h"
21 #include "IOStream.h"
22 #include "codec_defs.h"
23 #include "ut_rendercontrol_enc.h"
24 #include <pthread.h>
25 
26 #define ENV_RGL_SERVER "RGL_SERVER"
27 #define RGL_DEFAULT_SERVER "10.0.2.2"
28 
29 class ServerConnection {
30 public:
31     ~ServerConnection();
32     int create(size_t buf_size = 4 * 1024 * 1024, const char *defaultServer = RGL_DEFAULT_SERVER);
33     static gl_client_context_t *s_getGlContext();
34     static ServerConnection *s_getServerConnection();
35     static gl2_client_context_t *s_getGl2Context();
glEncoder()36     GLEncoder *glEncoder() { return m_glEnc; }
gl2Encoder()37     GL2Encoder *gl2Encoder() { return m_gl2Enc; }
utEnc()38     ut_rendercontrol_encoder_context_t * utEnc() { return m_ut_enc; }
39 
40 private:
41     ServerConnection();
42 
43 private:
44     static pthread_key_t s_glKey;
45     static pthread_key_t s_connectionKey;
46     static void s_initKeys();
47     IOStream *m_stream;
48     GLEncoder *m_glEnc;
49     GL2Encoder *m_gl2Enc;
50     ut_rendercontrol_encoder_context_t *m_ut_enc;
51 
52 };
53 
54 
55 #endif
56