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