Skip to content

Commit

Permalink
Add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Komodo5197 committed May 25, 2024
1 parent 0ea8c02 commit f1036ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/components/PlayerScreen/feature_chips.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class FeatureState {
? null
: metadata?.mediaSourceInfo.mediaStreams
.firstWhereOrNull((stream) => stream.type == "Audio");
// Transcoded downloads will not have a valid MediaStream, but will have
// the target transcode bitrate set for the mediasource bitrate. Other items
// should have a valid mediaStream, so use that audio-only bitrate instead of the
// whole-file bitrate.
int? get bitrate => isTranscoding
? settings.transcodeBitrate
: audioStream?.bitRate ?? metadata?.mediaSourceInfo.bitrate;
Expand Down
5 changes: 5 additions & 0 deletions lib/services/metadata_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class MetadataRequest {
item.id, queueItem?.id, includeLyrics, checkIfSpeedControlNeeded);
}

/// A storage container for metadata about a song. The codec information will reflect
/// the downloaded file if appropriate, even for transcoded downloads. Online
/// transcoding will not be reflected.
class MetadataProvider {
static const speedControlGenres = ["audiobook", "podcast", "speech"];
static const speedControlLongTrackDuration = Duration(minutes: 15);
Expand Down Expand Up @@ -93,6 +96,8 @@ final AutoDisposeFutureProviderFamily<MetadataProvider?, MetadataRequest>
? profile?.stereoBitrate
: downloadItem.baseItem!.mediaSources?.first.bitrate;

// We cannot create a fully accurate MediaStream for a transcoded item, so
// just return an empty list.
List<MediaStream> mediaStream =
profile?.codec != FinampTranscodingCodec.original
? []
Expand Down

0 comments on commit f1036ff

Please sign in to comment.