add codec tag value

This commit is contained in:
Luke Pulverenti 2015-10-19 12:05:03 -04:00
parent 00bb68d2e8
commit 51c3f270ae
14 changed files with 73 additions and 22 deletions

View File

@ -1993,7 +1993,8 @@ namespace MediaBrowser.Api.Playback
state.IsTargetCabac, state.IsTargetCabac,
state.TargetRefFrames, state.TargetRefFrames,
state.TargetVideoStreamCount, state.TargetVideoStreamCount,
state.TargetAudioStreamCount); state.TargetAudioStreamCount,
state.TargetVideoCodecTag);
if (mediaProfile != null) if (mediaProfile != null)
{ {
@ -2090,7 +2091,8 @@ namespace MediaBrowser.Api.Playback
state.IsTargetCabac, state.IsTargetCabac,
state.TargetRefFrames, state.TargetRefFrames,
state.TargetVideoStreamCount, state.TargetVideoStreamCount,
state.TargetAudioStreamCount state.TargetAudioStreamCount,
state.TargetVideoCodecTag
).FirstOrDefault() ?? string.Empty; ).FirstOrDefault() ?? string.Empty;
} }

View File

@ -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 public bool? IsTargetAnamorphic
{ {
get get

View File

@ -163,7 +163,8 @@ namespace MediaBrowser.Dlna.Didl
streamInfo.IsTargetCabac, streamInfo.IsTargetCabac,
streamInfo.TargetRefFrames, streamInfo.TargetRefFrames,
streamInfo.TargetVideoStreamCount, streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount); streamInfo.TargetAudioStreamCount,
streamInfo.TargetVideoCodecTag);
foreach (var contentFeature in contentFeatureList) foreach (var contentFeature in contentFeatureList)
{ {
@ -301,7 +302,8 @@ namespace MediaBrowser.Dlna.Didl
streamInfo.IsTargetCabac, streamInfo.IsTargetCabac,
streamInfo.TargetRefFrames, streamInfo.TargetRefFrames,
streamInfo.TargetVideoStreamCount, streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount); streamInfo.TargetAudioStreamCount,
streamInfo.TargetVideoCodecTag);
var filename = url.Substring(0, url.IndexOf('?')); var filename = url.Substring(0, url.IndexOf('?'));

View File

@ -525,7 +525,8 @@ namespace MediaBrowser.Dlna.PlayTo
streamInfo.IsTargetCabac, streamInfo.IsTargetCabac,
streamInfo.TargetRefFrames, streamInfo.TargetRefFrames,
streamInfo.TargetVideoStreamCount, streamInfo.TargetVideoStreamCount,
streamInfo.TargetAudioStreamCount); streamInfo.TargetAudioStreamCount,
streamInfo.TargetVideoCodecTag);
return list.FirstOrDefault(); return list.FirstOrDefault();
} }

View File

@ -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 public bool? IsTargetAnamorphic
{ {
get get

View File

@ -750,7 +750,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
state.IsTargetCabac, state.IsTargetCabac,
state.TargetRefFrames, state.TargetRefFrames,
state.TargetVideoStreamCount, state.TargetVideoStreamCount,
state.TargetAudioStreamCount); state.TargetAudioStreamCount,
state.TargetVideoCodecTag);
if (mediaProfile != null) if (mediaProfile != null)
{ {

View File

@ -130,6 +130,7 @@ namespace MediaBrowser.MediaEncoding.Probing
var stream = new MediaStream var stream = new MediaStream
{ {
Codec = streamInfo.codec_name, Codec = streamInfo.codec_name,
CodecTag = streamInfo.codec_tag_string,
Profile = streamInfo.profile, Profile = streamInfo.profile,
Level = streamInfo.level, Level = streamInfo.level,
Index = streamInfo.index, Index = streamInfo.index,

View File

@ -20,15 +20,11 @@ namespace MediaBrowser.Model.Dlna
bool? isCabac, bool? isCabac,
int? refFrames, int? refFrames,
int? numVideoStreams, int? numVideoStreams,
int? numAudioStreams) int? numAudioStreams,
string videoCodecTag)
{ {
switch (condition.Property) switch (condition.Property)
{ {
case ProfileConditionValue.AudioProfile:
// TODO: Implement
return true;
case ProfileConditionValue.Has64BitOffsets:
return true;
case ProfileConditionValue.IsAnamorphic: case ProfileConditionValue.IsAnamorphic:
return IsConditionSatisfied(condition, isAnamorphic); return IsConditionSatisfied(condition, isAnamorphic);
case ProfileConditionValue.IsCabac: case ProfileConditionValue.IsCabac:
@ -39,6 +35,8 @@ namespace MediaBrowser.Model.Dlna
return IsConditionSatisfied(condition, videoLevel); return IsConditionSatisfied(condition, videoLevel);
case ProfileConditionValue.VideoProfile: case ProfileConditionValue.VideoProfile:
return IsConditionSatisfied(condition, videoProfile); return IsConditionSatisfied(condition, videoProfile);
case ProfileConditionValue.VideoCodecTag:
return IsConditionSatisfied(condition, videoCodecTag);
case ProfileConditionValue.PacketLength: case ProfileConditionValue.PacketLength:
return IsConditionSatisfied(condition, packetLength); return IsConditionSatisfied(condition, packetLength);
case ProfileConditionValue.VideoBitDepth: case ProfileConditionValue.VideoBitDepth:
@ -58,7 +56,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionValue.VideoTimestamp: case ProfileConditionValue.VideoTimestamp:
return IsConditionSatisfied(condition, timestamp); return IsConditionSatisfied(condition, timestamp);
default: default:
throw new ArgumentException("Unexpected condition on video file: " + condition.Property); return true;
} }
} }

View File

@ -118,7 +118,8 @@ namespace MediaBrowser.Model.Dlna
bool? isCabac, bool? isCabac,
int? refFrames, int? refFrames,
int? numVideoStreams, 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 // 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); string orgOp = ";DLNA.ORG_OP=" + DlnaMaps.GetOrgOpValue(runtimeTicks.HasValue, isDirectStream, transcodeSeekInfo);
@ -159,7 +160,8 @@ namespace MediaBrowser.Model.Dlna
isCabac, isCabac,
refFrames, refFrames,
numVideoStreams, numVideoStreams,
numAudioStreams); numAudioStreams,
videoCodecTag);
List<string> orgPnValues = new List<string>(); List<string> orgPnValues = new List<string>();

