1 /*
2  * Copyright (C) 2015 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 com.android.tv.tuner.data;
18 
19 import com.android.tv.tuner.data.Track.AtscAudioTrack;
20 import com.android.tv.tuner.data.Track.AtscCaptionTrack;
21 import java.util.List;
22 
23 /** Collection of MPEG PSI table items. */
24 public class PsiData {
25 
PsiData()26     private PsiData() {}
27 
28     public static class PatItem {
29         private final int mProgramNo;
30         private final int mPmtPid;
31 
PatItem(int programNo, int pmtPid)32         public PatItem(int programNo, int pmtPid) {
33             mProgramNo = programNo;
34             mPmtPid = pmtPid;
35         }
36 
getProgramNo()37         public int getProgramNo() {
38             return mProgramNo;
39         }
40 
getPmtPid()41         public int getPmtPid() {
42             return mPmtPid;
43         }
44 
45         @Override
toString()46         public String toString() {
47             return String.format("Program No: %x PMT Pid: %x", mProgramNo, mPmtPid);
48         }
49     }
50 
51     public static class PmtItem {
52         public static final int ES_PID_PCR = 0x100;
53 
54         private final int mStreamType;
55         private final int mEsPid;
56         private final List<AtscAudioTrack> mAudioTracks;
57         private final List<AtscCaptionTrack> mCaptionTracks;
58 
PmtItem( int streamType, int esPid, List<AtscAudioTrack> audioTracks, List<AtscCaptionTrack> captionTracks)59         public PmtItem(
60                 int streamType,
61                 int esPid,
62                 List<AtscAudioTrack> audioTracks,
63                 List<AtscCaptionTrack> captionTracks) {
64             mStreamType = streamType;
65             mEsPid = esPid;
66             mAudioTracks = audioTracks;
67             mCaptionTracks = captionTracks;
68         }
69 
getStreamType()70         public int getStreamType() {
71             return mStreamType;
72         }
73 
getEsPid()74         public int getEsPid() {
75             return mEsPid;
76         }
77 
getAudioTracks()78         public List<AtscAudioTrack> getAudioTracks() {
79             return mAudioTracks;
80         }
81 
getCaptionTracks()82         public List<AtscCaptionTrack> getCaptionTracks() {
83             return mCaptionTracks;
84         }
85 
86         @Override
toString()87         public String toString() {
88             return String.format(
89                     "Stream Type: %x ES Pid: %x AudioTracks: %s CaptionTracks: %s",
90                     mStreamType, mEsPid, mAudioTracks, mCaptionTracks);
91         }
92     }
93 }
94