diff options
author | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-23 10:10:06 +0000 |
---|---|---|
committer | ben <ben@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-23 10:10:06 +0000 |
commit | f5b338b852ed80c7631aed7a6e48d92ff9dcb33b (patch) | |
tree | 3a934130993968882972f96f664355d8ebf47899 /libvo | |
parent | c2ade5351803cdd22bd834fb5d9feb218b0e2ee7 (diff) |
use mpeg packetizer helpers for sending lpcm packets
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19169 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_dxr2.c | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/libvo/vo_dxr2.c b/libvo/vo_dxr2.c index a8f147a4aa..f43ed25f6c 100644 --- a/libvo/vo_dxr2.c +++ b/libvo/vo_dxr2.c @@ -36,7 +36,6 @@ int dxr2_fd = -1; static int movie_w,movie_h; static int playing = 0; -static int last_freq_id = -1; // vo device used to blank the screen for the overlay init static vo_functions_t* sub_vo = NULL; @@ -218,99 +217,6 @@ static void dxr2_send_eof(void) write_dxr2(mpg_eof, sizeof(mpg_eof)); } -void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id) -{ - int arg; - int ptslen=5; - - if(dxr2_fd < 0) { - mp_msg(MSGT_VO,MSGL_ERR,"DXR2 fd is not valid\n"); - return; - } - - if(last_freq_id != freq_id) { - ioctl(dxr2_fd, DXR2_IOC_SET_AUDIO_SAMPLE_FREQUENCY, &freq_id); - last_freq_id = freq_id; - } - - if (((int) timestamp)<0) - timestamp=0; - - mp_msg(MSGT_VO,MSGL_DBG2,"dxr2_send_lpcm_packet(timestamp=%d)\n", timestamp); - // startcode: - pack[0]=pack[1]=0;pack[2]=0x01; - - // stream id - pack[3]=0xBD; - - while(len>=4){ - int payload_size; - - payload_size=PACK_MAX_SIZE-6-3-ptslen-7; // max possible data len - if(payload_size>len) payload_size=len; - payload_size&=(~3); // align! - - // packetsize: - pack[4]=(payload_size+3+ptslen+7)>>8; - pack[5]=(payload_size+3+ptslen+7)&255; - - // stuffing: - pack[6]=0x81; - // pack[7]=0x00; //0x80 - - // hdrlen: - pack[8]=ptslen; - - if(ptslen){ - int x; - pack[7]=0x80; - // presentation time stamp: - x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1; - pack[9]=x; - x=((((timestamp >> 15) & 0x7fff) << 1) | 1); - pack[10]=x>>8; pack[11]=x&255; - x=((((timestamp) & 0x7fff) << 1) | 1); - pack[12]=x>>8; pack[13]=x&255; - } else { - pack[7]=0x00; - } - - // ============ LPCM header: (7 bytes) ================= - // Info by mocm@convergence.de - - // ID: - pack[ptslen+9]=id; - - // number of frames: - pack[ptslen+10]=0x07; - - // first acces unit pointer, i.e. start of audio frame: - pack[ptslen+11]=0x00; - pack[ptslen+12]=0x04; - - // audio emphasis on-off 1 bit - // audio mute on-off 1 bit - // reserved 1 bit - // audio frame number 5 bit - pack[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 - pack[ptslen+14]=1; - - // dynamic range control (0x80 if off) - pack[ptslen+15]=0x80; - - write_dxr2(pack, 6+3+ptslen+7); - write_dxr2(data, payload_size); - - len-=payload_size; data+=payload_size; - timestamp+=90000/4*payload_size/48000; - } -} - void dxr2_send_sub_packet(unsigned char* data,int len,int id,unsigned int timestamp) { int ptslen=5; @@ -613,8 +519,6 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t playing = 0; } - last_freq_id = -1; - // Video stream setup arg3.arg1 = DXR2_STREAM_VIDEO; arg3.arg2 = 0; |