View File

@ -286,7 +286,8 @@ namespace MediaBrowser.Model.Dlna
bool? isCabac, bool? isCabac,
int? refFrames, int? refFrames,
int? numVideoStreams, int? numVideoStreams,
int? numAudioStreams) int? numAudioStreams,
string videoCodecTag)
{ {
container = StringHelper.TrimStart((container ?? string.Empty), '.'); container = StringHelper.TrimStart((container ?? string.Empty), '.');
@ -320,7 +321,7 @@ namespace MediaBrowser.Model.Dlna
var anyOff = false; var anyOff = false;
foreach (ProfileCondition c in i.Conditions) 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; anyOff = true;
break; break;

View File

@ -20,6 +20,7 @@
IsCabac = 15, IsCabac = 15,
NumAudioStreams = 16, NumAudioStreams = 16,
NumVideoStreams = 17, NumVideoStreams = 17,
IsSecondaryAudio IsSecondaryAudio = 18,
VideoCodecTag = 19
} }
} }

View File

@ -571,6 +571,7 @@ namespace MediaBrowser.Model.Dlna
float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate;
bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic;
bool? isCabac = videoStream == null ? null : videoStream.IsCabac; bool? isCabac = videoStream == null ? null : videoStream.IsCabac;
string videoCodecTag = videoStream == null ? null : videoStream.CodecTag;
int? audioBitrate = audioStream == null ? null : audioStream.BitRate; int? audioBitrate = audioStream == null ? null : audioStream.BitRate;
int? audioChannels = audioStream == null ? null : audioStream.Channels; int? audioChannels = audioStream == null ? null : audioStream.Channels;
@ -586,7 +587,7 @@ namespace MediaBrowser.Model.Dlna
// Check container conditions // Check container conditions
foreach (ProfileCondition i in 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); LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource);
@ -619,7 +620,7 @@ namespace MediaBrowser.Model.Dlna
foreach (ProfileCondition i in 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, "VideoCodecProfile", i, mediaSource); LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource);
@ -966,8 +967,6 @@ namespace MediaBrowser.Model.Dlna
} }
break; break;
} }
default:
throw new ArgumentException("Unrecognized ProfileConditionValue");
} }
} }
} }

View File

@ -489,6 +489,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> /// <summary>
/// Predicts the audio bitrate that will be in the output stream /// Predicts the audio bitrate that will be in the output stream
/// </summary> /// </summary>

View File

@ -18,6 +18,12 @@ namespace MediaBrowser.Model.Entities
/// <value>The codec.</value> /// <value>The codec.</value>
public string Codec { get; set; } public string Codec { get; set; }
/// <summary>
/// Gets or sets the codec tag.
/// </summary>
/// <value>The codec tag.</value>
public string CodecTag { get; set; }
/// <summary> /// <summary>
/// Gets or sets the language. /// Gets or sets the language.
/// </summary> /// </summary>