diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-03-09 15:01:12 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-03-09 15:01:12 +0000 |
commit | 8c5b570b50f956366be55b78c754c26a02c3d817 (patch) | |
tree | 07129011f415089393504bf65a627de090da4a05 | |
parent | 9545a4a211fc124b79a35e6ff5070643eb00b87e (diff) |
Get rid of nuppelvideo.h and its ugly packed struct and instead write the
frame header directly in nuv encoder.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28914 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/ve_nuv.c | 35 | ||||
-rw-r--r-- | libmpdemux/nuppelvideo.h | 80 |
2 files changed, 17 insertions, 98 deletions
diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index 1a8e5c0c42..af6a1dff57 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -19,7 +19,7 @@ #include "mp_image.h" #include "vf.h" -#include "libmpdemux/nuppelvideo.h" +#include "libavutil/intreadwrite.h" #include <lzo/lzo1x.h> #include "native/rtjpegn.h" @@ -68,6 +68,7 @@ m_option_t nuvopts_conf[]={ #define COMPDATASIZE (128*4) +#define FRAMEHEADERSIZE 12 static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, @@ -102,13 +103,13 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){ } static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ - struct rtframeheader* ench = (struct rtframeheader*)vf->priv->buffer; + uint8_t *header = vf->priv->buffer; uint8_t* data = vf->priv->buffer + FRAMEHEADERSIZE; uint8_t* zdata = vf->priv->zbuffer + FRAMEHEADERSIZE; int len = 0, r; size_t zlen = 0; - memset(vf->priv->buffer,0,FRAMEHEADERSIZE); // Reset the header + memset(header, 0, FRAMEHEADERSIZE); // Reset the header if(vf->priv->lzo) memset(vf->priv->zbuffer,0,FRAMEHEADERSIZE); @@ -117,15 +118,14 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ RTjpeg_init_compress((uint32_t *)data,mpi->width,mpi->height,vf->priv->q); RTjpeg_init_mcompress(); - ench->frametype = 'D'; // compressor data - ench->comptype = 'R'; // compressor data for RTjpeg - ench->packetlength = COMPDATASIZE; + header[0] = 'D'; // frametype: compressor data + header[1] = 'R'; // comptype: compressor data for RTjpeg + AV_WL32(header + 8, COMPDATASIZE); // packetlength - le2me_rtframeheader(ench); mux_v->buffer=vf->priv->buffer; muxer_write_chunk(mux_v,FRAMEHEADERSIZE + COMPDATASIZE, 0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); vf->priv->tbl_wrote = 1; - memset(ench,0,FRAMEHEADERSIZE); // Reset the header + memset(header, 0, FRAMEHEADERSIZE); // Reset the header } // Raw picture @@ -143,10 +143,10 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ if(zlen <= 0 || zlen > len) { memcpy(data,mpi->planes[0],len); - ench->comptype = '0'; + header[1] = '0'; // comptype: uncompressed } else { // Use lzo only if it's littler - ench = (struct rtframeheader*)vf->priv->zbuffer; - ench->comptype = '3'; + header = vf->priv->zbuffer; + header[1] = '3'; //comptype: lzo len = zlen; } @@ -167,19 +167,18 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){ } if(zlen <= 0 || zlen > len) - ench->comptype = '1'; + header[1] = '1'; // comptype: RTjpeg else { - ench = (struct rtframeheader*)vf->priv->zbuffer; - ench->comptype = '2'; + header = vf->priv->zbuffer; + header[1] = '2'; // comptype: RTjpeg + LZO len = zlen; } } - ench->frametype = 'V'; // video frame - ench->packetlength = len; - le2me_rtframeheader(ench); - mux_v->buffer=(void*)ench; + header[0] = 'V'; // frametype: video frame + AV_WL32(header + 8, len); // packetlength + mux_v->buffer = header; muxer_write_chunk(mux_v, len + FRAMEHEADERSIZE, 0x10, pts, pts); return 1; } diff --git a/libmpdemux/nuppelvideo.h b/libmpdemux/nuppelvideo.h deleted file mode 100644 index 8982f443c3..0000000000 --- a/libmpdemux/nuppelvideo.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - nuppelvideo.h taken from NuppelVideo, by - (c) Roman Hochleitner roman@mars.tuwien.ac.at - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef MPLAYER_NUPPELVIDEO_H -#define MPLAYER_NUPPELVIDEO_H - -typedef struct __attribute__((packed)) rtframeheader -{ - char frametype; // A .. Audio, V .. Video, S .. Sync, T .. Text - // R .. Seekpoint: String RTjjjjjjjj (use full packet) - // D .. Addition Data for Compressors - // ct: R .. RTjpeg Tables - - char comptype; // V: 0 .. Uncompressed [NI] - // 1 .. RTJpeg - // 2 .. RTJpeg with lzo afterwards - // N .. black frame - // L .. simply copy last frame (if lost frames) - // A: 0 .. Uncompressed (44100/sec 16bit 2ch) - // 1 .. lzo compression [NI] - // 2 .. layer2 (packet) [NI] - // 3 .. layer3 (packet) [NI] - // F .. flac (lossless) [NI] - // S .. shorten (lossless) [NI] - // N .. null frame loudless - // L .. simply copy last frame (may sound bad) NI - // S: B .. Audio and Video sync point [NI] - // A .. Audio Sync Information - // timecode == effective dsp-frequency*100 - // when reaching this audio sync point - // because many cheap soundcards are unexact - // and have a range from 44000 to 44250 - // instead of the expected exact 44100 S./sec - // V .. Next Video Sync - // timecode == next video framenumber - // S .. Audio,Video,Text Correlation [NI] - char keyframe; // 0 .. keyframe - // 1 .. nr of frame in gop => no keyframe - - char filters; // Every bit stands for one type of filter - // 1 .. Gauss 5 Pixel (8*m+2*l+2*r+2*a+2*b)/16 [NYI] - // 2 .. Gauss 5 Pixel (8*m+1*l+1*r+1*a+1*b)/12 [NYI] - // 4 .. Cartoon Filter [NI] - // 8 .. Reserverd Filter [NI] - // 16 .. Reserverd Filter [NI] - // 32 .. Reserverd Filter [NI] - // 64 .. Reserverd Filter [NI] - // 128 .. Reserverd Filter [NI] - - int timecode; // Timecodeinformation sec*1000 + msecs - - int packetlength; // V,A,T: length of following data in stream - // S: length of packet correl. information [NI] - // R: do not use here! (fixed 'RTjjjjjjjjjjjjjj') -} rtframeheader; - -#define FRAMEHEADERSIZE sizeof(rtframeheader) - -#define le2me_rtframeheader(h) { \ - (h)->timecode = le2me_32((h)->timecode); \ - (h)->packetlength = le2me_32((h)->packetlength); \ - } - -#endif /* MPLAYER_NUPPELVIDEO_H */ |