~ubuntu-branches/ubuntu/utopic/libhybris/utopic-proposed

« back to all changes in this revision

Viewing changes to compat/media/SimplePlayer.cpp

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2014-01-23 02:38:35 UTC
  • Revision ID: package-import@ubuntu.com-20140123023835-wtt32jl6x1o7zyk5
Tags: 0.1.0+git20131207+e452e83-0ubuntu6
Making compat code compatible with Android 4.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include "SimplePlayer.h"
22
22
 
 
23
#include <gui/Surface.h>
 
24
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2
23
25
#include <gui/SurfaceTextureClient.h>
 
26
#endif
24
27
#include <media/AudioTrack.h>
25
28
#include <media/ICrypto.h>
26
29
#include <media/stagefright/foundation/ABuffer.h>
70
73
status_t SimplePlayer::setSurface(const sp<ISurfaceTexture> &surfaceTexture) {
71
74
    sp<AMessage> msg = new AMessage(kWhatSetSurface, id());
72
75
 
 
76
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2
73
77
    sp<SurfaceTextureClient> surfaceTextureClient;
74
78
    if (surfaceTexture != NULL) {
75
79
        surfaceTextureClient = new SurfaceTextureClient(surfaceTexture);
76
80
    }
 
81
#else
 
82
    sp<Surface> surfaceTextureClient;
 
83
    if (surfaceTexture != NULL) {
 
84
        surfaceTextureClient = new Surface(surfaceTexture);
 
85
    }
 
86
#endif
77
87
 
78
88
    msg->setObject(
79
89
            "native-window", new NativeWindowWrapper(surfaceTextureClient));
349
359
        CHECK(state->mCodec != NULL);
350
360
 
351
361
#ifdef USE_MEDIA_CODEC_LAYER
 
362
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2
352
363
        err = media_codec_configure(state->mCodecDelegate, mformat, mNativeWindow->getSurfaceTextureClient().get(), 0);
353
364
#else
 
365
        err = media_codec_configure(state->mCodecDelegate, mformat, mNativeWindow->getSurface().get(), 0);
 
366
#endif
 
367
#else
354
368
        err = state->mCodec->configure(
355
369
                format,
 
370
#if ANDROID_VERSION_MAJOR==4 && ANDROID_VERSION_MINOR<=2
356
371
                mNativeWindow->getSurfaceTextureClient(),
 
372
#else
 
373
                mNativeWindow->getSurface(),
 
374
#endif
357
375
                NULL /* crypto */,
358
376
                0 /* flags */);
359
377
#endif