Skip to content

Commit df5540e

Browse files
committed
remove DefaultMutableTreeNode
1 parent a656f5b commit df5540e

File tree

1 file changed

+47
-52
lines changed

1 file changed

+47
-52
lines changed

src/main/java/nl/digitalekabeltelevisie/data/mpeg/pes/video26x/AbstractVuiParamters.java

Lines changed: 47 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
package nl.digitalekabeltelevisie.data.mpeg.pes.video26x;
2525

26-
import javax.swing.tree.DefaultMutableTreeNode;
27-
2826
import nl.digitalekabeltelevisie.controller.KVP;
2927
import nl.digitalekabeltelevisie.util.BitSource;
3028

@@ -155,78 +153,75 @@ public int getChroma_sample_loc_type_bottom_field() {
155153
/**
156154
* @param t
157155
*/
158-
protected void addCommonFields(final DefaultMutableTreeNode t) {
159-
t.add(new DefaultMutableTreeNode(new KVP("aspect_ratio_info_present_flag",aspect_ratio_info_present_flag,null)));
156+
protected void addCommonFields(KVP t) {
157+
t.add(new KVP("aspect_ratio_info_present_flag",aspect_ratio_info_present_flag));
160158
if( aspect_ratio_info_present_flag!=0 ) {
161-
t.add(new DefaultMutableTreeNode(new KVP("aspect_ratio_idc",aspect_ratio_idc,getAspectRationIdcString(aspect_ratio_idc))));
159+
t.add(new KVP("aspect_ratio_idc",aspect_ratio_idc,getAspectRationIdcString(aspect_ratio_idc)));
162160
if( aspect_ratio_idc == 255 ) { //Extended_SAR
163-
t.add(new DefaultMutableTreeNode(new KVP("sar_width",sar_width,null)));
164-
t.add(new DefaultMutableTreeNode(new KVP("sar_height",sar_height,null)));
161+
t.add(new KVP("sar_width",sar_width));
162+
t.add(new KVP("sar_height",sar_height));
165163
}
166164
}
167-
t.add(new DefaultMutableTreeNode(new KVP("overscan_info_present_flag",overscan_info_present_flag,null)));
165+
t.add(new KVP("overscan_info_present_flag",overscan_info_present_flag));
168166
if( overscan_info_present_flag!=0 ){
169-
t.add(new DefaultMutableTreeNode(new KVP("overscan_appropriate_flag",overscan_appropriate_flag,overscan_appropriate_flag==1?"suitable for display using overscan":"output should not be displayed using overscan")));
167+
t.add(new KVP("overscan_appropriate_flag",overscan_appropriate_flag,overscan_appropriate_flag==1?"suitable for display using overscan":"output should not be displayed using overscan"));
170168
}
171-
t.add(new DefaultMutableTreeNode(new KVP("video_signal_type_present_flag",video_signal_type_present_flag,null)));
169+
t.add(new KVP("video_signal_type_present_flag",video_signal_type_present_flag));
172170
if( video_signal_type_present_flag!=0 ){
173-
t.add(new DefaultMutableTreeNode(new KVP("video_format",video_format,getVideoFormatString(video_format))));
171+
t.add(new KVP("video_format",video_format,getVideoFormatString(video_format)));
174172

175-
t.add(new DefaultMutableTreeNode(new KVP("video_full_range_flag",video_full_range_flag,null)));
176-
t.add(new DefaultMutableTreeNode(new KVP("colour_description_present_flag",colour_description_present_flag,null)));
173+
t.add(new KVP("video_full_range_flag",video_full_range_flag));
174+
t.add(new KVP("colour_description_present_flag",colour_description_present_flag));
177175
if( colour_description_present_flag!=0 ) {
178-
t.add(new DefaultMutableTreeNode(new KVP("colour_primaries",colour_primaries,null)));
179-
t.add(new DefaultMutableTreeNode(new KVP("transfer_characteristics",transfer_characteristics,null)));
180-
t.add(new DefaultMutableTreeNode(new KVP("matrix_coefficients",matrix_coefficients,null)));
176+
t.add(new KVP("colour_primaries",colour_primaries));
177+
t.add(new KVP("transfer_characteristics",transfer_characteristics));
178+
t.add(new KVP("matrix_coefficients",matrix_coefficients));
181179
}
182180
}
183181

184-
t.add(new DefaultMutableTreeNode(new KVP("chroma_loc_info_present_flag",chroma_loc_info_present_flag,null)));
182+
t.add(new KVP("chroma_loc_info_present_flag",chroma_loc_info_present_flag));
185183
if( chroma_loc_info_present_flag!=0) {
186-
t.add(new DefaultMutableTreeNode(new KVP("chroma_sample_loc_type_top_field",chroma_sample_loc_type_top_field,null)));
187-
t.add(new DefaultMutableTreeNode(new KVP("chroma_sample_loc_type_bottom_field",chroma_sample_loc_type_bottom_field,null)));
184+
t.add(new KVP("chroma_sample_loc_type_top_field",chroma_sample_loc_type_top_field));
185+
t.add(new KVP("chroma_sample_loc_type_bottom_field",chroma_sample_loc_type_bottom_field));
188186
}
189187
}
190188

191189
public static String getAspectRationIdcString(final int aspect_ratio_idc) {
192190

193-
switch (aspect_ratio_idc) {
194-
case 0 : return "Unspecified";
195-
case 1 : return "1:1 (square)";
196-
case 2 : return "12:11";
197-
case 3 : return "10:11";
198-
case 4 : return "16:11";
199-
case 5 : return "40:33";
200-
case 6 : return "24:11";
201-
case 7 : return "20:11";
202-
case 8 : return "32:11";
203-
case 9 : return "80:33";
204-
case 10 : return "18:11";
205-
case 11 : return "15:11";
206-
case 12 : return "64:33";
207-
case 13 : return "160:99";
208-
case 14 : return "4:3";
209-
case 15 : return "3:2";
210-
case 16 : return "2:1";
211-
case 255 : return "Extended_SAR";
212-
213-
default:
214-
return "reserved";
215-
}
191+
return switch (aspect_ratio_idc) {
192+
case 0 -> "Unspecified";
193+
case 1 -> "1:1 (square)";
194+
case 2 -> "12:11";
195+
case 3 -> "10:11";
196+
case 4 -> "16:11";
197+
case 5 -> "40:33";
198+
case 6 -> "24:11";
199+
case 7 -> "20:11";
200+
case 8 -> "32:11";
201+
case 9 -> "80:33";
202+
case 10 -> "18:11";
203+
case 11 -> "15:11";
204+
case 12 -> "64:33";
205+
case 13 -> "160:99";
206+
case 14 -> "4:3";
207+
case 15 -> "3:2";
208+
case 16 -> "2:1";
209+
case 255 -> "Extended_SAR";
210+
default -> "reserved";
211+
};
216212
}
217213

218214
public static String getVideoFormatString(final int video_format) {
219215

220-
switch (video_format) {
221-
case 0 : return "Component";
222-
case 1 : return "PAL";
223-
case 2 : return "NTSC";
224-
case 3 : return "SECAM";
225-
case 4 : return "MAC";
226-
case 5 : return "Unspecified video format";
227-
default:
228-
return "reserved";
229-
}
216+
return switch (video_format) {
217+
case 0 -> "Component";
218+
case 1 -> "PAL";
219+
case 2 -> "NTSC";
220+
case 3 -> "SECAM";
221+
case 4 -> "MAC";
222+
case 5 -> "Unspecified video format";
223+
default -> "reserved";
224+
};
230225
}
231226

232227
}

0 commit comments

Comments
 (0)