[FFmpeg-soc] [soc]: r5106 - spdif/spdif.c
bwolowiec
subversion at mplayerhq.hu
Sat Aug 15 12:22:36 CEST 2009
Author: bwolowiec
Date: Sat Aug 15 12:22:36 2009
New Revision: 5106
Log:
use new function instead of swab
Modified:
spdif/spdif.c
Modified: spdif/spdif.c
==============================================================================
--- spdif/spdif.c Sat Aug 15 01:50:34 2009 (r5105)
+++ spdif/spdif.c Sat Aug 15 12:22:36 2009 (r5106)
@@ -29,8 +29,6 @@
#include "libavcodec/ac3.h"
#include "libavcodec/dca.h"
#include "libavcodec/aac_parser.h"
-#define __USE_XOPEN
-#include <unistd.h>
#define SYNCWORD1 0xF872
#define SYNCWORD2 0x4E1F
@@ -63,6 +61,25 @@ typedef struct IEC958Context {
#endif
} IEC958Context;
+//TODO move to DSP
+static void bswap_buf16(uint16_t *dst, const uint16_t *src, int w){
+ int i;
+
+ for(i=0; i+8<=w; i+=8){
+ dst[i+0]= bswap_16(src[i+0]);
+ dst[i+1]= bswap_16(src[i+1]);
+ dst[i+2]= bswap_16(src[i+2]);
+ dst[i+3]= bswap_16(src[i+3]);
+ dst[i+4]= bswap_16(src[i+4]);
+ dst[i+5]= bswap_16(src[i+5]);
+ dst[i+6]= bswap_16(src[i+6]);
+ dst[i+7]= bswap_16(src[i+7]);
+ }
+ for(;i<w; i++){
+ dst[i+0]= bswap_16(src[i+0]);
+ }
+}
+
static int spdif_header_ac3(AVFormatContext *s, AVPacket *pkt)
{
IEC958Context *ctx = s->priv_data;
@@ -257,7 +274,7 @@ static int spdif_write_packet(struct AVF
if (!ctx->buffer)
return AVERROR(ENOMEM);
}
- swab(pkt->data, ctx->buffer, pkt->size & ~1);
+ bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)pkt->data, pkt->size >> 1);
put_buffer(s->pb, ctx->buffer, pkt->size & ~1);
#endif
More information about the FFmpeg-soc
mailing list