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