diff --git a/.gitignore b/.gitignore index 9bcdd5a..9384601 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ build out +/.gradle/ +/.idea/ diff --git a/README.md b/README.md index 3a438d6..50ab12e 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ implementation 'io.lindstrom:m3u8-parser:0.21' ## Usage -### Create master playlist +### Create main playlist ```java -MasterPlaylist playlist = MasterPlaylist.builder() +MainPlaylist playlist = MainPlaylist.builder() .version(4) .independentSegments(true) .addAlternativeRenditions(AlternativeRendition.builder() @@ -55,11 +55,11 @@ MasterPlaylist playlist = MasterPlaylist.builder() .build()) .build(); -MasterPlaylistParser parser = new MasterPlaylistParser(); +MainPlaylistParser parser = new MainPlaylistParser(); System.out.println(parser.writePlaylistAsString(playlist)); ``` -This code should produce the following master playlist: +This code should produce the following main playlist: ``` #EXTM3U #EXT-X-VERSION:4 @@ -113,15 +113,15 @@ http://media.example.com/third.ts #EXT-X-ENDLIST ``` -### Parse master playlist +### Parse main playlist ```java -MasterPlaylistParser parser = new MasterPlaylistParser(); +MainPlaylistParser parser = new MainPlaylistParser(); // Parse playlist -MasterPlaylist playlist = parser.readPlaylist(Paths.get("path/to/master.m3u8")); +MainPlaylist playlist = parser.readPlaylist(Paths.get("path/to/main.m3u8")); // Update playlist version -MasterPlaylist updated = MasterPlaylist.builder() +MainPlaylist updated = MainPlaylist.builder() .from(playlist) .version(2) .build(); @@ -153,7 +153,7 @@ By default, the parser will throw an exception on unsupported tags and attribute passing a `ParsingMode` to the parser. Example: ```java -MasterPlaylistParser lenientParser = new MasterPlaylistParser(ParsingMode.LENIENT); +MainPlaylistParser lenientParser = new MainPlaylistParser(ParsingMode.LENIENT); ``` Currently two modes are available: diff --git a/src/main/java/io/lindstrom/m3u8/model/MasterPlaylist.java b/src/main/java/io/lindstrom/m3u8/model/MainPlaylist.java similarity index 93% rename from src/main/java/io/lindstrom/m3u8/model/MasterPlaylist.java rename to src/main/java/io/lindstrom/m3u8/model/MainPlaylist.java index 596fad0..ddfd921 100644 --- a/src/main/java/io/lindstrom/m3u8/model/MasterPlaylist.java +++ b/src/main/java/io/lindstrom/m3u8/model/MainPlaylist.java @@ -5,10 +5,10 @@ import java.util.List; /** - * Master playlist interface + * Main playlist interface */ @Value.Immutable -public interface MasterPlaylist extends Playlist { +public interface MainPlaylist extends Playlist { /** * A list of alternate renditions related to this playlist. @@ -59,6 +59,6 @@ static Builder builder() { return new Builder(); } - class Builder extends MasterPlaylistBuilder { + class Builder extends MainPlaylistBuilder { } } diff --git a/src/main/java/io/lindstrom/m3u8/model/Playlist.java b/src/main/java/io/lindstrom/m3u8/model/Playlist.java index 7a08ef1..a6e8d37 100644 --- a/src/main/java/io/lindstrom/m3u8/model/Playlist.java +++ b/src/main/java/io/lindstrom/m3u8/model/Playlist.java @@ -8,7 +8,7 @@ /** * Common playlist interface * - * @see MasterPlaylist + * @see MainPlaylist * @see MediaPlaylist */ public interface Playlist { diff --git a/src/main/java/io/lindstrom/m3u8/parser/MasterPlaylistParser.java b/src/main/java/io/lindstrom/m3u8/parser/MainPlaylistParser.java similarity index 55% rename from src/main/java/io/lindstrom/m3u8/parser/MasterPlaylistParser.java rename to src/main/java/io/lindstrom/m3u8/parser/MainPlaylistParser.java index 2a2dd2f..121bd60 100644 --- a/src/main/java/io/lindstrom/m3u8/parser/MasterPlaylistParser.java +++ b/src/main/java/io/lindstrom/m3u8/parser/MainPlaylistParser.java @@ -1,22 +1,22 @@ package io.lindstrom.m3u8.parser; -import io.lindstrom.m3u8.model.MasterPlaylist; +import io.lindstrom.m3u8.model.MainPlaylist; import java.util.Iterator; /** - * MasterPlaylistParser can read and write Master Playlists according to RFC 8216 (HTTP Live Streaming). + * MainPlaylistParser can read and write Main Playlists according to RFC 8216 (HTTP Live Streaming). *

