1c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith/*
2c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * Copyright (C) 2014 The Android Open Source Project
3c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith *
4c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * Licensed under the Apache License, Version 2.0 (the "License");
5c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * you may not use this file except in compliance with the License.
6c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * You may obtain a copy of the License at
7c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith *
8c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith *      http://www.apache.org/licenses/LICENSE-2.0
9c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith *
10c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * Unless required by applicable law or agreed to in writing, software
11c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * distributed under the License is distributed on an "AS IS" BASIS,
12c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * See the License for the specific language governing permissions and
14c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith * limitations under the License.
15c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith */
16c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
17c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith#ifndef RS_FILTER_H_
18c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith#define RS_FILTER_H_
19c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
20c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith#include <media/stagefright/RenderScriptWrapper.h>
21c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith#include <RenderScript.h>
22c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
23c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith#include "SimpleFilter.h"
24c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
25c6c182f354142b47b7a5abfa9f95c82b236f5832David Smithnamespace android {
26c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
27c6c182f354142b47b7a5abfa9f95c82b236f5832David Smithstruct AString;
28c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
29c6c182f354142b47b7a5abfa9f95c82b236f5832David Smithstruct RSFilter : public SimpleFilter {
30c6c182f354142b47b7a5abfa9f95c82b236f5832David Smithpublic:
31c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    RSFilter();
32c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
33c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    virtual status_t configure(const sp<AMessage> &msg);
34c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    virtual status_t start();
35c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    virtual void reset();
36c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    virtual status_t setParameters(const sp<AMessage> &msg);
37c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    virtual status_t processBuffers(
38c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith            const sp<ABuffer> &srcBuffer, const sp<ABuffer> &outBuffer);
39c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
40c6c182f354142b47b7a5abfa9f95c82b236f5832David Smithprotected:
41c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    virtual ~RSFilter();
42c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
43c6c182f354142b47b7a5abfa9f95c82b236f5832David Smithprivate:
44c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    AString mCacheDir;
45c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    sp<RenderScriptWrapper::RSFilterCallback> mCallback;
46c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    RSC::sp<RSC::RS> mRS;
47c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    RSC::sp<RSC::Allocation> mAllocIn;
48c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith    RSC::sp<RSC::Allocation> mAllocOut;
49c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith};
50c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
51c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith}   // namespace android
52c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith
53c6c182f354142b47b7a5abfa9f95c82b236f5832David Smith#endif  // RS_FILTER_H_
54