summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-04-01 22:52:33 +0200
committerwm4 <wm4@mplayer2.org>2012-04-01 22:52:33 +0200
commit1aa2e36122e6e664e42170f47d6db82873bef5aa (patch)
tree39e13f93bcb606da9e365c7cd379132bdf53c20b /libmpcodecs
parentfea8c85c8595b797fc839b113c1db252fc55c798 (diff)
parent8cd71527ade21ea27ea24cdcc66dc71dca460f85 (diff)
downloadmpv-1aa2e36122e6e664e42170f47d6db82873bef5aa.tar.bz2
mpv-1aa2e36122e6e664e42170f47d6db82873bef5aa.tar.xz
Merge remote-tracking branch 'origin/master'
Conflicts: bstr.c bstr.h etc/input.conf input/input.c input/input.h libao2/ao_pulse.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libvo/gl_common.c libvo/x11_common.c mixer.c mixer.h mplayer.c
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/img_format.c3
-rw-r--r--libmpcodecs/img_format.h5
-rw-r--r--libmpcodecs/mp_image.c4
-rw-r--r--libmpcodecs/vf_ass.c2
-rw-r--r--libmpcodecs/vf_vo.c202
5 files changed, 106 insertions, 110 deletions
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 54ccc42b2a..033c0a4e3e 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -103,9 +103,6 @@ const char *vo_format_name(int format)
case IMGFMT_YUVP: return "Packed YUVP";
case IMGFMT_UYVP: return "Packed UYVP";
case IMGFMT_MPEGPES: return "Mpeg PES";
- case IMGFMT_ZRMJPEGNI: return "Zoran MJPEG non-interlaced";
- case IMGFMT_ZRMJPEGIT: return "Zoran MJPEG top field first";
- case IMGFMT_ZRMJPEGIB: return "Zoran MJPEG bottom field first";
case IMGFMT_XVMC_MOCO_MPEG2: return "MPEG1/2 Motion Compensation";
case IMGFMT_XVMC_IDCT_MPEG2: return "MPEG1/2 Motion Compensation and IDCT";
case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration";
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index a3a475a68b..4200282f98 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -192,11 +192,6 @@
/* Compressed Formats */
#define IMGFMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S'))
#define IMGFMT_MJPEG (('M')|('J'<<8)|('P'<<16)|('G'<<24))
-/* Formats that are understood by zoran chips, we include
- * non-interlaced, interlaced top-first, interlaced bottom-first */
-#define IMGFMT_ZRMJPEGNI (('Z'<<24)|('R'<<16)|('N'<<8)|('I'))
-#define IMGFMT_ZRMJPEGIT (('Z'<<24)|('R'<<16)|('I'<<8)|('T'))
-#define IMGFMT_ZRMJPEGIB (('Z'<<24)|('R'<<16)|('I'<<8)|('B'))
// I think that this code could not be used by any other codec/format
#define IMGFMT_XVMC 0x1DC70000
diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c
index 8cdb5eee6b..4e20dee119 100644
--- a/libmpcodecs/mp_image.c
+++ b/libmpcodecs/mp_image.c
@@ -99,9 +99,7 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags&=~(MP_IMGFLAG_PLANAR|MP_IMGFLAG_YUV|MP_IMGFLAG_SWAPPED);
mpi->imgfmt=out_fmt;
// compressed formats
- if(out_fmt == IMGFMT_MPEGPES ||
- out_fmt == IMGFMT_ZRMJPEGNI || out_fmt == IMGFMT_ZRMJPEGIT || out_fmt == IMGFMT_ZRMJPEGIB ||
- IMGFMT_IS_HWACCEL(out_fmt)){
+ if(out_fmt == IMGFMT_MPEGPES || IMGFMT_IS_HWACCEL(out_fmt)){
mpi->bpp=0;
return;
}
diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c
index ce80caa74b..4dcddb1d08 100644
--- a/libmpcodecs/vf_ass.c
+++ b/libmpcodecs/vf_ass.c
@@ -370,7 +370,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
mp_ass_reload_options(vf->priv->renderer, vf->opts);
osd->ass_force_reload = false;
images = ass_render_frame(vf->priv->renderer, osd->ass_track,
- (pts + sub_delay) * 1000 + .5, NULL);
+ (pts - osd->sub_offset + sub_delay) * 1000 + .5, NULL);
}
prepare_image(vf, mpi);
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index b7c16a7759..a6bd165dee 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -33,8 +33,6 @@
#include "sub/ass_mp.h"
#include "sub/sub.h"
-//===========================================================================//
-
extern float sub_delay;
struct vf_priv_s {
@@ -47,45 +45,47 @@ struct vf_priv_s {
};
#define video_out (vf->priv->vo)
-static int query_format(struct vf_instance *vf, unsigned int fmt); /* forward declaration */
-static void draw_slice(struct vf_instance *vf, unsigned char** src, int* stride, int w,int h, int x, int y);
+static int query_format(struct vf_instance *vf, unsigned int fmt);
+static void draw_slice(struct vf_instance *vf, unsigned char **src,
+ int *stride, int w, int h, int x, int y);
static int config(struct vf_instance *vf,
- int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
+ int width, int height, int d_width, int d_height,
+ unsigned int flags, unsigned int outfmt)
+{
- if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0))
- {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "VO: invalid dimensions!\n");
- return 0;
+ if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0)) {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR, "VO: invalid dimensions!\n");
+ return 0;
}
const vo_info_t *info = video_out->driver->info;
- mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
- width, height,
- d_width, d_height,
- vo_format_name(outfmt),
- (flags&VOFLAG_FULLSCREEN)?" [fs]":"",
- (flags&VOFLAG_MODESWITCHING)?" [vm]":"",
- (flags&VOFLAG_SWSCALE)?" [zoom]":"",
- (flags&VOFLAG_FLIPPING)?" [flip]":"");
- mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Description: %s\n",info->name);
- mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
- if(info->comment && strlen(info->comment) > 0)
- mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",
+ info->short_name,
+ width, height,
+ d_width, d_height,
+ vo_format_name(outfmt),
+ (flags & VOFLAG_FULLSCREEN) ? " [fs]" : "",
+ (flags & VOFLAG_MODESWITCHING) ? " [vm]" : "",
+ (flags & VOFLAG_SWSCALE) ? " [zoom]" : "",
+ (flags & VOFLAG_FLIPPING) ? " [flip]" : "");
+ mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Description: %s\n", info->name);
+ mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Author: %s\n", info->author);
+ if (info->comment && strlen(info->comment) > 0)
+ mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Comment: %s\n", info->comment);
// save vo's stride capability for the wanted colorspace:
- vf->default_caps=query_format(vf,outfmt);
+ vf->default_caps = query_format(vf, outfmt);
vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
if (vo_config(video_out, width, height, d_width, d_height, flags, outfmt))
- return 0;
+ return 0;
#ifdef CONFIG_ASS
vf->priv->scale_ratio = (double) d_width / d_height * height / width;
if (vf->priv->renderer) {
- mp_ass_configure(vf->priv->renderer, vf->opts, width, height,
+ mp_ass_configure(vf->priv->renderer, vf->opts, width, height,
vf->default_caps & VFCAP_EOSD_UNSCALED);
}
@@ -96,40 +96,43 @@ static int config(struct vf_instance *vf,
return 1;
}
-static int control(struct vf_instance *vf, int request, void* data)
+static int control(struct vf_instance *vf, int request, void *data)
{
- switch(request){
+ switch (request) {
case VFCTRL_GET_DEINTERLACE:
- {
- if(!video_out) return CONTROL_FALSE; // vo not configured?
+ if (!video_out)
+ return CONTROL_FALSE; // vo not configured?
return vo_control(video_out, VOCTRL_GET_DEINTERLACE, data) == VO_TRUE;
- }
case VFCTRL_SET_DEINTERLACE:
- {
- if(!video_out) return CONTROL_FALSE; // vo not configured?
+ if (!video_out)
+ return CONTROL_FALSE; // vo not configured?
return vo_control(video_out, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE;
- }
case VFCTRL_GET_YUV_COLORSPACE:
return vo_control(video_out, VOCTRL_GET_YUV_COLORSPACE, data) == true;
case VFCTRL_SET_YUV_COLORSPACE:
return vo_control(video_out, VOCTRL_SET_YUV_COLORSPACE, data) == true;
case VFCTRL_DRAW_OSD:
- if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
- vo_draw_osd(video_out, data);
- return CONTROL_TRUE;
- case VFCTRL_SET_EQUALIZER:
- {
- vf_equalizer_t *eq=data;
- if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
- struct voctrl_set_equalizer_args param = {eq->item, eq->value};
- return vo_control(video_out, VOCTRL_SET_EQUALIZER, &param) == VO_TRUE;
+ if (!video_out->config_ok)
+ return CONTROL_FALSE; // vo not configured?
+ vo_draw_osd(video_out, data);
+ return CONTROL_TRUE;
+ case VFCTRL_SET_EQUALIZER: {
+ vf_equalizer_t *eq = data;
+ if (!video_out->config_ok)
+ return CONTROL_FALSE; // vo not configured?
+ struct voctrl_set_equalizer_args param = {
+ eq->item, eq->value
+ };
+ return vo_control(video_out, VOCTRL_SET_EQUALIZER, &param) == VO_TRUE;
}
- case VFCTRL_GET_EQUALIZER:
- {
- vf_equalizer_t *eq=data;
- if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
- struct voctrl_get_equalizer_args param = {eq->item, &eq->value};
- return vo_control(video_out, VOCTRL_GET_EQUALIZER, &param) == VO_TRUE;
+ case VFCTRL_GET_EQUALIZER: {
+ vf_equalizer_t *eq = data;
+ if (!video_out->config_ok)
+ return CONTROL_FALSE; // vo not configured?
+ struct voctrl_get_equalizer_args param = {
+ eq->item, &eq->value
+ };
+ return vo_control(video_out, VOCTRL_GET_EQUALIZER, &param) == VO_TRUE;
}
#ifdef CONFIG_ASS
case VFCTRL_INIT_EOSD:
@@ -141,8 +144,7 @@ static int control(struct vf_instance *vf, int request, void* data)
vf->priv->prev_visibility = false;
return CONTROL_TRUE;
}
- case VFCTRL_DRAW_EOSD:
- {
+ case VFCTRL_DRAW_EOSD: {
struct osd_state *osd = data;
mp_eosd_images_t images = {NULL, 2};
ASS_Renderer *renderer = vf->priv->renderer;
@@ -158,7 +160,7 @@ static int control(struct vf_instance *vf, int request, void* data)
vf->priv->prev_visibility = false;
osd->ass_track_changed = false;
if (sub_visibility && osd->ass_track && (osd->pts != MP_NOPTS_VALUE)) {
- struct mp_eosd_res res = {0};
+ struct mp_eosd_res res = { 0 };
if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
ass_set_frame_size(renderer, res.w, res.h);
ass_set_margins(renderer, res.mt, res.mb, res.ml, res.mr);
@@ -168,7 +170,7 @@ static int control(struct vf_instance *vf, int request, void* data)
if (osd->ass_force_reload)
mp_ass_reload_options(vf->priv->renderer, vf->opts);
images.imgs = ass_render_frame(renderer, osd->ass_track,
- (osd->pts+sub_delay) * 1000 + .5,
+ (osd->pts + sub_delay) * 1000 + .5,
&images.changed);
if (!vf->priv->prev_visibility || osd->ass_force_reload)
images.changed = 2;
@@ -183,53 +185,58 @@ static int control(struct vf_instance *vf, int request, void* data)
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance *vf, unsigned int fmt){
+static int query_format(struct vf_instance *vf, unsigned int fmt)
+{
int flags = vo_control(video_out, VOCTRL_QUERY_FORMAT, &fmt);
// draw_slice() accepts stride, draw_frame() doesn't:
- if(flags)
- if(fmt==IMGFMT_YV12 || fmt==IMGFMT_I420 || fmt==IMGFMT_IYUV)
- flags|=VFCAP_ACCEPT_STRIDE;
+ if (flags)
+ if (fmt == IMGFMT_YV12 || fmt == IMGFMT_I420 || fmt == IMGFMT_IYUV)
+ flags |= VFCAP_ACCEPT_STRIDE;
return flags;
}
static void get_image(struct vf_instance *vf,
- mp_image_t *mpi){
+ mp_image_t *mpi)
+{
if (!video_out->config_ok)
return;
// GET_IMAGE is required for hardware-accelerated formats
- if(vo_directrendering ||
- IMGFMT_IS_HWACCEL(mpi->imgfmt))
- vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
+ if (vo_directrendering || IMGFMT_IS_HWACCEL(mpi->imgfmt))
+ vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
}
-static int put_image(struct vf_instance *vf,
- mp_image_t *mpi, double pts){
- if(!video_out->config_ok) return 0; // vo not configured?
- // first check, maybe the vo/vf plugin implements draw_image using mpi:
- if (vo_draw_image(video_out, mpi, pts) >= 0)
- return 1;
- // nope, fallback to old draw_frame/draw_slice:
- if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
- // blit frame:
-// if(mpi->flags&MP_IMGFLAG_PLANAR)
- if(vf->default_caps&VFCAP_ACCEPT_STRIDE)
- vo_draw_slice(video_out, mpi->planes,mpi->stride,mpi->w,mpi->h,0,0);
- else
- vo_draw_frame(video_out, mpi->planes);
- }
- return 1;
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
+{
+ if (!video_out->config_ok)
+ return 0;
+ // first check, maybe the vo/vf plugin implements draw_image using mpi:
+ if (vo_draw_image(video_out, mpi, pts) >= 0)
+ return 1;
+ // nope, fallback to old draw_frame/draw_slice:
+ if (!(mpi->flags & (MP_IMGFLAG_DIRECT | MP_IMGFLAG_DRAW_CALLBACK))) {
+ // blit frame:
+ if (vf->default_caps & VFCAP_ACCEPT_STRIDE)
+ vo_draw_slice(video_out, mpi->planes, mpi->stride, mpi->w, mpi->h,
+ 0, 0);
+ else
+ vo_draw_frame(video_out, mpi->planes);
+ }
+ return 1;
}
-static void start_slice(struct vf_instance *vf,
- mp_image_t *mpi) {
- if(!video_out->config_ok) return; // vo not configured?
- vo_control(video_out, VOCTRL_START_SLICE,mpi);
+static void start_slice(struct vf_instance *vf, mp_image_t *mpi)
+{
+ if (!video_out->config_ok)
+ return;
+ vo_control(video_out, VOCTRL_START_SLICE, mpi);
}
-static void draw_slice(struct vf_instance *vf,
- unsigned char** src, int* stride, int w,int h, int x, int y){
- if(!video_out->config_ok) return; // vo not configured?
- vo_draw_slice(video_out, src,stride,w,h,x,y);
+static void draw_slice(struct vf_instance *vf, unsigned char **src,
+ int *stride, int w, int h, int x, int y)
+{
+ if (!video_out->config_ok)
+ return;
+ vo_draw_slice(video_out, src, stride, w, h, x, y);
}
static void uninit(struct vf_instance *vf)
@@ -245,20 +252,21 @@ static void uninit(struct vf_instance *vf)
free(vf->priv);
}
}
-//===========================================================================//
-static int vf_open(vf_instance_t *vf, char *args){
- vf->config=config;
- vf->control=control;
- vf->query_format=query_format;
- vf->get_image=get_image;
- vf->put_image=put_image;
- vf->draw_slice=draw_slice;
- vf->start_slice=start_slice;
- vf->uninit=uninit;
- vf->priv=calloc(1, sizeof(struct vf_priv_s));
+static int vf_open(vf_instance_t *vf, char *args)
+{
+ vf->config = config;
+ vf->control = control;
+ vf->query_format = query_format;
+ vf->get_image = get_image;
+ vf->put_image = put_image;
+ vf->draw_slice = draw_slice;
+ vf->start_slice = start_slice;
+ vf->uninit = uninit;
+ vf->priv = calloc(1, sizeof(struct vf_priv_s));
vf->priv->vo = (struct vo *)args;
- if(!video_out) return 0; // no vo ?
+ if (!video_out)
+ return 0;
return 1;
}
@@ -270,5 +278,3 @@ const vf_info_t vf_info_vo = {
vf_open,
NULL
};
-
-//===========================================================================//