mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
16ca65e83a
commit
7172339ff9
|
@ -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)
|
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) {
|
if(dxr2_fd < 0) {
|
||||||
mp_msg(MSGT_AO,MSGL_ERR,"DXR2 fd is not valid\n");
|
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
|
// it should round it down to outburst*n
|
||||||
// return: number of bytes played
|
// return: number of bytes played
|
||||||
static int play(void* data,int len,int flags){
|
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 :-(
|
// MPEG and AC3 don't work :-(
|
||||||
if(ao_data.format==AF_FORMAT_MPEG2)
|
if(ao_data.format==AF_FORMAT_MPEG2)
|
||||||
|
|
|
@ -48,7 +48,7 @@ static const unsigned char ps1_header[] = {
|
||||||
static int
|
static int
|
||||||
send_mpeg_pes_packet_ll(unsigned char *data, int len, int id, uint64_t pts,
|
send_mpeg_pes_packet_ll(unsigned char *data, int len, int id, uint64_t pts,
|
||||||
int type, unsigned char *header, int header_len,
|
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 ptslen = (pts ? 5 : 0);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
@ -139,7 +139,7 @@ send_mpeg_pes_packet_ll(unsigned char *data, int len, int id, uint64_t pts,
|
||||||
|
|
||||||
int
|
int
|
||||||
send_mpeg_pes_packet (unsigned char *data, int len, int id, uint64_t pts,
|
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);
|
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 <type> PS packet */
|
/* Send MPEG <type> PS packet */
|
||||||
int
|
int
|
||||||
send_mpeg_ps_packet(unsigned char *data, int len, int id, uint64_t pts, int type,
|
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)
|
if(type == 2)
|
||||||
my_write (ps2_header, sizeof (ps2_header));
|
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
|
int
|
||||||
send_mpeg_lpcm_packet(unsigned char* data, int len,
|
send_mpeg_lpcm_packet(unsigned char* data, int len,
|
||||||
int id, uint64_t pts, int freq_id,
|
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};
|
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);
|
return send_mpeg_pes_packet_ll(data, len, 0xBD, pts, 2, header, sizeof(header), 1, my_write);
|
||||||
|
|
|
@ -27,15 +27,15 @@
|
||||||
|
|
||||||
/* Send MPEG <type> PES packet */
|
/* Send MPEG <type> PES packet */
|
||||||
int send_mpeg_pes_packet (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));
|
||||||
|
|
||||||
/* Send MPEG <type> PS packet */
|
/* Send MPEG <type> PS packet */
|
||||||
int send_mpeg_ps_packet (unsigned char *data, int len, int id, uint64_t pts,
|
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 */
|
/* Send MPEG 2 LPCM packet */
|
||||||
int send_mpeg_lpcm_packet (unsigned char *data, int len,
|
int send_mpeg_lpcm_packet (unsigned char *data, int len,
|
||||||
int id, uint64_t pts, int freq_id,
|
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 */
|
#endif /* MPEG_PACKETIZER_H */
|
||||||
|
|
|
@ -153,7 +153,7 @@ static char *ucodesearchpath[] = {
|
||||||
static unsigned char dxr2buf[BUF_SIZE];
|
static unsigned char dxr2buf[BUF_SIZE];
|
||||||
static unsigned int dxr2bufpos = 0;
|
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;
|
int w = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue