Skip to content

Commit f7b1515

Browse files
committed
[YouTube] Refactor DASH manifests creation
Move DASH manifests creation into a new subpackage of the YouTube package, dashmanifestcreators. This subpackage contains: - CreationException, exception extending Java's RuntimeException, thrown by manifest creators when something goes wrong; - YoutubeDashManifestCreatorsUtils, class which contains all common methods and constants of all or a part of the manifest creators; - a manifest creator has been added per delivery type of YouTube streams: - YoutubeProgressiveDashManifestCreator, for progressive streams; - YoutubeOtfDashManifestCreator, for OTF streams; - YoutubePostLiveStreamDvrDashManifestCreator, for post-live DVR streams (which use the live delivery method). Every DASH manifest creator has a getCache() static method, which returns the ManifestCreatorCache instance used to cache results. DeliveryType has been also extracted from the YouTube DASH manifest creators part of the extractor and moved to the YouTube package. YoutubeDashManifestCreatorTest has been updated and renamed to YoutubeDashManifestCreatorsTest, and YoutubeDashManifestCreator has been removed. Finally, several documentation and exception messages fixes and improvements have been made.
1 parent f17f7b9 commit f7b1515

8 files changed

Lines changed: 1766 additions & 1543 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package org.schabi.newpipe.extractor.services.youtube;
2+
3+
/**
4+
* Streaming format types used by YouTube in their streams.
5+
*
6+
* <p>
7+
* It is different of {@link org.schabi.newpipe.extractor.stream.DeliveryMethod delivery methods}!
8+
* </p>
9+
*/
10+
public enum DeliveryType {
11+
12+
/**
13+
* YouTube's progressive delivery method, which works with HTTP range headers.
14+
* (Note that official clients use the corresponding parameter instead.)
15+
*
16+
* <p>
17+
* Initialization and index ranges are available to get metadata (the corresponding values
18+
* are returned in the player response).
19+
* </p>
20+
*/
21+
PROGRESSIVE,
22+
23+
/**
24+
* YouTube's OTF delivery method which uses a sequence parameter to get segments of
25+
* streams.
26+
*
27+
* <p>
28+
* The first sequence (which can be fetched with the {@code &sq=0} parameter) contains all the
29+
* metadata needed to build the stream source (sidx boxes, segment length, segment count,
30+
* duration, ...).
31+
* </p>
32+
*
33+
* <p>
34+
* Only used for videos; mostly those with a small amount of views, or ended livestreams
35+
* which have just been re-encoded as normal videos.
36+
* </p>
37+
*/
38+
OTF,
39+
40+
/**
41+
* YouTube's delivery method for livestreams which uses a sequence parameter to get
42+
* segments of streams.
43+
*
44+
* <p>
45+
* Each sequence (which can be fetched with the {@code &sq=0} parameter) contains its own
46+
* metadata (sidx boxes, segment length, ...), which make no need of an initialization
47+
* segment.
48+
* </p>
49+
*
50+
* <p>
51+
* Only used for livestreams (ended or running).
52+
* </p>
53+
*/
54+
LIVE
55+
}

0 commit comments

Comments
 (0)