• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.filter;
18 
19 import android.annotation.IntRange;
20 import android.annotation.SystemApi;
21 
22 /**
23  * Filter event sent from {@link Filter} objects with download type.
24  *
25  * @hide
26  */
27 @SystemApi
28 public class DownloadEvent extends FilterEvent {
29     private final int mItemId;
30     private final int mMpuSequenceNumber;
31     private final int mItemFragmentIndex;
32     private final int mLastItemFragmentIndex;
33     private final int mDataLength;
34 
35     // This constructor is used by JNI code only
DownloadEvent(int itemId, int mpuSequenceNumber, int itemFragmentIndex, int lastItemFragmentIndex, int dataLength)36     private DownloadEvent(int itemId, int mpuSequenceNumber, int itemFragmentIndex,
37             int lastItemFragmentIndex, int dataLength) {
38         mItemId = itemId;
39         mMpuSequenceNumber = mpuSequenceNumber;
40         mItemFragmentIndex = itemFragmentIndex;
41         mLastItemFragmentIndex = lastItemFragmentIndex;
42         mDataLength = dataLength;
43     }
44 
45     /**
46      * Gets item ID.
47      */
getItemId()48     public int getItemId() {
49         return mItemId;
50     }
51 
52     /**
53      * Gets MPU sequence number of filtered data.
54      */
55     @IntRange(from = 0)
getMpuSequenceNumber()56     public int getMpuSequenceNumber() {
57         return mMpuSequenceNumber;
58     }
59 
60     /**
61      * Gets current index of the current item.
62      *
63      * An item can be stored in different fragments.
64      */
getItemFragmentIndex()65     public int getItemFragmentIndex() {
66         return mItemFragmentIndex;
67     }
68 
69     /**
70      * Gets last index of the current item.
71      */
getLastItemFragmentIndex()72     public int getLastItemFragmentIndex() {
73         return mLastItemFragmentIndex;
74     }
75 
76     /**
77      * Gets data size in bytes of filtered data.
78      */
getDataLength()79     public int getDataLength() {
80         return mDataLength;
81     }
82 }
83 
84