OSDN Git Service

stop using trunk or dist directory in rec10 project.
[rec10/rec10-git.git] / jTsSplitter / jtssplitter / data / descriptor / ARIB_Audio_Component_Descriptor.java
1 /*
2  * jTsSplitter - java based mpeg2ts splitter.
3  * Copyright (C) 2009-2010 Yukikaze
4  */
5
6 package jtssplitter.data.descriptor;
7
8 import java.io.UnsupportedEncodingException;
9 import java.util.logging.Level;
10 import java.util.logging.Logger;
11
12 /**
13  *
14  * @author yukikaze
15  */
16 public class ARIB_Audio_Component_Descriptor extends jtssplitter.data.descriptor.abstract_Descriptor{
17     private int Descriptor;
18     private int compornent_type;
19     private int compornent_tag;
20     private int stream_type;
21     private boolean ES_multi_lingual_flag;
22     private boolean main_component_flag;
23     private int quality_indicator;
24     private int sampling_rate;
25     private int ISO_639_language_code;
26     private int ISO_639_language_code_2;
27     private String text;
28     @Override
29     public int getDescriptorTag() {
30         return Descriptor;
31     }
32
33     @Override
34     public void analyzeDescriptor(byte[] descriptor) {
35         Descriptor=descriptor[0]&0xFF;
36         compornent_type=descriptor[3]&0xFF;
37         compornent_tag=descriptor[4]&0xFF;
38         stream_type=descriptor[5]&0xFF;
39         ES_multi_lingual_flag=(((descriptor[7]&0x80)>>7)==1);
40         main_component_flag=(((descriptor[7]&0x40)>>6)==1);
41         quality_indicator=(descriptor[7]&0x30>>4);
42         sampling_rate=(descriptor[7]&0xE>>1);
43         ISO_639_language_code=(((descriptor[8]&0xFF)<<16)+((descriptor[9]&0xFF)<<8)+(descriptor[10]&0xFF));
44         if (ES_multi_lingual_flag){
45             ISO_639_language_code_2=(((descriptor[11]&0xFF)<<16)+((descriptor[12]&0xFF)<<8)+(descriptor[13]&0xFF));
46             try {
47                 text = new String(descriptor, 14, descriptor.length - 14, "EUC-JP");
48             } catch (UnsupportedEncodingException ex) {
49                 Logger.getLogger(ARIB_Audio_Component_Descriptor.class.getName()).log(Level.SEVERE, null, ex);
50             }
51         }else{
52             try {
53                 text = new String(descriptor, 11, descriptor.length - 11, "EUC-JP");
54             } catch (UnsupportedEncodingException ex) {
55                 Logger.getLogger(ARIB_Audio_Component_Descriptor.class.getName()).log(Level.SEVERE, null, ex);
56             }
57         }
58
59     }
60
61     @Override
62     public void analyzeDescriptor(int DescriptorTag, byte[] descriptor) {
63
64         throw new UnsupportedOperationException("Not supported yet.");
65     }
66
67     /**
68      * 音声のコンポーネント種別を示す。
69      * @return the compornent_type
70      * -1:1/0(シングルモノラル)
71      * -2:1/0+1/0(デュアルモノラル)
72      * -3:2/0
73      * -4:2/1
74      * -7:3/1
75      * -8:3/2
76      * -9:3/2+LFE (5.1chサラウンド)
77      */
78     public int getCompornent_type() {
79         return compornent_type;
80     }
81
82     /**
83      * @return the compornent_tag
84      */
85     public int getCompornent_tag() {
86         return compornent_tag;
87     }
88
89     /**
90      * @return the stream_type
91      */
92     public int getStream_type() {
93         return stream_type;
94     }
95
96     /**
97      * @return the ES_multi_lingual_flag
98      */
99     public boolean isES_multi_lingual_flag() {
100         return ES_multi_lingual_flag;
101     }
102
103     /**
104      * @return the main_component_flag
105      */
106     public boolean isMain_component_flag() {
107         return main_component_flag;
108     }
109
110     /**
111      * @return the quality_indicator
112      */
113     public int getQuality_indicator() {
114         return quality_indicator;
115     }
116
117     /**
118      * サンプリング周波数を示す。
119      * @return the sampling_rate
120      * 1-16kHz
121      * 2-22.05kHz
122      * 3-24kHz
123      * 5-32kHz
124      * 6-44.1kHz
125      * 7-48kHz
126      */
127     public int getSampling_rate() {
128         return sampling_rate;
129     }
130
131     /**
132      * @return the ISO_639_language_code
133      */
134     public int getISO_639_language_code() {
135         return ISO_639_language_code;
136     }
137
138     /**
139      * @return the ISO_639_language_code_2
140      */
141     public int getISO_639_language_code_2() {
142         return ISO_639_language_code_2;
143     }
144
145     /**
146      * @return the text
147      */
148     public String getText() {
149         return text;
150     }
151     
152
153 }