diff options
-rw-r--r-- | DOCS/man/en/mplayer.1 | 8 | ||||
-rw-r--r-- | cfg-mencoder.h | 6 | ||||
-rw-r--r-- | libmpcodecs/Makefile | 2 | ||||
-rw-r--r-- | libmpcodecs/ve.c | 6 | ||||
-rw-r--r-- | libmpcodecs/ve_raw.c | 150 | ||||
-rw-r--r-- | libmpcodecs/ve_rawrgb.c | 83 | ||||
-rw-r--r-- | libmpcodecs/ve_rawyuv.c | 81 | ||||
-rw-r--r-- | mencoder.c | 9 |
8 files changed, 161 insertions, 184 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index c060a94bb9..cb883a9f1c 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3832,10 +3832,8 @@ Use \-ovc help to get a list of available codecs. no encoding, just streamcopy .IPs "\-ovc divx4" encode to DivX4/\:DivX5 -.IPs "\-ovc rawrgb" -encode to uncompressed RGB24 -.IPs "\-ovc rawyuv" -encode to uncompressed YUV (I420) +.IPs "\-ovc raw" +encode to arbitrary uncompressed format (use \-vf format to select) .IPs "\-ovc lavc" encode with a libavcodec codecs .RE @@ -5273,7 +5271,7 @@ mencoder dvd://2 \-o titel2.avi \-ovc lavc mencoder "mf://*.jpg" \-mf fps=25 \-o output.avi \-ovc divx4 .TP .B Encoding from tuner -mencoder \-tv driver=v4l:width=640:height=480 tv:// \-o tv.avi \-ovc rawrgb +mencoder \-tv driver=v4l:width=640:height=480 tv:// \-o tv.avi \-ovc raw .TP .B Encoding from a pipe rar p test-SVCD.rar | mencoder \-ovc divx4 \-divx4opts br=800 \-ofps 24 \- diff --git a/cfg-mencoder.h b/cfg-mencoder.h index 9e1a50d33c..3b5331f06a 100644 --- a/cfg-mencoder.h +++ b/cfg-mencoder.h @@ -67,8 +67,7 @@ m_option_t ovc_conf[]={ // {"raw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAW, NULL}, {"lavc", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBAVCODEC, NULL}, // {"null", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_NULL, NULL}, - {"rawrgb", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAWRGB, NULL}, - {"rawyuv", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAWYUV, NULL}, + {"raw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_RAW, NULL}, {"vfw", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_VFW, NULL}, {"libdv", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_LIBDV, NULL}, {"xvid", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_XVID, NULL}, @@ -77,8 +76,7 @@ m_option_t ovc_conf[]={ {"help", "\nAvailable codecs:\n" " copy - frame copy, without re-encoding. doesn't work with filters!\n" " frameno - special audio-only file for 3-pass encoding, see DOCS!\n" - " rawrgb - uncompressed RGB 24bpp video\n" - " rawyuv - uncompressed 4:2:0 YUV (I420) 12bpp video\n" + " raw - uncompressed video. Use fourcc option to set format explicitly.\n" " nuv - nuppel video\n" #ifdef HAVE_DIVX4ENCORE #ifdef ENCORE_XVID diff --git a/libmpcodecs/Makefile b/libmpcodecs/Makefile index 200de312df..29e25c9efd 100644 --- a/libmpcodecs/Makefile +++ b/libmpcodecs/Makefile @@ -19,7 +19,7 @@ ifeq ($(HAVE_FFPOSTPROCESS),yes) VFILTER_SRCS += vf_pp.c endif -ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_rawyuv.c ve_libdv.c ve_xvid.c ve_xvid4.c ve_qtvideo.c ve_nuv.c +ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_raw.c ve_libdv.c ve_xvid.c ve_xvid4.c ve_qtvideo.c ve_nuv.c NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/fli.c native/minilzo.c native/nuppelvideo.c native/qtrle.c native/roqav.c native/xa_gsm.c native/decode144.c native/decode288.c diff --git a/libmpcodecs/ve.c b/libmpcodecs/ve.c index 1b6aba9326..e6f2adf1a4 100644 --- a/libmpcodecs/ve.c +++ b/libmpcodecs/ve.c @@ -12,8 +12,7 @@ extern vf_info_t ve_info_divx4; extern vf_info_t ve_info_lavc; extern vf_info_t ve_info_vfw; -extern vf_info_t ve_info_rawrgb; -extern vf_info_t ve_info_rawyuv; +extern vf_info_t ve_info_raw; extern vf_info_t ve_info_libdv; extern vf_info_t ve_info_xvid; extern vf_info_t ve_info_qtvideo; @@ -33,8 +32,7 @@ static vf_info_t* encoder_list[]={ #ifdef HAVE_LIBDV095 &ve_info_libdv, #endif - &ve_info_rawrgb, - &ve_info_rawyuv, + &ve_info_raw, #if defined(HAVE_XVID3) || defined(HAVE_XVID4) &ve_info_xvid, #endif diff --git a/libmpcodecs/ve_raw.c b/libmpcodecs/ve_raw.c new file mode 100644 index 0000000000..ddc93a606f --- /dev/null +++ b/libmpcodecs/ve_raw.c @@ -0,0 +1,150 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "../config.h" +#include "../mp_msg.h" + +#include "codec-cfg.h" +#include "stream.h" +#include "demuxer.h" +#include "stheader.h" + +#include "muxer.h" + +#include "img_format.h" +#include "mp_image.h" +#include "vf.h" + + +//===========================================================================// + +struct vf_priv_s { + muxer_stream_t* mux; +}; +#define mux_v (vf->priv->mux) + +static int set_format(struct vf_instance_s *vf, unsigned int fmt) { + mux_v->bih->biCompression = fmt; + + mux_v->bih->biPlanes = 1; + if (IMGFMT_IS_RGB(fmt)) { + if (IMGFMT_RGB_DEPTH(fmt) < 8 && !(fmt&128)) + mux_v->bih->biBitCount = IMGFMT_RGB_DEPTH(fmt); + else + mux_v->bih->biBitCount = (IMGFMT_RGB_DEPTH(fmt)+7)&(~7); + return 1; + } + if (IMGFMT_IS_BGR(fmt)) { + if (IMGFMT_BGR_DEPTH(fmt) < 8 && !(fmt&128)) + mux_v->bih->biBitCount = IMGFMT_BGR_DEPTH(fmt); + else + mux_v->bih->biBitCount = (IMGFMT_BGR_DEPTH(fmt)+7)&(~7); + return 1; + } + switch (fmt) { + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YV12: + case IMGFMT_411P: + mux_v->bih->biPlanes = 3; + mux_v->bih->biBitCount = 12; + break; + case IMGFMT_444P: + mux_v->bih->biPlanes = 3; + mux_v->bih->biBitCount = 24; + break; + case IMGFMT_422P: + mux_v->bih->biPlanes = 3; + mux_v->bih->biBitCount = 16; + break; + case IMGFMT_IF09: + mux_v->bih->biPlanes = 4; + case IMGFMT_YVU9: + mux_v->bih->biBitCount = 9; + break; + case IMGFMT_UYVY: + case IMGFMT_YUY2: + mux_v->bih->biBitCount = 16; + break; + default: + printf("ve_raw: raw output with fourcc [%x] not supported!\n", fmt); + mux_v->bih->biCompression = 0; + return 0; + } + return 1; +} + + +static int config(struct vf_instance_s *vf, + int width, int height, int d_width, int d_height, + unsigned int flags, unsigned int outfmt) +{ + int ret; + mux_v->bih->biWidth = width; + mux_v->bih->biHeight = height; + ret = set_format(vf, outfmt); + if (!ret) return 0; + + mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*mux_v->bih->biBitCount/8; + return 1; +} + +static int control(struct vf_instance_s *vf, int request, void *data) { + return CONTROL_UNKNOWN; +} + +static int query_format(struct vf_instance_s *vf, unsigned int fmt) { + if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) + return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; + switch (fmt) { + case IMGFMT_I420: + case IMGFMT_IYUV: + case IMGFMT_YV12: + case IMGFMT_411P: + case IMGFMT_444P: + case IMGFMT_422P: + case IMGFMT_UYVY: + case IMGFMT_YUY2: + case IMGFMT_YVU9: + case IMGFMT_IF09: + return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; + } + + return 0; +} + +static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) { + mux_v->buffer = mpi->planes[0]; + muxer_write_chunk(mux_v, mpi->width*mpi->height*mux_v->bih->biBitCount/8, 0x10); + return 1; +} + +//===========================================================================// + +static int vf_open(vf_instance_t *vf, char* args){ + vf->config = config; + vf->control = control; + vf->query_format = query_format; + vf->put_image = put_image; + vf->priv = malloc(sizeof(struct vf_priv_s)); + memset(vf->priv, 0, sizeof(struct vf_priv_s)); + vf->priv->mux = (muxer_stream_t*)args; + + mux_v->bih = malloc(sizeof(BITMAPINFOHEADER)); + mux_v->bih->biSize = sizeof(BITMAPINFOHEADER); + mux_v->bih->biWidth = 0; + mux_v->bih->biHeight = 0; + + return 1; +} + +vf_info_t ve_info_raw = { + "raw encoder", + "raw", + "jwe21@cam.ac.uk", + "Based on rawrgb", + vf_open +}; + +//===========================================================================// diff --git a/libmpcodecs/ve_rawrgb.c b/libmpcodecs/ve_rawrgb.c deleted file mode 100644 index 64e03b30f8..0000000000 --- a/libmpcodecs/ve_rawrgb.c +++ /dev/null @@ -1,83 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "../config.h" -#include "../mp_msg.h" - -#include "codec-cfg.h" -#include "stream.h" -#include "demuxer.h" -#include "stheader.h" - -#include "muxer.h" - -#include "img_format.h" -#include "mp_image.h" -#include "vf.h" - -//===========================================================================// - -struct vf_priv_s { - muxer_stream_t* mux; -}; -#define mux_v (vf->priv->mux) - -static int config(struct vf_instance_s* vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt){ - - mux_v->bih->biWidth=width; - mux_v->bih->biHeight=height; - mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); - - return 1; -} - -static int control(struct vf_instance_s* vf, int request, void* data){ - - return CONTROL_UNKNOWN; -} - -static int query_format(struct vf_instance_s* vf, unsigned int fmt){ - if(fmt==IMGFMT_BGR24) return 3 | VFCAP_FLIPPED; - return 0; -} - -static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ - mux_v->buffer=mpi->planes[0]; - muxer_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10); - return 1; -} - -//===========================================================================// - -static int vf_open(vf_instance_t *vf, char* args){ - vf->config=config; - vf->control=control; - vf->query_format=query_format; - vf->put_image=put_image; - vf->priv=malloc(sizeof(struct vf_priv_s)); - memset(vf->priv,0,sizeof(struct vf_priv_s)); - vf->priv->mux=(muxer_stream_t*)args; - - mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); - mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); - mux_v->bih->biWidth=0; - mux_v->bih->biHeight=0; - mux_v->bih->biCompression=0; - mux_v->bih->biPlanes=1; - mux_v->bih->biBitCount=24; - - return 1; -} - -vf_info_t ve_info_rawrgb = { - "rawrgb encoder", - "rawrgb", - "A'rpi", - "for internal use by mencoder", - vf_open -}; - -//===========================================================================// diff --git a/libmpcodecs/ve_rawyuv.c b/libmpcodecs/ve_rawyuv.c deleted file mode 100644 index ea322c39ad..0000000000 --- a/libmpcodecs/ve_rawyuv.c +++ /dev/null @@ -1,81 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "../config.h" -#include "../mp_msg.h" - -#include "codec-cfg.h" -#include "stream.h" -#include "demuxer.h" -#include "stheader.h" - -#include "muxer.h" - -#include "img_format.h" -#include "mp_image.h" -#include "vf.h" - -//===========================================================================// - -struct vf_priv_s { - muxer_stream_t* mux; -}; -#define mux_v (vf->priv->mux) - -static int config(struct vf_instance_s *vf, - int width, int height, int d_width, int d_height, - unsigned int flags, unsigned int outfmt) -{ - mux_v->bih->biWidth = width; - mux_v->bih->biHeight = height; - mux_v->bih->biSizeImage = mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); - return 1; -} - -static int control(struct vf_instance_s *vf, int request, void *data) { - return CONTROL_UNKNOWN; -} - -static int query_format(struct vf_instance_s *vf, unsigned int fmt) { - if (fmt==IMGFMT_I420) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW; - return 0; -} - -static int put_image(struct vf_instance_s *vf, mp_image_t *mpi) { - mux_v->buffer = mpi->planes[0]; - muxer_write_chunk(mux_v, mpi->width*mpi->height*3/2, 0x10); - return 1; -} - -//===========================================================================// - -static int vf_open(vf_instance_t *vf, char* args){ - vf->config = config; - vf->control = control; - vf->query_format = query_format; - vf->put_image = put_image; - vf->priv = malloc(sizeof(struct vf_priv_s)); - memset(vf->priv, 0, sizeof(struct vf_priv_s)); - vf->priv->mux = (muxer_stream_t*)args; - - mux_v->bih = malloc(sizeof(BITMAPINFOHEADER)); - mux_v->bih->biSize = sizeof(BITMAPINFOHEADER); - mux_v->bih->biWidth = 0; - mux_v->bih->biHeight = 0; - mux_v->bih->biCompression = mmioFOURCC('I', '4', '2', '0'); - mux_v->bih->biPlanes = 3; - mux_v->bih->biBitCount = 12; - - return 1; -} - -vf_info_t ve_info_rawyuv = { - "rawyuv encoder", - "rawyuv", - "tuukkat@ee.oulu.fi", - "Based on rawrgb", - vf_open -}; - -//===========================================================================// diff --git a/mencoder.c b/mencoder.c index 34f0167aac..211ceb63e8 100644 --- a/mencoder.c +++ b/mencoder.c @@ -3,13 +3,12 @@ // real codecs: #define VCODEC_DIVX4 2 #define VCODEC_LIBAVCODEC 4 -#define VCODEC_RAWRGB 6 #define VCODEC_VFW 7 #define VCODEC_LIBDV 8 #define VCODEC_XVID 9 #define VCODEC_QTVIDEO 10 #define VCODEC_NUV 11 -#define VCODEC_RAWYUV 12 +#define VCODEC_RAW 12 #define ACODEC_COPY 0 #define ACODEC_PCM 1 @@ -681,10 +680,8 @@ default: sh_video->vfilter=vf_open_encoder(NULL,"divx4",(char *)mux_v); break; case VCODEC_LIBAVCODEC: sh_video->vfilter=vf_open_encoder(NULL,"lavc",(char *)mux_v); break; - case VCODEC_RAWRGB: - sh_video->vfilter=vf_open_encoder(NULL,"rawrgb",(char *)mux_v); break; - case VCODEC_RAWYUV: - sh_video->vfilter=vf_open_encoder(NULL,"rawyuv",(char *)mux_v); break; + case VCODEC_RAW: + sh_video->vfilter=vf_open_encoder(NULL,"raw",(char *)mux_v); break; case VCODEC_VFW: sh_video->vfilter=vf_open_encoder(NULL,"vfw",(char *)mux_v); break; case VCODEC_LIBDV: |