1 /* 2 * Copyright 2019 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 package android.media.tv.tuner; 18 19 import android.annotation.BytesLong; 20 import android.annotation.IntDef; 21 import android.annotation.NonNull; 22 import android.annotation.Size; 23 import android.annotation.SystemApi; 24 import android.media.tv.tuner.filter.Filter; 25 import android.media.tv.tuner.filter.FilterConfiguration; 26 27 import java.lang.annotation.Retention; 28 import java.lang.annotation.RetentionPolicy; 29 30 /** 31 * Capabilities info for Demux. 32 * 33 * @hide 34 */ 35 @SystemApi 36 public class DemuxCapabilities { 37 38 /** @hide */ 39 @IntDef(value = {Filter.TYPE_TS, Filter.TYPE_MMTP, Filter.TYPE_IP, Filter.TYPE_TLV, 40 Filter.TYPE_ALP}) 41 @Retention(RetentionPolicy.SOURCE) 42 public @interface FilterCapabilities {} 43 44 private final int mDemuxCount; 45 private final int mRecordCount; 46 private final int mPlaybackCount; 47 private final int mTsFilterCount; 48 private final int mSectionFilterCount; 49 private final int mAudioFilterCount; 50 private final int mVideoFilterCount; 51 private final int mPesFilterCount; 52 private final int mPcrFilterCount; 53 private final long mSectionFilterLength; 54 private final int mFilterCaps; 55 private final int[] mLinkCaps; 56 private final boolean mSupportTimeFilter; 57 58 // Used by JNI DemuxCapabilities(int demuxCount, int recordCount, int playbackCount, int tsFilterCount, int sectionFilterCount, int audioFilterCount, int videoFilterCount, int pesFilterCount, int pcrFilterCount, long sectionFilterLength, int filterCaps, int[] linkCaps, boolean timeFilter)59 private DemuxCapabilities(int demuxCount, int recordCount, int playbackCount, int tsFilterCount, 60 int sectionFilterCount, int audioFilterCount, int videoFilterCount, int pesFilterCount, 61 int pcrFilterCount, long sectionFilterLength, int filterCaps, int[] linkCaps, 62 boolean timeFilter) { 63 mDemuxCount = demuxCount; 64 mRecordCount = recordCount; 65 mPlaybackCount = playbackCount; 66 mTsFilterCount = tsFilterCount; 67 mSectionFilterCount = sectionFilterCount; 68 mAudioFilterCount = audioFilterCount; 69 mVideoFilterCount = videoFilterCount; 70 mPesFilterCount = pesFilterCount; 71 mPcrFilterCount = pcrFilterCount; 72 mSectionFilterLength = sectionFilterLength; 73 mFilterCaps = filterCaps; 74 mLinkCaps = linkCaps; 75 mSupportTimeFilter = timeFilter; 76 } 77 78 /** 79 * Gets total number of demuxes. 80 */ getDemuxCount()81 public int getDemuxCount() { 82 return mDemuxCount; 83 } 84 /** 85 * Gets max number of recordings at a time. 86 */ getRecordCount()87 public int getRecordCount() { 88 return mRecordCount; 89 } 90 /** 91 * Gets max number of playbacks at a time. 92 */ getPlaybackCount()93 public int getPlaybackCount() { 94 return mPlaybackCount; 95 } 96 /** 97 * Gets number of TS filters. 98 */ getTsFilterCount()99 public int getTsFilterCount() { 100 return mTsFilterCount; 101 } 102 /** 103 * Gets number of section filters. 104 */ getSectionFilterCount()105 public int getSectionFilterCount() { 106 return mSectionFilterCount; 107 } 108 /** 109 * Gets number of audio filters. 110 */ getAudioFilterCount()111 public int getAudioFilterCount() { 112 return mAudioFilterCount; 113 } 114 /** 115 * Gets number of video filters. 116 */ getVideoFilterCount()117 public int getVideoFilterCount() { 118 return mVideoFilterCount; 119 } 120 /** 121 * Gets number of PES filters. 122 */ getPesFilterCount()123 public int getPesFilterCount() { 124 return mPesFilterCount; 125 } 126 /** 127 * Gets number of PCR filters. 128 */ getPcrFilterCount()129 public int getPcrFilterCount() { 130 return mPcrFilterCount; 131 } 132 /** 133 * Gets number of bytes in the mask of a section filter. 134 */ 135 @BytesLong getSectionFilterLength()136 public long getSectionFilterLength() { 137 return mSectionFilterLength; 138 } 139 /** 140 * Gets filter capabilities in bit field. 141 * 142 * <p>The bits of the returned value is corresponding to the types in 143 * {@link FilterConfiguration}. 144 */ 145 @FilterCapabilities getFilterCapabilities()146 public int getFilterCapabilities() { 147 return mFilterCaps; 148 } 149 150 /** 151 * Gets link capabilities. 152 * 153 * <p>The returned array contains the same elements as the number of types in 154 * {@link FilterConfiguration}. 155 * <p>The ith element represents the filter's capability as the source for the ith type. 156 */ 157 @NonNull 158 @Size(5) getLinkCapabilities()159 public int[] getLinkCapabilities() { 160 return mLinkCaps; 161 } 162 /** 163 * Is {@link android.media.tv.tuner.filter.TimeFilter} supported. 164 */ isTimeFilterSupported()165 public boolean isTimeFilterSupported() { 166 return mSupportTimeFilter; 167 } 168 } 169