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 
17 
18 package android.filterfw.core;
19 
20 import android.compat.annotation.UnsupportedAppUsage;
21 
22 import java.util.Arrays;
23 
24 /**
25  * @hide
26  */
27 public class MutableFrameFormat extends FrameFormat {
28 
MutableFrameFormat()29     public MutableFrameFormat() {
30         super();
31     }
32 
33     @UnsupportedAppUsage
MutableFrameFormat(int baseType, int target)34     public MutableFrameFormat(int baseType, int target) {
35         super(baseType, target);
36     }
37 
setBaseType(int baseType)38     public void setBaseType(int baseType) {
39         mBaseType = baseType;
40         mBytesPerSample = bytesPerSampleOf(baseType);
41     }
42 
setTarget(int target)43     public void setTarget(int target) {
44         mTarget = target;
45     }
46 
47     @UnsupportedAppUsage
setBytesPerSample(int bytesPerSample)48     public void setBytesPerSample(int bytesPerSample) {
49         mBytesPerSample = bytesPerSample;
50         mSize = SIZE_UNKNOWN;
51     }
52 
setDimensions(int[] dimensions)53     public void setDimensions(int[] dimensions) {
54         mDimensions = (dimensions == null) ? null : Arrays.copyOf(dimensions, dimensions.length);
55         mSize = SIZE_UNKNOWN;
56     }
57 
setDimensions(int size)58     public void setDimensions(int size) {
59         int[] dimensions = new int[1];
60         dimensions[0] = size;
61         mDimensions = dimensions;
62         mSize = SIZE_UNKNOWN;
63     }
64 
65     @UnsupportedAppUsage
setDimensions(int width, int height)66     public void setDimensions(int width, int height) {
67         int[] dimensions = new int[2];
68         dimensions[0] = width;
69         dimensions[1] = height;
70         mDimensions = dimensions;
71         mSize = SIZE_UNKNOWN;
72     }
73 
setDimensions(int width, int height, int depth)74     public void setDimensions(int width, int height, int depth) {
75         int[] dimensions = new int[3];
76         dimensions[0] = width;
77         dimensions[1] = height;
78         dimensions[2] = depth;
79         mDimensions = dimensions;
80         mSize = SIZE_UNKNOWN;
81     }
82 
setDimensionCount(int count)83     public void setDimensionCount(int count) {
84         mDimensions = new int[count];
85     }
86 
setObjectClass(Class objectClass)87     public void setObjectClass(Class objectClass) {
88         mObjectClass = objectClass;
89     }
90 
setMetaValue(String key, Object value)91     public void setMetaValue(String key, Object value) {
92         if (mMetaData == null) {
93             mMetaData = new KeyValueMap();
94         }
95         mMetaData.put(key, value);
96     }
97 
98 }
99