Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove XvMC support.

This removes XvMC code from libmythtv. The main configure script is
unchanged as there is an interaction with ffmpeg compile options that I
haven't yet tracked down.
  • Loading branch information...
commit 252f8018ecc4067b61ac93ce512eee02a4b74f28 1 parent 828757a
Mark Kendall authored
View
393 mythtv/libs/libmythtv/XvMCSurfaceTypes.cpp
@@ -1,393 +0,0 @@
-#ifdef USING_XVMC
-
-#include <sstream>
-using namespace std;
-
-#include "XvMCSurfaceTypes.h"
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-
-static inline MythXDisplay* createXvMCDisplay()
-{
- MythXDisplay *disp = OpenMythXDisplay();
- if (!disp)
- return NULL;
-
- unsigned int p_version, p_release, p_request_base, p_event_base,
- p_error_base;
-
- int ret = Success;
- XLOCK(disp, ret = XvQueryExtension(disp->GetDisplay(),
- &p_version, &p_release, &p_request_base,
- &p_event_base, &p_error_base));
- if (ret != Success)
- {
- VERBOSE(VB_IMPORTANT, "XvQueryExtension failed");
- delete disp;
- return 0;
- }
-
- int mc_eventBase = 0, mc_errorBase = 0;
- XLOCK(disp, ret = XvMCQueryExtension(disp->GetDisplay(),
- &mc_eventBase, &mc_errorBase));
-
- if (True != ret)
- {
- VERBOSE(VB_IMPORTANT, "XvMC extension not found");
- delete disp;
- return 0;
- }
-
- int mc_version, mc_release;
- XLOCK(disp, ret = XvMCQueryVersion(disp->GetDisplay(),
- &mc_version, &mc_release));
- if (Success == ret)
- VERBOSE(VB_PLAYBACK, QString("Using XvMC version: %1.%2").
- arg(mc_version).arg(mc_release));
- return disp;
-}
-
-int XvMCSurfaceTypes::find(int pminWidth, int pminHeight,
- int chroma, bool vld, bool idct, int mpeg,
- int pminSubpictureWidth,
- int pminSubpictureHeight)
-{
- if (0 == surfaces || 0 == num)
- return -1;
-
- for (int s = 0; s < size(); s++)
- {
- if (pminWidth > maxWidth(s))
- continue;
- if (pminHeight > maxHeight(s))
- continue;
- if (chroma!=surfaces[s].chroma_format)
- continue;
- if (idct && !hasIDCTAcceleration(s))
- continue;
- if (!idct && hasIDCTAcceleration(s))
- continue;
- if (vld && !hasVLDAcceleration(s))
- continue;
- if (!vld && hasVLDAcceleration(s))
- continue;
- if (1 == mpeg && !hasMPEG1Support(s))
- continue;
- if (2 == mpeg && !hasMPEG2Support(s))
- continue;
- if (3 == mpeg && !hasH263Support(s))
- continue;
- if (4 == mpeg && !hasMPEG4Support(s))
- continue;
- if (pminSubpictureWidth > maxSubpictureWidth(s))
- continue;
- if (pminSubpictureHeight > maxSubpictureHeight(s))
- continue;
-
- return s;
- }
-
- return -1;
-}
-
-void XvMCSurfaceTypes::find(int minWidth, int minHeight,
- int chroma, bool vld, bool idct, int mpeg,
- int minSubpictureWidth,
- int minSubpictureHeight,
- MythXDisplay *dpy, XvPortID portMin,
- XvPortID portMax, XvPortID& port,
- int& surfNum)
-{
- VERBOSE(VB_PLAYBACK,
- QString("XvMCSurfaceTypes::find(w %1, h %2, chroma %3, vld %4, idct %5,"
- " mpeg%6, sub-width %7, sub-height %8, disp, %9")
- .arg(minWidth).arg(minHeight).arg(chroma)
- .arg(vld).arg(idct).arg(mpeg)
- .arg(minSubpictureWidth).arg(minSubpictureHeight)
- .arg(QString("p<= %9, %10 <=p, port, surfNum)")
- .arg(portMin).arg(portMax)));
-
- port = 0;
- surfNum = -1;
- for (XvPortID p = portMin; p <= portMax; p++)
- {
- VERBOSE(VB_PLAYBACK, QString("Trying XvMC port %1").arg(p));
- XvMCSurfaceTypes surf(dpy, p);
- int s = surf.find(minWidth, minHeight, chroma, vld, idct, mpeg,
- minSubpictureWidth, minSubpictureHeight);
- if (s >= 0)
- {
- VERBOSE(VB_PLAYBACK, QString("Found a suitable XvMC surface %1")
- .arg(s));
- port = p;
- surfNum = s;
- return;
- }
- }
-}
-
-bool XvMCSurfaceTypes::has(MythXDisplay *pdisp,
- XvMCAccelID accel_type,
- uint stream_type,
- int chroma,
- uint width, uint height,
- uint osd_width, uint osd_height)
-{
- MythXDisplay* disp = pdisp;
- if (!pdisp)
- disp = createXvMCDisplay();
- if (!disp)
- return false;
-
- //VERBOSE(VB_IMPORTANT, "\n\n\n" << XvMCDescription(disp) << "\n\n\n");
-
- XvAdaptorInfo *ai = 0;
- unsigned int p_num_adaptors = 0;
-
- int ret = Success;
- XLOCK(disp, ret = XvQueryAdaptors(disp->GetDisplay(), disp->GetRoot(),
- &p_num_adaptors, &ai));
-
- if (ret != Success)
- {
- VERBOSE(VB_IMPORTANT, "XvQueryAdaptors failed.");
- if (!pdisp)
- delete disp;
- return false;
- }
-
- if (!ai)
- {
- if (!pdisp)
- delete disp;
- return false; // huh? no xv capable video adaptors?
- }
-
- for (unsigned int i = 0; i < p_num_adaptors; i++)
- {
- XvPortID p = 0;
- int s;
- if (ai[i].type == 0)
- continue;
- XvMCSurfaceTypes::find(width, height, chroma,
- XvVLD == accel_type, XvIDCT == accel_type,
- stream_type, osd_width, osd_height,
- disp, ai[i].base_id,
- ai[i].base_id + ai[i].num_ports - 1,
- p, s);
- if (0 != p)
- {
- if (p_num_adaptors > 0)
- XLOCK(disp, XvFreeAdaptorInfo(ai));
- if (!pdisp)
- delete disp;
- return true;
- }
- }
-
- if (p_num_adaptors > 0)
- XLOCK(disp, XvFreeAdaptorInfo(ai));
- if (!pdisp)
- delete disp;
-
- return false;
-}
-
-QString XvImageFormatToString(const XvImageFormatValues &fmt)
-{
- QString id = QString("0x%1").arg(fmt.id,0,16);
- id = (fmt.id == GUID_IA44_PACKED) ? "IA44" : id;
- id = (fmt.id == GUID_AI44_PACKED) ? "AI44" : id;
-
- QString type = "UNK";
- type = (XvRGB == fmt.type) ? "RGB" : type;
- type = (XvYUV == fmt.type) ? "YUV" : type;
-
- QString byte_order = "UNK";
- byte_order = (LSBFirst == fmt.type) ? "LSB" : byte_order;
- byte_order = (MSBFirst == fmt.type) ? "MSB" : byte_order;
-
- QString guid = "";
- for (uint i = 0; i < 16; i++)
- {
- guid += QString("%1%2")
- .arg((fmt.guid[i] / 16) & 0xf, 0, 16)
- .arg(fmt.guid[i] & 0xf, 0, 16);
- }
-
- QString format = "unknown";
- format = (XvPacked == fmt.format) ? "packed" : format;
- format = (XvPlanar == fmt.format) ? "planar" : format;
-
- QString addl = "";
- if (XvYUV == fmt.type)
- {
- addl = "\n\t\t\tYUV ";
- addl += QString("bits: %1,%2,%3 ").arg(fmt.y_sample_bits)
- .arg(fmt.u_sample_bits).arg(fmt.v_sample_bits);
- addl += QString("horz: %1,%2,%3 ").arg(fmt.horz_y_period)
- .arg(fmt.horz_u_period).arg(fmt.horz_v_period);
- addl += QString("vert: %1,%2,%3 ").arg(fmt.vert_y_period)
- .arg(fmt.vert_u_period).arg(fmt.vert_v_period);
-
- QString slo = "unknown";
- slo = (fmt.scanline_order == XvTopToBottom) ? "top->bot" : slo;
- slo = (fmt.scanline_order == XvBottomToTop) ? "bot->top" : slo;
-
- addl += QString("scan order: %1").arg(slo);
-
- //char component_order[32]; /* eg. UYVY */
- }
-
- return QString("id: %1 type: %2 order: %3 fmt: %4 bbp: %5"
- "%7")
- //"\n\t\t\tguid: %6 %7")
- .arg(id).arg(type).arg(byte_order).arg(format)
- .arg(fmt.bits_per_pixel)
- //.arg(guid)
- .arg(addl);
-}
-
-
-QString XvMCSurfaceTypes::toString(MythXDisplay *pdisp, XvPortID p) const
-{
- ostringstream os;
- for (int j = 0; j < size(); j++)
- {
- QString chroma = "unknown";
- chroma = hasChroma420(j) ? "420" : chroma;
- chroma = hasChroma422(j) ? "422" : chroma;
- chroma = hasChroma444(j) ? "444" : chroma;
-
- QString accel = "";
- accel += hasMotionCompensationAcceleration(j)?"MC, " : "";
- accel += hasIDCTAcceleration(j) ? "IDCT, " : "";
- accel += hasVLDAcceleration(j) ? "VLD, " : "";
- accel += hasMPEG1Support(j) ? "MPEG1, " : "";
- accel += hasMPEG2Support(j) ? "MPEG2, " : "";
- accel += hasMPEG4Support(j) ? "MPEG4-1, " : "";
- accel += hasH263Support(j) ? "MPEG1-AVC, " : "";
-
- bool backend = hasBackendSubpicture(j);
- bool overlay = hasOverlay(j);
- bool indep = hasSubpictureScaling(j);
- bool intrau = isIntraUnsigned(j);
- bool copytop = hasCopyToPBuffer(j);
- QString flags = QString("0x%1 ")
- .arg(surfaces[j].flags,0,16);
- flags += (backend) ? "backend" : "blend";
- flags += (overlay) ? ", overlay" : "";
- flags += (indep) ? ", independent_scaling" : "";
- flags += (intrau) ? ", intra_unsigned" : ", intra_signed";
- flags += (copytop) ? ", copy_to_pbuf" : "";
-
- os<<"\t\t"
- << (QString("type_id: 0x%1").arg(surfaceTypeID(j)))
- .toLocal8Bit().constData()
- <<" chroma: "<< chroma.toLocal8Bit().constData()
- <<" max_size: "
- <<maxWidth(j)<<"x"<<maxHeight(j)
- <<" sub_max_size: "
- <<maxSubpictureWidth(j)<<"x"
- <<maxSubpictureHeight(j)
- <<endl<<"\t\t"
- <<"accel: "<< accel.toLocal8Bit().constData()
- <<" flags: "<< flags.toLocal8Bit().constData()<<endl;
-
- if (pdisp && p)
- {
- int num = 0;
- XvImageFormatValues *xvfmv = NULL;
- XLOCK(pdisp, xvfmv = XvMCListSubpictureTypes(pdisp->GetDisplay(),
- p,surfaceTypeID(j), &num));
- for (int k = (xvfmv) ? 0 : num; k < num; k++)
- os << "\t\t\t"
- << XvImageFormatToString(xvfmv[k]).toLocal8Bit().constData()
- << endl;
-
- if (xvfmv)
- XLOCK(pdisp, XFree(xvfmv));
- }
- }
- if (size())
- os<<endl;
-
- return QString(os.str().c_str());
-}
-
-QString XvMCSurfaceTypes::XvMCDescription(MythXDisplay *pdisp)
-{
- MythXDisplay* disp = pdisp;
- if (!pdisp)
- disp = createXvMCDisplay();
- if (!disp)
- return QString::null;
-
- Display *d = disp->GetDisplay();
- XvAdaptorInfo *ai = 0;
- unsigned int p_num_adaptors = 0;
-
- int ret = Success;
- XLOCK(disp, ret = XvQueryAdaptors(d, disp->GetRoot(),
- &p_num_adaptors, &ai));
-
- if (ret != Success)
- {
- if (!pdisp)
- delete disp;
- return "XvQueryAdaptors failed.";
- }
-
- if (!ai)
- {
- if (!pdisp)
- delete disp;
- return "No XVideo Capable Adaptors.";
- }
-
- ostringstream os;
- for (uint i = 0; i < p_num_adaptors; i++)
- {
- QString type = "";
- type += (ai[i].type & XvInputMask) ? "input, " : "";
- type += (ai[i].type & XvOutputMask) ? "output, " : "";
- type += (ai[i].type & XvImageMask) ? "image, " : "";
-
- os<< (QString("Adaptor #%1 ").arg(i)).toLocal8Bit().constData()
- << (QString("name: %1 base_id: %2 num_ports: %3 type: %4"
- "num_fmt: %5")
- .arg(ai[i].name).arg(ai[i].base_id)
- .arg(ai[i].num_ports).arg(type)
- .arg(ai[i].num_formats)).toLocal8Bit().constData()<<endl;
-
- for (uint j = 0; j < ai[i].num_formats; j++)
- {
- XvFormat &fmt = ai[i].formats[j];
- os << (QString("\tFormat #%1 ").arg(j,2) +
- QString("depth: %1 ").arg((int)fmt.depth,2) +
- QString("visual id: 0x%1").arg(fmt.visual_id,0,16))
- .toLocal8Bit().constData()
- << endl;
- }
- os<<endl;
-
- XvPortID portMin = ai[i].base_id;
- XvPortID portMax = ai[i].base_id + ai[i].num_ports - 1;
- for (XvPortID p = portMin; p <= portMax; p++)
- {
- XvMCSurfaceTypes surf(pdisp, p);
- os<<"\tPort #"<<p<<" size: "<<surf.size()<<endl;
- os<< surf.toString(pdisp, p).toLocal8Bit().constData();
- }
- os<<endl<<endl;
- }
-
- if (p_num_adaptors > 0)
- XLOCK(disp, XvFreeAdaptorInfo(ai));
- if (!pdisp)
- delete disp;
-
- return QString(os.str().c_str());
-}
-
-#endif // USING_XVMC
View
211 mythtv/libs/libmythtv/XvMCSurfaceTypes.h
@@ -1,211 +0,0 @@
-// -*- Mode: c++ -*-
-#ifndef XVMC_SURFACE_TYPES_H_
-#define XVMC_SURFACE_TYPES_H_
-
-#ifdef USING_XVMC
-
-#include <ostream>
-using namespace std;
-
-#include <QString>
-
-#include <qwindowdefs.h>
-#include "mythcontext.h"
-#include <X11/Xlib.h>
-#include <X11/extensions/XvMC.h>
-#include <X11/extensions/XvMClib.h>
-#include "mythxdisplay.h"
-#include "fourcc.h"
-
-extern "C" {
-#include "libavcodec/xvmc.h"
-}
-
-#ifndef XVMC_VLD
-#define XVMC_VLD 0x0020000
-#endif
-
-// This is for an nVidia only feature
-#define XVMC_COPY_TO_PBUFFER 0x00000010
-extern "C" {
-Status
-XvMCCopySurfaceToGLXPbuffer (
- MythXDisplay *display,
- XvMCSurface *surface,
- XID pbuffer_id,
- short src_x, // in X11 coords
- short src_y, // in X11 coords
- unsigned short width,
- unsigned short height,
- short dst_x, // in open gl coords
- short dst_y, // in open gl coords
- unsigned int gl_buffer, // GL_FRONT_LEFT, GL_BACK_LEFT, GL_FRONT_RIGHT, etc
- int flags
-);
-}
-
-typedef enum { XvVLD, XvIDCT, XvMC } XvMCAccelID;
-
-QString XvImageFormatToString(const XvImageFormatValues &fmt);
-
-class XvMCSurfaceTypes
-{
- public:
- XvMCSurfaceTypes(MythXDisplay *dpy, XvPortID port) : num(0), disp(dpy)
- {
- XLOCK(disp, surfaces = XvMCListSurfaceTypes(disp->GetDisplay(),
- port, &num));
- }
-
- ~XvMCSurfaceTypes()
- {
- XLOCK(disp, XFree(surfaces));
- }
-
- /// Find an appropriate surface on the current port.
- inline int find(int pminWidth, int pminHeight, int chroma, bool vld,
- bool idct, int mpeg, int pminSubpictureWidth,
- int pminSubpictureHeight);
-
- bool hasChroma420(int surface) const
- {
- return XVMC_CHROMA_FORMAT_420 == surfaces[surface].chroma_format;
- }
-
- bool hasChroma422(int surface) const
- {
- return XVMC_CHROMA_FORMAT_422 == surfaces[surface].chroma_format;
- }
-
- bool hasChroma444(int surface) const
- {
- return XVMC_CHROMA_FORMAT_444 == surfaces[surface].chroma_format;
- }
-
- bool hasOverlay(int surface) const
- {
- return surfaces[surface].flags & XVMC_OVERLAID_SURFACE;
- }
-
- bool hasBackendSubpicture(int surface) const
- {
- return surfaces[surface].flags & XVMC_BACKEND_SUBPICTURE;
- }
-
- bool hasSubpictureScaling(int surface) const
- {
- return surfaces[surface].flags & XVMC_SUBPICTURE_INDEPENDENT_SCALING;
- }
-
- // Format for motion compensation acceleration
- bool isIntraUnsigned(int surface) const
- {
- return surfaces[surface].flags & XVMC_INTRA_UNSIGNED;
- }
-
- bool hasCopyToPBuffer(int surface) const
- {
-#ifdef USING_XVMC_PBUFFER
- (void) surface;
- return true;
-#else
- return surfaces[surface].flags & XVMC_COPY_TO_PBUFFER;
-#endif
- }
-
- bool hasMotionCompensationAcceleration(int surface) const
- {
- // This line below is not a bug, XVMC_MOCOMP is defined
- // as a zero in the XVMC_IDCT flag locatation
- return XVMC_MOCOMP == (surfaces[surface].mc_type & XVMC_IDCT);
- }
-
- bool hasIDCTAcceleration(int surface) const
- {
- return XVMC_IDCT == (surfaces[surface].mc_type & XVMC_IDCT);
- }
-
- bool hasVLDAcceleration(int surface) const
- {
- return XVMC_VLD == (surfaces[surface].mc_type & XVMC_VLD);
- }
-
- bool hasMPEG1Support(int surface) const
- {
- return XVMC_MPEG_1 == (surfaces[surface].mc_type & 0x7);
- }
-
- bool hasMPEG2Support(int surface) const
- {
- return XVMC_MPEG_2 == (surfaces[surface].mc_type & 0x7);
- }
-
- bool hasH263Support(int surface) const
- {
- return XVMC_H263 == (surfaces[surface].mc_type & 0x7);
- }
-
- bool hasMPEG4Support(int surface) const
- {
- return XVMC_MPEG_4 == (surfaces[surface].mc_type & 0x7);
- }
-
- int surfaceTypeID(int surface) const
- {
- return surfaces[surface].surface_type_id;
- }
-
- unsigned short maxWidth(int surface) const
- {
- return surfaces[surface].max_width;
- }
-
- unsigned short maxHeight(int surface) const
- {
- return surfaces[surface].max_height;
- }
-
- unsigned short maxSubpictureWidth(int surface) const
- {
- return surfaces[surface].subpicture_max_width;
- }
-
- unsigned short maxSubpictureHeight(int surface) const
- {
- return surfaces[surface].subpicture_max_height;
- }
-
- void set(int surface, XvMCSurfaceInfo* surfinfo) const
- {
- memcpy(surfinfo, &surfaces[surface], sizeof(XvMCSurfaceInfo));
- }
-
- int size() const { return num; }
-
- /// Find an appropriate surface on the current display.
- static void find(int minWidth, int minHeight, int chroma, bool vld,
- bool idct, int mpeg, int minSubpictureWidth,
- int minSubpictureHeight, MythXDisplay *dpy,
- XvPortID portMin, XvPortID portMax,
- XvPortID& port, int& surfNum);
-
- /// Find out if there is a surface on any port capable of a
- /// specific acceleration type.
- static bool has(MythXDisplay *pdisp,
- XvMCAccelID accel_type, uint stream_type, int chroma,
- uint width, uint height, uint osd_width, uint osd_height);
-
- static QString XvMCDescription(MythXDisplay *pdisp = NULL);
- QString toString(MythXDisplay *pdisp = NULL, XvPortID p = 0) const;
- ostream& operator<<(ostream& os) const
- { return os << toString().toLocal8Bit().constData(); }
-
- private:
- int num;
- XvMCSurfaceInfo *surfaces;
- MythXDisplay *disp;
-};
-
-#endif // USING_XVMC
-
-#endif // XVMC_SURFACE_TYPES_H_
View
224 mythtv/libs/libmythtv/avformatdecoder.cpp
@@ -40,13 +40,6 @@ using namespace std;
#include "videoout_quartz.h" // For VOQ::GetBestSupportedCodec()
-#ifdef USING_XVMC
-#include "videoout_xv.h"
-extern "C" {
-#include "libavcodec/xvmc.h"
-}
-#endif // USING_XVMC
-
#ifdef USING_VDPAU
#include "videoout_vdpau.h"
extern "C" {
@@ -116,14 +109,9 @@ static float get_aspect(const AVCodecContext &ctx)
return aspect_ratio;
}
-int get_avf_buffer_xvmc(struct AVCodecContext *c, AVFrame *pic);
-int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic);
+int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic);
void release_avf_buffer(struct AVCodecContext *c, AVFrame *pic);
-void release_avf_buffer_xvmc(struct AVCodecContext *c, AVFrame *pic);
-void render_slice_xvmc(struct AVCodecContext *s, const AVFrame *src,
- int offset[4], int y, int type, int height);
-
-int get_avf_buffer_vdpau(struct AVCodecContext *c, AVFrame *pic);
+int get_avf_buffer_vdpau(struct AVCodecContext *c, AVFrame *pic);
void release_avf_buffer_vdpau(struct AVCodecContext *c, AVFrame *pic);
void render_slice_vdpau(struct AVCodecContext *s, const AVFrame *src,
int offset[4], int y, int type, int height);
@@ -228,13 +216,6 @@ void AvFormatDecoder::GetDecoders(render_opts &opts)
(*opts.equiv_decoders)["ffmpeg"].append("nuppel");
(*opts.equiv_decoders)["ffmpeg"].append("dummy");
-#ifdef USING_XVMC
- opts.decoders->append("xvmc");
- opts.decoders->append("xvmc-vld");
- (*opts.equiv_decoders)["xvmc"].append("dummy");
- (*opts.equiv_decoders)["xvmc-vld"].append("dummy");
-#endif
-
#ifdef USING_VDPAU
opts.decoders->append("vdpau");
(*opts.equiv_decoders)["vdpau"].append("dummy");
@@ -287,8 +268,6 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
internal_vol(false),
disable_passthru(false),
dummy_frame(NULL),
- // DVD
- dvd_xvmc_enabled(false), dvd_video_codec_changed(false),
m_fps(0.0f)
{
bzero(&params, sizeof(AVFormatParameters));
@@ -1107,19 +1086,6 @@ float AvFormatDecoder::normalized_fps(AVStream *stream, AVCodecContext *enc)
return fps;
}
-static bool IS_XVMC_VLD_PIX_FMT(enum PixelFormat fmt)
-{
- return
- fmt == PIX_FMT_XVMC_MPEG2_VLD;
-}
-
-static bool IS_XVMC_PIX_FMT(enum PixelFormat fmt)
-{
- return
- fmt == PIX_FMT_XVMC_MPEG2_MC ||
- fmt == PIX_FMT_XVMC_MPEG2_IDCT;
-}
-
static bool IS_VDPAU_PIX_FMT(enum PixelFormat fmt)
{
return
@@ -1131,30 +1097,6 @@ static bool IS_VDPAU_PIX_FMT(enum PixelFormat fmt)
fmt == PIX_FMT_VDPAU_VC1;
}
-static enum PixelFormat get_format_xvmc_vld(struct AVCodecContext *avctx,
- const enum PixelFormat *fmt)
-{
- int i = 0;
-
- for(i=0; fmt[i]!=PIX_FMT_NONE; i++)
- if (IS_XVMC_VLD_PIX_FMT(fmt[i]))
- break;
-
- return fmt[i];
-}
-
-static enum PixelFormat get_format_xvmc(struct AVCodecContext *avctx,
- const enum PixelFormat *fmt)
-{
- int i = 0;
-
- for(i=0; fmt[i]!=PIX_FMT_NONE; i++)
- if (IS_XVMC_PIX_FMT(fmt[i]))
- break;
-
- return fmt[i];
-}
-
static enum PixelFormat get_format_vdpau(struct AVCodecContext *avctx,
const enum PixelFormat *fmt)
{
@@ -1251,17 +1193,7 @@ void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,
}
}
- if (CODEC_IS_XVMC(codec))
- {
- enc->flags |= CODEC_FLAG_EMU_EDGE;
- enc->get_buffer = get_avf_buffer_xvmc;
- enc->get_format = (codec->id == CODEC_ID_MPEG2VIDEO_XVMC) ?
- get_format_xvmc : get_format_xvmc_vld;
- enc->release_buffer = release_avf_buffer_xvmc;
- enc->draw_horiz_band = render_slice_xvmc;
- enc->slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD;
- }
- else if (CODEC_IS_VDPAU(codec))
+ if (CODEC_IS_VDPAU(codec))
{
enc->get_buffer = get_avf_buffer_vdpau;
enc->get_format = get_format_vdpau;
@@ -1338,7 +1270,7 @@ void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,
m_parent->SetVideoParams(width, height, fps,
keyframedist, aspect, kScan_Detect,
- dvd_video_codec_changed);
+ false);
if (LCD *lcd = LCD::Get())
{
LCDVideoFormatSet video_format;
@@ -1376,24 +1308,6 @@ void AvFormatDecoder::InitVideoCodec(AVStream *stream, AVCodecContext *enc,
}
}
-#ifdef USING_XVMC
-static int xvmc_pixel_format(enum PixelFormat pix_fmt)
-{
- int xvmc_chroma = XVMC_CHROMA_FORMAT_420;
-
-#if 0
-// We don't support other chromas yet
- if (PIX_FMT_YUV420P == pix_fmt)
- xvmc_chroma = XVMC_CHROMA_FORMAT_420;
- else if (PIX_FMT_YUV422P == pix_fmt)
- xvmc_chroma = XVMC_CHROMA_FORMAT_422;
- else if (PIX_FMT_YUV420P == pix_fmt)
- xvmc_chroma = XVMC_CHROMA_FORMAT_444;
-#endif
- return xvmc_chroma;
-}
-#endif // USING_XVMC
-
// CC Parity checking
// taken from xine-lib libspucc
@@ -1791,7 +1705,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
bool handled = false;
if (!using_null_videoout && mpeg_version(enc->codec_id))
{
-#if defined(USING_VDPAU) || defined(USING_XVMC)
+#if defined(USING_VDPAU)
// HACK -- begin
// Force MPEG2 decoder on MPEG1 streams.
// Needed for broken transmitters which mark
@@ -1800,7 +1714,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
if (CODEC_ID_MPEG1VIDEO == enc->codec_id)
enc->codec_id = CODEC_ID_MPEG2VIDEO;
// HACK -- end
-#endif // USING_XVMC || USING_VDPAU
+#endif // USING_VDPAU
#ifdef USING_VDPAU
MythCodecID vdpau_mcid;
vdpau_mcid = VideoOutputVDPAU::GetBestSupportedCodec(
@@ -1814,55 +1728,6 @@ int AvFormatDecoder::ScanStreams(bool novideo)
handled = true;
}
#endif // USING_VDPAU
-#ifdef USING_XVMC
-
- bool force_xv = no_hardware_decoders;
- if (ringBuffer && ringBuffer->IsDVD())
- {
- if (dec.left(4) == "xvmc")
- dvd_xvmc_enabled = true;
-
- if (ringBuffer->IsInDiscMenuOrStillFrame() &&
- dvd_xvmc_enabled)
- {
- force_xv = true;
- enc->pix_fmt = PIX_FMT_YUV420P;
- }
- }
-
- MythCodecID mcid;
- mcid = VideoOutputXv::GetBestSupportedCodec(
- /* disp dim */ width, height,
- /* osd dim */ /*enc->width*/ 0, /*enc->height*/ 0,
- /* mpeg type */ mpeg_version(enc->codec_id),
- /* xvmc pix fmt */ xvmc_pixel_format(enc->pix_fmt),
- /* test surface */ codec_is_std(video_codec_id),
- /* force_xv */ force_xv);
-
- if (mcid >= video_codec_id)
- {
- bool vcd, idct, mc, vdpau;
- enc->codec_id = (CodecID)
- myth2av_codecid(mcid, vcd, idct, mc, vdpau);
-
- if (ringBuffer && ringBuffer->IsDVD() &&
- (mcid == video_codec_id) &&
- dvd_video_codec_changed)
- {
- dvd_video_codec_changed = false;
- dvd_xvmc_enabled = false;
- }
-
- video_codec_id = mcid;
- if (!force_xv && codec_is_xvmc_std(mcid))
- {
- enc->pix_fmt = (idct) ?
- PIX_FMT_XVMC_MPEG2_IDCT :
- PIX_FMT_XVMC_MPEG2_MC;
- }
- handled = true;
- }
-#endif // USING_XVMC
}
if (!handled)
@@ -2390,83 +2255,6 @@ void release_avf_buffer(struct AVCodecContext *c, AVFrame *pic)
pic->data[i] = NULL;
}
-int get_avf_buffer_xvmc(struct AVCodecContext *c, AVFrame *pic)
-{
- AvFormatDecoder *nd = (AvFormatDecoder *)(c->opaque);
- VideoFrame *frame = nd->GetPlayer()->GetNextVideoFrame(false);
-
- pic->data[0] = frame->priv[0];
- pic->data[1] = frame->priv[1];
- pic->data[2] = frame->buf;
-
- pic->linesize[0] = 0;
- pic->linesize[1] = 0;
- pic->linesize[2] = 0;
-
- pic->opaque = frame;
- pic->type = FF_BUFFER_TYPE_USER;
-
- pic->age = 256 * 256 * 256 * 64;
-
-#ifdef USING_XVMC
- struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt *)frame->buf;
-
- render->state = AV_XVMC_STATE_PREDICTION;
- render->picture_structure = 0;
- render->flags = 0;
- render->start_mv_blocks_num = 0;
- render->filled_mv_blocks_num = 0;
- render->next_free_data_block_num = 0;
-#endif
-
- pic->reordered_opaque = c->reordered_opaque;
-
- return 0;
-}
-
-void release_avf_buffer_xvmc(struct AVCodecContext *c, AVFrame *pic)
-{
- assert(pic->type == FF_BUFFER_TYPE_USER);
-
-#ifdef USING_XVMC
- struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt *)pic->data[2];
- render->state &= ~AV_XVMC_STATE_PREDICTION;
-#endif
-
- AvFormatDecoder *nd = (AvFormatDecoder *)(c->opaque);
- if (nd && nd->GetPlayer() && nd->GetPlayer()->getVideoOutput())
- nd->GetPlayer()->getVideoOutput()->DeLimboFrame((VideoFrame*)pic->opaque);
-
- for (uint i = 0; i < 4; i++)
- pic->data[i] = NULL;
-
-}
-
-void render_slice_xvmc(struct AVCodecContext *s, const AVFrame *src,
- int offset[4], int y, int type, int height)
-{
- if (!src)
- return;
-
- (void)offset;
- (void)type;
-
- if (s && src && s->opaque && src->opaque)
- {
- AvFormatDecoder *nd = (AvFormatDecoder *)(s->opaque);
-
- int width = s->width;
-
- VideoFrame *frame = (VideoFrame *)src->opaque;
- nd->GetPlayer()->DrawSlice(frame, 0, y, width, height);
- }
- else
- {
- VERBOSE(VB_IMPORTANT, LOC +
- "render_slice_xvmc called with bad avctx or src");
- }
-}
-
int get_avf_buffer_vdpau(struct AVCodecContext *c, AVFrame *pic)
{
AvFormatDecoder *nd = (AvFormatDecoder *)(c->opaque);
View
9 mythtv/libs/libmythtv/avformatdecoder.h
@@ -182,11 +182,6 @@ class AvFormatDecoder : public DecoderBase
friend int get_avf_buffer(struct AVCodecContext *c, AVFrame *pic);
friend void release_avf_buffer(struct AVCodecContext *c, AVFrame *pic);
- friend int get_avf_buffer_xvmc(struct AVCodecContext *c, AVFrame *pic);
- friend void release_avf_buffer_xvmc(struct AVCodecContext *c, AVFrame *pic);
- friend void render_slice_xvmc(struct AVCodecContext *c, const AVFrame *src,
- int offset[4], int y, int type, int height);
-
friend int open_avf(URLContext *h, const char *filename, int flags);
friend int read_avf(URLContext *h, uint8_t *buf, int buf_size);
friend int write_avf(URLContext *h, uint8_t *buf, int buf_size);
@@ -330,10 +325,6 @@ class AvFormatDecoder : public DecoderBase
AudioInfo audioIn;
AudioInfo audioOut;
- // DVD
- bool dvd_xvmc_enabled;
- bool dvd_video_codec_changed;
-
float m_fps;
};
View
12 mythtv/libs/libmythtv/libmythtv.pro
@@ -324,19 +324,11 @@ using_frontend {
using_x11:DEFINES += USING_X11
- using_xv:HEADERS += videoout_xv.h XvMCSurfaceTypes.h
- using_xv:HEADERS += osdxvmc.h osdchromakey.h
- using_xv:HEADERS += util-xvmc.h util-xv.h
- using_xv:SOURCES += videoout_xv.cpp XvMCSurfaceTypes.cpp
- using_xv:SOURCES += osdxvmc.cpp osdchromakey.cpp
- using_xv:SOURCES += util-xvmc.cpp util-xv.cpp
+ using_xv:HEADERS += videoout_xv.h util-xv.h osdchromakey.h
+ using_xv:SOURCES += videoout_xv.cpp util-xv.cpp osdchromakey.cpp
using_xv:DEFINES += USING_XV
- using_xvmc:DEFINES += USING_XVMC
- using_xvmcw:DEFINES += USING_XVMCW
- using_xvmc_vld:DEFINES += USING_XVMC_VLD
-
using_vdpau {
DEFINES += USING_VDPAU
HEADERS += videoout_vdpau.h
View
114 mythtv/libs/libmythtv/mythcodecid.cpp
@@ -33,39 +33,6 @@ QString toString(MythCodecID codecid)
case kCodec_WMV3:
return "WMV3";
- case kCodec_MPEG1_XVMC:
- return "MPEG1 XvMC";
- case kCodec_MPEG2_XVMC:
- return "MPEG2 XvMC";
- case kCodec_H263_XVMC:
- return "H.263 XvMC";
- case kCodec_MPEG4_XVMC:
- return "MPEG4 XvMC";
- case kCodec_H264_XVMC:
- return "H.264 XvMC";
-
- case kCodec_MPEG1_IDCT:
- return "MPEG1 IDCT";
- case kCodec_MPEG2_IDCT:
- return "MPEG2 IDCT";
- case kCodec_H263_IDCT:
- return "H.263 IDCT";
- case kCodec_MPEG4_IDCT:
- return "MPEG4 IDCT";
- case kCodec_H264_IDCT:
- return "H.264 IDCT";
-
- case kCodec_MPEG1_VLD:
- return "MPEG1 VLD";
- case kCodec_MPEG2_VLD:
- return "MPEG2 VLD";
- case kCodec_H263_VLD:
- return "H.263 VLD";
- case kCodec_MPEG4_VLD:
- return "MPEG4 VLD";
- case kCodec_H264_VLD:
- return "H.264 VLD";
-
case kCodec_MPEG1_VDPAU:
return "MPEG1 VDPAU";
case kCodec_MPEG2_VDPAU:
@@ -118,10 +85,9 @@ QString toString(MythCodecID codecid)
return QString("Unknown(%1)").arg(codecid);
}
-int myth2av_codecid(MythCodecID codec_id,
- bool &vld, bool &idct, bool &mc, bool &vdpau)
+int myth2av_codecid(MythCodecID codec_id, bool &vdpau)
{
- vld = idct = mc = vdpau = false;
+ vdpau = false;
CodecID ret = CODEC_ID_NONE;
switch (codec_id)
{
@@ -154,57 +120,6 @@ int myth2av_codecid(MythCodecID codec_id,
ret = CODEC_ID_WMV3;
break;
- case kCodec_MPEG1_XVMC:
- case kCodec_MPEG2_XVMC:
- mc = true;
- ret = CODEC_ID_MPEG2VIDEO_XVMC;
- break;
- case kCodec_H263_XVMC:
- VERBOSE(VB_IMPORTANT, "Error: XvMC H.263 not supported by ffmpeg");
- break;
- case kCodec_MPEG4_XVMC:
- VERBOSE(VB_IMPORTANT, "Error: XvMC MPEG4 not supported by ffmpeg");
- break;
- case kCodec_H264_XVMC:
- VERBOSE(VB_IMPORTANT, "Error: XvMC H.264 not supported by ffmpeg");
- break;
-
- case kCodec_MPEG1_IDCT:
- case kCodec_MPEG2_IDCT:
- idct = mc = true;
- ret = CODEC_ID_MPEG2VIDEO_XVMC;
- break;
- case kCodec_H263_IDCT:
- VERBOSE(VB_IMPORTANT,
- "Error: XvMC-IDCT H.263 not supported by ffmpeg");
- break;
- case kCodec_MPEG4_IDCT:
- VERBOSE(VB_IMPORTANT,
- "Error: XvMC-IDCT MPEG4 not supported by ffmpeg");
- break;
- case kCodec_H264_IDCT:
- VERBOSE(VB_IMPORTANT,
- "Error: XvMC-IDCT H.264 not supported by ffmpeg");
- break;
-
- case kCodec_MPEG1_VLD:
- case kCodec_MPEG2_VLD:
- vld = true;
- ret = CODEC_ID_MPEG2VIDEO_XVMC_VLD;
- break;
- case kCodec_H263_VLD:
- VERBOSE(VB_IMPORTANT,
- "Error: XvMC-VLD H.263 not supported by ffmpeg");
- break;
- case kCodec_MPEG4_VLD:
- VERBOSE(VB_IMPORTANT,
- "Error: XvMC-VLD MPEG4 not supported by ffmpeg");
- break;
- case kCodec_H264_VLD:
- VERBOSE(VB_IMPORTANT,
- "Error: XvMC-VLD H.264 not supported by ffmpeg");
- break;
-
case kCodec_MPEG1_VDPAU:
ret = CODEC_ID_MPEG1VIDEO;
vdpau = true;
@@ -293,8 +208,6 @@ int mpeg_version(int codec_id)
case CODEC_ID_MPEG1VIDEO:
return 1;
case CODEC_ID_MPEG2VIDEO:
- case CODEC_ID_MPEG2VIDEO_XVMC:
- case CODEC_ID_MPEG2VIDEO_XVMC_VLD:
return 2;
case CODEC_ID_H263:
return 3;
@@ -320,25 +233,16 @@ QString get_encoding_type(MythCodecID codecid)
return "RTjpeg";
case kCodec_MPEG1:
- case kCodec_MPEG1_XVMC:
- case kCodec_MPEG1_IDCT:
- case kCodec_MPEG1_VLD:
case kCodec_MPEG1_VDPAU:
case kCodec_MPEG1_VAAPI:
case kCodec_MPEG1_DXVA2:
case kCodec_MPEG2:
- case kCodec_MPEG2_XVMC:
- case kCodec_MPEG2_IDCT:
- case kCodec_MPEG2_VLD:
case kCodec_MPEG2_VDPAU:
case kCodec_MPEG2_VAAPI:
case kCodec_MPEG2_DXVA2:
return "MPEG-2";
case kCodec_H263:
- case kCodec_H263_XVMC:
- case kCodec_H263_IDCT:
- case kCodec_H263_VLD:
case kCodec_H263_VDPAU:
case kCodec_H263_VAAPI:
case kCodec_H263_DXVA2:
@@ -346,18 +250,12 @@ QString get_encoding_type(MythCodecID codecid)
case kCodec_NUV_MPEG4:
case kCodec_MPEG4:
- case kCodec_MPEG4_IDCT:
- case kCodec_MPEG4_XVMC:
- case kCodec_MPEG4_VLD:
case kCodec_MPEG4_VDPAU:
case kCodec_MPEG4_VAAPI:
case kCodec_MPEG4_DXVA2:
return "MPEG-4";
case kCodec_H264:
- case kCodec_H264_XVMC:
- case kCodec_H264_IDCT:
- case kCodec_H264_VLD:
case kCodec_H264_VDPAU:
case kCodec_H264_VAAPI:
case kCodec_H264_DXVA2:
@@ -377,8 +275,6 @@ QString get_encoding_type(MythCodecID codecid)
case kCodec_NONE:
case kCodec_NORMAL_END:
- case kCodec_STD_XVMC_END:
- case kCodec_VLD_END:
case kCodec_VDPAU_END:
case kCodec_VAAPI_END:
case kCodec_DXVA2_END:
@@ -390,12 +286,6 @@ QString get_encoding_type(MythCodecID codecid)
QString get_decoder_name(MythCodecID codec_id)
{
- if (codec_is_xvmc_std(codec_id))
- return "xvmc";
-
- if (codec_is_xvmc_vld(codec_id))
- return "xvmc-vld";
-
if (codec_is_vdpau(codec_id))
return "vdpau";
View
46 mythtv/libs/libmythtv/mythcodecid.h
@@ -27,34 +27,8 @@ typedef enum
kCodec_WMV3,
kCodec_NORMAL_END,
-
- kCodec_STD_XVMC_BEGIN = kCodec_NORMAL_END,
-
- kCodec_MPEG1_XVMC,
- kCodec_MPEG2_XVMC,
- kCodec_H263_XVMC,
- kCodec_MPEG4_XVMC,
- kCodec_H264_XVMC,
-
- kCodec_MPEG1_IDCT,
- kCodec_MPEG2_IDCT,
- kCodec_H263_IDCT,
- kCodec_MPEG4_IDCT,
- kCodec_H264_IDCT,
-
- kCodec_STD_XVMC_END,
-
- kCodec_VLD_BEGIN = kCodec_STD_XVMC_END,
-
- kCodec_MPEG1_VLD,
- kCodec_MPEG2_VLD,
- kCodec_H263_VLD,
- kCodec_MPEG4_VLD,
- kCodec_H264_VLD,
-
- kCodec_VLD_END,
- kCodec_VDPAU_BEGIN = kCodec_VLD_END,
+ kCodec_VDPAU_BEGIN = kCodec_NORMAL_END,
kCodec_MPEG1_VDPAU,
kCodec_MPEG2_VDPAU,
@@ -94,12 +68,6 @@ typedef enum
// MythCodecID convenience functions
#define codec_is_std(id) (id < kCodec_NORMAL_END)
#define codec_is_std_mpeg(id) (id == kCodec_MPEG1 || id == kCodec_MPEG2)
-#define codec_is_xvmc_std(id) (id > kCodec_STD_XVMC_BEGIN) &&\
- (id < kCodec_STD_XVMC_END)
-#define codec_is_xvmc_vld(id) (id > kCodec_VLD_BEGIN) &&\
- (id < kCodec_VLD_END)
-#define codec_is_xvmc(id) (id > kCodec_STD_XVMC_BEGIN) &&\
- (id < kCodec_VLD_END)
#define codec_is_vdpau(id) (id > kCodec_VDPAU_BEGIN) &&\
(id < kCodec_VDPAU_END)
#define codec_is_vdpau_hw(id) (codec_is_vdpau(id) &&\
@@ -116,12 +84,11 @@ typedef enum
QString get_encoding_type(MythCodecID codecid);
QString get_decoder_name(MythCodecID codec_id);
QString toString(MythCodecID codecid);
-int myth2av_codecid(MythCodecID codec_id, bool &vld, bool &idct, bool &mc,
- bool &vdpau);
+int myth2av_codecid(MythCodecID codec_id, bool &vdpau);
inline int myth2av_codecid(MythCodecID codec_id)
{
- bool vld, idct, mc, vdpau;
- return myth2av_codecid(codec_id, vld, idct, mc, vdpau);
+ bool vdpau;
+ return myth2av_codecid(codec_id, vdpau);
}
// AV codec id convenience functions
@@ -129,14 +96,11 @@ int mpeg_version(int codec_id);
#define CODEC_IS_H264(id) (mpeg_version(id) == 5)
#define CODEC_IS_MPEG(id) (mpeg_version(id) && mpeg_version(id) <= 2)
#define CODEC_IS_FFMPEG_MPEG(id) (CODEC_IS_MPEG(id))
-#define CODEC_IS_XVMC(codec) (codec && (codec->id == CODEC_ID_MPEG2VIDEO_XVMC ||\
- codec->id == CODEC_ID_MPEG2VIDEO_XVMC_VLD))
#define CODEC_IS_VDPAU(codec) (codec &&\
codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
#define CODEC_IS_VAAPI(codec, enc) (codec && IS_VAAPI_PIX_FMT(enc->pix_fmt))
#define CODEC_IS_DXVA2(codec, enc) (codec && (enc->pix_fmt == PIX_FMT_DXVA2_VLD))
-#define CODEC_IS_HWACCEL(codec, enc) (CODEC_IS_XVMC(codec) ||\
- CODEC_IS_VDPAU(codec) ||\
+#define CODEC_IS_HWACCEL(codec, enc) (CODEC_IS_VDPAU(codec) ||\
CODEC_IS_VAAPI(codec, enc) ||\
CODEC_IS_DXVA2(codec, enc))
View
228 mythtv/libs/libmythtv/osdxvmc.cpp
@@ -1,228 +0,0 @@
-// Copyright (c) 2005, Daniel Thor Kristjansson
-// based on earlier work in MythTV's videout_xvmc.cpp
-
-#ifdef USING_XVMC
-
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <unistd.h>
-
-#include "osdxvmc.h"
-#include "videoout_xv.h"
-
-#define NO_SUBPICTURE 0
-#define OVERLAY_SUBPICTURE 1
-#define BLEND_SUBPICTURE 2
-#define BACKEND_SUBPICTURE 3
-
-static inline struct xvmc_pix_fmt *GetRender(VideoFrame *frame);
-
-XvMCOSD::XvMCOSD(MythXDisplay *display, int port, int surface_type_id,
- int xvmc_surf_flags) :
- disp(display), XJ_width(0),
- XJ_height(0), xv_port(port),
- osd_palette(NULL), osd_xv_image(NULL),
- osd_subpict_mode(NO_SUBPICTURE), osd_subpict_clear_color(0),
- osd_subpict_alloc(false)
-{
- bzero(&osd_subpict, sizeof(osd_subpict));
- bzero(&XJ_osd_shm_info, sizeof(XJ_osd_shm_info));
- bzero(&osd_subpict_info, sizeof(osd_subpict_info));
- bzero(&tmpframe, sizeof(tmpframe));
- // subpicture init
- int num = 0;
- XvImageFormatValues *xvfmv = NULL;
- XLOCK(disp, xvfmv = XvMCListSubpictureTypes(disp->GetDisplay(), xv_port,
- surface_type_id, &num));
-
- for (int i = (xvfmv) ? 0 : num; i < num; i++)
- {
- if (GUID_IA44_PACKED == xvfmv[i].id || GUID_AI44_PACKED == xvfmv[i].id)
- {
- osd_subpict_info = xvfmv[i];
- bool be = (XVMC_BACKEND_SUBPICTURE & xvmc_surf_flags);
- osd_subpict_mode = (be) ? BACKEND_SUBPICTURE : BLEND_SUBPICTURE;
- break;
- }
- }
-
- if (xvfmv)
- XLOCK(disp, XFree(xvfmv));
-}
-
-XvMCOSD::XvMCOSD() :
- disp(NULL), XJ_width(0),
- XJ_height(0), xv_port(-1),
- osd_palette(NULL), osd_xv_image(NULL),
- osd_subpict_mode(NO_SUBPICTURE), osd_subpict_clear_color(0),
- osd_subpict_alloc(false)
-{
- bzero(&osd_subpict, sizeof(osd_subpict));
- bzero(&XJ_osd_shm_info, sizeof(XJ_osd_shm_info));
- bzero(&osd_subpict_info, sizeof(osd_subpict_info));
- bzero(&tmpframe, sizeof(tmpframe));
-}
-
-void XvMCOSD::CreateBuffer(XvMCContext &xvmc_ctx, int width, int height)
-{
- if (NO_SUBPICTURE == osd_subpict_mode)
- {
- VERBOSE(VB_IMPORTANT, "XvMCOSD::CreateBuffer() failed because "
- "no subpicture is available");
- osd_subpict_alloc = false;
- return;
- }
-
- XJ_width = width;
- XJ_height = height;
- MythXLocker lock(disp);
- Display *d = disp->GetDisplay();
- osd_subpict_clear_color = 0;
- int ret = Success;
- ret = XvMCCreateSubpicture(d, &xvmc_ctx, &osd_subpict,
- XJ_width, XJ_height, osd_subpict_info.id);
-
- if (ret != Success)
- {
- VERBOSE(VB_IMPORTANT, "XvMCOSD::CreateBuffer() failed on XvMCCreateSubpicture");
- osd_subpict_mode = NO_SUBPICTURE;
- osd_subpict_alloc = false;
- return;
- }
-
- XvMCClearSubpicture(d, &osd_subpict, 0, 0, XJ_width,
- XJ_height, osd_subpict_clear_color);
-
- osd_xv_image = XvShmCreateImage(d, xv_port,
- osd_subpict_info.id, NULL,
- XJ_width, XJ_height,
- &XJ_osd_shm_info);
-
- if (!osd_xv_image)
- {
- VERBOSE(VB_IMPORTANT, "XvMCOSD::CreateBuffer() failed on XvShmCreateImage");
- osd_subpict_mode = NO_SUBPICTURE;
- osd_subpict_alloc = false;
- return;
- }
- XJ_osd_shm_info.shmid = shmget(IPC_PRIVATE, osd_xv_image->data_size,
- IPC_CREAT | 0777);
- XJ_osd_shm_info.shmaddr = (char *)shmat(XJ_osd_shm_info.shmid, 0, 0);
- XJ_osd_shm_info.readOnly = False;
-
- osd_xv_image->data = XJ_osd_shm_info.shmaddr;
-
- XShmAttach(d, &XJ_osd_shm_info);
-
- shmctl(XJ_osd_shm_info.shmid, IPC_RMID, 0);
-
- if (osd_subpict.num_palette_entries > 0)
- {
- int snum = osd_subpict.num_palette_entries;
- int seb = osd_subpict.entry_bytes;
-
- osd_palette = new unsigned char[snum * seb];
-
- for (int i = 0; i < snum; i++)
- {
- int Y = i * (1 << osd_subpict_info.y_sample_bits) / snum;
- int U = 1 << (osd_subpict_info.u_sample_bits - 1);
- int V = 1 << (osd_subpict_info.v_sample_bits - 1);
- for (int j = 0; j < seb; j++)
- {
- switch (osd_subpict.component_order[j])
- {
- case 'U': osd_palette[i * seb + j] = U; break;
- case 'V': osd_palette[i * seb + j] = V; break;
- case 'Y':
- default: osd_palette[i * seb + j] = Y; break;
- }
- }
- }
-
- XvMCSetSubpicturePalette(d, &osd_subpict, osd_palette);
- }
- osd_subpict_alloc = true;
-}
-
-void XvMCOSD::DeleteBuffer()
-{
- if (!osd_subpict_alloc)
- return;
-
- MythXLocker lock(disp);
- Display *d = disp->GetDisplay();
- XvMCDestroySubpicture(d, &osd_subpict);
- XShmDetach(d, &XJ_osd_shm_info);
- shmdt(XJ_osd_shm_info.shmaddr);
-
- osd_subpict_alloc = false;
- XFree(osd_xv_image);
- XFlush(d);
- usleep(50);
-
- disp->Sync();
-
- if (osd_palette)
- delete [] osd_palette;
-}
-
-void XvMCOSD::CompositeOSD(VideoFrame* frame, VideoFrame* osdframe)
-{
- if (!osd_subpict_alloc)
- return;
-
- disp->Lock();
- Display *d = disp->GetDisplay();
- XvMCCompositeSubpicture(d, &osd_subpict,
- osd_xv_image, 0, 0,
- XJ_width, XJ_height, 0, 0);
- // delay sync until after getnextfreeframe...
- XvMCFlushSubpicture(d, &osd_subpict);
-
- if (osd_subpict_mode == BLEND_SUBPICTURE && osdframe)
- {
- struct xvmc_pix_fmt *render = GetRender(frame);
- struct xvmc_pix_fmt *osdren = GetRender(osdframe);
-
- XvMCSyncSubpicture(d, &osd_subpict);
- VideoOutputXv::SyncSurface(frame);
-
- XvMCBlendSubpicture2(d, render->p_surface,
- osdren->p_surface, &osd_subpict,
- 0, 0, XJ_width, XJ_height,
- 0, 0, XJ_width, XJ_height);
- XvMCFlushSurface(d, osdren->p_surface);
- }
- else if (osd_subpict_mode == BACKEND_SUBPICTURE)
- {
- XvMCSyncSubpicture(d, &osd_subpict);
- XvMCBlendSubpicture(d, GetRender(frame)->p_surface,
- &osd_subpict, 0, 0, XJ_width,
- XJ_height, 0, 0, XJ_width, XJ_height);
- XvMCFlushSurface(d, GetRender(frame)->p_surface);
- }
- disp->Unlock();
-}
-
-bool XvMCOSD::NeedFrame() const
-{
- return osd_subpict_mode == BLEND_SUBPICTURE;
-}
-
-bool XvMCOSD::IsValid() const
-{
- return osd_subpict_mode != NO_SUBPICTURE &&
- osd_subpict_mode != OVERLAY_SUBPICTURE;
-}
-
-static inline struct xvmc_pix_fmt *GetRender(VideoFrame *frame)
-{
- if (frame)
- return (struct xvmc_pix_fmt*) frame->buf;
- else
- return NULL;
-}
-
-#endif // USING_XVMC
View
59 mythtv/libs/libmythtv/osdxvmc.h
@@ -1,59 +0,0 @@
-// -*- Mode: c++ -*-
-
-#ifdef USING_XVMC
-
-#ifndef __OSD_XVMC_H__
-#define __OSD_XVMC_H__
-
-#include "videooutbase.h"
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/XShm.h>
-#include "XvMCSurfaceTypes.h"
-#include <X11/extensions/Xvlib.h>
-#include <X11/extensions/Xv.h>
-
-class XvMCOSD
-{
- public:
- XvMCOSD(MythXDisplay *XJ_disp, int xv_port,
- int surface_type_id, int xvmc_surf_flags);
-
- void CreateBuffer(XvMCContext &xvmc_ctx, int XJ_width, int XJ_height);
- void DeleteBuffer();
- void CompositeOSD(VideoFrame* frame, VideoFrame* osdframe=NULL);
-
- VideoFrame *OSDFrame()
- {
- tmpframe.codec =
- (GUID_IA44_PACKED == osd_subpict_info.id) ? FMT_IA44 : FMT_AI44;
- tmpframe.buf = (unsigned char*) (osd_xv_image->data);
- return &tmpframe;
- }
-
- bool NeedFrame() const;
- bool IsValid() const;
-
- private:
- XvMCOSD(); // dummy, don't use
-
- public:
- // XvMC OSD info
- MythXDisplay *disp;
- int XJ_width, XJ_height;
- int xv_port;
- XShmSegmentInfo XJ_osd_shm_info;
- unsigned char *osd_palette;
- XvImage *osd_xv_image;
- XvMCSubpicture osd_subpict;
- XvImageFormatValues osd_subpict_info;
- int osd_subpict_mode;
- int osd_subpict_clear_color;
- bool osd_subpict_alloc;
-
- VideoFrame tmpframe;
-};
-
-#endif // __OSD_XVMC_H__
-
-#endif // USING_XVMC
View
0  mythtv/libs/libmythtv/util-xvmc.cpp
No changes.
View
127 mythtv/libs/libmythtv/util-xvmc.h
@@ -1,127 +0,0 @@
-//#define DEBUG_PAUSE /* enable to debug XvMC pause frame */
-
-#ifdef USING_XVMC
-
-# if defined(USING_XVMCW) || defined(USING_XVMC_VLD)
- extern "C" Status XvMCPutSlice2(Display*,XvMCContext*,char*,int,int);
-# else
- Status XvMCPutSlice2(Display*, XvMCContext*, char*, int, int)
- { return XvMCBadSurface; }
-# endif
-
-static QString ErrorStringXvMC(int val)
-{
- QString str = "unrecognized return value";
- switch (val)
- {
- case Success: str = "Success" ; break;
- case BadValue: str = "BadValue" ; break;
- case BadMatch: str = "BadMatch" ; break;
- case BadAlloc: str = "BadAlloc" ; break;
- }
- return str;
-}
-
-static struct xvmc_pix_fmt *GetRender(VideoFrame *frame)
-{
- if (frame)
- return (struct xvmc_pix_fmt*) frame->buf;
- return NULL;
-}
-
-static uint calcBPM(int chroma)
-{
- int ret;
- switch (chroma)
- {
- case XVMC_CHROMA_FORMAT_420: ret = 6; break;
- case XVMC_CHROMA_FORMAT_422: ret = 4+2; break;
- case XVMC_CHROMA_FORMAT_444: ret = 4+4; break;
- default: ret = 6;
- // default unless gray, then 4 is the right number,
- // a bigger number just wastes a little memory.
- }
- return ret;
-}
-#endif // USING_XVMC
-
-
-class XvMCBufferSettings
-{
- public:
- XvMCBufferSettings() :
- num_xvmc_surf(1),
- needed_for_display(1),
- min_num_xvmc_surfaces(8),
- max_num_xvmc_surfaces(16),
- num_xvmc_surfaces(min_num_xvmc_surfaces),
- aggressive(false) {}
-
- void SetOSDNum(uint val)
- {
- num_xvmc_surf = val;
- }
-
- void SetNumSurf(uint val)
- {
- num_xvmc_surfaces = min(max(val, min_num_xvmc_surfaces),
- max_num_xvmc_surfaces);
- }
-
- /// Returns number of XvMC OSD surfaces to allocate
- uint GetOSDNum(void) const { return num_xvmc_surf; }
-
- /// Returns number of frames we want decoded before we
- /// try to display a frame.
- uint GetNeededBeforeDisplay(void)
- const { return needed_for_display; }
-
- /// Returns minumum number of XvMC surfaces we need
- uint GetMinSurf(void) const { return min_num_xvmc_surfaces; }
-
- /// Returns maximum number of XvMC surfaces should try to get
- uint GetMaxSurf(void) const { return max_num_xvmc_surfaces; }
-
- /// Returns number of XvMC surfaces we actually allocate
- uint GetNumSurf(void) const { return num_xvmc_surfaces; }
-
- /// Returns number of frames we want to try to prebuffer
- uint GetPreBufferGoal(void) const
- {
- uint reserved = GetFrameReserve() + XVMC_PRE_NUM +
- XVMC_POST_NUM + XVMC_SHOW_NUM;
- return num_xvmc_surfaces - reserved;
- }
-
- /// Returns number of frames reserved for the OSD blending process
- /// and for video display. This is the HARD reserve.
- uint GetFrameReserve(void) const
- { return num_xvmc_surf + XVMC_SHOW_NUM; }
-
- /// Returns true if we should be aggressive in freeing buffers
- bool IsAggressive(void) const { return aggressive; }
-
- private:
- /// Number of XvMC OSD surface to allocate
- uint num_xvmc_surf;
- /// Frames needed before we try to display a frame, a larger
- /// number here ensures that we don't lose A/V Sync when a
- /// frame takes longer than one frame interval to decode.
- uint needed_for_display;
- /// Minumum number of XvMC surfaces to get
- uint min_num_xvmc_surfaces;
- /// Maximum number of XvMC surfaces to get
- uint max_num_xvmc_surfaces;
- /// Number of XvMC surfaces we got
- uint num_xvmc_surfaces;
- /// Use aggressive buffer management
- bool aggressive;
-
- /// Allow for one I/P frame before us
- static const uint XVMC_PRE_NUM = 1;
- /// Allow for one I/P frame after us
- static const uint XVMC_POST_NUM = 1;
- /// Allow for one B frame to be displayed
- static const uint XVMC_SHOW_NUM = 1;
-};
-
View
64 mythtv/libs/libmythtv/videodisplayprofile.cpp
@@ -638,8 +638,6 @@ QString VideoDisplayProfile::GetDecoderName(const QString &decoder)
{
dec_name["ffmpeg"] = QObject::tr("Standard");
dec_name["libmpeg2"] = QObject::tr("libmpeg2");
- dec_name["xvmc"] = QObject::tr("Standard XvMC");
- dec_name["xvmc-vld"] = QObject::tr("VIA XvMC");
dec_name["macaccel"] = QObject::tr("Mac hardware acceleration");
dec_name["vdpau"] = QObject::tr("NVidia VDPAU acceleration");
}
@@ -671,16 +669,6 @@ QString VideoDisplayProfile::GetDecoderHelp(QString decoder)
"libmpeg2 is slower on almost all processors than ffmpeg "
"and breaks caption decoding. Use at your own risk!");
- if (decoder == "xvmc")
- msg += QObject::tr(
- "Standard XvMC will use XvMC API 1.0 to "
- "play back video; this is fast, but does not "
- "work well with HDTV sized frames.");
-
- if (decoder == "xvmc-vld")
- msg += QObject::tr("VIA XvMC will use the VIA VLD XvMC extension.");
-
-
if (decoder == "macaccel")
msg += QObject::tr(
"Mac hardware will try to use the graphics "
@@ -1028,40 +1016,8 @@ void VideoDisplayProfile::CreateOldProfiles(const QString &hostname)
"ffmpeg", 1, true, "quartz-blit", "softblend", true,
"linearblend", "linearblend", "");
- (void) QObject::tr("CPU+", "Sample: Hardware assist HD only");
DeleteProfileGroup("CPU+", hostname);
- groupid = CreateProfileGroup("CPU+", hostname);
- CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
- "ffmpeg", 1, true, "xv-blit", "softblend", true,
- "bobdeint", "linearblend", "");
- CreateProfile(groupid, 2, "<=", 1280, 720, ">", 720, 576,
- "xvmc", 1, true, "xvmc-blit", "opengl", true,
- "bobdeint", "onefield", "");
- CreateProfile(groupid, 3, "<=", 1280, 720, ">", 720, 576,
- "libmpeg2", 1, true, "xv-blit", "softblend", true,
- "bobdeint", "onefield", "");
- CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
- "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
- "bobdeint", "onefield", "");
- CreateProfile(groupid, 5, ">", 0, 0, "", 0, 0,
- "libmpeg2", 1, true, "xv-blit", "chromakey", false,
- "bobdeint", "onefield", "");
-
- (void) QObject::tr("CPU--", "Sample: Hardware assist all");
DeleteProfileGroup("CPU--", hostname);
- groupid = CreateProfileGroup("CPU--", hostname);
- CreateProfile(groupid, 1, "<=", 720, 576, ">", 0, 0,
- "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
- "bobdeint", "onefield", "");
- CreateProfile(groupid, 2, "<=", 1280, 720, ">", 720, 576,
- "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
- "bobdeint", "onefield", "");
- CreateProfile(groupid, 3, ">", 0, 0, "", 0, 0,
- "xvmc", 1, true, "xvmc-blit", "ia44blend", false,
- "bobdeint", "onefield", "");
- CreateProfile(groupid, 4, ">", 0, 0, "", 0, 0,
- "libmpeg2", 1, true, "xv-blit", "chromakey", false,
- "none", "none", "");
}
void VideoDisplayProfile::CreateNewProfiles(const QString &hostname)
@@ -1197,12 +1153,6 @@ QString VideoDisplayProfile::GetVideoRendererHelp(const QString &renderer)
"XVideo hardware assist for scaling, color conversion. If the "
"hardware offers picture controls the renderer supports them.");
- if (renderer == "xvmc-blit")
- msg = QObject::tr(
- "This is the standard video renderer for XvMC decoders. It uses "
- "XVideo hardware assist for scaling, color conversion and "
- "when available offers XVideo picture controls.");
-
if (renderer == "directfb")
msg = QObject::tr(
"This video renderer uses DirectFB for scaling and color "
@@ -1403,8 +1353,7 @@ QString VideoDisplayProfile::GetOSDHelp(const QString &osd)
msg = QObject::tr(
"Render the OSD using the XVideo chromakey feature."
"This renderer does not alpha blend. But it is the fastest "
- "OSD renderer; and is particularly efficient compared to the "
- "ia44blend OSD renderer for XvMC.") + "\n" +
+ "OSD renderer for XVideo.") + "\n" +
QObject::tr(
"Note: nVidia hardware after the 5xxx series does not "
"have XVideo chromakey support.");
@@ -1416,17 +1365,6 @@ QString VideoDisplayProfile::GetOSDHelp(const QString &osd)
"Software OSD rendering uses your CPU to alpha blend the OSD.");
}
- if (osd == "ia44blend")
- {
- msg = QObject::tr(
- "Uses hardware support for 16 color alpha-blend surfaces for "
- "rendering the OSD. Because of the limited color range, MythTV "
- "renders the OSD in 16 level grayscale.") + "\n" +
- QObject::tr(
- "Note: Not recommended for nVidia or Intel chipsets. This "
- "removes two of the limited XvMC buffers from decoding duty.");
- }
-
if (osd.contains("opengl"))
{
msg = QObject::tr(
View
1,577 mythtv/libs/libmythtv/videoout_xv.cpp
@@ -28,14 +28,12 @@ using namespace std;
// MythTV OSD headers
#include "yuv2rgb.h"
#include "osd.h"
-#include "osdxvmc.h"
#include "osdchromakey.h"
// MythTV X11 headers
#include "videoout_xv.h"
#include "mythxdisplay.h"
#include "util-xv.h"
-#include "util-xvmc.h"
// MythTV General headers
#include "mythcorecontext.h"
@@ -68,23 +66,17 @@ extern "C" {
#define round(x) ((int) ((x) + 0.5))
#endif
-#ifndef XVMC_CHROMA_FORMAT_420
-#define XVMC_CHROMA_FORMAT_420 0x00000001
-#endif
-
static QStringList allowed_video_renderers(
MythCodecID codec_id, MythXDisplay *display, Window curwin = 0);
-static void SetFromEnv(bool &useXvVLD, bool &useXvIDCT, bool &useXvMC,
- bool &useXV, bool &useShm);
+static void SetFromEnv(bool &useXV, bool &useShm);
static void SetFromHW(MythXDisplay *d, Window curwin,
- bool &useXvMC, bool &useXV, bool &useShm);
+ bool &useXV, bool &useShm);
static int calc_hue_base(const QString &adaptor_name);
const char *vr_str[] =
{
- "unknown", "xlib", "xshm", "xv-blit", "xvmc", "xvmc",
- "xvmc",
+ "unknown", "xlib", "xshm", "xv-blit",
};
void VideoOutputXv::GetRenderOptions(render_opts &opts,
@@ -138,34 +130,14 @@ void VideoOutputXv::GetRenderOptions(render_opts &opts,
(*opts.safe_renderers)["crystalhd"].append("xshm");
(*opts.safe_renderers)["crystalhd"].append("xv-blit");
}
-
-#ifdef USING_XVMC
- if (opts.decoders->contains("xvmc"))
- {
- (*opts.deints)["xvmc-blit"].append("bobdeint");
- (*opts.deints)["xvmc-blit"].append("onefield");
- (*opts.deints)["xvmc-blit"].append("none");
- (*opts.osds)["xvmc-blit"].append("chromakey");
- (*opts.osds)["xvmc-blit"].append("ia44blend");
- (*opts.safe_renderers)["dummy"].append("xvmc-blit");
- (*opts.safe_renderers)["xvmc"].append("xvmc-blit");
- (*opts.render_group)["x11"].append("xvmc-blit");
- opts.priorities->insert("xvmc-blit", 110);
- }
- if (opts.decoders->contains("xvmc-vld"))
- (*opts.safe_renderers)["xvmc-vld"].append("xvmc-blit");
-#endif
-
}
/** \class VideoOutputXv
* \brief Supports common video output methods used with %X11 Servers.
*
- * This class suppurts XVideo with VLD acceleration (XvMC-VLD), XVideo with
- * inverse discrete cosine transform (XvMC-IDCT) acceleration, XVideo with
- * motion vector (XvMC) acceleration, and normal XVideo with color transform
- * and scaling acceleration only. When none of these will work, we also try
- * to use X Shared memory, and if that fails we try standard Xlib output.
+ * This class supports XVideo with color transform and scaling acceleration.
+ * When this is not available, we also try to use X Shared memory, and if that
+ * fails we try standard Xlib output.
*
* \see VideoOutput, VideoBuffers
*
@@ -181,10 +153,6 @@ VideoOutputXv::VideoOutputXv()
XJ_non_xv_image(0), non_xv_frames_shown(0), non_xv_show_frame(1),
non_xv_fps(0), non_xv_av_format(PIX_FMT_NB), non_xv_stop_time(0),
- xvmc_buf_attr(new XvMCBufferSettings()),
- xvmc_chroma(XVMC_CHROMA_FORMAT_420), xvmc_ctx(NULL),
- xvmc_osd_lock(),
-
xv_port(-1), xv_hue_base(0),
xv_colorkey(0), xv_draw_colorkey(false),
xv_chroma(0), xv_set_defaults(false),
@@ -236,9 +204,6 @@ VideoOutputXv::~VideoOutputXv()
delete disp;
disp = NULL;
}
-
- if (xvmc_buf_attr)
- delete xvmc_buf_attr;
}
// this is documented in videooutbase.cpp
@@ -371,12 +336,9 @@ class XvAttributes
uint xv_flags;
uint feature_flags;
- static const uint kFeatureNone = 0x0000;
- static const uint kFeatureXvMC = 0x0001;
- static const uint kFeatureVLD = 0x0002;
- static const uint kFeatureIDCT = 0x0004;
- static const uint kFeatureChromakey = 0x0008;
- static const uint kFeaturePicCtrl = 0x0010;
+ static const uint kFeatureNone = 0x00;
+ static const uint kFeatureChromakey = 0x01;
+ static const uint kFeaturePicCtrl = 0x02;
};
/**
@@ -404,93 +366,30 @@ int VideoOutputXv::GrabSuitableXvPort(MythXDisplay* disp, Window root,
MythCodecID mcodecid,
uint width, uint height,
bool &xvsetdefaults,
- int xvmc_chroma,
- XvMCSurfaceInfo* xvmc_surf_info,
QString *adaptor_name)
{
- // avoid compiler warnings
- (void)xvmc_chroma; (void)xvmc_surf_info;
-
if (adaptor_name)
*adaptor_name = QString::null;
- // figure out what basic kind of surface we want..
- int stream_type = 0;
- bool need_mc = false, need_idct = false;
- bool need_vld = false, need_xv = false;
- switch (mcodecid)
- {
- case kCodec_MPEG1_XVMC: stream_type = 1; need_mc = true; break;
- case kCodec_MPEG2_XVMC: stream_type = 2; need_mc = true; break;
- case kCodec_H263_XVMC: stream_type = 3; need_mc = true; break;
- case kCodec_MPEG4_XVMC: stream_type = 4; need_mc = true; break;
-
- case kCodec_MPEG1_IDCT: stream_type = 1; need_idct = true; break;
- case kCodec_MPEG2_IDCT: stream_type = 2; need_idct = true; break;
- case kCodec_H263_IDCT: stream_type = 3; need_idct = true; break;
- case kCodec_MPEG4_IDCT: stream_type = 4; need_idct = true; break;
-
- case kCodec_MPEG1_VLD: stream_type = 1; need_vld = true; break;
- case kCodec_MPEG2_VLD: stream_type = 2; need_vld = true; break;
- case kCodec_H263_VLD: stream_type = 3; need_vld = true; break;
- case kCodec_MPEG4_VLD: stream_type = 4; need_vld = true; break;
-
- default:
- need_xv = true;
- break;
- }
-
// create list of requirements to check in order..
vector<XvAttributes> req;
- if (need_vld)
- {
- req.push_back(XvAttributes(
- "XvMC surface found with VLD support on port %1",
- XvInputMask, XvAttributes::kFeatureXvMC |
- XvAttributes::kFeatureVLD));
- }
-
- if (need_idct)
- {
- req.push_back(XvAttributes(
- "XvMC surface found with IDCT support on port %1",
- XvInputMask, XvAttributes::kFeatureXvMC |
- XvAttributes::kFeatureIDCT));
- }
-
- if (need_mc)
- {
- req.push_back(XvAttributes(
- "XvMC surface found with MC support on port %1",
- XvInputMask, XvAttributes::kFeatureXvMC));
- }
-
- if (need_xv)
- {
- req.push_back(XvAttributes(
- "XVideo surface found on port %1",
- XvInputMask | XvImageMask,
- XvAttributes::kFeatureNone));
- }
+ req.push_back(XvAttributes(
+ "XVideo surface found on port %1",
+ XvInputMask | XvImageMask,
+ XvAttributes::kFeatureNone));
// try to get an adapter with picture attributes
- if (true)
+ uint end = req.size();
+ for (uint i = 0; i < end; i++)
{
- uint end = req.size();
- for (uint i = 0; i < end; i++)
- {
- req.push_back(req[i]);
- req[i].feature_flags |= XvAttributes::kFeaturePicCtrl;
- }
+ req.push_back(req[i]);
+ req[i].feature_flags |= XvAttributes::kFeaturePicCtrl;
}
// figure out if we want chromakeying..
VideoDisplayProfile vdp;
vdp.SetInput(QSize(width, height));
- bool check_for_colorkey = (vdp.GetOSDRenderer() == "chromakey");
-
- // if we want colorkey capability try to get an adapter with them
- if (check_for_colorkey)
+ if (vdp.GetOSDRenderer() == "chromakey")
{
uint end = req.size();
for (uint i = 0; i < end; i++)
@@ -565,62 +464,20 @@ int VideoOutputXv::GrabSuitableXvPort(MythXDisplay* disp, Window root,
VERBOSE(VB_PLAYBACK, LOC + "Here...");
- if (req[j].feature_flags & XvAttributes::kFeatureXvMC)
+ for (p = firstPort; (p <= lastPort) && (port == -1); ++p)
{
-#ifdef USING_XVMC
- int surfNum;
- XvMCSurfaceTypes::find(
- width, height, xvmc_chroma,
- req[j].feature_flags & XvAttributes::kFeatureVLD,
- req[j].feature_flags & XvAttributes::kFeatureIDCT,
- stream_type,
- 0, 0,
- disp, firstPort, lastPort,
- p, surfNum);
-
- if (surfNum<0)
- continue;
-
- XvMCSurfaceTypes surf(disp, p);
-
- if (!surf.size())
- continue;
-
disp->Lock();
ret = XvGrabPort(disp->GetDisplay(), p, CurrentTime);
if (Success == ret)
{
- VERBOSE(VB_PLAYBACK, LOC + "Grabbed xv port "<<p);
+ VERBOSE(VB_PLAYBACK, LOC + "Grabbed xv port "<<p);
port = p;
xvsetdefaults = add_open_xv_port(disp, p);
}
disp->Unlock();
- if (Success != ret)
- {
- VERBOSE(VB_PLAYBACK, LOC + "Failed to grab xv port "<<p);
- continue;
- }
-
- if (xvmc_surf_info)
- surf.set(surfNum, xvmc_surf_info);
-#endif // USING_XVMC
- }
- else
- {
- for (p = firstPort; (p <= lastPort) && (port == -1); ++p)
- {
- disp->Lock();
- ret = XvGrabPort(disp->GetDisplay(), p, CurrentTime);
- if (Success == ret)
- {
- VERBOSE(VB_PLAYBACK, LOC + "Grabbed xv port "<<p);
- port = p;
- xvsetdefaults = add_open_xv_port(disp, p);
- }
- disp->Unlock();
- }
}
}
+
if (port != -1)
{
VERBOSE(VB_PLAYBACK, LOC + req[j].description.arg(port));
@@ -642,6 +499,7 @@ int VideoOutputXv::GrabSuitableXvPort(MythXDisplay* disp, Window root,
break;
}
}
+
if (port == -1)
VERBOSE(VB_PLAYBACK, LOC + "No suitable XVideo port found");
@@ -660,36 +518,30 @@ int VideoOutputXv::GrabSuitableXvPort(MythXDisplay* disp, Window root,
*
* This creates a pause frame by copies the scratch frame settings, a
* and allocating a databuffer, so a scratch must already exist.
- * XvMC does not use this pause frame facility so this only creates
- * a pause buffer for the other output methods.
*
* \sideeffect sets av_pause_frame.
*/
void VideoOutputXv::CreatePauseFrame(VOSType subtype)
{
- // All methods but XvMC use a pause frame, create it if needed
- if ((subtype <= XVideo))
- {
- vbuffers.LockFrame(&av_pause_frame, "CreatePauseFrame");
+ vbuffers.LockFrame(&av_pause_frame, "CreatePauseFrame");
- if (av_pause_frame.buf)
- {
- delete [] av_pause_frame.buf;
- av_pause_frame.buf = NULL;
- }
+ if (av_pause_frame.buf)
+ {
+ delete [] av_pause_frame.buf;
+ av_pause_frame.buf = NULL;
+ }
- init(&av_pause_frame, FMT_YV12,
- new unsigned char[vbuffers.GetScratchFrame()->size + 128],
- vbuffers.GetScratchFrame()->width,
- vbuffers.GetScratchFrame()->height,
- vbuffers.GetScratchFrame()->size);
+ init(&av_pause_frame, FMT_YV12,
+ new unsigned char[vbuffers.GetScratchFrame()->size + 128],
+ vbuffers.GetScratchFrame()->width,
+ vbuffers.GetScratchFrame()->height,
+ vbuffers.GetScratchFrame()->size);
- av_pause_frame.frameNumber = vbuffers.GetScratchFrame()->frameNumber;
+ av_pause_frame.frameNumber = vbuffers.GetScratchFrame()->frameNumber;
- clear(&av_pause_frame);
+ clear(&av_pause_frame);
- vbuffers.UnlockFrame(&av_pause_frame, "CreatePauseFrame");
- }
+ vbuffers.UnlockFrame(&av_pause_frame, "CreatePauseFrame");
}
/**
@@ -697,47 +549,12 @@ void VideoOutputXv::CreatePauseFrame(VOSType subtype)
*
* \sideeffect sets video_output_subtype if it succeeds.
*
- * \bug Extra buffers are pre-allocated here for XVMC_VLD
- * due to a bug somewhere else, see comment in code.
- *
* \return success or failure at creating any buffers.
*/
bool VideoOutputXv::InitVideoBuffers(bool use_xv, bool use_shm)
{
bool done = false;
- // If use_xvmc try to create XvMC buffers
-#ifdef USING_XVMC
- if (!done && codec_is_xvmc(video_codec_id))
- {
- // Create ffmpeg VideoFrames
- bool vld, idct, mc, dummy;
- myth2av_codecid(video_codec_id, vld, idct, mc, dummy);
-
- vbuffers.Init(xvmc_buf_attr->GetNumSurf(),
- false /* create an extra frame for pause? */,
- xvmc_buf_attr->GetFrameReserve(),
- xvmc_buf_attr->GetPreBufferGoal(),
- xvmc_buf_attr->GetPreBufferGoal(),
- xvmc_buf_attr->GetNeededBeforeDisplay(),
- true /*use_frame_locking*/);
-
-
- done = InitXvMC();
-
- if (!done)
- vbuffers.Reset();
- }
-#endif // USING_XVMC
-
- if (!done && !codec_is_std(video_codec_id))
- {
- VERBOSE(VB_IMPORTANT, LOC_ERR +
- QString("Failed to initialize buffers for codec %1")
- .arg(toString(video_codec_id)));
- return false;
- }
-
// Create ffmpeg VideoFrames
if (!done)
vbuffers.Init(31, true, 1, 12, 4, 2, false);
@@ -759,86 +576,11 @@ bool VideoOutputXv::InitVideoBuffers(bool use_xv, bool use_shm)
done = InitXlib();
if (done)
- {
- QString tmp = vr_str[VideoOutputSubType()];
- QString rend = db_vdisp_profile->GetVideoRenderer();
- if ((tmp == "xvmc") && (rend.left(4) == "xvmc"))
- tmp = rend;
- db_vdisp_profile->SetVideoRenderer(tmp);
- }
+ db_vdisp_profile->SetVideoRenderer(vr_str[VideoOutputSubType()]);
return done;
}
-/**
- * \fn VideoOutputXv::InitXvMC(MythCodecID)
- * Creates and initializes video buffers.
- *
- * \sideeffect sets video_output_subtype if it succeeds.
- *
- * \return success or failure at creating any buffers.
- */
-bool VideoOutputXv::InitXvMC()
-{
-#ifdef USING_XVMC
- MythXLocker lock(disp);
- disp->StartLog();
- QString adaptor_name = QString::null;
- const QSize video_dim = window.GetVideoDim();
- xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), video_codec_id,
- video_dim.width(), video_dim.height(),
- xv_set_defaults,
- xvmc_chroma, &xvmc_surf_info, &adaptor_name);
- if (xv_port == -1)
- {
- VERBOSE(VB_IMPORTANT, LOC_ERR +
- "Could not find suitable XvMC surface.");
- return false;
- }
-
- VERBOSE(VB_IMPORTANT, LOC + QString("XvMC Adaptor Name: '%1'")
- .arg(adaptor_name));
-
- xv_hue_base = calc_hue_base(adaptor_name);
-
- // create XvMC buffers
- bool ok = CreateXvMCBuffers();
- ok &= disp->StopLog();
-
- if (!ok)
- {
- DeleteBuffers(XVideoMC, false);
- ok = false;
- }
-
- if (ok)
- {
- video_output_subtype = XVideoMC;
- if (XVMC_IDCT == (xvmc_surf_info.mc_type & XVMC_IDCT))
- video_output_subtype = XVideoIDCT;
- if (XVMC_VLD == (xvmc_surf_info.mc_type & XVMC_VLD))
- video_output_subtype = XVideoVLD;
- window.SetAllowPreviewEPG(true);
- }
- else
- {
- VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to create XvMC Buffers.");
-
- xvmc_osd_lock.lock();
- for (uint i=0; i<xvmc_osd_available.size(); i++)
- delete xvmc_osd_available[i];
- xvmc_osd_available.clear();
- xvmc_osd_lock.unlock();
- UngrabXvPort(disp, xv_port);
- xv_port = -1;
- }
-
- return ok;
-#else // USING_XVMC
- return false;
-#endif // USING_XVMC
-}
-
static bool has_format(XvImageFormatValues *formats, int format_cnt, int id)
{
for (int i = 0; i < format_cnt; i++)
@@ -866,7 +608,7 @@ bool VideoOutputXv::InitXVideo()
const QSize video_dim = window.GetVideoDim();
xv_port = GrabSuitableXvPort(disp, disp->GetRoot(), kCodec_MPEG2,
video_dim.width(), video_dim.height(),
- xv_set_defaults, 0, NULL, &adaptor_name);
+ xv_set_defaults, &adaptor_name);
if (xv_port == -1)
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
@@ -1014,107 +756,9 @@ bool VideoOutputXv::InitXlib()
/**
* \return MythCodecID for the best supported codec on the main display.
*/
-MythCodecID VideoOutputXv::GetBestSupportedCodec(
- uint width, uint height,
- uint osd_width, uint osd_height,
- uint stream_type, int xvmc_chroma,
- bool test_surface, bool force_xv)
+MythCodecID VideoOutputXv::GetBestSupportedCodec(uint stream_type)
{
- (void)width, (void)height, (void)osd_width, (void)osd_height;
- (void)stream_type, (void)xvmc_chroma, (void)test_surface;
-
- MythCodecID ret = (MythCodecID)(kCodec_MPEG1 + (stream_type-1));
-
- if (force_xv || !codec_is_std_mpeg(ret))
- return ret;
-
-#ifdef USING_XVMC
- VideoDisplayProfile vdp;
- vdp.SetInput(QSize(width, height));
- QString dec = vdp.GetDecoder();
- if ((dec == "libmpeg2") || (dec == "ffmpeg"))
- return ret;
-
- // Disable features based on environment and DB values.
- bool use_xvmc_vld = false, use_xvmc_idct = false, use_xvmc = false;
- bool use_xv = true, use_shm = true;
- if (dec == "xvmc")
- use_xvmc_idct = use_xvmc = true;
- else if (dec == "xvmc-vld")
- use_xvmc_vld = use_xvmc = true;
-
- SetFromEnv(use_xvmc_vld, use_xvmc_idct, use_xvmc, use_xv, use_shm);
-
- // Disable features based on hardware capabilities.
- MythXDisplay *disp = OpenMythXDisplay();
- if (disp)
- {
- MythXLocker lock(disp);
- SetFromHW(disp, disp->GetRoot(), use_xvmc, use_xv, use_shm);
- }
-
- if (use_xvmc_vld &&
- XvMCSurfaceTypes::has(disp, XvVLD, stream_type, xvmc_chroma,
- width, height, osd_width, osd_height))
- {
- ret = (MythCodecID)(kCodec_MPEG1_VLD + (stream_type-1));
- }
- else if (use_xvmc_idct &&
- XvMCSurfaceTypes::has(disp, XvIDCT, stream_type, xvmc_chroma,
- width, height, osd_width, osd_height))
- {
- ret = (MythCodecID)(kCodec_MPEG1_IDCT + (stream_type-1));
- }
- else if (use_xvmc &&
- XvMCSurfaceTypes::has(disp, XvMC, stream_type, xvmc_chroma,
- width, height, osd_width, osd_height))
- {
- ret = (MythCodecID)(kCodec_MPEG1_XVMC + (stream_type-1));
- }
-
- bool ok = true;
- if (disp && test_surface && !codec_is_std(ret))
- {
- XvMCSurfaceInfo info;
-
- ok = false;
- bool dummy;
- int port = GrabSuitableXvPort(disp, disp->GetRoot(), ret, width, height,
- dummy, xvmc_chroma, &info);
- if (port >= 0)
- {
- XvMCContext *ctx =
- CreateXvMCContext(disp, port, info.surface_type_id,
- width, height);
- ok = NULL != ctx;
- DeleteXvMCContext(disp, ctx);
- UngrabXvPort(disp, port);
- }
- }
-
- ok |= cnt_open_xv_port() > 0; // also ok if we already opened port..
-
- if (!ok)
- {
- QString msg = LOC_ERR + "Could not open XvMC port...\n"
- "\n"
- "\t\t\tYou may wish to verify that your DISPLAY\n"
- "\t\t\tenvironment variable does not use an external\n"
- "\t\t\tnetwork connection.\n";
-#ifdef USING_XVMCW
- msg += "\n"
- "\t\t\tYou may also wish to verify that\n"
- "\t\t\t/etc/X11/XvMCConfig contains the correct\n"
- "\t\t\tvendor's XvMC library.\n";
-#endif // USING_XVMCW
- VERBOSE(VB_IMPORTANT, msg);
- }
-
- if (disp)
- delete disp;
-#endif // USING_XVMC
-
- return ret;
+ return (MythCodecID)(kCodec_MPEG1 + (stream_type-1));
}
bool VideoOutputXv::InitOSD(void)
@@ -1139,12 +783,10 @@ bool VideoOutputXv::InitOSD(void)
else
{
chroma_osd = new ChromaKeyOSD(this);
- xvmc_buf_attr->SetOSDNum(0); // disable XvMC blending OSD
}
return chroma_osd;
}
- // Other OSD's don't require initialization here...
return true;
}
@@ -1189,14 +831,6 @@ bool VideoOutputXv::InitSetupBuffers(void)
XV_INIT_FATAL_ERROR_TEST(false, "Failed to find a video renderer");
else
{
- // HACK HACK HACK -- begin See #4792 for more elegant solutions
- if ((db_vdisp_profile->GetVideoRenderer() == "xvmc-blit") &&
- (renderers.indexOf("xv-blit") > 0))
- {
- swap(renderers[0], renderers[renderers.indexOf("xv-blit")]);
- }
- // HACK HACK HACK -- end
-
QString tmp;
QStringList::const_iterator it = renderers.begin();
for (; it != renderers.end(); ++it)
@@ -1398,16 +1032,14 @@ bool VideoOutputXv::SetupDeinterlace(bool interlaced,
/**
* \fn VideoOutput::ApproveDeintFilter(const QString&) const
- * Approves bobdeint filter for XVideo and XvMC surfaces,
- * rejects other filters for XvMC, and defers to
- * VideoOutput::ApproveDeintFilter(const QString&)
- * otherwise.
+ * Approves bobdeint filter for XVideo and otherwise defers to
+ * VideoOutput::ApproveDeintFilter(const QString&).
*
* \return whether current video output supports a specific filter.
*/
bool VideoOutputXv::ApproveDeintFilter(const QString &filtername) const
{
- // TODO implement bobdeint for non-Xv[MC]
+ // TODO implement bobdeint for non-Xv
VOSType vos = VideoOutputSubType();
if (filtername == "bobdeint" && (vos >= XVideo))
@@ -1416,175 +1048,6 @@ bool VideoOutputXv::ApproveDeintFilter(const QString &filtername) const
return VideoOutput::ApproveDeintFilter(filtername);
}
-XvMCContext* VideoOutputXv::CreateXvMCContext(
- MythXDisplay* disp, int port, int surf_type, int width, int height)
-{
- (void)disp; (void)port; (void)surf_type; (void)width; (void)height;
-#ifdef USING_XVMC
- int ret = Success;
- XvMCContext *ctx = new XvMCContext;
- XLOCK(disp, ret = XvMCCreateContext(disp->GetDisplay(), port, surf_type,
- width, height, XVMC_DIRECT, ctx));
- if (ret != Success)
- {
- VERBOSE(VB_IMPORTANT, LOC_ERR +
- QString("Unable to create XvMC Context, status(%1): %2")
- .arg(ret).arg(ErrorStringXvMC(ret)));
-
- delete ctx;
- ctx = NULL;
- }
- return ctx;
-#else // if !USING_XVMC
- return NULL;
-#endif // !USING_XVMC
-}
-
-void VideoOutputXv::DeleteXvMCContext(MythXDisplay* disp, XvMCContext*& ctx)
-{
- (void)disp; (void)ctx;
-#ifdef USING_XVMC
- if (ctx)
- {
- XLOCK(disp, XvMCDestroyContext(disp->GetDisplay(), ctx));
- delete ctx;
- ctx = NULL;
- }
-#endif // !USING_XVMC
-}
-
-bool VideoOutputXv::CreateXvMCBuffers(void)
-{
-#ifdef USING_XVMC
- const QSize video_dim = window.GetVideoDim();
- xvmc_ctx = CreateXvMCContext(disp, xv_port,
- xvmc_surf_info.surface_type_id,
- video_dim.width(), video_dim.height());
- if (!xvmc_ctx)
- return false;
-
- bool surface_has_vld = (XVMC_VLD == (xvmc_surf_info.mc_type & XVMC_VLD));
- xvmc_surfs = CreateXvMCSurfaces(xvmc_buf_attr->GetMaxSurf</