content/media/omx/AudioOffloadPlayerBase.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/omx/AudioOffloadPlayerBase.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/*
     1.7 + * Copyright (c) 2014 The Linux Foundation. All rights reserved.
     1.8 + * Copyright (C) 2009 The Android Open Source Project
     1.9 + *
    1.10 + * Licensed under the Apache License, Version 2.0 (the "License");
    1.11 + * you may not use this file except in compliance with the License.
    1.12 + * You may obtain a copy of the License at
    1.13 + *
    1.14 + *      http://www.apache.org/licenses/LICENSE-2.0
    1.15 + *
    1.16 + * Unless required by applicable law or agreed to in writing, software
    1.17 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.18 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.19 + * See the License for the specific language governing permissions and
    1.20 + * limitations under the License.
    1.21 + */
    1.22 +
    1.23 +#ifndef AUDIO_OFFLOAD_PLAYER_BASE_H_
    1.24 +#define AUDIO_OFFLOAD_PLAYER_BASE_H_
    1.25 +
    1.26 +#include "MediaDecoderOwner.h"
    1.27 +#include "MediaOmxDecoder.h"
    1.28 +
    1.29 +namespace mozilla {
    1.30 +
    1.31 +class MediaOmxDecoder;
    1.32 +
    1.33 +/**
    1.34 + * AudioOffloadPlayer interface class which has funtions used by MediaOmxDecoder
    1.35 + * This is to reduce the dependency of AudioOffloadPlayer in MediaOmxDecoder
    1.36 + */
    1.37 +class AudioOffloadPlayerBase
    1.38 +{
    1.39 +  typedef android::status_t status_t;
    1.40 +  typedef android::MediaSource MediaSource;
    1.41 +
    1.42 +public:
    1.43 +  virtual ~AudioOffloadPlayerBase() {};
    1.44 +
    1.45 +  // Caller retains ownership of "aSource".
    1.46 +  virtual void SetSource(const android::sp<MediaSource> &aSource) {}
    1.47 +
    1.48 +  // Start the source if it's not already started and open the AudioSink to
    1.49 +  // create an offloaded audio track
    1.50 +  virtual status_t Start(bool aSourceAlreadyStarted = false)
    1.51 +  {
    1.52 +    return android::NO_INIT;
    1.53 +  }
    1.54 +
    1.55 +  virtual status_t ChangeState(MediaDecoder::PlayState aState)
    1.56 +  {
    1.57 +    return android::NO_INIT;
    1.58 +  }
    1.59 +
    1.60 +  virtual void SetVolume(double aVolume) {}
    1.61 +
    1.62 +  virtual double GetMediaTimeSecs() { return 0; }
    1.63 +
    1.64 +  // To update progress bar when the element is visible
    1.65 +  virtual void SetElementVisibility(bool aIsVisible) {}
    1.66 +
    1.67 +  // Update ready state based on current play state. Not checking data
    1.68 +  // availability since offloading is currently done only when whole compressed
    1.69 +  // data is available
    1.70 +  virtual MediaDecoderOwner::NextFrameStatus GetNextFrameStatus()
    1.71 +  {
    1.72 +    return MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
    1.73 +  }
    1.74 +};
    1.75 +
    1.76 +} // namespace mozilla
    1.77 +
    1.78 +#endif // AUDIO_OFFLOAD_PLAYER_BASE_H_

mercurial