diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-22 09:45:34 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-22 09:45:34 +0000 |
commit | fdcee83d90c415df6cb570af14073407071fb6bf (patch) | |
tree | abdb012d32c5c53825264a45ef9e2bcb963544d1 /libvo | |
parent | 4cbc615ca4031ebf35ac8c44b41812b103f262f9 (diff) | |
download | mpv-fdcee83d90c415df6cb570af14073407071fb6bf.tar.bz2 mpv-fdcee83d90c415df6cb570af14073407071fb6bf.tar.xz |
simplified mpeg packetizer used by hw mpeg decoders/vo - first round
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19153 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_ivtv.c | 4 | ||||
-rw-r--r-- | libvo/vo_mpegpes.c | 40 |
2 files changed, 4 insertions, 40 deletions
diff --git a/libvo/vo_ivtv.c b/libvo/vo_ivtv.c index 24ecdc5724..253cffefbb 100644 --- a/libvo/vo_ivtv.c +++ b/libvo/vo_ivtv.c @@ -236,8 +236,8 @@ flip_page (void) if (!pes) return; - send_mpeg2_pes_packet (pes->data, pes->size, pes->id, - pes->timestamp ? pes->timestamp : vo_pts, + send_mpeg_pes_packet (pes->data, pes->size, pes->id, + pes->timestamp ? pes->timestamp : vo_pts, 2, ivtv_write); /* ensure flip_page() won't be called twice */ diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c index 522e444703..5d901c0883 100644 --- a/libvo/vo_mpegpes.c +++ b/libvo/vo_mpegpes.c @@ -62,6 +62,7 @@ #include "config.h" #include "video_out.h" #include "video_out_internal.h" +#include "libmpdemux/mpeg_packetizer.h" int vo_mpegpes_fd=-1; int vo_mpegpes_fd2=-1; @@ -226,44 +227,7 @@ static void my_write(unsigned char* data,int len){ static unsigned char pes_header[PES_MAX_SIZE]; void send_pes_packet(unsigned char* data,int len,int id,int timestamp){ - int ptslen=timestamp?5:1; - - // startcode: - pes_header[0]=pes_header[1]=0; - pes_header[2]=id>>8; pes_header[3]=id&255; - - while(len>0){ - int payload_size=len; // data + PTS - if(6+ptslen+payload_size>PES_MAX_SIZE) payload_size=PES_MAX_SIZE-(6+ptslen); - - // construct PES header: (code from ffmpeg's libav) - // packetsize: - pes_header[4]=(ptslen+payload_size)>>8; - pes_header[5]=(ptslen+payload_size)&255; - - if(ptslen==5){ - int x; - // presentation time stamp: - x=(0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1; - pes_header[6]=x; - x=((((timestamp >> 15) & 0x7fff) << 1) | 1); - pes_header[7]=x>>8; pes_header[8]=x&255; - x=((((timestamp) & 0x7fff) << 1) | 1); - pes_header[9]=x>>8; pes_header[10]=x&255; - } else { - // stuffing and header bits: - pes_header[6]=0x0f; - } - - memcpy(&pes_header[6+ptslen],data,payload_size); - my_write(pes_header,6+ptslen+payload_size); - - len-=payload_size; data+=payload_size; - ptslen=1; // store PTS only once, at first packet! - } - -// printf("PES: draw frame! pts=%d size=%d \n",timestamp,len); - + send_mpeg_pes_packet (data, len, id, timestamp, 1, my_write); } void send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id){ |