[Live-devel] [PATCH] Add SMPTE 370M (DVCPRO HD) profiles

Ben Hutchings ben at decadent.org.uk
Sun May 24 08:15:28 PDT 2009


This changes the DV profile matching to match ffmpeg's code, adding
support for DVCPRO HD.  I have no examples of DVPCRO HD streams to test
against, but presumably ffmpeg does the right thing.

Ben.

diff --git a/liveMedia/DVVideo.cpp b/liveMedia/DVVideo.cpp
index 4b8742f..3dc3bc9 100644
--- a/liveMedia/DVVideo.cpp
+++ b/liveMedia/DVVideo.cpp
@@ -20,26 +20,23 @@ along with this library; if not, write to the Free Software Foundation, Inc.,
 #include <stddef.h>
 #include "DVVideoInternals.hh"
 
-// We support the following profiles:
-//
-// SD-VCR/525-60
-// SD-VCR/625-50
-// 314M-25/525-60
-// 314M-25/625-50
-// 314M-50/525-60
-// 314M-50/625-50
-//
-// We don't include HD-VCR (MPEG-2 payload), SDL-VCR (never seen it),
-// or 370M (never seen it).  RFC 3189bis says 306M can be treated as
-// 314M-25.
+// The profiles here do not include HD-VCR (this has an MPEG-2 payload
+// and therefore entirely different presentation timing) or SDL-VCR
+// (the author has never seen any specification or codec for it).
+// SMPTE 314M obsoleted 306M and there is no need to treat them as
+// defining separate profiles.
 
 static DVVideoProfile const profiles[] = {
-  { "SD-VCR/525-60",  0, 10, 1, 1000000 * 1001 / 30000 },
-  { "SD-VCR/625-50",  0, 12, 1, 1000000 / 25 },
-  { "314M-25/525-60", 1, 10, 1, 1000000 * 1001 / 30000 },
-  { "314M-25/625-50", 1, 12, 1, 1000000 / 25 },
-  { "314M-50/525-60", 1, 10, 2, 1000000 * 1001 / 30000 },
-  { "314M-50/625-50", 1, 12, 2, 1000000 / 25 },
+  { "SD-VCR/525-60",  0, 0x00, 10, 1, 1000000 * 1001 / 30000 },
+  { "SD-VCR/625-50",  0, 0x00, 12, 1, 1000000 / 25 },
+  { "314M-25/525-60", 1, 0x00, 10, 1, 1000000 * 1001 / 30000 },
+  { "314M-25/625-50", 1, 0x00, 12, 1, 1000000 / 25 },
+  { "314M-50/525-60", 1, 0x04, 10, 2, 1000000 * 1001 / 30000 },
+  { "314M-50/625-50", 1, 0x04, 12, 2, 1000000 / 25 },
+  { "370M/1080-60i",  1, 0x14, 10, 4, 1000000 * 1001 / 30000 },
+  { "370M/1080-50i",  1, 0x14, 12, 4, 1000000 / 25 },
+  { "370M/720-60p",   1, 0x18, 10, 4, 1000000 * 1001 / 60000 },
+  { "370M/720-50p",   1, 0x18, 12, 4, 1000000 / 50 },
   { 0 }
 };
 
@@ -53,18 +50,16 @@ const DVVideoProfile* DVVideoProfile::getByHeader(const DVBlock* headerBlocks)
     return NULL;
 
   unsigned apt = headerBlocks[0].Data[1] & 7;
+  unsigned stype = headerBlocks[5].Data[48] & 0x1f;
   unsigned sequenceCount =
     (headerBlocks[0].Data[0] == DVPackHeader12) ? 12 : 10;
-  unsigned channelCount =
-    (headerBlocks[5].Data[45] == DVPackVideoSource &&
-     headerBlocks[5].Data[48] & 4) ? 2 : 1;
 
   for (DVVideoProfile const* profile = profiles;
        profile->Name != NULL;
        ++profile)
     if (profile->APT == apt &&
-	profile->SequenceCount == sequenceCount &&
-	profile->ChannelCount == channelCount)
+	profile->SType == stype &&
+	profile->SequenceCount == sequenceCount)
       return profile;
 
   return NULL;
diff --git a/liveMedia/DVVideoInternals.hh b/liveMedia/DVVideoInternals.hh
index b204c56..d6f5222 100644
--- a/liveMedia/DVVideoInternals.hh
+++ b/liveMedia/DVVideoInternals.hh
@@ -91,6 +91,7 @@ struct DVVideoProfile {
 
   char const* Name;
   unsigned APT;
+  unsigned SType;
   unsigned SequenceCount;
   unsigned ChannelCount; /* for higher bit rates */
   unsigned FrameDuration; /* in microseconds */

-- 
Ben Hutchings
Teamwork is essential - it allows you to blame someone else.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090524/2ba7e09e/attachment-0001.bin>


More information about the live-devel mailing list