Skip to content

Better support for accessing stream types. #23

@alex-w-k

Description

@alex-w-k

Add better support for accessing stream types, like video, audio, and subtitles.

For example on this movie the streams section of the XML looks like this:

<Stream id="352782" streamType="1" default="1" codec="h264" index="0" bitrate="12993" language="English" languageCode="eng" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" frameRate="23.976" hasScalingMatrix="0" height="816" level="41" profile="high" refFrames="5" requiredBandwidths="35655,31724,25768,23725,21919,20284,16697,16697" scanType="progressive" title="13993 kbps" width="1920" displayTitle="1080p (H.264)"/>
<Stream id="352783" streamType="2" selected="1" default="1" codec="dca" index="1" channels="6" bitrate="1509" language="English" languageCode="eng" audioChannelLayout="5.1(side)" bitDepth="24" profile="dts" requiredBandwidths="1509,1509,1509,1509,1509,1509,1509,1509" samplingRate="48000" title="Main Audio" displayTitle="English (DTS 5.1)"/>
<Stream id="352784" streamType="2" codec="aac" index="2" channels="2" bitrate="70" language="English" languageCode="eng" audioChannelLayout="stereo" profile="he-aac" requiredBandwidths="71,71,71,71,71,71,71,71" samplingRate="48000" title="Commentary" displayTitle="English (HE-AAC Stereo)"/>
<Stream id="352785" streamType="3" selected="1" default="1" codec="srt" index="3" bitrate="0" language="English" languageCode="eng" requiredBandwidths="1,1,1,1,1,1,1,1" title="srt" displayTitle="English (SRT)"/>
<Stream id="352786" streamType="3" codec="srt" index="4" bitrate="0" language="中文" languageCode="chi" requiredBandwidths="1,1,1,1,1,1,1,1" title="srt" displayTitle="中文 (SRT)"/>

And I'd love a way to do something like: movie.streams.audios or something and have it return these two entries in an array of two objects of audio class or something to that effect:

<Stream id="352783" streamType="2" selected="1" default="1" codec="dca" index="1" channels="6" bitrate="1509" language="English" languageCode="eng" audioChannelLayout="5.1(side)" bitDepth="24" profile="dts" requiredBandwidths="1509,1509,1509,1509,1509,1509,1509,1509" samplingRate="48000" title="Main Audio" displayTitle="English (DTS 5.1)"/>
<Stream id="352784" streamType="2" codec="aac" index="2" channels="2" bitrate="70" language="English" languageCode="eng" audioChannelLayout="stereo" profile="he-aac" requiredBandwidths="71,71,71,71,71,71,71,71" samplingRate="48000" title="Commentary" displayTitle="English (HE-AAC Stereo)"/>

Note that audio is streamType="2" so that should be pretty straight forward, however I was thinking about how to implement this and it would make sense to break each stream type out into its own class, but herein lies the problem. streamType="1" is video and there is already a Video class, so I'm not sure how to go about doing this. What are the thoughts on the best way to tackle this?

Would it be best to leave video out of it and just do audio and subtitles? Or would it be best to name them like StreamVideo, StreamAudio, and StreamSubtitle, though that seems a bit awkward and not super discoverable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions