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

bwolowiec subversion at mplayerhq.hu
Fri Aug 7 19:23:11 CEST 2009


Author: bwolowiec
Date: Fri Aug  7 19:23:11 2009
New Revision: 4976

Log:
Use put_buffer

Modified:
   spdif/spdif.c

Modified: spdif/spdif.c
==============================================================================
--- spdif/spdif.c	Fri Aug  7 16:08:05 2009	(r4975)
+++ spdif/spdif.c	Fri Aug  7 19:23:11 2009	(r4976)
@@ -204,7 +204,6 @@ static int spdif_write_header(AVFormatCo
 static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     IEC958Context *ctx = s->priv_data;
-    uint16_t *data = (uint16_t *) pkt->data;
     int i, ret;
 
     ctx->pkt_size = ((pkt->size + 1) >> 1) << 4;
@@ -217,9 +216,16 @@ static int spdif_write_packet(struct AVF
     put_le16(s->pb, ctx->data_type); //Pc
     put_le16(s->pb, ctx->pkt_size);  //Pd
 
-    //XXX memcpy... ?
-    for (i = 0; i < pkt->size >> 1; i++)
-        put_be16(s->pb, data[i]);
+#ifdef WORDS_BIGENDIAN
+    put_buffer(s->pb, pkt->data, pkt->size & (~1));
+#else
+    {
+        //XXX swab... ?
+        uint16_t *data = (uint16_t *) pkt->data;
+        for (i = 0; i < pkt->size >> 1; i++)
+            put_be16(s->pb, data[i]);
+    }
+#endif
 
     if (pkt->size & 1)
         put_be16(s->pb, pkt->data[pkt->size - 1]);


More information about the FFmpeg-soc mailing list