-
-
Notifications
You must be signed in to change notification settings - Fork 496
Add media.ccc specific parsing of recordings #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| package org.schabi.newpipe.extractor.services.media_ccc.extractors.data; | ||
|
|
||
| import com.grack.nanojson.JsonObject; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Locale; | ||
|
|
||
| import javax.annotation.Nullable; | ||
|
|
||
|
|
||
| /** A recording stream of a talk/event. Switch on the implementation to get the actual data. */ | ||
| public interface MediaCCCRecording { | ||
|
|
||
| /** A recording stream of a talk/event. | ||
| * These files usually have one or more audio streams in different languages. */ | ||
| class Video implements MediaCCCRecording { | ||
| public String filename; | ||
| public VideoType recordingType; | ||
| public String mimeType; | ||
| /** Each language is one separate audio track on the video. */ | ||
| public List<Locale> languages; | ||
| public String url; | ||
| public int lengthSeconds; | ||
| public int width; | ||
| public int height; | ||
| } | ||
|
|
||
| /** Some talks have multiple kinds of video. */ | ||
| enum VideoType { | ||
| /** The main recording of a talk/event. */ | ||
| MAIN, | ||
| /** A side-recording of a talk/event that has the slides full-screen. | ||
| * Usually if there is a slide-recording there is a MAIN recording as well */ | ||
| SLIDES | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably we should add something like this but for videos, to distinguish between the main and secondary types There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’d go for “as small an enum here as possible” and then convert on the NewPipe side to the enum that NewPlayer expects. I’d slowly expand these as I find new edge-cases in the mediaCCC APIs (they add new kinds of features every year or so, usually with backwards compat in mind). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, but it's something that should be exposed at the extractor-level APIs, not be specific for every service. This way it would be easy in clients to add a switch that allows choosing the video track type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, maybe, once we figured out which parts are specific to media.ccc.de and which ones can be abstracted :) I think a major issue with NPE is that it’s trying to unify the services too much, and then we get lots of workarounds on the NewPipe side cause we have to reconstruct specific service behaviour again that was unified on the NPE side. I’d rather cast on the class and then have some service-specific functionality available if I need it in the player. |
||
| } | ||
|
|
||
| /** An audio recording of a talk/event. | ||
| * These audio streams are usually also available in their respective video streams. | ||
| */ | ||
| class Audio implements MediaCCCRecording { | ||
| public String filename; | ||
| public String mimeType; | ||
| public @Nullable Locale language; | ||
| public String url; | ||
| public int lengthSeconds; | ||
| } | ||
|
|
||
| /** A subtitle file of a talk/event. */ | ||
| class Subtitle implements MediaCCCRecording { | ||
| public String filename; | ||
| public String mimeType; | ||
| public @Nullable Locale language; | ||
| public String url; | ||
| } | ||
|
|
||
| /** The Slides of the talk, usually as PDF file. */ | ||
| class Slides implements MediaCCCRecording { | ||
| public String filename; | ||
| public String mimeType; | ||
| public String url; | ||
| public @Nullable Locale language; | ||
| } | ||
|
|
||
| /** Anything we can’t put in any of the other categories. */ | ||
| class Unknown implements MediaCCCRecording { | ||
| public String filename; | ||
| public String mimeType; | ||
| public String url; | ||
| /** The raw object for easier debugging. */ | ||
| public JsonObject rawObject; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also in other places)