diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-19 12:05:03 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-19 12:05:03 -0400 |
| commit | 51c3f270ae80290da75e48b0e4aa838af72b07b6 (patch) | |
| tree | 98e9b20680e320b0f111ab2e934b2746c2d6a4b3 | |
| parent | 00bb68d2e8801c3b89b6cb5e5af495aad4f352f5 (diff) | |
add codec tag value
| -rw-r--r-- | MediaBrowser.Api/Playback/BaseStreamingService.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Api/Playback/StreamState.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.Dlna/Didl/DidlBuilder.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Dlna/PlayTo/PlayToController.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs | 11 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/ConditionProcessor.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/DeviceProfile.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/ProfileConditionValue.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamBuilder.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamInfo.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 6 |
14 files changed, 73 insertions, 22 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index cf84b839f..36207c8b4 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1993,7 +1993,8 @@ namespace MediaBrowser.Api.Playback state.IsTargetCabac, state.TargetRefFrames, state.TargetVideoStreamCount, - state.TargetAudioStreamCount); + state.TargetAudioStreamCount, + state.TargetVideoCodecTag); if (mediaProfile != null) { @@ -2090,7 +2091,8 @@ namespace MediaBrowser.Api.Playback state.IsTargetCabac, state.TargetRefFrames, state.TargetVideoStreamCount, - state.TargetAudioStreamCount + state.TargetAudioStreamCount, + state.TargetVideoCodecTag ).FirstOrDefault() ?? string.Empty; } diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index fdbe5835e..d61bb9c0f 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -457,6 +457,17 @@ namespace MediaBrowser.Api.Playback } } + public string TargetVideoCodecTag + { + get + { + var stream = VideoStream; + return !Request.Static + ? null + : stream == null ? null : stream.CodecTag; + } + } + public bool? IsTargetAnamorphic { get diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index 8bea14f14..5589a6e3b 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -163,7 +163,8 @@ namespace MediaBrowser.Dlna.Didl streamInfo.IsTargetCabac, streamInfo.TargetRefFrames, streamInfo.TargetVideoStreamCount, - streamInfo.TargetAudioStreamCount); + streamInfo.TargetAudioStreamCount, + streamInfo.TargetVideoCodecTag); foreach (var contentFeature in contentFeatureList) { @@ -301,7 +302,8 @@ namespace MediaBrowser.Dlna.Didl streamInfo.IsTargetCabac, streamInfo.TargetRefFrames, streamInfo.TargetVideoStreamCount, - streamInfo.TargetAudioStreamCount); + streamInfo.TargetAudioStreamCount, + streamInfo.TargetVideoCodecTag); var filename = url.Substring(0, url.IndexOf('?')); diff --git a/MediaBrowser.Dlna/PlayTo/PlayToController.cs b/MediaBrowser.Dlna/PlayTo/PlayToController.cs index 941b2aeca..cb3629678 100644 --- a/MediaBrowser.Dlna/PlayTo/PlayToController.cs +++ b/MediaBrowser.Dlna/PlayTo/PlayToController.cs @@ -525,7 +525,8 @@ namespace MediaBrowser.Dlna.PlayTo streamInfo.IsTargetCabac, streamInfo.TargetRefFrames, streamInfo.TargetVideoStreamCount, - streamInfo.TargetAudioStreamCount); + streamInfo.TargetAudioStreamCount, + streamInfo.TargetVideoCodecTag); return list.FirstOrDefault(); } diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs index 47babfd13..07626db33 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJob.cs @@ -368,6 +368,17 @@ namespace MediaBrowser.MediaEncoding.Encoder } } + public string TargetVideoCodecTag + { + get + { + var stream = VideoStream; + return !Options.Static + ? null + : stream == null ? null : stream.CodecTag; + } + } + public bool? IsTargetAnamorphic { get diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs index 03dbd07f0..692fe2b6a 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs @@ -750,7 +750,8 @@ namespace MediaBrowser.MediaEncoding.Encoder state.IsTargetCabac, state.TargetRefFrames, state.TargetVideoStreamCount, - state.TargetAudioStreamCount); + state.TargetAudioStreamCount, + state.TargetVideoCodecTag); if (mediaProfile != null) { diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 25a8e4876..7e9fa151b 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -130,6 +130,7 @@ namespace MediaBrowser.MediaEncoding.Probing var stream = new MediaStream { Codec = streamInfo.codec_name, + CodecTag = streamInfo.codec_tag_string, Profile = streamInfo.profile, Level = streamInfo.level, Index = streamInfo.index, diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index fd3df9c76..fef04647a 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -20,15 +20,11 @@ namespace MediaBrowser.Model.Dlna bool? isCabac, int? refFrames, int? numVideoStreams, - int? numAudioStreams) + int? numAudioStreams, + string videoCodecTag) { switch (condition.Property) { - case ProfileConditionValue.AudioProfile: - // TODO: Implement - return true; - case ProfileConditionValue.Has64BitOffsets: - return true; case ProfileConditionValue.IsAnamorphic: return IsConditionSatisfied(condition, isAnamorphic); case ProfileConditionValue.IsCabac: @@ -39,6 +35,8 @@ namespace MediaBrowser.Model.Dlna return IsConditionSatisfied(condition, videoLevel); case ProfileConditionValue.VideoProfile: return IsConditionSatisfied(condition, videoProfile); + case ProfileConditionValue.VideoCodecTag: + return IsConditionSatisfied(condition, videoCodecTag); case ProfileConditionValue.PacketLength: return IsConditionSatisfied(condition, packetLength); case ProfileConditionValue.VideoBitDepth: @@ -58,7 +56,7 @@ namespace MediaBrowser.Model.Dlna case ProfileConditionValue.VideoTimestamp: return IsConditionSatisfied(condition, timestamp); default: - throw new ArgumentException("Unexpected condition on video file: " + condition.Property); + return true; } } diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index 62463d196..58d669c22 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -118,7 +118,8 @@ namespace MediaBrowser.Model.Dlna bool? isCabac, int? refFrames, int? numVideoStreams, - int? numAudioStreams) + int? numAudioStreams, + string videoCodecTag) { // first bit means Time based seek supported, second byte range seek supported (not sure about the order now), so 01 = only byte seek, 10 = time based, 11 = both, 00 = none string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo); @@ -159,7 +160,8 @@ namespace MediaBrowser.Model.Dlna isCabac, refFrames, numVideoStreams, - numAudioStreams); + numAudioStreams, + videoCodecTag); List<string> orgPnValues = new List<string>(); diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index fc508991e..6d4aa34a3 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -286,7 +286,8 @@ namespace MediaBrowser.Model.Dlna bool? isCabac, int? refFrames, int? numVideoStreams, - int? numAudioStreams) + int? numAudioStreams, + string videoCodecTag) { container = StringHelper.TrimStart((container ?? string.Empty), '.'); @@ -320,7 +321,7 @@ namespace MediaBrowser.Model.Dlna var anyOff = false; foreach (ProfileCondition c in i.Conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams)) + if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { anyOff = true; break; diff --git a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs index 7563ffb5a..4ad326e51 100644 --- a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs +++ b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs @@ -20,6 +20,7 @@ IsCabac = 15, NumAudioStreams = 16, NumVideoStreams = 17, - IsSecondaryAudio + IsSecondaryAudio = 18, + VideoCodecTag = 19 } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index e23cb8951..1834e24fe 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -571,6 +571,7 @@ namespace MediaBrowser.Model.Dlna float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; bool? isCabac = videoStream == null ? null : videoStream.IsCabac; + string videoCodecTag = videoStream == null ? null : videoStream.CodecTag; int? audioBitrate = audioStream == null ? null : audioStream.BitRate; int? audioChannels = audioStream == null ? null : audioStream.Channels; @@ -586,7 +587,7 @@ namespace MediaBrowser.Model.Dlna // Check container conditions foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams)) + if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource); @@ -619,7 +620,7 @@ namespace MediaBrowser.Model.Dlna foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams)) + if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource); @@ -966,8 +967,6 @@ namespace MediaBrowser.Model.Dlna } break; } - default: - throw new ArgumentException("Unrecognized ProfileConditionValue"); } } } diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 8f7412097..50d1cdfc8 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -490,6 +490,21 @@ namespace MediaBrowser.Model.Dlna } /// <summary> + /// Gets the target video codec tag. + /// </summary> + /// <value>The target video codec tag.</value> + public string TargetVideoCodecTag + { + get + { + MediaStream stream = TargetVideoStream; + return !IsDirectStream + ? null + : stream == null ? null : stream.CodecTag; + } + } + + /// <summary> /// Predicts the audio bitrate that will be in the output stream /// </summary> public int? TargetAudioBitrate diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 519d3a04c..79d1df911 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -19,6 +19,12 @@ namespace MediaBrowser.Model.Entities public string Codec { get; set; } /// <summary> + /// Gets or sets the codec tag. + /// </summary> + /// <value>The codec tag.</value> + public string CodecTag { get; set; } + + /// <summary> /// Gets or sets the language. /// </summary> /// <value>The language.</value> |
