fixes #797 - Determine mpeg2ts timestamp info

This commit is contained in:
Luke Pulverenti
2014-04-24 22:00:19 -04:00
parent 725e1a1509
commit eca1ba0b12
21 changed files with 125 additions and 55 deletions

View File

@@ -1,5 +1,7 @@
using System;
using System.Globalization;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{

View File

@@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{

View File

@@ -110,11 +110,4 @@ namespace MediaBrowser.Model.Dlna
MPEG4_H263_3GPP_P0_L10_AMR,
MPEG4_H263_MP4_P0_L10_AAC
}
public enum TransportStreamTimestamp
{
NONE,
ZERO,
VALID
}
}

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{
@@ -147,14 +149,14 @@ namespace MediaBrowser.Model.Dlna
}
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
{
// if (audioCodec == AudioCodec.AAC)
// return Collections.singletonList(MediaFormatProfile.valueOf(String.format("MPEG4_P2_TS_ASP_AAC%s", cast(Object[])[ suffix ])));
// if (audioCodec == AudioCodec.MP3)
// return Collections.singletonList(MediaFormatProfile.valueOf(String.format("MPEG4_P2_TS_ASP_MPEG1_L3%s", cast(Object[])[ suffix ])));
// if (audioCodec == AudioCodec.MP2)
// return Collections.singletonList(MediaFormatProfile.valueOf(String.format("MPEG4_P2_TS_ASP_MPEG2_L2%s", cast(Object[])[ suffix ])));
// if ((audioCodec is null) || (audioCodec == AudioCodec.AC3)) {
// return Collections.singletonList(MediaFormatProfile.valueOf(String.format("MPEG4_P2_TS_ASP_AC3%s", cast(Object[])[ suffix ])));
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
if (string.Equals(audioCodec, "mp2", StringComparison.OrdinalIgnoreCase))
return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
return new[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
}
return new List<MediaFormatProfile>();

View File

@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{
@@ -285,7 +286,7 @@ namespace MediaBrowser.Model.Dlna
var audioBitrate = audioStream == null ? null : audioStream.BitRate;
var audioChannels = audioStream == null ? null : audioStream.Channels;
var timestamp = videoStream == null ? TransportStreamTimestamp.NONE : videoStream.Timestamp;
var timestamp = videoStream == null ? TransportStreamTimestamp.NONE : mediaSource.Timestamp;
var packetLength = videoStream == null ? null : videoStream.PacketLength;
// Check container conditions

View File

@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{
@@ -339,11 +340,13 @@ namespace MediaBrowser.Model.Dlna
{
get
{
var stream = TargetVideoStream;
return !IsDirectStream
var defaultValue = string.Equals(Container, "m2ts", StringComparison.OrdinalIgnoreCase)
? TransportStreamTimestamp.VALID
: stream == null ? TransportStreamTimestamp.VALID : stream.Timestamp;
: TransportStreamTimestamp.NONE;
return !IsDirectStream
? defaultValue
: MediaSource == null ? defaultValue : MediaSource.Timestamp;
}
}