From 7172339ff9086f1f86937d06c89a4b348fdf2ed3 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 12 Jan 2008 16:05:04 +0000 Subject: [PATCH] Write functions used by send_mpeg_*_packet may _not_ modify data git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25701 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_dxr2.c | 4 ++-- libmpdemux/mpeg_packetizer.c | 8 ++++---- libmpdemux/mpeg_packetizer.h | 6 +++--- libvo/vo_dxr2.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libao2/ao_dxr2.c b/libao2/ao_dxr2.c index 3056ba619a..dc0e762362 100644 --- a/libao2/ao_dxr2.c +++ b/libao2/ao_dxr2.c @@ -157,7 +157,7 @@ static int get_space(void){ static void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id) { - extern int write_dxr2(unsigned char *data, int len); + extern int write_dxr2(const unsigned char *data, int len); if(dxr2_fd < 0) { mp_msg(MSGT_AO,MSGL_ERR,"DXR2 fd is not valid\n"); @@ -176,7 +176,7 @@ static void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned in // it should round it down to outburst*n // return: number of bytes played static int play(void* data,int len,int flags){ - extern int write_dxr2(unsigned char *data, int len); + extern int write_dxr2(const unsigned char *data, int len); // MPEG and AC3 don't work :-( if(ao_data.format==AF_FORMAT_MPEG2) diff --git a/libmpdemux/mpeg_packetizer.c b/libmpdemux/mpeg_packetizer.c index ecff3f804d..6f198abc11 100644 --- a/libmpdemux/mpeg_packetizer.c +++ b/libmpdemux/mpeg_packetizer.c @@ -48,7 +48,7 @@ static const unsigned char ps1_header[] = { static int send_mpeg_pes_packet_ll(unsigned char *data, int len, int id, uint64_t pts, int type, unsigned char *header, int header_len, - int align4, int my_write (unsigned char *data, int len)) + int align4, int my_write (const unsigned char *data, int len)) { int ptslen = (pts ? 5 : 0); int n = 0; @@ -139,7 +139,7 @@ send_mpeg_pes_packet_ll(unsigned char *data, int len, int id, uint64_t pts, int send_mpeg_pes_packet (unsigned char *data, int len, int id, uint64_t pts, - int type, int my_write (unsigned char *data, int len)) + int type, int my_write (const unsigned char *data, int len)) { return send_mpeg_pes_packet_ll(data, len, id, pts, type, NULL, 0, 0, my_write); } @@ -148,7 +148,7 @@ send_mpeg_pes_packet (unsigned char *data, int len, int id, uint64_t pts, /* Send MPEG PS packet */ int send_mpeg_ps_packet(unsigned char *data, int len, int id, uint64_t pts, int type, - int my_write (unsigned char *data, int len)) + int my_write (const unsigned char *data, int len)) { if(type == 2) my_write (ps2_header, sizeof (ps2_header)); @@ -161,7 +161,7 @@ send_mpeg_ps_packet(unsigned char *data, int len, int id, uint64_t pts, int type int send_mpeg_lpcm_packet(unsigned char* data, int len, int id, uint64_t pts, int freq_id, - int my_write (unsigned char *data, int len)) + int my_write (const unsigned char *data, int len)) { unsigned char header[7] = {0xA0, 0x07, 0x00, 0x04, 0x0C, 1 | (freq_id << 4), 0x80}; return send_mpeg_pes_packet_ll(data, len, 0xBD, pts, 2, header, sizeof(header), 1, my_write); diff --git a/libmpdemux/mpeg_packetizer.h b/libmpdemux/mpeg_packetizer.h index 6a17034f1f..1273b86b3a 100644 --- a/libmpdemux/mpeg_packetizer.h +++ b/libmpdemux/mpeg_packetizer.h @@ -27,15 +27,15 @@ /* Send MPEG PES packet */ int send_mpeg_pes_packet (unsigned char *data, int len, int id, uint64_t pts, - int type, int my_write (unsigned char *data, int len)); + int type, int my_write (const unsigned char *data, int len)); /* Send MPEG PS packet */ int send_mpeg_ps_packet (unsigned char *data, int len, int id, uint64_t pts, - int type,int my_write (unsigned char *data, int len)); + int type,int my_write (const unsigned char *data, int len)); /* Send MPEG 2 LPCM packet */ int send_mpeg_lpcm_packet (unsigned char *data, int len, int id, uint64_t pts, int freq_id, - int my_write (unsigned char *data, int len)); + int my_write (const unsigned char *data, int len)); #endif /* MPEG_PACKETIZER_H */ diff --git a/libvo/vo_dxr2.c b/libvo/vo_dxr2.c index 4aca495b30..37f093ec98 100644 --- a/libvo/vo_dxr2.c +++ b/libvo/vo_dxr2.c @@ -153,7 +153,7 @@ static char *ucodesearchpath[] = { static unsigned char dxr2buf[BUF_SIZE]; static unsigned int dxr2bufpos = 0; -int write_dxr2(unsigned char *data, int len) +int write_dxr2(const unsigned char *data, int len) { int w = 0;