Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #69 from taconaut/generic

Use List instead of ArrayList as return type for methods in DLNAMediaInfo
  • Loading branch information...
commit b20e5b854f7fe94e748b3016ea1ce2475c3c11a9 2 parents 741e885 + 5b526aa
@taconaut taconaut authored
View
30 src/main/java/net/pms/dlna/DLNAMediaInfo.java
@@ -48,6 +48,8 @@
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.*;
+import java.util.List;
+
/**
* This class keeps track of scanned MediaInfo library information.
@@ -128,8 +130,8 @@
@Deprecated
public int bitsPerPixel;
- private ArrayList<DLNAMediaAudio> audioTracks = new ArrayList<DLNAMediaAudio>();
- private ArrayList<DLNAMediaSubtitle> subtitleTracks = new ArrayList<DLNAMediaSubtitle>();
+ private List<DLNAMediaAudio> audioTracks = new ArrayList<DLNAMediaAudio>();
+ private List<DLNAMediaSubtitle> subtitleTracks = new ArrayList<DLNAMediaSubtitle>();
/**
* @deprecated Use standard getter and setter to access this variable.
@@ -1455,7 +1457,7 @@ public void setBitsPerPixel(int bitsPerPixel) {
* @return the audioTracks
* @since 1.60
*/
- public ArrayList<DLNAMediaAudio> getAudioTracksList() {
+ public List<DLNAMediaAudio> getAudioTracksList() {
return audioTracks;
}
@@ -1465,14 +1467,18 @@ public void setBitsPerPixel(int bitsPerPixel) {
*/
@Deprecated
public ArrayList<DLNAMediaAudio> getAudioCodes() {
- return getAudioTracksList();
+ if(audioTracks instanceof ArrayList) {
+ return (ArrayList<DLNAMediaAudio>) audioTracks;
+ } else {
+ return new ArrayList<DLNAMediaAudio>();
+ }
}
/**
* @param audioTracks the audioTracks to set
* @since 1.60
*/
- public void setAudioTracksList(ArrayList<DLNAMediaAudio> audioTracks) {
+ public void setAudioTracksList(List<DLNAMediaAudio> audioTracks) {
this.audioTracks = audioTracks;
}
@@ -1481,7 +1487,7 @@ public void setAudioTracksList(ArrayList<DLNAMediaAudio> audioTracks) {
* @deprecated use setAudioTracksList(ArrayList<DLNAMediaAudio> audioTracks) instead
*/
@Deprecated
- public void setAudioCodes(ArrayList<DLNAMediaAudio> audioTracks) {
+ public void setAudioCodes(List<DLNAMediaAudio> audioTracks) {
setAudioTracksList(audioTracks);
}
@@ -1489,7 +1495,7 @@ public void setAudioCodes(ArrayList<DLNAMediaAudio> audioTracks) {
* @return the subtitleTracks
* @since 1.60
*/
- public ArrayList<DLNAMediaSubtitle> getSubtitleTracksList() {
+ public List<DLNAMediaSubtitle> getSubtitleTracksList() {
return subtitleTracks;
}
@@ -1499,14 +1505,18 @@ public void setAudioCodes(ArrayList<DLNAMediaAudio> audioTracks) {
*/
@Deprecated
public ArrayList<DLNAMediaSubtitle> getSubtitlesCodes() {
- return getSubtitleTracksList();
+ if(subtitleTracks instanceof ArrayList) {
+ return (ArrayList<DLNAMediaSubtitle>) subtitleTracks;
+ } else {
+ return new ArrayList<DLNAMediaSubtitle>();
+ }
}
/**
* @param subtitleTracks the subtitleTracks to set
* @since 1.60
*/
- public void setSubtitleTracksList(ArrayList<DLNAMediaSubtitle> subtitleTracks) {
+ public void setSubtitleTracksList(List<DLNAMediaSubtitle> subtitleTracks) {
this.subtitleTracks = subtitleTracks;
}
@@ -1515,7 +1525,7 @@ public void setSubtitleTracksList(ArrayList<DLNAMediaSubtitle> subtitleTracks) {
* @deprecated use setSubtitleTracksList(ArrayList<DLNAMediaSubtitle> subtitleTracks) instead
*/
@Deprecated
- public void setSubtitlesCodes(ArrayList<DLNAMediaSubtitle> subtitleTracks) {
+ public void setSubtitlesCodes(List<DLNAMediaSubtitle> subtitleTracks) {
setSubtitleTracksList(subtitleTracks);
}
View
4 src/main/java/net/pms/dlna/FileTranscodeVirtualFolder.java
@@ -127,8 +127,8 @@ public void resolve() {
// List holding all combinations
ArrayList<DLNAResource> combos = new ArrayList<DLNAResource>();
- ArrayList<DLNAMediaAudio> audioTracks = child.getMedia().getAudioTracksList();
- ArrayList<DLNAMediaSubtitle> subtitles = child.getMedia().getSubtitleTracksList();
+ List<DLNAMediaAudio> audioTracks = child.getMedia().getAudioTracksList();
+ List<DLNAMediaSubtitle> subtitles = child.getMedia().getSubtitleTracksList();
// Make sure a combo with no subtitles will be added
DLNAMediaSubtitle noSubtitle = new DLNAMediaSubtitle();
Please sign in to comment.
Something went wrong with that request. Please try again.