MediaBuffer class exposes internal classes, ABuffer and IMemory, which we don't want to expose to plugins. This change introduces MediaBufferBase which does not expose any classes from system library. Test: build and post-submit media cts tests Bug: 67908556 Change-Id: Ic9ee239caf9b84b2b3740e2d533257afa25c8784gugelfrei
parent
405b3c70cc
commit
1889c3edad
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "MediaBufferBase"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <media/stagefright/MediaBuffer.h>
|
||||
#include <media/stagefright/MediaBufferBase.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
//static
|
||||
MediaBufferBase *MediaBufferBase::Create(size_t size) {
|
||||
return new (std::nothrow) MediaBuffer(size);
|
||||
}
|
||||
|
||||
} // android
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MEDIA_BUFFER_BASE_H_
|
||||
|
||||
#define MEDIA_BUFFER_BASE_H_
|
||||
|
||||
#include <utils/RefBase.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
class MediaBufferBase;
|
||||
class MetaData;
|
||||
|
||||
class MediaBufferObserver {
|
||||
public:
|
||||
MediaBufferObserver() {}
|
||||
virtual ~MediaBufferObserver() {}
|
||||
|
||||
virtual void signalBufferReturned(MediaBufferBase *buffer) = 0;
|
||||
|
||||
private:
|
||||
MediaBufferObserver(const MediaBufferObserver &);
|
||||
MediaBufferObserver &operator=(const MediaBufferObserver &);
|
||||
};
|
||||
|
||||
class MediaBufferBase {
|
||||
public:
|
||||
static MediaBufferBase *Create(size_t size);
|
||||
|
||||
// If MediaBufferGroup is set, decrement the local reference count;
|
||||
// if the local reference count drops to 0, return the buffer to the
|
||||
// associated MediaBufferGroup.
|
||||
//
|
||||
// If no MediaBufferGroup is set, the local reference count must be zero
|
||||
// when called, whereupon the MediaBuffer is deleted.
|
||||
virtual void release() = 0;
|
||||
|
||||
// Increments the local reference count.
|
||||
// Use only when MediaBufferGroup is set.
|
||||
virtual void add_ref() = 0;
|
||||
|
||||
virtual void *data() const = 0;
|
||||
virtual size_t size() const = 0;
|
||||
|
||||
virtual size_t range_offset() const = 0;
|
||||
virtual size_t range_length() const = 0;
|
||||
|
||||
virtual void set_range(size_t offset, size_t length) = 0;
|
||||
|
||||
virtual sp<MetaData> meta_data() = 0;
|
||||
|
||||
// Clears meta data and resets the range to the full extent.
|
||||
virtual void reset() = 0;
|
||||
|
||||
virtual void setObserver(MediaBufferObserver *group) = 0;
|
||||
|
||||
// Returns a clone of this MediaBufferBase increasing its reference
|
||||
// count. The clone references the same data but has its own range and
|
||||
// MetaData.
|
||||
virtual MediaBufferBase *clone() = 0;
|
||||
|
||||
virtual int refcount() const = 0;
|
||||
|
||||
virtual int localRefcount() const = 0;
|
||||
virtual int remoteRefcount() const = 0;
|
||||
|
||||
virtual ~MediaBufferBase() {};
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // MEDIA_BUFFER_BASE_H_
|
@ -0,0 +1 @@
|
||||
../../../../libmediaextractor/include/media/stagefright/MediaBufferBase.h
|
Loading…
Reference in new issue