[MPlayer-cvslog] r19166 - trunk/libvo/vo_mpegpes.c
nicodvb
subversion at mplayerhq.hu
Sun Jul 23 11:32:11 CEST 2006
Author: nicodvb
Date: Sun Jul 23 11:32:04 2006
New Revision: 19166
Modified:
trunk/libvo/vo_mpegpes.c
Log:
reuse send_mpeg_lpcm_packet() instead of the old packetizer
Modified: trunk/libvo/vo_mpegpes.c
==============================================================================
--- trunk/libvo/vo_mpegpes.c (original)
+++ trunk/libvo/vo_mpegpes.c Sun Jul 23 11:32:04 2006
@@ -233,84 +233,7 @@
}
void send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id){
-
- int ptslen=timestamp?5:0;
-
- // startcode:
- pes_header[0]=pes_header[1]=0;
- pes_header[2]=1; pes_header[3]=0xBD;
-
- while(len>=4){
- int payload_size;
-
- payload_size=PES_MAX_SIZE-6-20; // max possible data len
- if(payload_size>len) payload_size=len;
- payload_size&=(~3); // align!
-
- //if(6+payload_size>PES_MAX_SIZE) payload_size=PES_MAX_SIZE-6;
-
- // packetsize:
- pes_header[4]=(payload_size+3+ptslen+7)>>8;
- pes_header[5]=(payload_size+3+ptslen+7)&255;
-
- // stuffing:
- // TTCCxxxx CC=css TT=type: 1=STD 0=mpeg1 2=vob
- pes_header[6]=0x81;
-
- // FFxxxxxx FF=pts flags=2 vs 0
- pes_header[7]=ptslen ? 0x80 : 0;
-
- // hdrlen:
- pes_header[8]=ptslen;
-
- if(ptslen){
- int x;
- // presentation time stamp:
- x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1;
- pes_header[9]=x;
- x=((((timestamp >> 15) & 0x7fff) << 1) | 1);
- pes_header[10]=x>>8; pes_header[11]=x&255;
- x=((((timestamp) & 0x7fff) << 1) | 1);
- pes_header[12]=x>>8; pes_header[13]=x&255;
- }
-
-// ============ LPCM header: (7 bytes) =================
-// Info by mocm at convergence.de
-
-// ID:
- pes_header[ptslen+9]=id;
-
-// number of frames:
- pes_header[ptslen+10]=0x07;
-
-// first acces unit pointer, i.e. start of audio frame:
- pes_header[ptslen+11]=0x00;
- pes_header[ptslen+12]=0x04;
-
-// audio emphasis on-off 1 bit
-// audio mute on-off 1 bit
-// reserved 1 bit
-// audio frame number 5 bit
- pes_header[ptslen+13]=0x0C;
-
-// quantization word length 2 bit
-// audio sampling frequency (48khz = 0, 96khz = 1) 2 bit
-// reserved 1 bit
-// number of audio channels - 1 (e.g. stereo = 1) 3 bit
- pes_header[ptslen+14]=1|(freq_id<<4);
-
-// dynamic range control (0x80 if off)
- pes_header[ptslen+15]=0x80;
-
- memcpy(&pes_header[6+3+ptslen+7],data,payload_size);
- my_write(pes_header,6+3+ptslen+7+payload_size);
-
- len-=payload_size; data+=payload_size;
- ptslen=0; // store PTS only once, at first packet!
- }
-
-// printf("PES: draw frame! pts=%d size=%d \n",timestamp,len);
-
+ send_mpeg_lpcm_packet(data, len, id, timestamp, freq_id, my_write);
}
More information about the MPlayer-cvslog
mailing list