summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-24 22:38:45 +0200
committerwm4 <wm4@nowhere>2012-10-24 22:38:45 +0200
commit0e81d62c53a205ce5a4a5b201c283a1f9aba7316 (patch)
tree9ce8f4b0444a765c6a5dce3cb84c528a0e4ca3df /libmpcodecs
parentbcf447d7e82af814ccc07c852543be38e58d69c8 (diff)
parent60cbc9461b86b13c68cc9537bc9a124ddc07a399 (diff)
downloadmpv-0e81d62c53a205ce5a4a5b201c283a1f9aba7316.tar.bz2
mpv-0e81d62c53a205ce5a4a5b201c283a1f9aba7316.tar.xz
Merge branch 'master' into osd_changes
Conflicts: libvo/vo_xv.c
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/img_format.c2
-rw-r--r--libmpcodecs/img_format.h3
-rw-r--r--libmpcodecs/mp_image.c7
-rw-r--r--libmpcodecs/vd.c51
-rw-r--r--libmpcodecs/vd_ffmpeg.c3
-rw-r--r--libmpcodecs/vd_internal.h48
-rw-r--r--libmpcodecs/vf.c13
-rw-r--r--libmpcodecs/vf_dlopen.c2
-rw-r--r--libmpcodecs/vf_expand.c13
9 files changed, 21 insertions, 121 deletions
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 7f82f95db2..1084a8f9a1 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -191,10 +191,10 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = {
{"argb", IMGFMT_ARGB},
{"bgra", IMGFMT_BGRA},
{"abgr", IMGFMT_ABGR},
+ {"bgr0", IMGFMT_BGR0},
{"gbrp", IMGFMT_GBRP},
{"mjpeg", IMGFMT_MJPEG},
{"mjpg", IMGFMT_MJPEG},
- {"mpes", IMGFMT_MPEGPES},
{"vdpau_h264", IMGFMT_VDPAU_H264},
{"vdpau_mpeg1", IMGFMT_VDPAU_MPEG1},
{"vdpau_mpeg2", IMGFMT_VDPAU_MPEG2},
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index 42e601a270..b488734f02 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -101,6 +101,8 @@
#define IMGFMT_RGB_DEPTH(fmt) ((fmt)&0x3F)
#define IMGFMT_BGR_DEPTH(fmt) ((fmt)&0x3F)
+// AV_PIX_FMT_BGR0
+#define IMGFMT_BGR0 0x1DC70000
/* Planar YUV Formats */
@@ -196,7 +198,6 @@
#define IMGFMT_UYVP 0x50565955 // 10-bit UYVY
/* Compressed Formats */
-#define IMGFMT_MPEGPES (('M'<<24)|('P'<<16)|('E'<<8)|('S'))
#define IMGFMT_MJPEG (('M')|('J'<<8)|('P'<<16)|('G'<<24))
// VDPAU specific format.
diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c
index f01e416b01..b7c9017188 100644
--- a/libmpcodecs/mp_image.c
+++ b/libmpcodecs/mp_image.c
@@ -120,7 +120,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 || IMGFMT_IS_HWACCEL(out_fmt)){
+ if(IMGFMT_IS_HWACCEL(out_fmt)){
mpi->bpp=0;
return;
}
@@ -140,6 +140,11 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
mpi->flags|=MP_IMGFLAG_SWAPPED;
return;
}
+ switch (out_fmt) {
+ case IMGFMT_BGR0:
+ mpi->bpp = 32;
+ return;
+ }
mpi->num_planes=3;
if (out_fmt == IMGFMT_GBRP) {
mpi->bpp=24;
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 48e2b0627e..511665aeac 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -60,8 +60,7 @@ int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
unsigned int out_fmt = 0;
int screen_size_x = 0;
int screen_size_y = 0;
- vf_instance_t *vf = sh->vfilter, *sc = NULL;
- int palette = 0;
+ vf_instance_t *vf = sh->vfilter;
int vocfg_flags = 0;
if (w)
@@ -125,58 +124,14 @@ int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
sh->output_flags = flags;
if (flags & VFCAP_CSP_SUPPORTED_BY_HW)
break;
- } else if (!palette
- && !(flags &
- (VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_CSP_SUPPORTED))
- && (out_fmt == IMGFMT_RGB8 || out_fmt == IMGFMT_BGR8)) {
- sh->outfmtidx = j; // pass index to the control() function this way
- if (sh->vd_driver->control(sh, VDCTRL_QUERY_FORMAT, &out_fmt) !=
- CONTROL_FALSE)
- palette = 1;
}
}
if (j < 0) {
// TODO: no match - we should use conversion...
- if (strcmp(vf->info->name, "scale") && palette != -1) {
+ if (strcmp(vf->info->name, "scale")) {
mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Could not find matching colorspace - retrying with -vf scale...\n");
- sc = vf = vf_open_filter(opts, vf, "scale", NULL);
- goto csp_again;
- } else if (palette == 1) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "vd: Trying -vf palette...\n");
- palette = -1;
- vf = vf_open_filter(opts, vf, "palette", NULL);
+ vf = vf_open_filter(opts, vf, "scale", NULL);
goto csp_again;
- } else {
- // sws failed, if the last filter (vf_vo) support MPEGPES try
- // to append vf_lavc
- vf_instance_t *vo, *vp = NULL, *ve, *vpp = NULL;
- // Remove the scale filter if we added it ourselves
- if (vf == sc) {
- ve = vf;
- vf = vf->next;
- vf_uninit_filter(ve);
- }
- // Find the last filter (vf_vo)
- for (vo = vf; vo->next; vo = vo->next) {
- vpp = vp;
- vp = vo;
- }
- if (vo->query_format(vo, IMGFMT_MPEGPES)
- && (!vp || (vp && strcmp(vp->info->name, "lavc")))) {
- ve = vf_open_filter(opts, vo, "lavc", NULL);
- if (vp)
- vp->next = ve;
- else
- vf = ve;
- goto csp_again;
- }
- if (vp && !strcmp(vp->info->name,"lavc")) {
- if (vpp)
- vpp->next = vo;
- else
- vf = vo;
- vf_uninit_filter(vp);
- }
}
mp_tmsg(MSGT_CPLAYER, MSGL_WARN,
"The selected video_out device is incompatible with this codec.\n"\
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index d36e4122a0..343a26d8d3 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -583,9 +583,6 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic)
}
if (mpi) {
- // Palette support: free palette buffer allocated in get_buffer
- if (mpi->bpp == 8)
- av_freep(&mpi->planes[1]);
// release mpi (in case MPI_IMGTYPE_NUMBERED is used, e.g. for VDPAU)
mpi->usage_count--;
}
diff --git a/libmpcodecs/vd_internal.h b/libmpcodecs/vd_internal.h
deleted file mode 100644
index b4d74a6a48..0000000000
--- a/libmpcodecs/vd_internal.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer 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.
- *
- * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VD_INTERNAL_H
-#define MPLAYER_VD_INTERNAL_H
-
-#include "codec-cfg.h"
-#include "img_format.h"
-
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-
-#include "vd.h"
-
-extern int divx_quality;
-
-// prototypes:
-//static vd_info_t info;
-static int control(sh_video_t *sh,int cmd,void* arg,...);
-static int init(sh_video_t *sh);
-static void uninit(sh_video_t *sh);
-static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags);
-
-#define LIBVD_EXTERN(x) const vd_functions_t mpcodecs_vd_##x = {\
- &info,\
- init,\
- uninit,\
- control,\
- decode\
-};
-
-#endif /* MPLAYER_VD_INTERNAL_H */
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index 9ea17f978c..39a720a893 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -250,6 +250,8 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
break;
}
if (mpi) {
+ int missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) &&
+ (mp_imgflag & MP_IMGFLAG_RGB_PALETTE);
mpi->type = mp_imgtype;
mpi->w = vf->w;
mpi->h = vf->h;
@@ -261,11 +263,15 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
MP_IMGFLAG_DRAW_CALLBACK | MP_IMGFLAG_RGB_PALETTE);
if (!vf->draw_slice)
mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
- if (mpi->width != w2 || mpi->height != h) {
+ if (mpi->width != w2 || mpi->height != h || missing_palette) {
if (mpi->flags & MP_IMGFLAG_ALLOCATED) {
- if (mpi->width < w2 || mpi->height < h) {
+ if (mpi->width < w2 || mpi->height < h || missing_palette) {
// need to re-allocate buffer memory:
av_free(mpi->planes[0]);
+ if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
+ av_free(mpi->planes[1]);
+ for (int n = 0; n < MP_MAX_PLANES; n++)
+ mpi->planes[n] = NULL;
mpi->flags &= ~MP_IMGFLAG_ALLOCATED;
mp_msg(MSGT_VFILTER, MSGL_V,
"vf.c: have to REALLOCATE buffer memory :(\n");
@@ -355,11 +361,8 @@ mp_image_t *vf_get_image(vf_instance_t *vf, unsigned int outfmt,
//============================================================================
-// By default vf doesn't accept MPEGPES
static int vf_default_query_format(struct vf_instance *vf, unsigned int fmt)
{
- if (fmt == IMGFMT_MPEGPES)
- return 0;
return vf_next_query_format(vf, fmt);
}
diff --git a/libmpcodecs/vf_dlopen.c b/libmpcodecs/vf_dlopen.c
index 71da4f1636..183b31be84 100644
--- a/libmpcodecs/vf_dlopen.c
+++ b/libmpcodecs/vf_dlopen.c
@@ -281,7 +281,7 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
static int query_format(struct vf_instance *vf, unsigned int fmt)
{
- if (IMGFMT_IS_HWACCEL(fmt) || fmt == IMGFMT_MJPEG || fmt == IMGFMT_MPEGPES)
+ if (IMGFMT_IS_HWACCEL(fmt))
return 0; // these can't really be filtered
if (fmt == IMGFMT_RGB8 || fmt == IMGFMT_BGR8)
return 0; // we don't have palette support, sorry
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index b8ac9f728d..ff13a8501e 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -48,7 +48,6 @@ static struct vf_priv_s {
int exp_x,exp_y;
double aspect;
int round;
- int passthrough;
int first_slice;
} const vf_priv_dflt = {
-1,-1,
@@ -57,7 +56,6 @@ static struct vf_priv_s {
-1,-1,
0.,
1,
- 0,
0
};
@@ -69,10 +67,6 @@ static int config(struct vf_instance *vf,
{
struct MPOpts *opts = vf->opts;
mp_image_t test_mpi;
- if(outfmt == IMGFMT_MPEGPES) {
- vf->priv->passthrough = 1;
- return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
- }
mp_image_setfmt(&test_mpi, outfmt);
if (outfmt == IMGFMT_IF09 || !test_mpi.bpp) return 0;
vf->priv->exp_x = vf->priv->cfg_exp_x;
@@ -261,13 +255,6 @@ static void clear_borders(struct vf_instance *vf, int w, int h)
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
- if (vf->priv->passthrough) {
- mp_image_t *dmpi = vf_get_image(vf->next, IMGFMT_MPEGPES,
- MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
- dmpi->planes[0]=mpi->planes[0];
- return vf_next_put_image(vf,dmpi, pts);
- }
-
if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
vf->dmpi=mpi->priv;
if(!vf->dmpi) { mp_tmsg(MSGT_VFILTER, MSGL_WARN, "Why do we get NULL??\n"); return 0; }