* Example usage: *

  * {@code
- * MasterPlaylistParser parser = new MasterPlaylistParser();
+ * MainPlaylistParser parser = new MainPlaylistParser();
  *
  * // Parse playlist
- * MasterPlaylist playlist = parser.readPlaylist(Paths.get("path/to/master.m3u8"));
+ * MainPlaylist playlist = parser.readPlaylist(Paths.get("path/to/main.m3u8"));
  *
  * // Update playlist version
- * MasterPlaylist updated = MasterPlaylist.builder()
+ * MainPlaylist updated = MainPlaylist.builder()
  *                                        .from(playlist)
  *                                        .version(2)
  *                                        .build();
@@ -28,34 +28,34 @@
  *
  * This implementation is reusable and thread safe.
  */
-public class MasterPlaylistParser extends AbstractPlaylistParser {
+public class MainPlaylistParser extends AbstractPlaylistParser {
     private final ParsingMode parsingMode;
 
-    public MasterPlaylistParser() {
+    public MainPlaylistParser() {
         this(ParsingMode.STRICT);
     }
 
-    public MasterPlaylistParser(ParsingMode parsingMode) {
+    public MainPlaylistParser(ParsingMode parsingMode) {
         this.parsingMode = parsingMode;
     }
 
     @Override
-    void write(MasterPlaylist playlist, TextBuilder textBuilder) {
-        for (MasterPlaylistTag tag : MasterPlaylistTag.tags.values()) {
+    void write(MainPlaylist playlist, TextBuilder textBuilder) {
+        for (MainPlaylistTag tag : MainPlaylistTag.tags.values()) {
             tag.write(playlist, textBuilder);
         }
     }
 
     @Override
-    MasterPlaylist.Builder newBuilder() {
-        return MasterPlaylist.builder();
+    MainPlaylist.Builder newBuilder() {
+        return MainPlaylist.builder();
     }
 
     @Override
-    void onTag(MasterPlaylist.Builder builder, String name, String attributes, Iterator lineIterator) throws PlaylistParserException{
-        MasterPlaylistTag tag = MasterPlaylistTag.tags.get(name);
+    void onTag(MainPlaylist.Builder builder, String name, String attributes, Iterator lineIterator) throws PlaylistParserException{
+        MainPlaylistTag tag = MainPlaylistTag.tags.get(name);
 
-        if (tag == MasterPlaylistTag.EXT_X_STREAM_INF) {
+        if (tag == MainPlaylistTag.EXT_X_STREAM_INF) {
             String uriLine = lineIterator.next();
             if (uriLine == null || uriLine.startsWith("#")) {
                 throw new PlaylistParserException("Expected URI, got " + uriLine);
@@ -69,14 +69,14 @@ void onTag(MasterPlaylist.Builder builder, String name, String attributes, Itera
     }
 
     @Override
-    void onComment(MasterPlaylist.Builder builder, String value) {
+    void onComment(MainPlaylist.Builder builder, String value) {
         builder.addComments(
                 value
         );
     }
 
     @Override
-    MasterPlaylist build(MasterPlaylist.Builder builder) {
+    MainPlaylist build(MainPlaylist.Builder builder) {
         return builder.build();
     }
 }
diff --git a/src/main/java/io/lindstrom/m3u8/parser/MasterPlaylistTag.java b/src/main/java/io/lindstrom/m3u8/parser/MainPlaylistTag.java
similarity index 55%
rename from src/main/java/io/lindstrom/m3u8/parser/MasterPlaylistTag.java
rename to src/main/java/io/lindstrom/m3u8/parser/MainPlaylistTag.java
index fa8cfb9..d9d3e8a 100644
--- a/src/main/java/io/lindstrom/m3u8/parser/MasterPlaylistTag.java
+++ b/src/main/java/io/lindstrom/m3u8/parser/MainPlaylistTag.java
@@ -1,30 +1,30 @@
 package io.lindstrom.m3u8.parser;
 
-import io.lindstrom.m3u8.model.MasterPlaylist;
+import io.lindstrom.m3u8.model.MainPlaylist;
 
 import java.util.Map;
 
-enum MasterPlaylistTag implements Tag {
+enum MainPlaylistTag implements Tag {
     EXT_X_VERSION {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) {
             builder.version(Integer.parseInt(attributes));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             playlist.version().ifPresent(version -> textBuilder.addTag(tag(), version));
         }
     },
 
     EXT_X_INDEPENDENT_SEGMENTS {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) {
             builder.independentSegments(true);
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             if (playlist.independentSegments()) {
                 textBuilder.addTag(tag());
             }
@@ -33,48 +33,48 @@ public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
 
     EXT_X_START {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
             builder.startTimeOffset(StartTimeOffsetAttribute.parse(attributes, parsingMode));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             playlist.startTimeOffset().ifPresent(value -> textBuilder.addTag(tag(), value, StartTimeOffsetAttribute.attributeMap));
         }
     },
 
     EXT_X_DEFINE {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
             builder.addVariables(PlaylistVariableAttribute.parse(attributes, parsingMode));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             textBuilder.addTag(tag(), playlist.variables(), PlaylistVariableAttribute.attributeMap);
         }
     },
 
     EXT_X_MEDIA {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
             builder.addAlternativeRenditions(AlternativeRenditionAttribute.parse(attributes, parsingMode));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             textBuilder.addTag(tag(), playlist.alternativeRenditions(), AlternativeRenditionAttribute.attributeMap);
         }
     },
 
     EXT_X_STREAM_INF {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) {
-            // Not used. This is handled by the MasterPlaylistParser directly.
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) {
+            // Not used. This is handled by the MainPlaylistParser directly.
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             String tag = tag();
             playlist.variants().forEach(variant -> textBuilder.addTag(tag, variant, VariantAttribute.attributeMap)
                     .add(variant.uri())
@@ -84,39 +84,39 @@ public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
 
     EXT_X_I_FRAME_STREAM_INF {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
             builder.addIFrameVariants(IFrameVariantAttribute.parse(attributes, parsingMode));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             textBuilder.addTag(tag(), playlist.iFrameVariants(), IFrameVariantAttribute.attributeMap);
         }
     },
 
     EXT_X_SESSION_DATA {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
             builder.addSessionData(SessionDataAttribute.parse(attributes, parsingMode));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             textBuilder.addTag(tag(), playlist.sessionData(), SessionDataAttribute.attributeMap);
         }
     },
 
     EXT_X_SESSION_KEY {
         @Override
-        public void read(MasterPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
+        public void read(MainPlaylist.Builder builder, String attributes, ParsingMode parsingMode) throws PlaylistParserException {
             builder.addSessionKeys(SegmentKeyAttribute.parse(attributes, parsingMode));
         }
 
         @Override
-        public void write(MasterPlaylist playlist, TextBuilder textBuilder) {
+        public void write(MainPlaylist playlist, TextBuilder textBuilder) {
             textBuilder.addTag(tag(), playlist.sessionKeys(), SegmentKeyAttribute.attributeMap);
         }
     };
 
-    static final Map tags = ParserUtils.toMap(values(), Tag::tag);
+    static final Map tags = ParserUtils.toMap(values(), Tag::tag);
 }
diff --git a/src/test/java/io/lindstrom/m3u8/examples/ParsePlaylists.java b/src/test/java/io/lindstrom/m3u8/examples/ParsePlaylists.java
index e060d78..b10d81c 100644
--- a/src/test/java/io/lindstrom/m3u8/examples/ParsePlaylists.java
+++ b/src/test/java/io/lindstrom/m3u8/examples/ParsePlaylists.java
@@ -1,7 +1,7 @@
 package io.lindstrom.m3u8.examples;
 
-import io.lindstrom.m3u8.parser.MasterPlaylistParser;
-import io.lindstrom.m3u8.model.MasterPlaylist;
+import io.lindstrom.m3u8.parser.MainPlaylistParser;
+import io.lindstrom.m3u8.model.MainPlaylist;
 import org.junit.Test;
 
 import java.io.BufferedReader;
@@ -18,40 +18,40 @@
 import static org.junit.Assert.assertEquals;
 
 public class ParsePlaylists {
-    private final Path masterPlaylist = Paths.get("src/test/resources/master/master.m3u8");
-    private final MasterPlaylistParser masterPlaylistParser  = new MasterPlaylistParser();
+    private final Path mainPlaylist = Paths.get("src/test/resources/main/main.m3u8");
+    private final MainPlaylistParser mainPlaylistParser = new MainPlaylistParser();
 
     @Test
     public void readPlaylist() throws Exception {
-        Set playlists = new HashSet<>();
+        Set playlists = new HashSet<>();
 
         playlists.add(
                 // From Path
-                masterPlaylistParser.readPlaylist(masterPlaylist)
+                mainPlaylistParser.readPlaylist(mainPlaylist)
         );
 
         playlists.add(
                 // From String
-                masterPlaylistParser.readPlaylist(new String(Files.readAllBytes(masterPlaylist), UTF_8))
+                mainPlaylistParser.readPlaylist(new String(Files.readAllBytes(mainPlaylist), UTF_8))
         );
 
-        try (InputStream inputStream = Files.newInputStream(masterPlaylist)) {
+        try (InputStream inputStream = Files.newInputStream(mainPlaylist)) {
             playlists.add(
                     // From InputStream
-                    masterPlaylistParser.readPlaylist(inputStream)
+                    mainPlaylistParser.readPlaylist(inputStream)
             );
         }
 
-        try (BufferedReader bufferedReader = Files.newBufferedReader(masterPlaylist, UTF_8)) {
+        try (BufferedReader bufferedReader = Files.newBufferedReader(mainPlaylist, UTF_8)) {
             playlists.add(
                     // From BufferedReader
-                    masterPlaylistParser.readPlaylist(bufferedReader)
+                    mainPlaylistParser.readPlaylist(bufferedReader)
             );
         }
 
         playlists.add(
                 // From Iterator
-                masterPlaylistParser.readPlaylist(Files.readAllLines(masterPlaylist, UTF_8).iterator())
+                mainPlaylistParser.readPlaylist(Files.readAllLines(mainPlaylist, UTF_8).iterator())
         );
 
         // All methods should produce the same playlist
@@ -60,11 +60,11 @@ public void readPlaylist() throws Exception {
 
     @Test
     public void writePlaylist() throws Exception {
-        MasterPlaylist playlist = masterPlaylistParser.readPlaylist(masterPlaylist);
+        MainPlaylist playlist = mainPlaylistParser.readPlaylist(mainPlaylist);
 
-        byte[] bytes = masterPlaylistParser.writePlaylistAsBytes(playlist);
-        String string = masterPlaylistParser.writePlaylistAsString(playlist);
-        ByteBuffer byteBuffer = masterPlaylistParser.writePlaylistAsByteBuffer(playlist);
+        byte[] bytes = mainPlaylistParser.writePlaylistAsBytes(playlist);
+        String string = mainPlaylistParser.writePlaylistAsString(playlist);
+        ByteBuffer byteBuffer = mainPlaylistParser.writePlaylistAsByteBuffer(playlist);
 
         assertArrayEquals(bytes, string.getBytes(UTF_8));
         assertArrayEquals(bytes, byteBuffer.array());
diff --git a/src/test/java/io/lindstrom/m3u8/examples/ParserModeTest.java b/src/test/java/io/lindstrom/m3u8/examples/ParserModeTest.java
index d968b1c..55c11d6 100644
--- a/src/test/java/io/lindstrom/m3u8/examples/ParserModeTest.java
+++ b/src/test/java/io/lindstrom/m3u8/examples/ParserModeTest.java
@@ -1,6 +1,6 @@
 package io.lindstrom.m3u8.examples;
 
-import io.lindstrom.m3u8.parser.MasterPlaylistParser;
+import io.lindstrom.m3u8.parser.MainPlaylistParser;
 import io.lindstrom.m3u8.parser.MediaPlaylistParser;
 import io.lindstrom.m3u8.parser.ParsingMode;
 import io.lindstrom.m3u8.parser.PlaylistParserException;
@@ -11,15 +11,15 @@
 
 public class ParserModeTest {
     @Test(expected = PlaylistParserException.class)
-    public void strictParsingMasterPlaylist() throws IOException {
-        MasterPlaylistParser parser = new MasterPlaylistParser(ParsingMode.STRICT);
-        parser.readPlaylist(Paths.get("src/test/resources/master/master-lenient.m3u8"));
+    public void strictParsingMainPlaylist() throws IOException {
+        MainPlaylistParser parser = new MainPlaylistParser(ParsingMode.STRICT);
+        parser.readPlaylist(Paths.get("src/test/resources/main/main-lenient.m3u8"));
     }
 
     @Test
-    public void lenientParsingMasterPlaylist() throws IOException {
-        MasterPlaylistParser parser = new MasterPlaylistParser(ParsingMode.LENIENT);
-        parser.readPlaylist(Paths.get("src/test/resources/master/master-lenient.m3u8"));
+    public void lenientParsingMainPlaylist() throws IOException {
+        MainPlaylistParser parser = new MainPlaylistParser(ParsingMode.LENIENT);
+        parser.readPlaylist(Paths.get("src/test/resources/main/main-lenient.m3u8"));
     }
 
     @Test(expected = PlaylistParserException.class)
diff --git a/src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistCommentsTest.java b/src/test/java/io/lindstrom/m3u8/parser/MainPlaylistCommentsTest.java
similarity index 77%
rename from src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistCommentsTest.java
rename to src/test/java/io/lindstrom/m3u8/parser/MainPlaylistCommentsTest.java
index 91fc75e..78918a6 100644
--- a/src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistCommentsTest.java
+++ b/src/test/java/io/lindstrom/m3u8/parser/MainPlaylistCommentsTest.java
@@ -5,12 +5,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-public class MasterPlaylistCommentsTest {
-    private final MasterPlaylistParser parser = new MasterPlaylistParser();
+public class MainPlaylistCommentsTest {
+    private final MainPlaylistParser parser = new MainPlaylistParser();
 
     @Test
-    public void shouldAddCommentToMasterPlaylist() {
-        MasterPlaylist playlist = MasterPlaylist.builder()
+    public void shouldAddCommentToMainPlaylist() {
+        MainPlaylist playlist = MainPlaylist.builder()
                 .addComments("Test Comment")
                 .build();
 
@@ -21,8 +21,8 @@ public void shouldAddCommentToMasterPlaylist() {
     }
 
     @Test
-    public void shouldAddCommentsToMasterPlaylist() {
-        MasterPlaylist playlist = MasterPlaylist.builder()
+    public void shouldAddCommentsToMainPlaylist() {
+        MainPlaylist playlist = MainPlaylist.builder()
                 .addComments(
                         "Test Comment 1",
                         "Test Comment 2"
@@ -38,7 +38,7 @@ public void shouldAddCommentsToMasterPlaylist() {
 
     @Test
     public void shouldHaveCommentBetweenInitAndVersion() {
-        MasterPlaylist playlist = MasterPlaylist.builder()
+        MainPlaylist playlist = MainPlaylist.builder()
                 .version(4)
                 .addComments("Test Comment")
                 .build();
@@ -52,7 +52,7 @@ public void shouldHaveCommentBetweenInitAndVersion() {
 
     @Test
     public void shouldOmitCommentsThatBeginWithExt() {
-        MasterPlaylist playlist = MasterPlaylist.builder()
+        MainPlaylist playlist = MainPlaylist.builder()
                 .version(4)
                 .addComments(
                         "Test Comment",
diff --git a/src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistParserTest.java b/src/test/java/io/lindstrom/m3u8/parser/MainPlaylistParserTest.java
similarity index 81%
rename from src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistParserTest.java
rename to src/test/java/io/lindstrom/m3u8/parser/MainPlaylistParserTest.java
index 86819ac..af80d8f 100644
--- a/src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistParserTest.java
+++ b/src/test/java/io/lindstrom/m3u8/parser/MainPlaylistParserTest.java
@@ -7,22 +7,22 @@
 
 import static org.junit.Assert.assertEquals;
 
-public class MasterPlaylistParserTest {
-    private final MasterPlaylistParser parser = new MasterPlaylistParser();
+public class MainPlaylistParserTest {
+    private final MainPlaylistParser parser = new MainPlaylistParser();
 
     @Test
-    public void masterParser() throws Exception {
-        parser.readPlaylist(Paths.get("src/test/resources/master/master.m3u8"));
+    public void mainParser() throws Exception {
+        parser.readPlaylist(Paths.get("src/test/resources/main/main.m3u8"));
     }
 
     @Test
-    public void masterParser2() throws Exception {
-        parser.readPlaylist(Paths.get("src/test/resources/master/apple-master.m3u8"));
+    public void mainParser2() throws Exception {
+        parser.readPlaylist(Paths.get("src/test/resources/main/apple-main.m3u8"));
     }
 
     @Test
     public void custom() throws Exception {
-        MasterPlaylist playlist = MasterPlaylist.builder()
+        MainPlaylist playlist = MainPlaylist.builder()
                 .version(4)
                 .independentSegments(true)
                 .addAlternativeRenditions(AlternativeRendition.builder()
diff --git a/src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistReadAndWrite.java b/src/test/java/io/lindstrom/m3u8/parser/MainPlaylistReadAndWrite.java
similarity index 64%
rename from src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistReadAndWrite.java
rename to src/test/java/io/lindstrom/m3u8/parser/MainPlaylistReadAndWrite.java
index 1ef942a..3f4c4cd 100644
--- a/src/test/java/io/lindstrom/m3u8/parser/MasterPlaylistReadAndWrite.java
+++ b/src/test/java/io/lindstrom/m3u8/parser/MainPlaylistReadAndWrite.java
@@ -1,6 +1,6 @@
 package io.lindstrom.m3u8.parser;
 
-import io.lindstrom.m3u8.model.MasterPlaylist;
+import io.lindstrom.m3u8.model.MainPlaylist;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -20,19 +20,19 @@
 import static org.junit.runners.Parameterized.Parameter;
 
 @RunWith(Parameterized.class)
-public class MasterPlaylistReadAndWrite {
-    private final MasterPlaylistParser masterPlaylistParser = new MasterPlaylistParser();
+public class MainPlaylistReadAndWrite {
+    private final MainPlaylistParser mainPlaylistParser = new MainPlaylistParser();
 
     @Parameters
     public static List data() {
         return Stream.of(
-                "master/apple-master.m3u8",
-                "master/master.m3u8",
-                "master/master-variables.m3u8",
-                "open-m3u8/masterPlaylist.m3u8",
-                "open-m3u8/masterPlaylistWithAlternativeAudio.m3u8",
-                "open-m3u8/masterPlaylistWithAlternativeVideo.m3u8",
-                "open-m3u8/masterPlaylistWithIFrames.m3u8")
+                "main/apple-main.m3u8",
+                "main/main.m3u8",
+                "main/main-variables.m3u8",
+                "open-m3u8/mainPlaylist.m3u8",
+                "open-m3u8/mainPlaylistWithAlternativeAudio.m3u8",
+                "open-m3u8/mainPlaylistWithAlternativeVideo.m3u8",
+                "open-m3u8/mainPlaylistWithIFrames.m3u8")
                 .map(p -> Paths.get("src/test/resources/", p))
                 .collect(Collectors.toList());
     }
@@ -42,14 +42,14 @@ public static List data() {
 
     @Test
     public void readAndWrite() throws Exception {
-        MasterPlaylist playlist = masterPlaylistParser.readPlaylist(playlistPath);
-        assertEquals(playlist, masterPlaylistParser.readPlaylist(masterPlaylistParser.writePlaylistAsString(playlist)));
+        MainPlaylist playlist = mainPlaylistParser.readPlaylist(playlistPath);
+        assertEquals(playlist, mainPlaylistParser.readPlaylist(mainPlaylistParser.writePlaylistAsString(playlist)));
     }
 
     @Test
     public void readAndWriteAttributeQuoting() throws Exception {
         String original = new String(Files.readAllBytes(playlistPath), StandardCharsets.UTF_8);
-        String written = masterPlaylistParser.writePlaylistAsString(masterPlaylistParser.readPlaylist(original));
+        String written = mainPlaylistParser.writePlaylistAsString(mainPlaylistParser.readPlaylist(original));
 
         TestUtils.attributeConsistencyCheck(original, written, playlistPath);
     }
@@ -57,7 +57,7 @@ public void readAndWriteAttributeQuoting() throws Exception {
     @Test
     public void streamInfoUriTest() throws IOException {
         String original = new String(Files.readAllBytes(playlistPath), StandardCharsets.UTF_8);
-        String written = masterPlaylistParser.writePlaylistAsString(masterPlaylistParser.readPlaylist(playlistPath));
+        String written = mainPlaylistParser.writePlaylistAsString(mainPlaylistParser.readPlaylist(playlistPath));
         assertEquals(variantUris(original), variantUris(written));
     }
 
diff --git a/src/test/java/io/lindstrom/m3u8/parser/MediaPlaylistCommentsTest.java b/src/test/java/io/lindstrom/m3u8/parser/MediaPlaylistCommentsTest.java
index 31b8dfe..baa3b47 100644
--- a/src/test/java/io/lindstrom/m3u8/parser/MediaPlaylistCommentsTest.java
+++ b/src/test/java/io/lindstrom/m3u8/parser/MediaPlaylistCommentsTest.java
@@ -9,7 +9,7 @@ public class MediaPlaylistCommentsTest {
     private final MediaPlaylistParser parser = new MediaPlaylistParser();
 
     @Test
-    public void shouldAddCommentToMasterPlaylist() {
+    public void shouldAddCommentToMainPlaylist() {
         MediaPlaylist playlist = MediaPlaylist.builder()
                 .targetDuration(2)
                 .addComments(
@@ -25,7 +25,7 @@ public void shouldAddCommentToMasterPlaylist() {
     }
 
     @Test
-    public void shouldAddCommentsToMasterPlaylist() {
+    public void shouldAddCommentsToMainPlaylist() {
         MediaPlaylist playlist = MediaPlaylist.builder()
                 .targetDuration(2)
                 .addComments(
diff --git a/src/test/java/io/lindstrom/m3u8/parser/PlaylistParserTests.java b/src/test/java/io/lindstrom/m3u8/parser/PlaylistParserTests.java
index 0fbeff4..2d4e097 100644
--- a/src/test/java/io/lindstrom/m3u8/parser/PlaylistParserTests.java
+++ b/src/test/java/io/lindstrom/m3u8/parser/PlaylistParserTests.java
@@ -1,9 +1,6 @@
 package io.lindstrom.m3u8.parser;
 
 import io.lindstrom.m3u8.model.*;
-import io.lindstrom.m3u8.parser.MasterPlaylistParser;
-import io.lindstrom.m3u8.parser.MediaPlaylistParser;
-import io.lindstrom.m3u8.parser.PlaylistParserException;
 import org.junit.Test;
 
 import java.nio.file.Path;
@@ -18,7 +15,7 @@
 
 public class PlaylistParserTests {
     private final Path resources = Paths.get("src/test/resources/");
-    private final MasterPlaylistParser masterPlaylistParser = new MasterPlaylistParser();
+    private final MainPlaylistParser mainPlaylistParser = new MainPlaylistParser();
     private final MediaPlaylistParser mediaPlaylistParser = new MediaPlaylistParser();
 
     @Test
@@ -45,8 +42,8 @@ public void liveMediaPlaylist() throws Exception {
     }
 
     @Test
-    public void masterPlaylist() throws Exception {
-        MasterPlaylist playlist = masterPlaylistParser.readPlaylist(resources.resolve("open-m3u8/masterPlaylist.m3u8"));
+    public void mainPlaylist() throws Exception {
+        MainPlaylist playlist = mainPlaylistParser.readPlaylist(resources.resolve("open-m3u8/mainPlaylist.m3u8"));
         assertFalse(playlist.version().isPresent());
         assertThat(playlist.variants(), is(Arrays.asList(
                 Variant.builder()
@@ -72,8 +69,8 @@ public void masterPlaylist() throws Exception {
     }
 
     @Test
-    public void masterPlaylistWithAlternativeAudio() throws Exception {
-        MasterPlaylist playlist = masterPlaylistParser.readPlaylist(resources.resolve("open-m3u8/masterPlaylistWithAlternativeAudio.m3u8"));
+    public void mainPlaylistWithAlternativeAudio() throws Exception {
+        MainPlaylist playlist = mainPlaylistParser.readPlaylist(resources.resolve("open-m3u8/mainPlaylistWithAlternativeAudio.m3u8"));
         assertFalse(playlist.version().isPresent());
         assertThat(playlist.alternativeRenditions(), is(Arrays.asList(
                 AlternativeRendition.builder()
@@ -132,8 +129,8 @@ public void masterPlaylistWithAlternativeAudio() throws Exception {
     }
 
     @Test
-    public void masterPlaylistWithAlternativeVideo() throws Exception {
-        MasterPlaylist playlist = masterPlaylistParser.readPlaylist(resources.resolve("open-m3u8/masterPlaylistWithAlternativeVideo.m3u8"));
+    public void mainPlaylistWithAlternativeVideo() throws Exception {
+        MainPlaylist playlist = mainPlaylistParser.readPlaylist(resources.resolve("open-m3u8/mainPlaylistWithAlternativeVideo.m3u8"));
         assertFalse(playlist.version().isPresent());
 
         List lowVideo = Arrays.asList(
@@ -238,8 +235,8 @@ public void masterPlaylistWithAlternativeVideo() throws Exception {
     }
 
     @Test
-    public void masterPlaylistWithIFrames() throws Exception {
-        MasterPlaylist playlist = masterPlaylistParser.readPlaylist(resources.resolve("open-m3u8/masterPlaylistWithIFrames.m3u8"));
+    public void mainPlaylistWithIFrames() throws Exception {
+        MainPlaylist playlist = mainPlaylistParser.readPlaylist(resources.resolve("open-m3u8/mainPlaylistWithIFrames.m3u8"));
         assertFalse(playlist.version().isPresent());
 
         assertThat(playlist.variants(), is(Arrays.asList(
diff --git a/src/test/resources/master/apple-master.m3u8 b/src/test/resources/main/apple-main.m3u8
similarity index 100%
rename from src/test/resources/master/apple-master.m3u8
rename to src/test/resources/main/apple-main.m3u8
diff --git a/src/test/resources/master/master-lenient.m3u8 b/src/test/resources/main/main-lenient.m3u8
similarity index 100%
rename from src/test/resources/master/master-lenient.m3u8
rename to src/test/resources/main/main-lenient.m3u8
diff --git a/src/test/resources/master/master-variables.m3u8 b/src/test/resources/main/main-variables.m3u8
similarity index 100%
rename from src/test/resources/master/master-variables.m3u8
rename to src/test/resources/main/main-variables.m3u8
diff --git a/src/test/resources/master/master.m3u8 b/src/test/resources/main/main.m3u8
similarity index 100%
rename from src/test/resources/master/master.m3u8
rename to src/test/resources/main/main.m3u8
diff --git a/src/test/resources/open-m3u8/masterPlaylist.m3u8 b/src/test/resources/open-m3u8/mainPlaylist.m3u8
similarity index 100%
rename from src/test/resources/open-m3u8/masterPlaylist.m3u8
rename to src/test/resources/open-m3u8/mainPlaylist.m3u8
diff --git a/src/test/resources/open-m3u8/masterPlaylistWithAlternativeAudio.m3u8 b/src/test/resources/open-m3u8/mainPlaylistWithAlternativeAudio.m3u8
similarity index 100%
rename from src/test/resources/open-m3u8/masterPlaylistWithAlternativeAudio.m3u8
rename to src/test/resources/open-m3u8/mainPlaylistWithAlternativeAudio.m3u8
diff --git a/src/test/resources/open-m3u8/masterPlaylistWithAlternativeVideo.m3u8 b/src/test/resources/open-m3u8/mainPlaylistWithAlternativeVideo.m3u8
similarity index 100%
rename from src/test/resources/open-m3u8/masterPlaylistWithAlternativeVideo.m3u8
rename to src/test/resources/open-m3u8/mainPlaylistWithAlternativeVideo.m3u8
diff --git a/src/test/resources/open-m3u8/masterPlaylistWithIFrames.m3u8 b/src/test/resources/open-m3u8/mainPlaylistWithIFrames.m3u8
similarity index 100%
rename from src/test/resources/open-m3u8/masterPlaylistWithIFrames.m3u8
rename to src/test/resources/open-m3u8/mainPlaylistWithIFrames.m3u8