[Mplayer-cvslog] CVS: main/libmpcodecs ve_libdv.c,NONE,1.1 Makefile,1.31,1.32 ve.c,1.1,1.2

Arpi of Ize arpi at mplayer.dev.hu
Fri Apr 12 23:50:05 CEST 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mplayer:/var/tmp.root/cvs-serv3753

Modified Files:
	Makefile ve.c 
Added Files:
	ve_libdv.c 
Log Message:
RGB24/YUY2 -> DV encoding, using libdv

--- NEW FILE ---
// requires libdv-0.9.5 !!!
// (v0.9.0 is too old and has no encoding functionality exported!)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../config.h"
#include "../mp_msg.h"

#ifdef HAVE_LIBDV095

#include "codec-cfg.h"
#include "stream.h"
#include "demuxer.h"
#include "stheader.h"

#include "aviwrite.h"

#include "../libvo/img_format.h"
#include "../mp_image.h"
#include "vf.h"

#include <libdv/dv.h>

#ifndef DV_WIDTH
#define DV_WIDTH       720
#define DV_PAL_HEIGHT  576
#define DV_NTSC_HEIGHT 480
#endif

struct vf_priv_s {
    aviwrite_stream_t* mux;
    dv_encoder_t* enc;
    
};
#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){

    if(width!=DV_WIDTH || (height!=DV_PAL_HEIGHT && height!=DV_NTSC_HEIGHT)){
	mp_msg(MSGT_VFILTER,MSGL_ERR,"DV: only 720x480 (NTSC) and 720x576 (PAL) resolutions allowed! try with -vop scale=720:480\n");
    }
    
    vf->priv->enc->isPAL=(height==DV_PAL_HEIGHT);
    vf->priv->enc->is16x9=(d_width/(float)d_height > 1.7); // 16:9=1.777777
    vf->priv->enc->vlc_encode_passes=3;
    vf->priv->enc->static_qno=0;
    vf->priv->enc->force_dct=0;

    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_YUY2) return 3;
    if(fmt==IMGFMT_RGB24) return 1;
    return 0;
}

static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){

    dv_encode_full_frame(vf->priv->enc, mpi->planes, 
	(mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb,
	mux_v->buffer);

    mencoder_write_chunk(mux_v, 480 * (vf->priv->enc->isPAL ? 300 : 250) , 0x10);
}

//===========================================================================//

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=args;
    
    vf->priv->enc=dv_encoder_new(1,1,1); // FIXME, parse some options!
    if(!vf->priv->enc) return 0;
    
    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('d','v','s','d');
    mux_v->bih->biPlanes=1;
    mux_v->bih->biBitCount=24;

    return 1;
}

vf_info_t ve_info_libdv = {
    "DV encoder using libdv",
    "libdv",
    "A'rpi",
    "for internal use by mencoder",
    vf_open
};

//===========================================================================//
#endif

Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/Makefile,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Makefile	11 Apr 2002 03:17:14 -0000	1.31
+++ Makefile	12 Apr 2002 21:49:51 -0000	1.32
@@ -7,7 +7,7 @@
 AUDIO_SRCS=dec_audio.c ad.c ad_a52.c ad_acm.c ad_alaw.c ad_dk3adpcm.c ad_dk4adpcm.c ad_dshow.c ad_dvdpcm.c ad_ffmpeg.c ad_hwac3.c ad_imaadpcm.c ad_mp3.c ad_msadpcm.c ad_pcm.c ad_roqaudio.c ad_msgsm.c ad_faad.c ad_vorbis.c ad_libmad.c
 VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_cinepak.c vd_qtrpza.c vd_ffmpeg.c vd_dshow.c vd_vfw.c vd_odivx.c vd_divx4.c vd_raw.c vd_xanim.c vd_msvidc.c vd_fli.c vd_qtrle.c vd_qtsmc.c vd_roqvideo.c vd_cyuv.c vd_nuv.c vd_libmpeg2.c vd_msrle.c vd_huffyuv.c vd_zlib.c vd_mpegpes.c
 VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_fame.c vf_format.c vf_yuy2.c vf_flip.c
-ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c
+ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c
 
 ifeq ($(PNG),yes)
 VIDEO_SRCS += vd_mpng.c

Index: ve.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ve.c	10 Apr 2002 23:23:36 -0000	1.1
+++ ve.c	12 Apr 2002 21:49:51 -0000	1.2
@@ -13,6 +13,7 @@
 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_libdv;
 
 static vf_info_t* encoder_list[]={
 #ifdef HAVE_DIVX4ENCORE
@@ -23,6 +24,9 @@
 #endif
 #ifdef USE_WIN32DLL
     &ve_info_vfw,
+#endif
+#ifdef HAVE_LIBDV095
+    &ve_info_libdv,
 #endif
     &ve_info_rawrgb,
     NULL




More information about the MPlayer-cvslog mailing list