diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java index 8c63d8a6ba..79858ae591 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/ItagItem.java @@ -134,6 +134,7 @@ public static ItagItem getItag(final int itagId) throws ParsingException { public static final int AUDIO_CHANNELS_NOT_APPLICABLE_OR_UNKNOWN = -1; public static final long CONTENT_LENGTH_UNKNOWN = -1; public static final long APPROX_DURATION_MS_UNKNOWN = -1; + public static final long LAST_MODIFIED_UNKOWN = -1; /*////////////////////////////////////////////////////////////////////////// // Constructors and misc @@ -266,6 +267,9 @@ public MediaFormat getMediaFormat() { private AudioTrackType audioTrackType; @Nullable private Locale audioLocale; + private boolean isDrc; + private long lastModified; + private String xtags; public int getBitrate() { return bitrate; @@ -647,4 +651,77 @@ public Locale getAudioLocale() { public void setAudioLocale(@Nullable final Locale audioLocale) { this.audioLocale = audioLocale; } + + /** + * Whether the audio is using dynamic range compression (DRC). + * + *
+ * https://en.wikipedia.org/wiki/Dynamic_range_compression + *
+ * + * @return whether the audio is using DRC + */ + public Boolean isDrc() { + return isDrc; + } + + /** + * Sets whether the audio is using dynamic range compression (DRC). + * + *+ * https://en.wikipedia.org/wiki/Dynamic_range_compression + *
+ * + * @param isDrc whether the audio has DRC applied + */ + public void setIsDrc(final Boolean isDrc) { + this.isDrc = isDrc; + } + + + /** + * When the stream was last modified. + * + *+ * If the timestamp is unknown, {@link #LAST_MODIFIED_UNKOWN} is returned. + *
+ * + * @return unix timestamp of when the stream was last modified or + * {@link #LAST_MODIFIED_UNKOWN} if the timestamp is unknown. + */ + public long getLastModified() { + return lastModified; + } + + /** + * Sets the timestamp when the stream was last modified. + * + * @param lastModified unix timestamp of when the stream was last modified + */ + public void setLastModified(final long lastModified) { + this.lastModified = lastModified; + } + + /** + * Extra tags about the stream. + * + *+ * Contains a Base64 encoded protobuf key-value list of additional tags for the stream, + * such as whether the stream is using {@link #isDrc()}. + *
+ * + * @return Base64-encoded extra tags. + */ + public String getXtags() { + return xtags; + } + + /** + * Sets extra tags of the stream. + * + * @param xtags extra tags of the stream + */ + public void setXtags(final String xtags) { + this.xtags = xtags; + } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index ba23eb6463..b89823a985 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -1421,6 +1421,9 @@ private ItagInfo buildAndAddItagInfoToList( itagItem.setIndexEnd(Integer.parseInt(indexRange.getString("end", "-1"))); itagItem.setQuality(formatData.getString("quality")); itagItem.setCodec(codec); + itagItem.setIsDrc(formatData.getBoolean("isDrc", false)); + itagItem.setLastModified(Long.parseLong(formatData.getString("lastModified", "-1"))); + itagItem.setXtags(formatData.getString("xtags")); if (streamType == StreamType.LIVE_STREAM || streamType == StreamType.POST_LIVE_STREAM) { itagItem.setTargetDurationSec(formatData.getInt("targetDurationSec"));