[FFmpeg-soc] [soc]: r4980 - spdif/spdif.c

bwolowiec subversion at mplayerhq.hu
Fri Aug 7 23:50:00 CEST 2009


Author: bwolowiec
Date: Fri Aug  7 23:50:00 2009
New Revision: 4980

Log:
Simplify spdif_header_dts

Modified:
   spdif/spdif.c

Modified: spdif/spdif.c
==============================================================================
--- spdif/spdif.c	Fri Aug  7 20:01:12 2009	(r4979)
+++ spdif/spdif.c	Fri Aug  7 23:50:00 2009	(r4980)
@@ -69,30 +69,29 @@ static int spdif_header_ac3(AVFormatCont
 static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
 {
     IEC958Context *ctx = s->priv_data;
-    uint32_t syncword_dts = be2me_32(*(uint32_t *) pkt->data);
+    uint32_t syncword_dts = AV_RB32(pkt->data);
     int blocks;
 
     switch (syncword_dts) {
     case DCA_MARKER_RAW_BE:
-        blocks =
-            (((pkt->data[4] & 0x01) << 6) | (pkt->data[5] >> 2)) + 1;
+        blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
         break;
     case DCA_MARKER_RAW_LE:
-        blocks =
-            (((pkt->data[5] & 0x01) << 6) | (pkt->data[4] >> 2)) + 1;
+        blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;
         break;
     case DCA_MARKER_14B_BE:
         blocks =
-            (((pkt->data[5] & 0x07) << 4) | ((pkt->data[6] & 0x3f) >> 2)) + 1;
+            (((pkt->data[5] & 0x07) << 4) | ((pkt->data[6] & 0x3f) >> 2));
         break;
     case DCA_MARKER_14B_LE:
         blocks =
-            (((pkt->data[4] & 0x07) << 4) | ((pkt->data[7] & 0x3f) >> 2)) + 1;
+            (((pkt->data[4] & 0x07) << 4) | ((pkt->data[7] & 0x3f) >> 2)) ;
         break;
     default:
         av_log(s, AV_LOG_ERROR, "bad DTS syncword\n");
         return -1;
     }
+    blocks++;
     av_log(s, AV_LOG_DEBUG, "blocks=%i\n", blocks);
     switch (blocks) {
     case 512 >> 5:


More information about the FFmpeg-soc mailing list