mirror of https://github.com/mpv-player/mpv
RealVideo rv30 decoder, using binary driver from realplayer8
patch by Florian Schneider <flo-mplayer-dev@gmx.net> some cleanup, and transin1{} fix by me git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6342 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a545ffc48e
commit
73a4e12f08
|
@ -5,7 +5,7 @@ LIBNAME = libmpcodecs.a
|
||||||
LIBNAME2 = libmpencoders.a
|
LIBNAME2 = libmpencoders.a
|
||||||
|
|
||||||
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
|
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
|
VIDEO_SRCS=dec_video.c vd.c vd_null.c vd_real.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_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c
|
VFILTER_SRCS=vf.c vf_vo.c vf_crop.c vf_expand.c vf_pp.c vf_scale.c vf_format.c vf_yuy2.c vf_flip.c vf_rgb2bgr.c vf_rotate.c vf_mirror.c vf_palette.c vf_lavc.c vf_dvbscale.c vf_cropdetect.c vf_test.c
|
||||||
ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c
|
ENCODER_SRCS=ve.c ve_divx4.c ve_lavc.c ve_vfw.c ve_rawrgb.c ve_libdv.c
|
||||||
NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/cyuv.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c
|
NATIVE_SRCS=native/RTjpegN.c native/cinepak.c native/cyuv.c native/fli.c native/minilzo.c native/msvidc.c native/nuppelvideo.c native/qtrle.c native/qtrpza.c native/qtsmc.c native/roqav.c native/xa_gsm.c
|
||||||
|
|
|
@ -0,0 +1,213 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef USE_REALCODECS
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
#include "mp_msg.h"
|
||||||
|
#include "help_mp.h"
|
||||||
|
|
||||||
|
#include "vd_internal.h"
|
||||||
|
|
||||||
|
static vd_info_t info = {
|
||||||
|
"RealPlayer 8 video codecs",
|
||||||
|
"real",
|
||||||
|
VFM_REAL,
|
||||||
|
"Florian Schneider",
|
||||||
|
"using original closed source codecs for Linux",
|
||||||
|
"binary real video codecs"
|
||||||
|
};
|
||||||
|
|
||||||
|
LIBVD_EXTERN(real)
|
||||||
|
|
||||||
|
|
||||||
|
typedef unsigned long ulong;
|
||||||
|
|
||||||
|
ulong (*rvyuv_custom_message)(ulong,ulong);
|
||||||
|
ulong (*rvyuv_free)(ulong);
|
||||||
|
ulong (*rvyuv_hive_message)(ulong,ulong);
|
||||||
|
ulong (*rvyuv_init)(ulong,ulong);
|
||||||
|
ulong (*rvyuv_transform)(ulong,ulong,ulong,ulong,ulong);
|
||||||
|
ulong (*rvyuv_rnfru_free)(ulong);
|
||||||
|
ulong (*rvyuv_rnfru_get_frame)(ulong,ulong,ulong);
|
||||||
|
ulong (*rvyuv_rnfru_init)(ulong,ulong,ulong);
|
||||||
|
ulong (*rvyuv_rnfru_setup)(ulong,ulong,ulong,ulong,ulong,ulong,ulong,ulong);
|
||||||
|
|
||||||
|
void *rv_handle=NULL;
|
||||||
|
|
||||||
|
void *__builtin_vec_new(unsigned long size) {
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __builtin_vec_delete(void *mem) {
|
||||||
|
free(mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __pure_virtual(void) {
|
||||||
|
fprintf(stderr, "I'm outa here!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// to set/get/query special features/parameters
|
||||||
|
static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||||
|
// switch(cmd){
|
||||||
|
// case VDCTRL_QUERY_MAX_PP_LEVEL:
|
||||||
|
// return 9;
|
||||||
|
// case VDCTRL_SET_PP_LEVEL:
|
||||||
|
// vfw_set_postproc(sh,10*(*((int*)arg)));
|
||||||
|
// return CONTROL_OK;
|
||||||
|
// }
|
||||||
|
return CONTROL_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* exits program when failure */
|
||||||
|
int load_syms(char *path) {
|
||||||
|
fputs("loadSyms()\n", stderr);
|
||||||
|
if (1) {
|
||||||
|
void *handle;
|
||||||
|
char *error;
|
||||||
|
|
||||||
|
fprintf(stderr, "opening dll %s\n", path);
|
||||||
|
rv_handle = dlopen (path, RTLD_LAZY);
|
||||||
|
handle=rv_handle;
|
||||||
|
if (!handle) {
|
||||||
|
fputs (dlerror(), stderr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvCustomMessage): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_free = dlsym(handle, "RV20toYUV420Free");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvFree): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvHiveMessage): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_init = dlsym(handle, "RV20toYUV420Init");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvInit): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_transform = dlsym(handle, "RV20toYUV420Transform");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvTransform): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_rnfru_free = dlsym(handle, "RV20toYUV420_RN_FRU_Free");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvRNFRUFree): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_rnfru_get_frame = dlsym(handle, "RV20toYUV420_RN_FRU_GetFrame");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvRNFRUGetFrame): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_rnfru_init = dlsym(handle, "RV20toYUV420_RN_FRU_Init");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvRNFRUInit): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
rvyuv_rnfru_setup = dlsym(handle, "RV20toYUV420_RN_FRU_Setup");
|
||||||
|
if ((error = dlerror()) != NULL) {
|
||||||
|
fprintf (stderr, "dlsym(rvyuvRNFRUSetup): %s\n", error);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we need exact positions */
|
||||||
|
struct rv_init_t {
|
||||||
|
short unk1;
|
||||||
|
short w;
|
||||||
|
short h;
|
||||||
|
short unk3;
|
||||||
|
int unk2;
|
||||||
|
int unk4;
|
||||||
|
int unk5;
|
||||||
|
int format;
|
||||||
|
} rv_init_t;
|
||||||
|
|
||||||
|
// init driver
|
||||||
|
static int init(sh_video_t *sh){
|
||||||
|
//unsigned int out_fmt;
|
||||||
|
char path[4096];
|
||||||
|
int result;
|
||||||
|
ulong cmsg24[4]={sh->disp_w,sh->disp_h,sh->disp_w,sh->disp_h};
|
||||||
|
ulong cmsg_data[3]={0x24,2,&cmsg24};
|
||||||
|
struct rv_init_t init_data={
|
||||||
|
// 11, sh->disp_w, sh->disp_h,0,0,0x01099030,
|
||||||
|
11, sh->disp_w, sh->disp_h,0,0,0x00099030,
|
||||||
|
// 1,0x30202002};
|
||||||
|
1,0x30203002};
|
||||||
|
|
||||||
|
sprintf(path, LIBDIR "/real/%s", sh->codec->dll);
|
||||||
|
if(!load_syms(path)){
|
||||||
|
mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
|
||||||
|
mp_msg(MSGT_DECVIDEO,MSGL_HINT,"You need to copy the contents of the codecs directory from RealPlayer8\n");
|
||||||
|
mp_msg(MSGT_DECVIDEO,MSGL_HINT,"into " LIBDIR "/real/ !\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// only I420 supported
|
||||||
|
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_I420)) return 0;
|
||||||
|
// init codec:
|
||||||
|
sh->context=NULL;
|
||||||
|
result=(*rvyuv_init)(&init_data, &sh->context);
|
||||||
|
if (result){
|
||||||
|
mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Couldn't open RealVideo codec, error code: 0x%X \n",result);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// setup codec:
|
||||||
|
// realvid_hmsg(sh,0,2,0);
|
||||||
|
(*rvyuv_custom_message)(cmsg_data,sh->context);
|
||||||
|
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: RealVideo codec init OK!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// uninit driver
|
||||||
|
static void uninit(sh_video_t *sh){
|
||||||
|
// realvid_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
|
||||||
|
|
||||||
|
// decode a frame
|
||||||
|
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||||
|
mp_image_t* mpi;
|
||||||
|
ulong result;
|
||||||
|
int *buff=(unsigned int *)((char*)data+len);
|
||||||
|
ulong transform_out[5];
|
||||||
|
ulong transform_in[6]={
|
||||||
|
len, // length of the packet (sub-packets appended)
|
||||||
|
0, // unknown, seems to be unused
|
||||||
|
buff[0], // number of sub-packets - 1
|
||||||
|
&buff[2], // table of sub-packet offsets
|
||||||
|
0, // unknown, seems to be unused
|
||||||
|
buff[1], // timestamp (the integer value from the stream)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop
|
||||||
|
|
||||||
|
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
|
||||||
|
sh->disp_w, sh->disp_h);
|
||||||
|
if(!mpi) return NULL;
|
||||||
|
|
||||||
|
result=(*rvyuv_transform)(data, mpi->planes[0], transform_in,
|
||||||
|
transform_out, sh->context);
|
||||||
|
|
||||||
|
return (result?NULL:mpi);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue