vdr/xine-lib-vdr/src/dxr3 Makefile.am Makefile.in alphablend.c alphablend.h dxr3.h dxr3_decode_spu.c dxr3_decode_video.c dxr3_mpeg_encoders.c dxr3_scr.c dxr3_scr.h dxr3_spu_encoder.c em8300.h nav_read.c video_out_dxr3.c video_out_dxr3.h
Darren Salt
pkg-vdr-dvb-changes@lists.alioth.debian.org
Mon, 04 Apr 2005 22:29:30 +0000
Update of /cvsroot/pkg-vdr-dvb/vdr/xine-lib-vdr/src/dxr3
In directory haydn:/tmp/cvs-serv2129/src/dxr3
Added Files:
Makefile.am Makefile.in alphablend.c alphablend.h dxr3.h
dxr3_decode_spu.c dxr3_decode_video.c dxr3_mpeg_encoders.c
dxr3_scr.c dxr3_scr.h dxr3_spu_encoder.c em8300.h nav_read.c
video_out_dxr3.c video_out_dxr3.h
Log Message:
Import of VDR-patched xine-lib.
--- NEW FILE: alphablend.h ---
#include "../video_out/alphablend.h"
--- NEW FILE: dxr3_scr.c ---
/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_scr.c,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
/* dxr3 scr plugin.
* enables xine to use the internal clock of the card as its
* global time reference.
*/
#include <sys/ioctl.h>
#if defined(__sun)
#include <sys/ioccom.h>
#endif
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#define LOG_MODULE "dxr3_scr"
/* #define LOG_VERBOSE */
/* #define LOG */
#include "dxr3.h"
#include "dxr3_scr.h"
/* functions required by xine api */
static int dxr3_scr_get_priority(scr_plugin_t *scr);
static void dxr3_scr_start(scr_plugin_t *scr, int64_t vpts);
static int64_t dxr3_scr_get_current(scr_plugin_t *scr);
static void dxr3_scr_adjust(scr_plugin_t *scr, int64_t vpts);
static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed);
static void dxr3_scr_exit(scr_plugin_t *scr);
/* config callback */
static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry);
/* inline helper implementations */
static inline int dxr3_mvcommand(int fd_control, int command)
{
em8300_register_t reg;
reg.microcode_register = 1;
reg.reg = 0;
reg.val = command;
return ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®);
}
dxr3_scr_t *dxr3_scr_init(xine_t *xine)
{
dxr3_scr_t *this;
int devnum;
char tmpstr[128];
this = (dxr3_scr_t *)xine_xmalloc(sizeof(dxr3_scr_t));
devnum = xine->config->register_num(xine->config,
CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL);
snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300-%d", devnum);
if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) {
xprintf(this->xine, XINE_VERBOSITY_DEBUG,
"dxr3_scr: Failed to open control device %s (%s)\n", tmpstr, strerror(errno));
free(this);
return NULL;
}
this->xine = xine;
this->scr_plugin.interface_version = 3;
this->scr_plugin.get_priority = dxr3_scr_get_priority;
this->scr_plugin.start = dxr3_scr_start;
this->scr_plugin.get_current = dxr3_scr_get_current;
this->scr_plugin.adjust = dxr3_scr_adjust;
this->scr_plugin.set_fine_speed = dxr3_scr_set_speed;
this->scr_plugin.exit = dxr3_scr_exit;
this->priority = xine->config->register_num(
xine->config, "dxr3.scr_priority", 10, _("SCR plugin priority"),
_("Priority of the DXR3 SCR plugin. Values less than 5 mean that the "
"unix system timer will be used. Values greater 5 force to use "
"DXR3's internal clock as sync source."), 25,
dxr3_scr_update_priority, this);
this->offset = 0;
this->last_pts = 0;
this->scanning = 0;
this->sync = 0;
pthread_mutex_init(&this->mutex, NULL);
lprintf("init complete\n");
return this;
}
static int dxr3_scr_get_priority(scr_plugin_t *scr)
{
dxr3_scr_t *this = (dxr3_scr_t *)scr;
return this->priority;
}
static void dxr3_scr_start(scr_plugin_t *scr, int64_t vpts)
{
dxr3_scr_t *this = (dxr3_scr_t *)scr;
uint32_t vpts32 = vpts >> 1;
pthread_mutex_lock(&this->mutex);
this->last_pts = vpts32;
this->offset = vpts - ((int64_t)vpts32 << 1);
if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SET, &vpts32))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: start failed (%s)\n", strerror(errno));
lprintf("started with vpts %lld\n", vpts);
/* mis-use vpts32 to set the clock speed to 0x900, which is normal speed */
vpts32 = 0x900;
ioctl(this->fd_control, EM8300_IOCTL_SCR_SETSPEED, &vpts32);
this->scanning = 0;
this->sync = 0;
pthread_mutex_unlock(&this->mutex);
}
static int64_t dxr3_scr_get_current(scr_plugin_t *scr)
{
dxr3_scr_t *this = (dxr3_scr_t *)scr;
uint32_t pts;
int64_t current;
pthread_mutex_lock(&this->mutex);
if (ioctl(this->fd_control, EM8300_IOCTL_SCR_GET, &pts))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: get current failed (%s)\n", strerror(errno));
if (this->last_pts > 0xF0000000 && pts < 0x10000000)
/* wrap around detected, compensate with offset */
this->offset += (int64_t)1 << 33;
if (pts == 0)
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: WARNING: pts dropped to zero.\n");
this->last_pts = pts;
current = ((int64_t)pts << 1) + this->offset;
pthread_mutex_unlock(&this->mutex);
return current;
}
static void dxr3_scr_adjust(scr_plugin_t *scr, int64_t vpts)
{
dxr3_scr_t *this = (dxr3_scr_t *)scr;
uint32_t current_pts32;
int32_t offset32;
pthread_mutex_lock(&this->mutex);
if (ioctl(this->fd_control, EM8300_IOCTL_SCR_GET, ¤t_pts32))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: adjust get failed (%s)\n", strerror(errno));
this->last_pts = current_pts32;
this->offset = vpts - ((int64_t)current_pts32 << 1);
offset32 = this->offset / 4;
/* kernel driver ignores diffs < 7200, so abs(offset32) must be > 7200 / 4 */
if (offset32 < -7200/4 || offset32 > 7200/4) {
uint32_t vpts32 = vpts >> 1;
if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SET, &vpts32))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: adjust set failed (%s)\n", strerror(errno));
this->last_pts = vpts32;
this->offset = vpts - ((int64_t)vpts32 << 1);
}
lprintf("adjusted to vpts %lld\n", vpts);
pthread_mutex_unlock(&this->mutex);
}
static int dxr3_scr_set_speed(scr_plugin_t *scr, int speed)
{
dxr3_scr_t *this = (dxr3_scr_t *)scr;
uint32_t em_speed;
int playmode;
pthread_mutex_lock(&this->mutex);
em_speed = 0x900LL * (int64_t)speed / XINE_FINE_SPEED_NORMAL;
switch (em_speed) {
case 0:
/* pause mode */
playmode = MVCOMMAND_PAUSE;
break;
case 0x900:
/* normal playback */
if (this->sync)
playmode = MVCOMMAND_SYNC;
else
playmode = MVCOMMAND_START;
break;
default:
playmode = MVCOMMAND_START;
}
if (dxr3_mvcommand(this->fd_control, playmode))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to playmode (%s)\n", strerror(errno));
if(em_speed > 0x900)
this->scanning = 1;
else
this->scanning = 0;
if (ioctl(this->fd_control, EM8300_IOCTL_SCR_SETSPEED, &em_speed))
xprintf(this->xine, XINE_VERBOSITY_DEBUG, "dxr3_scr: failed to set speed (%s)\n", strerror(errno));
pthread_mutex_unlock(&this->mutex);
lprintf("speed set to mode %d\n", speed);
return speed;
}
static void dxr3_scr_exit(scr_plugin_t *scr)
{
dxr3_scr_t *this = (dxr3_scr_t *)scr;
close(this->fd_control);
pthread_mutex_destroy(&this->mutex);
free(this);
}
static void dxr3_scr_update_priority(void *this_gen, xine_cfg_entry_t *entry)
{
dxr3_scr_t *this = (dxr3_scr_t *)this_gen;
this->priority = entry->num_value;
xprintf(this->xine, XINE_VERBOSITY_DEBUG,
"dxr3_scr: setting scr priority to %d\n", entry->num_value);
}
--- NEW FILE: dxr3_decode_spu.c ---
/*
* Copyright (C) 2000-2004 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_decode_spu.c,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
/* dxr3 spu decoder plugin.
* Accepts the spu data from xine and sends it directly to the
* corresponding dxr3 device. Also handles dvd menu button highlights.
* Takes precedence over libspudec due to a higher priority.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#define LOG_MODULE "dxr3_decode_spu"
/* #define LOG_VERBOSE */
/* #define LOG */
#define LOG_PTS 0
#define LOG_SPU 0
#define LOG_BTN 0
#include "xine_internal.h"
#include "xineutils.h"
#include "buffer.h"
#include "xine-engine/bswap.h"
#ifdef HAVE_DVDNAV
# include <dvdnav/nav_types.h>
# include <dvdnav/nav_read.h>
#else
# include "nav_types.h"
# include "nav_read.h"
#endif
#include "video_out_dxr3.h"
#include "dxr3.h"
#define MAX_SPU_STREAMS 32
/* plugin class initialization function */
static void *dxr3_spudec_init_plugin(xine_t *xine, void *);
/* plugin catalog information */
static uint32_t supported_types[] = { BUF_SPU_DVD, 0 };
static decoder_info_t dxr3_spudec_info = {
supported_types, /* supported types */
10 /* priority */
};
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
{ PLUGIN_SPU_DECODER, 16, "dxr3-spudec", XINE_VERSION_CODE, &dxr3_spudec_info, &dxr3_spudec_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
/* plugin class functions */
static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xine_stream_t *stream);
static char *dxr3_spudec_get_identifier(spu_decoder_class_t *class_gen);
static char *dxr3_spudec_get_description(spu_decoder_class_t *class_gen);
static void dxr3_spudec_class_dispose(spu_decoder_class_t *class_gen);
/* plugin instance functions */
static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf);
static void dxr3_spudec_reset(spu_decoder_t *this_gen);
static void dxr3_spudec_discontinuity(spu_decoder_t *this_gen);
static void dxr3_spudec_dispose(spu_decoder_t *this_gen);
static int dxr3_spudec_interact_info(spu_decoder_t *this_gen, void *data);
static void dxr3_spudec_set_button(spu_decoder_t *this_gen, int32_t button, int32_t mode);
/* plugin structures */
typedef struct dxr3_spu_stream_state_s {
int spu_length;
int spu_ctrl;
int spu_end;
int parse;
int bytes_passed; /* used to parse the spu */
} dxr3_spu_stream_state_t;
typedef struct pci_node_s pci_node_t;
struct pci_node_s {
pci_t pci;
uint64_t vpts;
pci_node_t *next;
};
typedef struct dxr3_spudec_class_s {
spu_decoder_class_t spu_decoder_class;
int instance; /* we allow only one instance of this plugin */
} dxr3_spudec_class_t;
typedef struct dxr3_spudec_s {
spu_decoder_t spu_decoder;
dxr3_spudec_class_t *class;
xine_stream_t *stream;
dxr3_driver_t *dxr3_vo; /* we need to talk to the video out */
xine_event_queue_t *event_queue;
int devnum;
int fd_spu; /* to access the dxr3 spu device */
dxr3_spu_stream_state_t spu_stream_state[MAX_SPU_STREAMS];
uint32_t clut[16]; /* the current color lookup table */
int menu; /* are we in a menu? */
int button_filter;
pci_node_t pci_cur; /* a list of PCI packs, with the list head being current */
pthread_mutex_t pci_lock;
uint32_t buttonN; /* currently highlighted button */
int anamorphic; /* this is needed to detect anamorphic menus */
} dxr3_spudec_t;
/* helper functions */
static inline int dxr3_present(xine_stream_t *stream);
/* the NAV functions must be called with the pci_lock held */
static inline void dxr3_spudec_clear_nav_list(dxr3_spudec_t *this);
static inline void dxr3_spudec_update_nav(dxr3_spudec_t *this);
static void dxr3_spudec_process_nav(dxr3_spudec_t *this);
static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300_button_t *btn);
static inline void dxr3_swab_clut(int* clut);
/* inline helper implementations */
static inline int dxr3_present(xine_stream_t *stream)
{
plugin_node_t *node;
video_driver_class_t *vo_class;
int present = 0;
if (stream->video_driver && stream->video_driver->node) {
node = (plugin_node_t *)stream->video_driver->node;
if (node->plugin_class) {
vo_class = (video_driver_class_t *)node->plugin_class;
if (vo_class->get_identifier)
present = (strcmp(vo_class->get_identifier(vo_class), DXR3_VO_ID) == 0);
}
}
llprintf(LOG_SPU, "dxr3 %s\n", present ? "present" : "not present");
return present;
}
static inline void dxr3_spudec_clear_nav_list(dxr3_spudec_t *this)
{
while (this->pci_cur.next) {
pci_node_t *node = this->pci_cur.next->next;
free(this->pci_cur.next);
this->pci_cur.next = node;
}
/* invalidate current timestamp */
this->pci_cur.pci.hli.hl_gi.hli_s_ptm = (uint32_t)-1;
}
static inline void dxr3_spudec_update_nav(dxr3_spudec_t *this)
{
metronom_clock_t *clock = this->stream->xine->clock;
if (this->pci_cur.next && this->pci_cur.next->vpts <= clock->get_current_time(clock)) {
pci_node_t *node = this->pci_cur.next;
xine_fast_memcpy(&this->pci_cur, this->pci_cur.next, sizeof(pci_node_t));
dxr3_spudec_process_nav(this);
free(node);
}
}
static inline void dxr3_swab_clut(int *clut)
{
int i;
for (i=0; i<16; i++)
clut[i] = bswap_32(clut[i]);
}
static void *dxr3_spudec_init_plugin(xine_t *xine, void* data)
{
dxr3_spudec_class_t *this;
this = (dxr3_spudec_class_t *)xine_xmalloc(sizeof(dxr3_spudec_class_t));
if (!this) return NULL;
this->spu_decoder_class.open_plugin = dxr3_spudec_open_plugin;
this->spu_decoder_class.get_identifier = dxr3_spudec_get_identifier;
this->spu_decoder_class.get_description = dxr3_spudec_get_description;
this->spu_decoder_class.dispose = dxr3_spudec_class_dispose;
this->instance = 0;
return &this->spu_decoder_class;
}
static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xine_stream_t *stream)
{
dxr3_spudec_t *this;
dxr3_spudec_class_t *class = (dxr3_spudec_class_t *)class_gen;
char tmpstr[128];
if (class->instance) return NULL;
if (!dxr3_present(stream)) return NULL;
this = (dxr3_spudec_t *)xine_xmalloc(sizeof(dxr3_spudec_t));
if (!this) return NULL;
this->spu_decoder.decode_data = dxr3_spudec_decode_data;
this->spu_decoder.reset = dxr3_spudec_reset;
this->spu_decoder.discontinuity = dxr3_spudec_discontinuity;
this->spu_decoder.dispose = dxr3_spudec_dispose;
this->spu_decoder.get_interact_info = dxr3_spudec_interact_info;
this->spu_decoder.set_button = dxr3_spudec_set_button;
this->class = class;
this->stream = stream;
/* We need to talk to dxr3 video out to coordinate spus and overlays */
this->dxr3_vo = (dxr3_driver_t *)stream->video_driver;
this->event_queue = xine_event_new_queue(stream);
this->devnum = stream->xine->config->register_num(stream->xine->config,
CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL);
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
if (this->dxr3_vo->fd_spu)
this->fd_spu = this->dxr3_vo->fd_spu;
else {
/* open dxr3 spu device */
snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300_sp-%d", this->devnum);
if ((this->fd_spu = open(tmpstr, O_WRONLY)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_spu: Failed to open spu device %s (%s)\n"), tmpstr, strerror(errno));
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
free(this);
return NULL;
}
llprintf(LOG_SPU, "init: SPU_FD = %i\n",this->fd_spu);
/* We are talking directly to the dxr3 video out to allow concurrent
* access to the same spu device */
this->dxr3_vo->fd_spu = this->fd_spu;
}
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
this->menu = 0;
this->button_filter = 1;
this->pci_cur.pci.hli.hl_gi.hli_ss = 0;
this->pci_cur.next = NULL;
this->buttonN = 1;
this->anamorphic = 0;
pthread_mutex_init(&this->pci_lock, NULL);
class->instance = 1;
return &this->spu_decoder;
}
static char *dxr3_spudec_get_identifier(spu_decoder_class_t *class_gen)
{
return "dxr3-spudec";
}
static char *dxr3_spudec_get_description(spu_decoder_class_t *class_gen)
{
return "subtitle decoder plugin using the hardware decoding capabilities of a DXR3 decoder card";
}
static void dxr3_spudec_class_dispose(spu_decoder_class_t *class_gen)
{
free(class_gen);
}
static void dxr3_spudec_decode_data(spu_decoder_t *this_gen, buf_element_t *buf)
{
dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen;
ssize_t written;
uint32_t stream_id = buf->type & 0x1f;
dxr3_spu_stream_state_t *state = &this->spu_stream_state[stream_id];
uint32_t spu_channel = this->stream->spu_channel;
xine_event_t *event;
/* handle queued events */
while ((event = xine_event_get(this->event_queue))) {
llprintf(LOG_SPU, "event caught: SPU_FD = %i\n",this->fd_spu);
switch (event->type) {
case XINE_EVENT_FRAME_FORMAT_CHANGE:
/* we are in anamorphic mode, if the frame is 16:9, but not pan&scan'ed */
this->anamorphic =
(((xine_format_change_data_t *)event->data)->aspect == 3) &&
(((xine_format_change_data_t *)event->data)->pan_scan == 0);
llprintf(LOG_BTN, "anamorphic mode %s\n", this->anamorphic ? "on" : "off");
break;
}
xine_event_free(event);
}
/* check, if we need to process the next PCI from the list */
pthread_mutex_lock(&this->pci_lock);
dxr3_spudec_update_nav(this);
pthread_mutex_unlock(&this->pci_lock);
if ( (buf->type & 0xffff0000) != BUF_SPU_DVD ||
!(buf->decoder_flags & BUF_FLAG_SPECIAL) ||
buf->decoder_info[1] != BUF_SPECIAL_SPU_DVD_SUBTYPE )
return;
if (buf->decoder_info[2] == SPU_DVD_SUBTYPE_CLUT) {
llprintf(LOG_SPU, "BUF_SPU_CLUT\n");
if (buf->content[0] == 0) /* cheap endianess detection */
dxr3_swab_clut((int *)buf->content);
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, buf->content))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno));
/* remember clut, when video out places some overlay we may need to restore it */
memcpy(this->clut, buf->content, 16 * sizeof(uint32_t));
this->dxr3_vo->clut_cluttered = 0;
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
return;
}
if (buf->decoder_info[2] == SPU_DVD_SUBTYPE_NAV) {
uint8_t *p = buf->content;
llprintf(LOG_BTN, "got NAV packet\n");
pthread_mutex_lock(&this->pci_lock);
/* just watch out for menus */
if (p[3] == 0xbf && p[6] == 0x00) { /* Private stream 2 */
pci_t pci;
navRead_PCI(&pci, p + 7);
llprintf(LOG_BTN, "PCI packet hli_ss is %d\n", pci.hli.hl_gi.hli_ss);
if (pci.hli.hl_gi.hli_ss == 1) {
/* menu ahead */
/* NAV packets contain start and end presentation timestamps, which tell the
* application, when the highlight information in the NAV is supposed to be valid.
* We handle these timestamps only in a very stripped-down way: We keep a list
* of NAV packets (or better: the PCI part of them), tagged with a VPTS timestamp
* telling, when the NAV should be processed. However, we only enqueue a new node
* into this list, when we receive new highlight information during an already
* showing menu. This happens very rarerly on common DVDs, so it is of low impact.
* And we only check for processing of queued entries at some prominent
* locations in this SPU decoder. Since presentation timestamps rarely solve a real
* purpose on most DVDs, this is ok compared to the full-blown solution, which would
* require a separate thread managing the queue all the time. */
if (this->pci_cur.pci.hli.hl_gi.hli_ss != 0 &&
pci.hli.hl_gi.hli_s_ptm > this->pci_cur.pci.hli.hl_gi.hli_s_ptm) {
pci_node_t *node = &this->pci_cur;
printf("dxr3_decode_spu: DEBUG: allocating new PCI node for hli_s_ptm %d\n", pci.hli.hl_gi.hli_s_ptm);
/* append PCI at the end of the list */
while (node->next) node = node->next;
node->next = (pci_node_t *)xine_xmalloc(sizeof(pci_node_t));
node->next->vpts = this->stream->metronom->got_spu_packet(this->stream->metronom, pci.hli.hl_gi.hli_s_ptm);
node->next->next = NULL;
xine_fast_memcpy(&node->next->pci, &pci, sizeof(pci_t));
} else {
dxr3_spudec_clear_nav_list(this);
/* menu ahead, remember PCI for later use */
xine_fast_memcpy(&this->pci_cur.pci, &pci, sizeof(pci_t));
dxr3_spudec_process_nav(this);
}
}
if ((pci.hli.hl_gi.hli_ss == 0) && (this->pci_cur.pci.hli.hl_gi.hli_ss == 1)) {
/* this is (or: should be, I hope I got this right) a
subpicture plane, that hides all menu buttons */
uint8_t empty_spu[] = {
0x00, 0x26, 0x00, 0x08, 0x80, 0x00, 0x00, 0x80,
0x00, 0x00, 0x00, 0x20, 0x01, 0x03, 0x00, 0x00,
0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x00,
0x00, 0x01, 0x06, 0x00, 0x04, 0x00, 0x07, 0xFF,
0x00, 0x01, 0x00, 0x20, 0x02, 0xFF };
/* leaving menu */
dxr3_spudec_clear_nav_list(this);
this->pci_cur.pci.hli.hl_gi.hli_ss = 0;
this->menu = 0;
this->button_filter = 1;
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, NULL);
write(this->fd_spu, empty_spu, sizeof(empty_spu));
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
}
}
pthread_mutex_unlock(&this->pci_lock);
return;
}
/* We parse the SPUs command and end sequence here for two reasons:
* 1. Look for the display duration entry in the spu packets.
* If the spu is a menu button highlight pane, this entry must not exist,
* because the spu is hidden, when the menu is left, not by timeout.
* Some broken dvds do not respect this and therefore confuse the spu
* decoding pipeline of the card. We fix this here.
* 2. We need to handle SPU forcing here. When we only display forced
* SPUs, we have to prevent normal unforced SPUs from being displayed.
* But since that decision is only possible after parts of the SPU
* have already been written to the card, we have to manipulate the
* SPU's command sequence to prevent it from being displayed.
*/
if (!state->spu_length) {
state->spu_length = buf->content[0] << 8 | buf->content[1];
state->spu_ctrl = (buf->content[2] << 8 | buf->content[3]) + 2;
state->spu_end = 0;
state->parse = 0;
state->bytes_passed = 0;
}
if (state->spu_length) {
if (!state->parse) {
int offset_in_buffer = state->spu_ctrl - state->bytes_passed;
if (offset_in_buffer >= 0 && offset_in_buffer < buf->size)
state->spu_end = buf->content[offset_in_buffer] << 8;
offset_in_buffer++;
if (offset_in_buffer >= 0 && offset_in_buffer < buf->size) {
state->spu_end |= buf->content[offset_in_buffer];
state->parse = 2;
}
}
if (state->parse > 1) {
int offset_in_buffer;
do {
offset_in_buffer = state->spu_ctrl + state->parse - state->bytes_passed;
if (offset_in_buffer >= 0 && offset_in_buffer < buf->size) {
switch (buf->content[offset_in_buffer]) {
case 0x00: /* force display */
state->parse++;
break;
case 0x01: /* show */
/* when only forced SPUs are allowed, change show to hide */
if (spu_channel & 0x80) buf->content[offset_in_buffer] = 0x02;
/* falling through intended */
case 0x02: /* hide */
state->parse++;
break;
case 0x03: /* colour lookup table */
case 0x04: /* transparency palette */
state->parse += 3;
break;
case 0x05: /* position and size */
state->parse += 7;
break;
case 0x06: /* field offsets */
state->parse += 5;
break;
case 0x07: /* wipe */
case 0xff: /* end */
default:
state->parse = 1; /* bail out */
}
}
} while (offset_in_buffer < buf->size && state->parse > 1);
}
if (state->parse && this->menu) {
int offset_in_buffer = state->spu_end - state->bytes_passed;
if (offset_in_buffer >= 0 && offset_in_buffer < buf->size)
buf->content[offset_in_buffer] = 0x00;
offset_in_buffer++;
if (offset_in_buffer >= 0 && offset_in_buffer < buf->size)
buf->content[offset_in_buffer] = 0x00;
offset_in_buffer += 3;
if (offset_in_buffer >= 0 && offset_in_buffer < buf->size &&
buf->content[offset_in_buffer] == 0x02)
buf->content[offset_in_buffer] = 0x00;
}
state->spu_length -= buf->size;
if (state->spu_length < 0) state->spu_length = 0;
state->bytes_passed += buf->size;
}
/* filter unwanted streams */
if (buf->decoder_flags & BUF_FLAG_PREVIEW) {
llprintf(LOG_SPU, "Dropping SPU channel %d. Preview data\n", stream_id);
return;
}
if (this->anamorphic && !this->dxr3_vo->widescreen_enabled &&
this->stream->spu_channel_user == -1 && this->stream->spu_channel_letterbox >= 0) {
/* Use the letterbox version of the subpicture for letterboxed display. */
spu_channel = this->stream->spu_channel_letterbox;
}
if ((spu_channel & 0x1f) != stream_id) {
llprintf(LOG_SPU, "Dropping SPU channel %d. Not selected stream_id\n", stream_id);
return;
}
/* We used to filter for SPU forcing here as well, but this does not work
* this way with the DXR3, because we have to evaluate the SPU command sequence
* to detect, if a particular SPU is forced or not. See the parsing code above. */
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
/* write sync timestamp to the card */
if (buf->pts) {
int64_t vpts;
uint32_t vpts32;
vpts = this->stream->metronom->got_spu_packet(this->stream->metronom, buf->pts);
llprintf(LOG_PTS, "pts = %lld vpts = %lld\n", buf->pts, vpts);
vpts32 = vpts;
if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPTS, &vpts32))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: spu setpts failed (%s)\n", strerror(errno));
}
/* has video out tampered with our palette */
if (this->dxr3_vo->clut_cluttered) {
if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_SETPALETTE, this->clut))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: failed to set CLUT (%s)\n", strerror(errno));
this->dxr3_vo->clut_cluttered = 0;
}
/* write spu data to the card */
llprintf(LOG_SPU, "write: SPU_FD = %i\n",this->fd_spu);
written = write(this->fd_spu, buf->content, buf->size);
if (written < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: spu device write failed (%s)\n", strerror(errno));
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
return;
}
if (written != buf->size)
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: Could only write %d of %d spu bytes.\n", written, buf->size);
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
}
static void dxr3_spudec_reset(spu_decoder_t *this_gen)
{
dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen;
int i;
for (i = 0; i < MAX_SPU_STREAMS; i++)
this->spu_stream_state[i].spu_length = 0;
pthread_mutex_lock(&this->pci_lock);
dxr3_spudec_clear_nav_list(this);
pthread_mutex_unlock(&this->pci_lock);
}
static void dxr3_spudec_discontinuity(spu_decoder_t *this_gen)
{
dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen;
pthread_mutex_lock(&this->pci_lock);
dxr3_spudec_clear_nav_list(this);
pthread_mutex_unlock(&this->pci_lock);
}
static void dxr3_spudec_dispose(spu_decoder_t *this_gen)
{
uint8_t empty_spu[] = {
0x00, 0x26, 0x00, 0x08, 0x80, 0x00, 0x00, 0x80,
0x00, 0x00, 0x00, 0x20, 0x01, 0x03, 0x00, 0x00,
0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x00,
0x00, 0x01, 0x06, 0x00, 0x04, 0x00, 0x07, 0xFF,
0x00, 0x01, 0x00, 0x20, 0x02, 0xFF };
dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen;
llprintf(LOG_SPU, "close: SPU_FD = %i\n",this->fd_spu);
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
/* clear any remaining spu */
ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, NULL);
write(this->fd_spu, empty_spu, sizeof(empty_spu));
close(this->fd_spu);
this->fd_spu = 0;
this->dxr3_vo->fd_spu = 0;
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
dxr3_spudec_clear_nav_list(this);
xine_event_dispose_queue(this->event_queue);
pthread_mutex_destroy(&this->pci_lock);
this->class->instance = 0;
free (this);
}
static int dxr3_spudec_interact_info(spu_decoder_t *this_gen, void *data)
{
dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen;
pthread_mutex_lock(&this->pci_lock);
dxr3_spudec_update_nav(this);
memcpy(data, &this->pci_cur.pci, sizeof(pci_t));
pthread_mutex_unlock(&this->pci_lock);
return 1;
}
static void dxr3_spudec_set_button(spu_decoder_t *this_gen, int32_t button, int32_t mode)
{
dxr3_spudec_t *this = (dxr3_spudec_t *)this_gen;
em8300_button_t btn;
llprintf(LOG_BTN, "setting button\n");
this->buttonN = button;
pthread_mutex_lock(&this->pci_lock);
dxr3_spudec_update_nav(this);
if (mode > 0 && !this->button_filter &&
(dxr3_spudec_copy_nav_to_btn(this, mode - 1, &btn ) > 0)) {
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno));
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
}
pthread_mutex_unlock(&this->pci_lock);
if (mode == 2) this->button_filter = 1;
llprintf(LOG_BTN, "buttonN = %u\n", this->buttonN);
}
static void dxr3_spudec_process_nav(dxr3_spudec_t *this)
{
em8300_button_t btn;
this->menu = 1;
this->button_filter = 0;
if (this->pci_cur.pci.hli.hl_gi.fosl_btnn > 0) {
/* a button is forced here, inform nav plugin */
xine_event_t event;
this->buttonN = this->pci_cur.pci.hli.hl_gi.fosl_btnn;
event.type = XINE_EVENT_INPUT_BUTTON_FORCE;
event.stream = this->stream;
event.data = &this->buttonN;
event.data_length = sizeof(this->buttonN);
xine_event_send(this->stream, &event);
}
if ((dxr3_spudec_copy_nav_to_btn(this, 0, &btn ) > 0)) {
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno));
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
} else {
/* current button does not exist -> use another one */
xine_event_t event;
xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("requested button not available\n"));
if (this->buttonN > this->pci_cur.pci.hli.hl_gi.btn_ns)
this->buttonN = this->pci_cur.pci.hli.hl_gi.btn_ns;
else
this->buttonN = 1;
event.type = XINE_EVENT_INPUT_BUTTON_FORCE;
event.stream = this->stream;
event.data = &this->buttonN;
event.data_length = sizeof(this->buttonN);
xine_event_send(this->stream, &event);
if ((dxr3_spudec_copy_nav_to_btn(this, 0, &btn ) > 0)) {
pthread_mutex_lock(&this->dxr3_vo->spu_device_lock);
if (ioctl(this->fd_spu, EM8300_IOCTL_SPU_BUTTON, &btn))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: failed to set spu button (%s)\n", strerror(errno));
pthread_mutex_unlock(&this->dxr3_vo->spu_device_lock);
} else {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "no working menu button found\n");
}
}
}
static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode, em8300_button_t *btn)
{
btni_t *button_ptr = NULL;
if ((this->buttonN <= 0) || (this->buttonN > this->pci_cur.pci.hli.hl_gi.btn_ns))
return -1;
/* choosing a button from a matching button group */
if (this->anamorphic &&
!this->dxr3_vo->widescreen_enabled &&
this->stream->spu_channel_user == -1 &&
this->stream->spu_channel_letterbox != this->stream->spu_channel &&
this->stream->spu_channel_letterbox >= 0) {
unsigned int btns_per_group = 36 / this->pci_cur.pci.hli.hl_gi.btngr_ns;
/* use a letterbox button group for letterboxed anamorphic menus on tv out */
if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 1 && (this->pci_cur.pci.hli.hl_gi.btngr1_dsp_ty & 2))
button_ptr = &this->pci_cur.pci.hli.btnit[0 * btns_per_group + this->buttonN - 1];
if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 2 && (this->pci_cur.pci.hli.hl_gi.btngr2_dsp_ty & 2))
button_ptr = &this->pci_cur.pci.hli.btnit[1 * btns_per_group + this->buttonN - 1];
if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 3 && (this->pci_cur.pci.hli.hl_gi.btngr3_dsp_ty & 2))
button_ptr = &this->pci_cur.pci.hli.btnit[2 * btns_per_group + this->buttonN - 1];
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "No suitable letterbox button group found.\n");
_x_assert(button_ptr);
} else {
unsigned int btns_per_group = 36 / this->pci_cur.pci.hli.hl_gi.btngr_ns;
/* otherwise use a normal 4:3 or widescreen button group */
if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 1 && !(this->pci_cur.pci.hli.hl_gi.btngr1_dsp_ty & 6))
button_ptr = &this->pci_cur.pci.hli.btnit[0 * btns_per_group + this->buttonN - 1];
if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 2 && !(this->pci_cur.pci.hli.hl_gi.btngr2_dsp_ty & 6))
button_ptr = &this->pci_cur.pci.hli.btnit[1 * btns_per_group + this->buttonN - 1];
if (!button_ptr && this->pci_cur.pci.hli.hl_gi.btngr_ns >= 3 && !(this->pci_cur.pci.hli.hl_gi.btngr3_dsp_ty & 6))
button_ptr = &this->pci_cur.pci.hli.btnit[2 * btns_per_group + this->buttonN - 1];
}
if (!button_ptr) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_spu: No suitable menu button group found, using group 1.\n");
button_ptr = &this->pci_cur.pci.hli.btnit[this->buttonN - 1];
}
if(button_ptr->btn_coln != 0) {
llprintf(LOG_BTN, "normal button clut, mode %d\n", mode);
btn->color = (this->pci_cur.pci.hli.btn_colit.btn_coli[button_ptr->btn_coln-1][mode] >> 16);
btn->contrast = (this->pci_cur.pci.hli.btn_colit.btn_coli[button_ptr->btn_coln-1][mode]);
btn->left = button_ptr->x_start;
btn->top = button_ptr->y_start;
btn->right = button_ptr->x_end;
btn->bottom = button_ptr->y_end;
return 1;
}
return -1;
}
--- NEW FILE: dxr3_decode_video.c ---
/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_decode_video.c,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
/* dxr3 video decoder plugin.
* Accepts the video data from xine and sends it directly to the
* corresponding dxr3 device. Takes precedence over the libmpeg2
* due to a higher priority.
*/
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#define LOG_MODULE "dxr3_decode_video"
/* #define LOG_VERBOSE */
/* #define LOG */
#define LOG_VID 0
#define LOG_PTS 0
#include "xine_internal.h"
#include "buffer.h"
#include "video_out_dxr3.h"
#include "dxr3.h"
/* once activated, we wait for this amount of missing pan&scan info
* before disabling it again */
#define PAN_SCAN_WINDOW_SIZE 50
/* the number of frames to pass after an out-of-sync situation
* before locking the stream again */
#define RESYNC_WINDOW_SIZE 50
/* we adjust vpts_offset in metronom, when skip_count reaches this value */
#define SKIP_TOLERANCE 200
/* the number of frames to pass before we stop duration correction */
#define FORCE_DURATION_WINDOW_SIZE 100
/* plugin class initialization function */
static void *dxr3_init_plugin(xine_t *xine, void *);
/* plugin catalog information */
static uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 };
static decoder_info_t dxr3_video_decoder_info = {
supported_types, /* supported types */
10 /* priority */
};
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
{ PLUGIN_VIDEO_DECODER, 18, "dxr3-mpeg2", XINE_VERSION_CODE, &dxr3_video_decoder_info, &dxr3_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
/* plugin class functions */
static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_stream_t *stream);
static char *dxr3_get_identifier(video_decoder_class_t *class_gen);
static char *dxr3_get_description(video_decoder_class_t *class_gen);
static void dxr3_class_dispose(video_decoder_class_t *class_gen);
/* plugin instance functions */
static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf);
static void dxr3_reset(video_decoder_t *this_gen);
static void dxr3_discontinuity(video_decoder_t *this_gen);
static void dxr3_flush(video_decoder_t *this_gen);
static void dxr3_dispose(video_decoder_t *this_gen);
/* plugin structures */
typedef struct dxr3_decoder_class_s {
video_decoder_class_t video_decoder_class;
int instance; /* we allow only one instance of this plugin */
metronom_clock_t *clock; /* used for syncing */
} dxr3_decoder_class_t;
typedef struct dxr3_decoder_s {
video_decoder_t video_decoder;
dxr3_decoder_class_t *class;
xine_stream_t *stream;
dxr3_scr_t *scr; /* shortcut to the scr plugin in the dxr3 video out */
int devnum;
int fd_control;
int fd_video; /* to access the dxr3 devices */
int have_header_info;
int sequence_open;
int width;
int height;
double ratio;
int aspect_code;
int frame_rate_code;
int repeat_first_field; /* mpeg stream header data */
int force_aspect; /* when input plugin has better info, we are forced */
int force_pan_scan; /* to use a certain aspect or to do pan&scan */
int use_panscan;
int panscan_smart_change;
int afd_smart_change;
int afd_code; /* use pan&scan info if present in stream */
int last_width;
int last_height;
int last_aspect_code; /* used to detect changes for event sending */
unsigned int dts_offset[3];
int sync_every_frame;
int sync_retry;
int enhanced_mode;
int resync_window;
int skip_count; /* syncing parameters */
int correct_durations;
int64_t last_vpts;
int force_duration_window;
int avg_duration; /* logic to correct broken frame rates */
} dxr3_decoder_t;
/* helper functions */
static inline int dxr3_present(xine_stream_t *stream);
static inline int dxr3_mvcommand(int fd_control, int command);
static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t *buffer);
static int get_duration(dxr3_decoder_t *this);
static void frame_format_change(dxr3_decoder_t *this);
/* config callbacks */
static void dxr3_update_panscan(void *this_gen, xine_cfg_entry_t *entry);
static void dxr3_update_sync_mode(void *this_gen, xine_cfg_entry_t *entry);
static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *entry);
static void dxr3_update_correct_durations(void *this_gen, xine_cfg_entry_t *entry);
/* inline helper implementations */
static inline int dxr3_present(xine_stream_t *stream)
{
plugin_node_t *node;
video_driver_class_t *vo_class;
int present = 0;
if (stream->video_driver && stream->video_driver->node) {
node = (plugin_node_t *)stream->video_driver->node;
if (node->plugin_class) {
vo_class = (video_driver_class_t *)node->plugin_class;
if (vo_class->get_identifier)
present = (strcmp(vo_class->get_identifier(vo_class), DXR3_VO_ID) == 0);
}
}
llprintf(LOG_VID, "dxr3 %s\n", present ? "present" : "not present");
return present;
}
static inline int dxr3_mvcommand(int fd_control, int command)
{
em8300_register_t reg;
reg.microcode_register = 1;
reg.reg = 0;
reg.val = command;
return ioctl(fd_control, EM8300_IOCTL_WRITEREG, ®);
}
static void *dxr3_init_plugin(xine_t *xine, void *data)
{
dxr3_decoder_class_t *this;
this = (dxr3_decoder_class_t *)xine_xmalloc(sizeof (dxr3_decoder_class_t));
if (!this) return NULL;
this->video_decoder_class.open_plugin = dxr3_open_plugin;
this->video_decoder_class.get_identifier = dxr3_get_identifier;
this->video_decoder_class.get_description = dxr3_get_description;
this->video_decoder_class.dispose = dxr3_class_dispose;
this->instance = 0;
this->clock = xine->clock;
return &this->video_decoder_class;
}
static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_stream_t *stream)
{
static char *panscan_types[] = { "only when forced", "use MPEG hint", "use DVB hint", NULL };
dxr3_decoder_t *this;
dxr3_decoder_class_t *class = (dxr3_decoder_class_t *)class_gen;
config_values_t *cfg;
char tmpstr[128];
if (class->instance) return NULL;
if (!dxr3_present(stream)) return NULL;
this = (dxr3_decoder_t *)xine_xmalloc(sizeof (dxr3_decoder_t));
if (!this) return NULL;
cfg = stream->xine->config;
this->video_decoder.decode_data = dxr3_decode_data;
this->video_decoder.reset = dxr3_reset;
this->video_decoder.discontinuity = dxr3_discontinuity;
this->video_decoder.flush = dxr3_flush;
this->video_decoder.dispose = dxr3_dispose;
this->class = class;
this->stream = stream;
this->scr = NULL;
this->devnum = cfg->register_num(cfg, CONF_KEY, 0, CONF_NAME, CONF_HELP, 10, NULL, NULL);
snprintf(tmpstr, sizeof(tmpstr), "/dev/em8300-%d", this->devnum);
llprintf(LOG_VID, "Entering video init, devname=%s.\n",tmpstr);
/* open later, because dxr3_video_out might have it open until we request a frame */
this->fd_video = -1;
if ((this->fd_control = open(tmpstr, O_WRONLY)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_video: Failed to open control device %s (%s)\n"), tmpstr, strerror(errno));
free(this);
return NULL;
}
this->use_panscan = cfg->register_enum(cfg,
"dxr3.use_panscan", 0, panscan_types, _("use Pan & Scan info"),
_("\"Pan & Scan\" is a special display mode which is sometimes used in MPEG "
"encoded material. You can specify here, how to handle such content.\n\n"
"only when forced\n"
"Use Pan & Scan only, when the content you are playing enforces it.\n\n"
"use MPEG hint\n"
"Enable Pan & Scan based on information embedded in the MPEG video stream.\n\n"
"use DVB hint\n"
"Enable Pan & Scan based on information embedded in DVB streams. This makes "
"use of the Active Format Descriptor (AFD) used in some European DVB channels."),
10, dxr3_update_panscan, this);
this->dts_offset[0] = 21600;
this->dts_offset[1] = 21600;
this->dts_offset[2] = 21600;
this->force_duration_window = -FORCE_DURATION_WINDOW_SIZE;
this->last_vpts = this->class->clock->get_current_time(this->class->clock);
this->sync_every_frame = cfg->register_bool(cfg,
"dxr3.playback.sync_every_frame", 0, _("try to sync video every frame"),
_("Tries to set a synchronization timestamp for every frame. "
"Normally this is not necessary, because sync is sufficent "
"even when the timestamp is set only every now and then.\n"
"This is relevant for progressive video only (most PAL films)."),
20, dxr3_update_sync_mode, this);
this->enhanced_mode = cfg->register_bool(cfg,
"dxr3.playback.alt_play_mode", 1, _("use smooth play mode"),
_("Enabling this option will utilise a smoother play mode."),
20, dxr3_update_enhanced_mode, this);
this->correct_durations = cfg->register_bool(cfg,
"dxr3.playback.correct_durations", 0, _("correct frame durations in broken streams"),
_("Enables a small logic that corrects the frame durations of "
"some mpeg streams with wrong framerate codes. Currently a "
"correction for NTSC streams erroneously labeled as PAL "
"streams is implemented. Enable only, when you encounter such streams."),
0, dxr3_update_correct_durations, this);
/* the dxr3 needs a longer prebuffering to have time for its internal decoding */
this->stream->metronom->set_option(this->stream->metronom, METRONOM_PREBUFFER, 90000);
stream->video_out->open(stream->video_out, stream);
class->instance = 1;
return &this->video_decoder;
}
static char *dxr3_get_identifier(video_decoder_class_t *class_gen)
{
return "dxr3-mpeg2";
}
static char *dxr3_get_description(video_decoder_class_t *class_gen)
{
return "MPEGI/II decoder plugin using the hardware decoding capabilities of a DXR3 decoder card.";
}
static void dxr3_class_dispose(video_decoder_class_t *class_gen)
{
free(class_gen);
}
static void dxr3_decode_data(video_decoder_t *this_gen, buf_element_t *buf)
{
dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen;
ssize_t written;
int64_t vpts;
int i, skip;
vo_frame_t *img;
uint8_t *buffer, byte;
uint32_t shift;
vpts = 0;
/* handle aspect hints from xine-dvdnav */
if (buf->decoder_flags & BUF_FLAG_SPECIAL) {
if (buf->decoder_info[1] == BUF_SPECIAL_ASPECT) {
this->aspect_code = this->force_aspect = buf->decoder_info[2];
if (buf->decoder_info[3] == 0x1 && this->force_aspect == 3)
/* letterboxing is denied, we have to do pan&scan */
this->force_pan_scan = 1;
else
this->force_pan_scan = 0;
frame_format_change(this);
this->last_aspect_code = this->aspect_code;
}
return;
}
/* parse frames in the buffer handed in, evaluate headers,
* send frames to video_out and handle some syncing
*/
buffer = buf->content;
shift = 0xffffff00;
for (i = 0; i < buf->size; i++) {
byte = *buffer++;
if (shift != 0x00000100) {
shift = (shift | byte) << 8;
continue;
}
/* header code of some kind found */
shift = 0xffffff00;
if (byte == 0xb2) {
/* check for AFD data */
if (buffer + 5 < buf->content + buf->size) {
if (buffer[0] == 0x44 && buffer[1] == 0x54 && buffer[2] == 0x47) {
this->afd_code = buffer[5] & 0x0f;
if (this->aspect_code == 3)
/* 4:3 image in 16:9 frame -> zoomit! */
this->afd_smart_change = PAN_SCAN_WINDOW_SIZE;
}
}
continue;
}
if (byte == 0xb3) {
/* sequence data */
if (buffer + 3 < buf->content + buf->size)
parse_mpeg_header(this, buffer);
this->sequence_open = 1;
continue;
}
if (byte == 0xb5) {
/* extension data */
/* parse the extension type and use what is necessary...
* types are: sequence(1), sequence_display(2), quant_matrix(3),
* copyright(4), picture_display(7), picture_coding(8), ... */
if (buffer + 4 < buf->content + buf->size) {
switch (buffer[0] >> 4) {
case 2:
case 7:
/* picture_display and sequence_display are pan&scan info */
if (this->use_panscan) this->panscan_smart_change = PAN_SCAN_WINDOW_SIZE;
break;
case 8:
this->repeat_first_field = (buffer[3] >> 1) & 1;
/* clearing the progessive flag gets rid of the slight shaking with
* TV-out in the lower third of the image; but we have to set this
* flag, when a still frame is coming along, otherwise the card will
* drop one of the fields; therefore we check for the fifo size */
if (!((dxr3_driver_t *)this->stream->video_driver)->overlay_enabled) {
if (this->stream->video_fifo->fifo_size > this->stream->video_fifo->buffer_pool_capacity / 2)
buffer[4] &= ~(1 << 7);
else
buffer[4] |= (1 << 7);
}
break;
}
}
/* check if we can keep syncing */
if (this->repeat_first_field && this->sync_retry) /* reset counter */
this->sync_retry = 500;
if (this->repeat_first_field && this->sync_every_frame) {
llprintf(LOG_VID, "non-progressive video detected. disabling sync_every_frame.\n");
this->sync_every_frame = 0;
this->sync_retry = 500; /* see you later */
}
/* check for pan&scan state */
if (this->use_panscan && (this->panscan_smart_change > 0 || this->afd_smart_change > 0)) {
this->panscan_smart_change--;
this->afd_smart_change--;
if (this->panscan_smart_change > 0 || this->afd_smart_change > 0) {
/* only pan&scan if source is anamorphic */
if (this->aspect_code == 3) {
if (this->afd_smart_change && this->use_panscan == 2 && this->afd_code == 9)
this->force_pan_scan = 1; /* panscan info available -> zoom */
else if (this->afd_smart_change && this->use_panscan == 2 && this->afd_code != 9)
this->force_pan_scan = 0; /* force no panscan - image is 16:9 */
else if (this->use_panscan == 1 && this->panscan_smart_change)
this->force_pan_scan = 1; /* panscan info available, ignore AFD mode */
else if (!this->afd_smart_change && this->panscan_smart_change)
this->force_pan_scan = 1;
frame_format_change(this);
}
} else {
this->force_pan_scan = 0;
frame_format_change(this);
}
}
continue;
}
if (byte == 0xb7)
/* sequence end */
this->sequence_open = 0;
if (byte != 0x00) /* Don't care what it is. It's not a new frame */
continue;
/* we have a code for a new frame */
if (!this->have_header_info) /* this->width et al may still be undefined */
continue;
if (buf->decoder_flags & BUF_FLAG_PREVIEW)
continue;
/* pretend like we have decoded a frame */
img = this->stream->video_out->get_frame(this->stream->video_out,
this->width, this->height, this->ratio,
XINE_IMGFMT_DXR3, VO_BOTH_FIELDS | (this->force_pan_scan ? VO_PAN_SCAN_FLAG : 0));
img->pts = buf->pts;
img->bad_frame = 0;
img->duration = get_duration(this);
skip = img->draw(img, this->stream);
if (skip <= 0) { /* don't skip */
vpts = img->vpts; /* copy so we can free img */
if (this->correct_durations) {
/* calculate an average frame duration from metronom's vpts values */
this->avg_duration = this->avg_duration * 0.9 + (vpts - this->last_vpts) * 0.1;
llprintf(LOG_PTS, "average frame duration %d\n", this->avg_duration);
}
if (this->skip_count) this->skip_count--;
if (this->resync_window == 0 && this->scr && this->enhanced_mode &&
!this->scr->scanning) {
/* we are in sync, so we can lock the stream now */
llprintf(LOG_VID, "in sync, stream locked\n");
dxr3_mvcommand(this->fd_control, MVCOMMAND_SYNC);
this->resync_window = -RESYNC_WINDOW_SIZE;
pthread_mutex_lock(&this->scr->mutex);
this->scr->sync = 1;
pthread_mutex_unlock(&this->scr->mutex);
}
if (this->resync_window != 0 && this->resync_window > -RESYNC_WINDOW_SIZE)
this->resync_window--;
} else { /* metronom says skip, so don't set vpts */
llprintf(LOG_VID, "%d frames to skip\n", skip);
vpts = 0;
this->avg_duration = 0;
/* handle frame skip conditions */
if (this->scr && !this->scr->scanning) this->skip_count += skip;
if (this->skip_count > SKIP_TOLERANCE) {
/* we have had enough skipping messages now, let's react */
int64_t vpts_adjust = skip * (int64_t)img->duration / 2;
if (vpts_adjust > 90000) vpts_adjust = 90000;
this->stream->metronom->set_option(this->stream->metronom,
METRONOM_ADJ_VPTS_OFFSET, vpts_adjust);
this->skip_count = 0;
this->resync_window = 0;
}
if (this->scr && this->scr->scanning) this->resync_window = 0;
if (this->resync_window == 0 && this->scr && this->enhanced_mode &&
!this->scr->scanning) {
/* switch off sync mode in the card to allow resyncing */
llprintf(LOG_VID, "out of sync, allowing stream resync\n");
dxr3_mvcommand(this->fd_control, MVCOMMAND_START);
this->resync_window = RESYNC_WINDOW_SIZE;
pthread_mutex_lock(&this->scr->mutex);
this->scr->sync = 0;
pthread_mutex_unlock(&this->scr->mutex);
}
if (this->resync_window != 0 && this->resync_window < RESYNC_WINDOW_SIZE)
this->resync_window++;
}
this->last_vpts = img->vpts;
img->free(img);
/* if sync_every_frame was disabled, decrease the counter
* for a retry
* (it might be due to crappy studio logos and stuff
* so we should give the main movie a chance)
*/
if (this->sync_retry) {
if (!--this->sync_retry) {
llprintf(LOG_VID, "retrying sync_every_frame");
this->sync_every_frame = 1;
}
}
}
if (buf->decoder_flags & BUF_FLAG_PREVIEW) return;
/* ensure video device is open
* (we open it late because on occasion the dxr3 video out driver
* wants to open it)
* also ensure the scr is running
*/
if (this->fd_video < 0) {
metronom_clock_t *clock = this->class->clock;
char tmpstr[128];
int64_t time;
/* open the device for the decoder */
snprintf (tmpstr, sizeof(tmpstr), "/dev/em8300_mv-%d", this->devnum);
if ((this->fd_video = open(tmpstr, O_WRONLY)) < 0) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_video: Failed to open video device %s (%s)\n"), tmpstr, strerror(errno));
return;
}
/* We may want to issue a SETPTS, so make sure the scr plugin
* is running and registered. Unfortuantely wa cannot do this
* earlier, because the dxr3's internal scr gets confused
* when started with a closed video device. Maybe this is a
* driver bug and gets fixed somewhen. FIXME: We might then
* want to do this entirely in the video out.
*/
this->scr = ((dxr3_driver_t *)this->stream->video_driver)->class->scr;
time = clock->get_current_time(clock);
this->scr->scr_plugin.start(&this->scr->scr_plugin, time);
clock->register_scr(clock, &this->scr->scr_plugin);
}
/* update the pts timestamp in the card, which tags the data we write to it */
if (vpts) {
int64_t delay;
/* The PTS values written to the DXR3 must be modified based on the difference
* between stream's PTS and DTS (decoder timestamp). We receive this
* difference via decoder_info */
buf->decoder_info[0] <<= 1;
if (buf->pts) {
if ((this->dts_offset[0] == buf->decoder_info[0]) &&
(this->dts_offset[1] == buf->decoder_info[0]))
this->dts_offset[2] = buf->decoder_info[0];
else {
this->dts_offset[1] = this->dts_offset[0];
this->dts_offset[0] = buf->decoder_info[0];
}
llprintf(LOG_PTS, "PTS to DTS correction: %d\n", this->dts_offset[1]);
}
vpts -= this->dts_offset[2];
delay = vpts - this->class->clock->get_current_time(
this->class->clock);
llprintf(LOG_PTS, "SETPTS got %lld\n", vpts);
/* SETPTS only if less then one second in the future and
* either buffer has pts or sync_every_frame is set */
if ((delay > 0) && (delay < 90000) &&
(this->sync_every_frame || buf->pts)) {
uint32_t vpts32 = vpts;
/* update the dxr3's current pts value */
if (ioctl(this->fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vpts32))
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_video: set video pts failed (%s)\n", strerror(errno));
}
if (delay >= 90000) /* frame more than 1 sec ahead */
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_video: WARNING: vpts %lld is %.02f seconds ahead of time!\n",
vpts, delay/90000.0);
if (delay < 0)
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_video: WARNING: overdue frame.\n");
}
else if (buf->pts)
llprintf(LOG_PTS, "skip buf->pts = %lld (no vpts)\n", buf->pts);
/* now write the content to the dxr3 mpeg device and, in a dramatic
* break with open source tradition, check the return value
*/
written = write(this->fd_video, buf->content, buf->size);
if (written < 0) {
if (errno == EAGAIN) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_video: write to device would block. flushing\n"));
dxr3_flush(this_gen);
} else {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_video: video device write failed (%s)\n"), strerror(errno));
}
return;
}
if (written != buf->size)
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
"dxr3_decode_video: Could only write %d of %d video bytes.\n", written, buf->size);
}
static void dxr3_reset(video_decoder_t *this_gen)
{
dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen;
this->sequence_open = 0;
}
static void dxr3_discontinuity(video_decoder_t *this_gen)
{
}
static void dxr3_flush(video_decoder_t *this_gen)
{
dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen;
if (this->sequence_open && ++this->sequence_open > 5 &&
_x_stream_info_get(this->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL)) {
/* The dxr3 needs a sequence end code for still menus to work correctly
* (the highlights won't move without), but some dvds have stills
* with no sequence end code. Since it is very likely that flush() is called
* in still situations, we send one here. */
static uint8_t end_buffer[4] = { 0x00, 0x00, 0x01, 0xb7 };
write(this->fd_video, &end_buffer, 4);
this->sequence_open = 0;
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_video: WARNING: added missing end sequence\n");
}
}
static void dxr3_dispose(video_decoder_t *this_gen)
{
dxr3_decoder_t *this = (dxr3_decoder_t *)this_gen;
metronom_clock_t *clock = this->class->clock;
if (this->scr)
clock->unregister_scr(clock, &this->scr->scr_plugin);
dxr3_mvcommand(this->fd_control, MVCOMMAND_FLUSHBUF);
if (this->fd_video >= 0) close(this->fd_video);
close(this->fd_control);
this->stream->video_out->close(this->stream->video_out, this->stream);
this->class->instance = 0;
free(this);
}
static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t * buffer)
{
this->frame_rate_code = buffer[3] & 15;
this->height = (buffer[0] << 16) |
(buffer[1] << 8) |
(buffer[2] << 0);
this->width = ((this->height >> 12) + 15) & ~15;
this->height = ((this->height & 0xfff) + 15) & ~15;
this->aspect_code = buffer[3] >> 4;
this->have_header_info = 1;
if (this->force_aspect) this->aspect_code = this->force_aspect;
/* when width, height or aspect changes,
* we have to send an event for dxr3 spu decoder */
if (!this->last_width || !this->last_height || !this->last_aspect_code ||
(this->last_width != this->width) ||
(this->last_height != this->height) ||
(this->last_aspect_code != this->aspect_code)) {
frame_format_change(this);
this->last_width = this->width;
this->last_height = this->height;
this->last_aspect_code = this->aspect_code;
}
}
static int get_duration(dxr3_decoder_t *this)
{
int duration;
switch (this->frame_rate_code) {
case 1: /* 23.976 */
duration = 3754; /* actually it's 3753.75 */
break;
case 2: /* 24.000 */
duration = 3750;
break;
case 3: /* 25.000 */
duration = this->repeat_first_field ? 5400 : 3600;
break;
case 4: /* 29.970 */
duration = this->repeat_first_field ? 4505 : 3003;
break;
case 5: /* 30.000 */
duration = 3000;
break;
case 6: /* 50.000 */
duration = 1800;
break;
case 7: /* 59.940 */
duration = 1502; /* actually it's 1501.5 */
break;
case 8: /* 60.000 */
duration = 1500;
break;
default:
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_video: WARNING: unknown frame rate code %d\n"), this->frame_rate_code);
duration = 0;
break;
}
/* update stream metadata */
_x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, duration);
if (this->correct_durations && duration) {
/* we set an initial average frame duration here */
if (!this->avg_duration) this->avg_duration = duration;
/* Apply a correction to the framerate-code if metronom
* insists on a different frame duration.
* The code below is for NTCS streams labeled as PAL streams.
* (I have seen such things even on dvds!)
*/
if (this->avg_duration && this->avg_duration < 3300 && duration == 3600) {
if (this->force_duration_window > 0) {
/* we are already in a force_duration window, so we force duration */
this->force_duration_window = FORCE_DURATION_WINDOW_SIZE;
return 3000;
}
if (this->force_duration_window <= 0 && (this->force_duration_window += 10) > 0) {
/* we just entered a force_duration window, so we start the correction */
metronom_t *metronom = this->stream->metronom;
int64_t cur_offset;
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("dxr3_decode_video: WARNING: correcting frame rate code from PAL to NTSC\n"));
/* those weird streams need an offset, too */
cur_offset = metronom->get_option(metronom, METRONOM_AV_OFFSET);
metronom->set_option(metronom, METRONOM_AV_OFFSET, cur_offset - 28800);
this->force_duration_window = FORCE_DURATION_WINDOW_SIZE;
return 3000;
}
}
if (this->force_duration_window == -FORCE_DURATION_WINDOW_SIZE)
/* we are far from a force_duration window */
return duration;
if (--this->force_duration_window == 0) {
/* we have just left a force_duration window */
metronom_t *metronom = this->stream->metronom;
int64_t cur_offset;
cur_offset = metronom->get_option(metronom, METRONOM_AV_OFFSET);
metronom->set_option(metronom, METRONOM_AV_OFFSET, cur_offset + 28800);
this->force_duration_window = -FORCE_DURATION_WINDOW_SIZE;
}
}
return duration;
}
static void frame_format_change(dxr3_decoder_t *this)
{
/* inform the dxr3 SPU decoder about the current format,
* so that it can choose the correctly matching SPU */
xine_event_t event;
xine_format_change_data_t data;
event.type = XINE_EVENT_FRAME_FORMAT_CHANGE;
event.stream = this->stream;
event.data = &data;
event.data_length = sizeof(data);
data.width = this->width;
data.height = this->height;
data.aspect = this->aspect_code;
data.pan_scan = this->force_pan_scan;
xine_event_send(this->stream, &event);
/* update ratio */
switch (this->aspect_code) {
case 2:
this->ratio = 4.0 / 3.0;
break;
case 3:
this->ratio = 16.0 / 9.0;
break;
case 4:
this->ratio = 2.11;
break;
default:
if (this->have_header_info)
this->ratio = (double)this->width / (double)this->height;
}
/* update stream metadata */
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, 10000 * this->ratio);
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "MPEG (DXR3)");
}
static void dxr3_update_panscan(void *this_gen, xine_cfg_entry_t *entry)
{
((dxr3_decoder_t *)this_gen)->use_panscan = entry->num_value;
}
static void dxr3_update_sync_mode(void *this_gen, xine_cfg_entry_t *entry)
{
((dxr3_decoder_t *)this_gen)->sync_every_frame = entry->num_value;
}
static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *entry)
{
((dxr3_decoder_t *)this_gen)->enhanced_mode = entry->num_value;
}
static void dxr3_update_correct_durations(void *this_gen, xine_cfg_entry_t *entry)
{
((dxr3_decoder_t *)this_gen)->correct_durations = entry->num_value;
}
--- NEW FILE: em8300.h ---
#ifndef LINUX_EM8300_H
#define LINUX_EM8300_H
typedef struct {
void *ucode;
int ucode_size;
} em8300_microcode_t;
typedef struct {
int reg;
int val;
int microcode_register;
} em8300_register_t;
typedef struct {
int brightness;
int contrast;
int saturation;
} em8300_bcs_t;
typedef struct {
int cal_mode;
int arg;
int arg2;
int result;
int result2;
} em8300_overlay_calibrate_t;
typedef struct {
int xpos, ypos;
int width, height;
} em8300_overlay_window_t;
typedef struct {
int xsize, ysize;
} em8300_overlay_screen_t;
typedef struct {
int attribute;
int value;
} em8300_attribute_t;
typedef struct {
int color;
int contrast;
int top;
int bottom;
int left;
int right;
} em8300_button_t;
#define MAX_UCODE_REGISTER 110
#define EM8300_IOCTL_INIT _IOW('C',0,em8300_microcode_t)
#define EM8300_IOCTL_READREG _IOWR('C',1,em8300_register_t)
#define EM8300_IOCTL_WRITEREG _IOW('C',2,em8300_register_t)
#define EM8300_IOCTL_GETSTATUS _IOR('C',3,char[1024])
#define EM8300_IOCTL_SETBCS _IOW('C',4,em8300_bcs_t)
#define EM8300_IOCTL_GETBCS _IOR('C',4,em8300_bcs_t)
#define EM8300_IOCTL_SET_ASPECTRATIO _IOW('C',5,int)
#define EM8300_IOCTL_GET_ASPECTRATIO _IOR('C',5,int)
#define EM8300_IOCTL_SET_VIDEOMODE _IOW('C',6,int)
#define EM8300_IOCTL_GET_VIDEOMODE _IOR('C',6,int)
#define EM8300_IOCTL_SET_PLAYMODE _IOW('C',7,int)
#define EM8300_IOCTL_GET_PLAYMODE _IOR('C',7,int)
#define EM8300_IOCTL_SET_AUDIOMODE _IOW('C',8,int)
#define EM8300_IOCTL_GET_AUDIOMODE _IOR('C',8,int)
#define EM8300_IOCTL_SET_SPUMODE _IOW('C',9,int)
#define EM8300_IOCTL_GET_SPUMODE _IOR('C',9,int)
#define EM8300_IOCTL_OVERLAY_CALIBRATE _IOWR('C',10,em8300_overlay_calibrate_t)
#define EM8300_IOCTL_OVERLAY_SETMODE _IOW('C',11,int)
#define EM8300_IOCTL_OVERLAY_SETWINDOW _IOWR('C',12,em8300_overlay_window_t)
#define EM8300_IOCTL_OVERLAY_SETSCREEN _IOWR('C',13,em8300_overlay_screen_t)
#define EM8300_IOCTL_OVERLAY_GET_ATTRIBUTE _IOR('C',14,em8300_attribute_t)
#define EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE _IOW('C',14,em8300_attribute_t)
#define EM8300_IOCTL_OVERLAY_SIGNALMODE _IOW('C',15,em8300_attribute_t)
#define EM8300_IOCTL_SCR_GET _IOR('C',16,unsigned)
#define EM8300_IOCTL_SCR_SET _IOW('C',16,unsigned)
#define EM8300_IOCTL_SCR_GETSPEED _IOR('C',17,unsigned)
#define EM8300_IOCTL_SCR_SETSPEED _IOW('C',17,unsigned)
#define EM8300_IOCTL_FLUSH _IOW('C',18,int)
#define EM8300_IOCTL_VBI _IOW('C',19,struct timeval)
#define EM8300_OVERLAY_SIGNAL_ONLY 1
#define EM8300_OVERLAY_SIGNAL_WITH_VGA 2
#define EM8300_OVERLAY_VGA_ONLY 3
#define EM8300_IOCTL_VIDEO_SETPTS 1
#define EM8300_IOCTL_VIDEO_GETSCR _IOR('C',2,unsigned)
#define EM8300_IOCTL_VIDEO_SETSCR _IOW('C',2,unsigned)
#define EM8300_IOCTL_SPU_SETPTS 1
#define EM8300_IOCTL_SPU_SETPALETTE 2
#define EM8300_IOCTL_SPU_BUTTON 3
#define EM8300_ASPECTRATIO_4_3 0
#define EM8300_ASPECTRATIO_16_9 1
#define EM8300_ASPECTRATIO_LAST 1
#define EM8300_VIDEOMODE_PAL 0
#define EM8300_VIDEOMODE_PAL60 1
#define EM8300_VIDEOMODE_NTSC 2
#define EM8300_VIDEOMODE_LAST 2
#ifndef EM8300_VIDEOMODE_DEFAULT
#define EM8300_VIDEOMODE_DEFAULT EM8300_VIDEOMODE_PAL
#endif
#define EM8300_AUDIOMODE_ANALOG 0
#define EM8300_AUDIOMODE_DIGITALPCM 1
#define EM8300_AUDIOMODE_DIGITALAC3 2
#ifndef EM8300_AUDIOMODE_DEFAULT
#define EM8300_AUDIOMODE_DEFAULT EM8300_AUDIOMODE_ANALOG
#endif
#define EM8300_SPUMODE_OFF 0
#define EM8300_SPUMODE_ON 1
#define EM8300_PLAYMODE_STOPPED 0
#define EM8300_PLAYMODE_PAUSED 1
#define EM8300_PLAYMODE_SLOWFORWARDS 2
#define EM8300_PLAYMODE_SLOWBACKWARDS 3
#define EM8300_PLAYMODE_SINGLESTEP 4
#define EM8300_PLAYMODE_PLAY 5
#define EM8300_PLAYMODE_REVERSEPLAY 6
#define EM8300_PLAYMODE_SCAN 7
#define EM8300_PLAYMODE_FRAMEBUF 8
#define EM8300_OVERLAY_MODE_OFF 0
#define EM8300_OVERLAY_MODE_RECTANGLE 1
#define EM8300_OVERLAY_MODE_OVERLAY 2
#define EM8300_OVERLAY_CALMODE_XOFFSET 1
#define EM8300_OVERLAY_CALMODE_YOFFSET 2
#define EM8300_OVERLAY_CALMODE_XCORRECTION 3
#define EM8300_OVERLAY_CALMODE_COLOR 4
#define EM9010_ATTRIBUTE_XCORR 1
#define EM9010_ATTRIBUTE_XOFFSET 2
#define EM9010_ATTRIBUTE_YOFFSET 3
#define EM9010_ATTRIBUTE_JITTER 4
#define EM9010_ATTRIBUTE_STABILITY 5
#define EM9010_ATTRIBUTE_KEYCOLOR_UPPER 6
#define EM9010_ATTRIBUTE_KEYCOLOR_LOWER 7
#define EM9010_ATTRIBUTE_MAX 7
#define EM8300_SUBDEVICE_CONTROL 0
#define EM8300_SUBDEVICE_VIDEO 1
#define EM8300_SUBDEVICE_AUDIO 2
#define EM8300_SUBDEVICE_SUBPICTURE 3
#ifndef PCI_VENDOR_ID_SIGMADESIGNS
#define PCI_VENDOR_ID_SIGMADESIGNS 0x1105
#define PCI_DEVICE_ID_SIGMADESIGNS_EM8300 0x8300
#endif
#define CLOCKGEN_SAMPFREQ_MASK 0xc0
#define CLOCKGEN_SAMPFREQ_66 0xc0
#define CLOCKGEN_SAMPFREQ_48 0x40
#define CLOCKGEN_SAMPFREQ_44 0x80
#define CLOCKGEN_SAMPFREQ_32 0x00
#define CLOCKGEN_OUTMASK 0x30
#define CLOCKGEN_DIGITALOUT 0x10
#define CLOCKGEN_ANALOGOUT 0x20
#define CLOCKGEN_MODEMASK 0x0f
#define CLOCKGEN_OVERLAYMODE_1 0x07
#define CLOCKGEN_TVMODE_1 0x0b
#define CLOCKGEN_OVERLAYMODE_2 0x04
#define CLOCKGEN_TVMODE_2 0x02
#define MVCOMMAND_STOP 0x0
#define MVCOMMAND_PAUSE 0x1
#define MVCOMMAND_START 0x3
#define MVCOMMAND_PLAYINTRA 0x4
#define MVCOMMAND_SYNC 0x6
#define MVCOMMAND_FLUSHBUF 0x10
#define MVCOMMAND_DISPLAYBUFINFO 0x11
#define MACOMMAND_STOP 0x0
#define MACOMMAND_PAUSE 0x1
#define MACOMMAND_PLAY 0x2
#define IRQSTATUS_VIDEO_VBL 0x10
#define IRQSTATUS_VIDEO_FIFO 0x2
#define IRQSTATUS_AUDIO_FIFO 0x8
#define ENCODER_UNKNOWN 0
#define ENCODER_ADV7175 1
#define ENCODER_ADV7170 2
#define ENCODER_BT865 3
#ifdef __KERNEL__
#define EM8300_MAX 4
#define EM8300_MAJOR 121
#define EM8300_LOGNAME "em8300"
struct dicom_s {
int luma;
int chroma;
int frametop;
int framebottom;
int frameleft;
int frameright;
int visibletop;
int visiblebottom;
int visibleleft;
int visibleright;
int tvout;
};
struct displaybuffer_info_s {
int xsize;
int ysize;
int xsize2;
int flag1,flag2;
int buffer1;
int buffer2;
int unk_present;
int unknown1;
int unknown2;
int unknown3;
};
struct em8300_audio_s {
int channels;
int format;
int speed;
int slotsize;
int enable_bits;
};
struct em8300_s
{
char name[40];
int chip_revision;
int pci_revision;
int inuse[4];
int nonblock[4];
int ucodeloaded;
struct pci_dev *dev;
ulong adr;
volatile unsigned *mem;
ulong memsize;
int playmode;
/* Sysfs */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,46)
struct class_device classdev;
struct class_device classdev_mv;
struct class_device classdev_ma;
struct class_device classdev_sp;
#endif
/* Fifos */
struct fifo_s *mvfifo;
struct fifo_s *mafifo;
struct fifo_s *spfifo;
int mtrr_reg;
/* DICOM */
int dicom_vertoffset;
int dicom_horizoffset;
int dicom_brightness;
int dicom_contrast;
int dicom_saturation;
int dicom_tvout;
struct displaybuffer_info_s dbuf_info;
/* I2C */
int i2c_pin_reg;
int i2c_oe_reg;
/* different between revision 1 and revision 2 boards */
int mystery_divisor;
/* I2C bus 1*/
struct i2c_algo_bit_data i2c_data_1;
struct i2c_adapter i2c_ops_1;
/* I2C bus 2*/
struct i2c_algo_bit_data i2c_data_2;
struct i2c_adapter i2c_ops_2;
/* I2C clients */
int encoder_type;
struct i2c_client *encoder;
/* Microcode registers */
unsigned ucode_regs[MAX_UCODE_REGISTER];
int var_ucode_reg1; /* These are registers that differ */
int var_ucode_reg2; /* between versions 1 and 2 of the board */
int var_ucode_reg3; /* " */
/* Interrupt */
unsigned irqmask;
/* Clockgenerator */
int clockgen;
int clockgen_overlaymode;
int clockgen_tvmode;
/* Timing measurement */
struct timeval tv, last_status_time;
long irqtimediff;
int irqcount;
int frames;
int scr;
/* Audio */
struct em8300_audio_s audio;
int audio_mode;
int pcm_mode;
int dsp_num;
/* */
int dword_DB4;
unsigned char byte_D90[24];
/* Video */
int video_mode;
int video_playmode;
int aspect_ratio;
uint32_t video_pts;
uint32_t video_lastpts;
int video_ptsvalid,video_offset,video_count;
int video_ptsfifo_ptr;
#if LINUX_VERSION_CODE < 0x020314
struct wait_queue *video_ptsfifo_wait;
struct wait_queue *vbi_wait;
#else
wait_queue_head_t video_ptsfifo_wait;
wait_queue_head_t vbi_wait;
#endif
int video_ptsfifo_waiting;
int video_first;
int var_video_value;
/* Sub Picture */
int sp_pts, sp_ptsvalid, sp_count;
int sp_ptsfifo_ptr;
#if LINUX_VERSION_CODE < 0x020314
struct wait_queue *sp_ptsfifo_wait;
#else
wait_queue_head_t sp_ptsfifo_wait;
#endif
int sp_ptsfifo_waiting;
int sp_mode;
int linecounter;
/* EM9010 overlay processor */
int overlay_enabled;
int overlay_mode;
int overlay_gamma_enable;
int overlay_xres;
int overlay_yres;
int overlay_frame_xpos;
int overlay_frame_ypos;
int overlay_frame_width;
int overlay_frame_height;
int overlay_a[EM9010_ATTRIBUTE_MAX+1];
int overlay_double_y;
int overlay_xcorr_default;
int overlay_70;
int overlay_dword_24bb8;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
/* Memory exported via mmap() */
struct list_head memory;
#endif
/* To support different options for different cards */
unsigned int card_nr;
};
#define TIMEDIFF(a,b) a.tv_usec - b.tv_usec + \
1000000 * (a.tv_sec - b.tv_sec)
/*
Prototypes
*/
/* em8300_i2c.c */
int em8300_i2c_init(struct em8300_s *em);
void em8300_i2c_exit(struct em8300_s *em);
void em8300_clockgen_write(struct em8300_s *em, int abyte);
void em9010_write(struct em8300_s *em, int reg, int data);
int em9010_read(struct em8300_s *em, int reg);
int em9010_read16(struct em8300_s *em, int reg);
void em9010_write16(struct em8300_s *em, int reg, int value);
/* em8300_audio.c */
int em8300_audio_ioctl(struct em8300_s *em,unsigned int cmd, unsigned long arg);
int em8300_audio_flush(struct em8300_s *em);
int em8300_audio_open(struct em8300_s *em);
int em8300_audio_release(struct em8300_s *em);
int em8300_audio_setup(struct em8300_s *em);
ssize_t em8300_audio_write(struct em8300_s *em, const char * buf,
size_t count, loff_t *ppos);
int mpegaudio_command(struct em8300_s *em, int cmd);
/* em8300_ucode.c */
int em8300_ucode_upload(struct em8300_s *em, void *ucode_user, int ucode_size);
/* em8300_misc.c */
int em8300_setregblock(struct em8300_s *em, int offset, int val, int len);
int em8300_writeregblock(struct em8300_s *em, int offset, unsigned *buf, int len);
int em8300_waitfor(struct em8300_s *em, int reg, int val, int mask);
int em8300_waitfor_not(struct em8300_s *em, int reg, int val, int mask);
/* em8300_dicom.c */
void em8300_dicom_setBCS(struct em8300_s *em, int brightness, int contrast, int saturation);
void em8300_dicom_enable(struct em8300_s *em);
void em8300_dicom_disable(struct em8300_s *em);
int em8300_dicom_update(struct em8300_s *em);
void em8300_dicom_init(struct em8300_s *em);
int em8300_dicom_get_dbufinfo(struct em8300_s *em);
void em8300_dicom_fill_dispbuffers(struct em8300_s *em, int xpos, int ypos, int xsize,
int ysize, unsigned int pat1, unsigned int pat2);
/* em8300_video.c */
void em8300_video_open(struct em8300_s *em);
int em8300_video_setplaymode(struct em8300_s *em, int mode);
int em8300_video_sync(struct em8300_s *em);
int em8300_video_flush(struct em8300_s *em);
int em8300_video_setup(struct em8300_s *em);
int em8300_video_release(struct em8300_s *em);
void em8300_video_setspeed(struct em8300_s *em, int speed);
ssize_t em8300_video_write(struct em8300_s *em, const char * buf,
size_t count, loff_t *ppos);
int em8300_video_ioctl(struct em8300_s *em, unsigned int cmd, unsigned long arg);
void em8300_video_check_ptsfifo(struct em8300_s *em);
/* em8300_spu.c */
ssize_t em8300_spu_write(struct em8300_s *em, const char * buf,
size_t count, loff_t *ppos);
int em8300_spu_open(struct em8300_s *em);
int em8300_spu_ioctl(struct em8300_s *em, unsigned int cmd, unsigned long arg);
int em8300_spu_init(struct em8300_s *em);
void em8300_spu_check_ptsfifo(struct em8300_s *em);
int em8300_ioctl_setspumode(struct em8300_s *em, int mode);
void em8300_spu_release(struct em8300_s *em);
/* em8300_ioctl.c */
int em8300_control_ioctl(struct em8300_s *em, int cmd, unsigned long arg);
int em8300_ioctl_setvideomode(struct em8300_s *em, int mode);
int em8300_ioctl_setaspectratio(struct em8300_s *em, int ratio);
void em8300_ioctl_getstatus(struct em8300_s *em, char *usermsg);
int em8300_ioctl_init(struct em8300_s *em, em8300_microcode_t *useruc);
void em8300_ioctl_enable_videoout(struct em8300_s *em, int mode);
int em8300_ioctl_setplaymode(struct em8300_s *em, int mode);
int em8300_ioctl_setaudiomode(struct em8300_s *em, int mode);
int em8300_ioctl_getaudiomode(struct em8300_s *em, long int mode);
int em8300_ioctl_overlay_calibrate(struct em8300_s *em, em8300_overlay_calibrate_t *c);
int em8300_ioctl_overlay_setwindow(struct em8300_s *em,em8300_overlay_window_t *w);
int em8300_ioctl_overlay_setscreen(struct em8300_s *em,em8300_overlay_screen_t *s);
int em8300_ioctl_overlay_setmode(struct em8300_s *em,int val);
/* em9010.c */
int em9010_cabledetect(struct em8300_s *em);
int em9010_calibrate_xoffset(struct em8300_s *em);
int em9010_calibrate_yoffset(struct em8300_s *em);
int em9010_init(struct em8300_s *em);
int em9010_overlay_set_signalmode(struct em8300_s *em, int val);
int em9010_overlay_update(struct em8300_s *em);
int em9010_overlay_set_res(struct em8300_s *em, int xres, int yres);
void sub_4288c(struct em8300_s *em, int pa, int pb, int pc, int pd, int pe, int pf,
int pg, int ph);
int em9010_get_attribute(struct em8300_s *em, int attribute);
int em9010_set_attribute(struct em8300_s *em, int attribute, int value);
#endif /* __KERNEL__ */
#endif /* LINUX_EM8300_H */
--- NEW FILE: alphablend.c ---
#include "../video_out/alphablend.c"
--- NEW FILE: Makefile.am ---
include $(top_srcdir)/misc/Makefile.common
AM_CFLAGS = $(X_CFLAGS) $(LIBFAME_CFLAGS)
libdir = $(XINE_PLUGINDIR)
if HAVE_DXR3
dxr3_modules = xineplug_decode_dxr3_video.la \
xineplug_decode_dxr3_spu.la \
xineplug_vo_out_dxr3.la
endif
if HAVE_X11
link_x_libs = $(X_LIBS) -lXext
endif
if HAVE_LIBFAME
link_fame = $(LIBFAME_LIBS)
endif
if HAVE_LIBRTE
link_rte = -lrte
endif
lib_LTLIBRARIES = $(dxr3_modules)
xineplug_decode_dxr3_video_la_SOURCES = dxr3_decode_video.c
xineplug_decode_dxr3_video_la_LIBADD = $(XINE_LIB)
xineplug_decode_dxr3_video_la_LDFLAGS = -avoid-version -module
if HAVE_DVDNAV
AM_CPPFLAGS = $(DVDNAV_CFLAGS)
xineplug_decode_dxr3_spu_la_SOURCES = dxr3_decode_spu.c
xineplug_decode_dxr3_spu_la_LIBADD = $(XINE_LIB) $(DVDNAV_LIBS)
else
AM_CPPFLAGS = -I$(top_srcdir)/src/input/libdvdnav
xineplug_decode_dxr3_spu_la_SOURCES = dxr3_decode_spu.c nav_read.c
xineplug_decode_dxr3_spu_la_LIBADD = $(XINE_LIB)
endif
xineplug_decode_dxr3_spu_la_LDFLAGS = -avoid-version -module
xineplug_vo_out_dxr3_la_SOURCES = \
alphablend.c \
dxr3_mpeg_encoders.c \
dxr3_spu_encoder.c \
dxr3_scr.c \
video_out_dxr3.c
xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB)
xineplug_vo_out_dxr3_la_LDFLAGS = -avoid-version -module
noinst_HEADERS = \
em8300.h \
alphablend.h \
dxr3.h \
dxr3_scr.h \
video_out_dxr3.h
--- NEW FILE: Makefile.in ---
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(xineplug_decode_dxr3_spu_la_SOURCES) $(xineplug_decode_dxr3_video_la_SOURCES) $(xineplug_vo_out_dxr3_la_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/misc/Makefile.common
subdir = src/dxr3
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/_xine.m4 $(top_srcdir)/m4/aa.m4 \
$(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/arts.m4 \
$(top_srcdir)/m4/as.m4 $(top_srcdir)/m4/caca.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/directx.m4 \
$(top_srcdir)/m4/dl.m4 $(top_srcdir)/m4/dvdnav.m4 \
$(top_srcdir)/m4/esd.m4 $(top_srcdir)/m4/ffmpeg.m4 \
$(top_srcdir)/m4/freetype2.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/irixal.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/libFLAC.m4 $(top_srcdir)/m4/libfame.m4 \
$(top_srcdir)/m4/ogg.m4 $(top_srcdir)/m4/opengl.m4 \
$(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/progtest.m4 \
$(top_srcdir)/m4/sdl.m4 $(top_srcdir)/m4/speex.m4 \
$(top_srcdir)/m4/theora.m4 $(top_srcdir)/m4/vorbis.m4 \
$(top_srcdir)/m4/xv.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 = $(top_builddir)/src/xine-engine/libxine.la
am__DEPENDENCIES_2 =
@HAVE_DVDNAV_FALSE@xineplug_decode_dxr3_spu_la_DEPENDENCIES = \
@HAVE_DVDNAV_FALSE@ $(am__DEPENDENCIES_1)
@HAVE_DVDNAV_TRUE@xineplug_decode_dxr3_spu_la_DEPENDENCIES = \
@HAVE_DVDNAV_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am__xineplug_decode_dxr3_spu_la_SOURCES_DIST = dxr3_decode_spu.c \
nav_read.c
@HAVE_DVDNAV_FALSE@am_xineplug_decode_dxr3_spu_la_OBJECTS = \
@HAVE_DVDNAV_FALSE@ dxr3_decode_spu.lo nav_read.lo
@HAVE_DVDNAV_TRUE@am_xineplug_decode_dxr3_spu_la_OBJECTS = \
@HAVE_DVDNAV_TRUE@ dxr3_decode_spu.lo
xineplug_decode_dxr3_spu_la_OBJECTS = \
$(am_xineplug_decode_dxr3_spu_la_OBJECTS)
@HAVE_DXR3_TRUE@am_xineplug_decode_dxr3_spu_la_rpath = -rpath \
@HAVE_DXR3_TRUE@ $(libdir)
xineplug_decode_dxr3_video_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_xineplug_decode_dxr3_video_la_OBJECTS = dxr3_decode_video.lo
xineplug_decode_dxr3_video_la_OBJECTS = \
$(am_xineplug_decode_dxr3_video_la_OBJECTS)
@HAVE_DXR3_TRUE@am_xineplug_decode_dxr3_video_la_rpath = -rpath \
@HAVE_DXR3_TRUE@ $(libdir)
@HAVE_LIBFAME_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
@HAVE_X11_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2)
xineplug_vo_out_dxr3_la_DEPENDENCIES = $(am__DEPENDENCIES_3) \
$(am__DEPENDENCIES_2) $(am__DEPENDENCIES_4) \
$(am__DEPENDENCIES_1)
am_xineplug_vo_out_dxr3_la_OBJECTS = alphablend.lo \
dxr3_mpeg_encoders.lo dxr3_spu_encoder.lo dxr3_scr.lo \
video_out_dxr3.lo
xineplug_vo_out_dxr3_la_OBJECTS = \
$(am_xineplug_vo_out_dxr3_la_OBJECTS)
@HAVE_DXR3_TRUE@am_xineplug_vo_out_dxr3_la_rpath = -rpath $(libdir)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(xineplug_decode_dxr3_spu_la_SOURCES) \
$(xineplug_decode_dxr3_video_la_SOURCES) \
$(xineplug_vo_out_dxr3_la_SOURCES)
DIST_SOURCES = $(am__xineplug_decode_dxr3_spu_la_SOURCES_DIST) \
$(xineplug_decode_dxr3_video_la_SOURCES) \
$(xineplug_vo_out_dxr3_la_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
AAINFO = @AAINFO@
AALIB_CFLAGS = @AALIB_CFLAGS@
AALIB_CONFIG = @AALIB_CONFIG@
AALIB_LIBS = @AALIB_LIBS@
ACLOCAL = @ACLOCAL@
ACLOCAL_DIR = @ACLOCAL_DIR@
ALLOCA = @ALLOCA@
ALSA_CFLAGS = @ALSA_CFLAGS@
ALSA_LIBS = @ALSA_LIBS@
ALSA_STATIC_LIB = @ALSA_STATIC_LIB@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
ARTS_CFLAGS = @ARTS_CFLAGS@
ARTS_CONFIG = @ARTS_CONFIG@
ARTS_LIBS = @ARTS_LIBS@
AS = @AS@
ASFLAGS = @ASFLAGS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_ASF_FALSE = @BUILD_ASF_FALSE@
BUILD_ASF_TRUE = @BUILD_ASF_TRUE@
BUILD_DHA_KMOD_FALSE = @BUILD_DHA_KMOD_FALSE@
BUILD_DHA_KMOD_TRUE = @BUILD_DHA_KMOD_TRUE@
BUILD_FAAD_FALSE = @BUILD_FAAD_FALSE@
BUILD_FAAD_TRUE = @BUILD_FAAD_TRUE@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CACA_CFLAGS = @CACA_CFLAGS@
CACA_CONFIG = @CACA_CONFIG@
CACA_LIBS = @CACA_LIBS@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCAS = @CCAS@
CCASCOMPILE = @CCASCOMPILE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
DEBUG_CFLAGS = @DEBUG_CFLAGS@
DEFS = @DEFS@
DEPCOMP = @DEPCOMP@
DEPDIR = @DEPDIR@
DEPMOD = @DEPMOD@
DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@
DIRECTFB_LIBS = @DIRECTFB_LIBS@
DIRECTX_AUDIO_LIBS = @DIRECTX_AUDIO_LIBS@
DIRECTX_CPPFLAGS = @DIRECTX_CPPFLAGS@
DIRECTX_VIDEO_LIBS = @DIRECTX_VIDEO_LIBS@
DLLTOOL = @DLLTOOL@
DVDNAV_CFLAGS = @DVDNAV_CFLAGS@
DVDNAV_CONFIG = @DVDNAV_CONFIG@
DVDNAV_LIBS = @DVDNAV_LIBS@
DYNAMIC_LD_LIBS = @DYNAMIC_LD_LIBS@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_VCD_FALSE = @ENABLE_VCD_FALSE@
ENABLE_VCD_TRUE = @ENABLE_VCD_TRUE@
ESD_CFLAGS = @ESD_CFLAGS@
ESD_CONFIG = @ESD_CONFIG@
ESD_LIBS = @ESD_LIBS@
EXEEXT = @EXEEXT@
EXTRA_X_CFLAGS = @EXTRA_X_CFLAGS@
EXTRA_X_LIBS = @EXTRA_X_LIBS@
F77 = @F77@
FFLAGS = @FFLAGS@
FFMPEG_CPPFLAGS = @FFMPEG_CPPFLAGS@
FFMPEG_LIBS = @FFMPEG_LIBS@
FIG2DEV = @FIG2DEV@
FREETYPE_CONFIG = @FREETYPE_CONFIG@
FT2_CFLAGS = @FT2_CFLAGS@
FT2_LIBS = @FT2_LIBS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GLUT_LIBS = @GLUT_LIBS@
GLU_LIBS = @GLU_LIBS@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GNOME_VFS_CFLAGS = @GNOME_VFS_CFLAGS@
GNOME_VFS_LIBS = @GNOME_VFS_LIBS@
GOOM_LIBS = @GOOM_LIBS@
HAVE_AA_FALSE = @HAVE_AA_FALSE@
HAVE_AA_TRUE = @HAVE_AA_TRUE@
HAVE_ALSA09_FALSE = @HAVE_ALSA09_FALSE@
HAVE_ALSA09_TRUE = @HAVE_ALSA09_TRUE@
HAVE_ALSA_FALSE = @HAVE_ALSA_FALSE@
HAVE_ALSA_TRUE = @HAVE_ALSA_TRUE@
HAVE_ARMV4L_FALSE = @HAVE_ARMV4L_FALSE@
HAVE_ARMV4L_TRUE = @HAVE_ARMV4L_TRUE@
HAVE_ARTS_FALSE = @HAVE_ARTS_FALSE@
HAVE_ARTS_TRUE = @HAVE_ARTS_TRUE@
HAVE_BSDI_CDROM = @HAVE_BSDI_CDROM@
HAVE_CACA_FALSE = @HAVE_CACA_FALSE@
HAVE_CACA_TRUE = @HAVE_CACA_TRUE@
HAVE_CDROM_IOCTLS_FALSE = @HAVE_CDROM_IOCTLS_FALSE@
HAVE_CDROM_IOCTLS_TRUE = @HAVE_CDROM_IOCTLS_TRUE@
HAVE_COREAUDIO_FALSE = @HAVE_COREAUDIO_FALSE@
HAVE_COREAUDIO_TRUE = @HAVE_COREAUDIO_TRUE@
HAVE_DARWIN_CDROM = @HAVE_DARWIN_CDROM@
HAVE_DIRECTFB_FALSE = @HAVE_DIRECTFB_FALSE@
HAVE_DIRECTFB_TRUE = @HAVE_DIRECTFB_TRUE@
HAVE_DIRECTX_FALSE = @HAVE_DIRECTX_FALSE@
HAVE_DIRECTX_TRUE = @HAVE_DIRECTX_TRUE@
HAVE_DVDNAV_FALSE = @HAVE_DVDNAV_FALSE@
HAVE_DVDNAV_TRUE = @HAVE_DVDNAV_TRUE@
HAVE_DXR3_FALSE = @HAVE_DXR3_FALSE@
HAVE_DXR3_TRUE = @HAVE_DXR3_TRUE@
HAVE_ESD_FALSE = @HAVE_ESD_FALSE@
HAVE_ESD_TRUE = @HAVE_ESD_TRUE@
HAVE_FB_FALSE = @HAVE_FB_FALSE@
HAVE_FB_TRUE = @HAVE_FB_TRUE@
HAVE_FFMMX_FALSE = @HAVE_FFMMX_FALSE@
HAVE_FFMMX_TRUE = @HAVE_FFMMX_TRUE@
HAVE_FFMPEG_FALSE = @HAVE_FFMPEG_FALSE@
HAVE_FFMPEG_TRUE = @HAVE_FFMPEG_TRUE@
HAVE_FIG2DEV_FALSE = @HAVE_FIG2DEV_FALSE@
HAVE_FIG2DEV_TRUE = @HAVE_FIG2DEV_TRUE@
HAVE_FLAC_FALSE = @HAVE_FLAC_FALSE@
HAVE_FLAC_TRUE = @HAVE_FLAC_TRUE@
HAVE_FREEBSD_CDROM = @HAVE_FREEBSD_CDROM@
HAVE_GNOME_VFS_FALSE = @HAVE_GNOME_VFS_FALSE@
HAVE_GNOME_VFS_TRUE = @HAVE_GNOME_VFS_TRUE@
HAVE_IRIXAL_FALSE = @HAVE_IRIXAL_FALSE@
HAVE_IRIXAL_TRUE = @HAVE_IRIXAL_TRUE@
HAVE_LIBFAME_FALSE = @HAVE_LIBFAME_FALSE@
HAVE_LIBFAME_TRUE = @HAVE_LIBFAME_TRUE@
HAVE_LIBMNG_FALSE = @HAVE_LIBMNG_FALSE@
HAVE_LIBMNG_TRUE = @HAVE_LIBMNG_TRUE@
HAVE_LIBPNG_FALSE = @HAVE_LIBPNG_FALSE@
HAVE_LIBPNG_TRUE = @HAVE_LIBPNG_TRUE@
HAVE_LIBRTE_FALSE = @HAVE_LIBRTE_FALSE@
HAVE_LIBRTE_TRUE = @HAVE_LIBRTE_TRUE@
HAVE_LIBSMBCLIENT_FALSE = @HAVE_LIBSMBCLIENT_FALSE@
HAVE_LIBSMBCLIENT_TRUE = @HAVE_LIBSMBCLIENT_TRUE@
HAVE_LINUX_CDROM = @HAVE_LINUX_CDROM@
HAVE_LINUX_FALSE = @HAVE_LINUX_FALSE@
HAVE_LINUX_TRUE = @HAVE_LINUX_TRUE@
HAVE_MACOSX_VIDEO_FALSE = @HAVE_MACOSX_VIDEO_FALSE@
HAVE_MACOSX_VIDEO_TRUE = @HAVE_MACOSX_VIDEO_TRUE@
HAVE_MLIB_FALSE = @HAVE_MLIB_FALSE@
HAVE_MLIB_TRUE = @HAVE_MLIB_TRUE@
HAVE_OPENGL_FALSE = @HAVE_OPENGL_FALSE@
HAVE_OPENGL_TRUE = @HAVE_OPENGL_TRUE@
HAVE_OSS_FALSE = @HAVE_OSS_FALSE@
HAVE_OSS_TRUE = @HAVE_OSS_TRUE@
HAVE_POLYPAUDIO_FALSE = @HAVE_POLYPAUDIO_FALSE@
HAVE_POLYPAUDIO_TRUE = @HAVE_POLYPAUDIO_TRUE@
HAVE_SDL_FALSE = @HAVE_SDL_FALSE@
HAVE_SDL_TRUE = @HAVE_SDL_TRUE@
HAVE_SGMLTOOLS_FALSE = @HAVE_SGMLTOOLS_FALSE@
HAVE_SGMLTOOLS_TRUE = @HAVE_SGMLTOOLS_TRUE@
HAVE_SOLARIS_CDROM = @HAVE_SOLARIS_CDROM@
HAVE_SPEEX_FALSE = @HAVE_SPEEX_FALSE@
HAVE_SPEEX_TRUE = @HAVE_SPEEX_TRUE@
HAVE_STK_FALSE = @HAVE_STK_FALSE@
HAVE_STK_TRUE = @HAVE_STK_TRUE@
HAVE_SUNAUDIO_FALSE = @HAVE_SUNAUDIO_FALSE@
HAVE_SUNAUDIO_TRUE = @HAVE_SUNAUDIO_TRUE@
HAVE_SUNDGA_FALSE = @HAVE_SUNDGA_FALSE@
HAVE_SUNDGA_TRUE = @HAVE_SUNDGA_TRUE@
HAVE_SUNFB_FALSE = @HAVE_SUNFB_FALSE@
HAVE_SUNFB_TRUE = @HAVE_SUNFB_TRUE@
HAVE_SYNCFB_FALSE = @HAVE_SYNCFB_FALSE@
HAVE_SYNCFB_TRUE = @HAVE_SYNCFB_TRUE@
HAVE_THEORA_FALSE = @HAVE_THEORA_FALSE@
HAVE_THEORA_TRUE = @HAVE_THEORA_TRUE@
HAVE_V4L_FALSE = @HAVE_V4L_FALSE@
HAVE_V4L_TRUE = @HAVE_V4L_TRUE@
HAVE_VCDNAV_FALSE = @HAVE_VCDNAV_FALSE@
HAVE_VCDNAV_TRUE = @HAVE_VCDNAV_TRUE@
HAVE_VIDIX_FALSE = @HAVE_VIDIX_FALSE@
HAVE_VIDIX_TRUE = @HAVE_VIDIX_TRUE@
HAVE_VLDXVMC_FALSE = @HAVE_VLDXVMC_FALSE@
HAVE_VLDXVMC_TRUE = @HAVE_VLDXVMC_TRUE@
HAVE_VORBIS_FALSE = @HAVE_VORBIS_FALSE@
HAVE_VORBIS_TRUE = @HAVE_VORBIS_TRUE@
HAVE_W32DLL_FALSE = @HAVE_W32DLL_FALSE@
HAVE_W32DLL_TRUE = @HAVE_W32DLL_TRUE@
HAVE_WIN32_CDROM = @HAVE_WIN32_CDROM@
HAVE_X11_FALSE = @HAVE_X11_FALSE@
HAVE_X11_TRUE = @HAVE_X11_TRUE@
HAVE_XVMC_FALSE = @HAVE_XVMC_FALSE@
HAVE_XVMC_TRUE = @HAVE_XVMC_TRUE@
HAVE_XV_FALSE = @HAVE_XV_FALSE@
HAVE_XV_TRUE = @HAVE_XV_TRUE@
HAVE_XXMC_FALSE = @HAVE_XXMC_FALSE@
HAVE_XXMC_TRUE = @HAVE_XXMC_TRUE@
HAVE_ZLIB_FALSE = @HAVE_ZLIB_FALSE@
HAVE_ZLIB_TRUE = @HAVE_ZLIB_TRUE@
HOST_OS_DARWIN_FALSE = @HOST_OS_DARWIN_FALSE@
HOST_OS_DARWIN_TRUE = @HOST_OS_DARWIN_TRUE@
INCLUDED_INTL_FALSE = @INCLUDED_INTL_FALSE@
INCLUDED_INTL_TRUE = @INCLUDED_INTL_TRUE@
INCLUDES = @INCLUDES@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_M4_FALSE = @INSTALL_M4_FALSE@
INSTALL_M4_TRUE = @INSTALL_M4_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLDIR = @INTLDIR@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
IRIXAL_CFLAGS = @IRIXAL_CFLAGS@
IRIXAL_LIBS = @IRIXAL_LIBS@
IRIXAL_STATIC_LIB = @IRIXAL_STATIC_LIB@
KSTAT_LIBS = @KSTAT_LIBS@
LDFLAGS = @LDFLAGS@
LIBCDIO_CFLAGS = @LIBCDIO_CFLAGS@
LIBCDIO_LIBS = @LIBCDIO_LIBS@
LIBFAME_CFLAGS = @LIBFAME_CFLAGS@
LIBFAME_CONFIG = @LIBFAME_CONFIG@
LIBFAME_LIBS = @LIBFAME_LIBS@
LIBFFMPEG_CFLAGS = @LIBFFMPEG_CFLAGS@
LIBFLAC_CFLAGS = @LIBFLAC_CFLAGS@
LIBFLAC_LIBS = @LIBFLAC_LIBS@
LIBICONV = @LIBICONV@
LIBISO9660_LIBS = @LIBISO9660_LIBS@
LIBMODPLUG_CFLAGS = @LIBMODPLUG_CFLAGS@
LIBMODPLUG_LIBS = @LIBMODPLUG_LIBS@
LIBMPEG2_CFLAGS = @LIBMPEG2_CFLAGS@
LIBNAME = @LIBNAME@
LIBOBJS = @LIBOBJS@
LIBPNG_CONFIG = @LIBPNG_CONFIG@
LIBS = @LIBS@
LIBSMBCLIENT_LIBS = @LIBSMBCLIENT_LIBS@
LIBSTK_CFLAGS = @LIBSTK_CFLAGS@
LIBSTK_LIBS = @LIBSTK_LIBS@
LIBTOOL = $(SHELL) $(top_builddir)/libtool-nofpic
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIBVCDINFO_LIBS = @LIBVCDINFO_LIBS@
LIBVCD_CFLAGS = @LIBVCD_CFLAGS@
LIBVCD_LIBS = @LIBVCD_LIBS@
LIBVCD_SYSDEP = @LIBVCD_SYSDEP@
LINUX_CDROM_TIMEOUT = @LINUX_CDROM_TIMEOUT@
LINUX_INCLUDE = @LINUX_INCLUDE@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_REVISION = @LT_REVISION@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MKNOD = @MKNOD@
MLIB_CFLAGS = @MLIB_CFLAGS@
MLIB_LIBS = @MLIB_LIBS@
MNG_LIBS = @MNG_LIBS@
MSGFMT = @MSGFMT@
NET_LIBS = @NET_LIBS@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJCFLAGS = @OBJCFLAGS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OPENGL_CFLAGS = @OPENGL_CFLAGS@
OPENGL_LIBS = @OPENGL_LIBS@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PASS1_CFLAGS = @PASS1_CFLAGS@
PASS2_CFLAGS = @PASS2_CFLAGS@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PNG_CFLAGS = @PNG_CFLAGS@
PNG_LIBS = @PNG_LIBS@
POFILES = @POFILES@
POLYPAUDIO_CFLAGS = @POLYPAUDIO_CFLAGS@
POLYPAUDIO_LIBS = @POLYPAUDIO_LIBS@
POSUB = @POSUB@
PPC_ARCH_FALSE = @PPC_ARCH_FALSE@
PPC_ARCH_TRUE = @PPC_ARCH_TRUE@
RANLIB = @RANLIB@
RT_LIBS = @RT_LIBS@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SET_MAKE = @SET_MAKE@
SGMLTOOLS = @SGMLTOOLS@
SHELL = @SHELL@
SPEC_VERSION = @SPEC_VERSION@
SPEEX_CFLAGS = @SPEEX_CFLAGS@
SPEEX_LIBS = @SPEEX_LIBS@
STATIC = @STATIC@
STRIP = @STRIP@
SUNDGA_CFLAGS = @SUNDGA_CFLAGS@
SUNDGA_LIBS = @SUNDGA_LIBS@
TAR_NAME = @TAR_NAME@
THEORAENC_LIBS = @THEORAENC_LIBS@
THEORAFILE_LIBS = @THEORAFILE_LIBS@
THEORA_CFLAGS = @THEORA_CFLAGS@
THEORA_LIBS = @THEORA_LIBS@
THREAD_CFLAGS = @THREAD_CFLAGS@
THREAD_CFLAGS_CONFIG = @THREAD_CFLAGS_CONFIG@
THREAD_INCLUDES = @THREAD_INCLUDES@
THREAD_LIBS = @THREAD_LIBS@
THREAD_LIBS_CONFIG = @THREAD_LIBS_CONFIG@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
W32DLL_DEP = @W32DLL_DEP@
W32_NO_OPTIMIZE = @W32_NO_OPTIMIZE@
WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
WIN32_FALSE = @WIN32_FALSE@
WIN32_TRUE = @WIN32_TRUE@
XGETTEXT = @XGETTEXT@
XINE_ACFLAGS = @XINE_ACFLAGS@
XINE_BIN_AGE = @XINE_BIN_AGE@
XINE_BUILD_CC = @XINE_BUILD_CC@
XINE_BUILD_DATE = @XINE_BUILD_DATE@
XINE_BUILD_OS = @XINE_BUILD_OS@
XINE_CONFIG_PREFIX = @XINE_CONFIG_PREFIX@
XINE_DATADIR = @XINE_DATADIR@
XINE_FONTDIR = @XINE_FONTDIR@
XINE_FONTPATH = @XINE_FONTPATH@
XINE_IFACE_AGE = @XINE_IFACE_AGE@
XINE_LOCALEDIR = @XINE_LOCALEDIR@
XINE_LOCALEPATH = @XINE_LOCALEPATH@
XINE_MAJOR = @XINE_MAJOR@
XINE_MINOR = @XINE_MINOR@
XINE_PLUGINDIR = @XINE_PLUGINDIR@
XINE_PLUGINPATH = @XINE_PLUGINPATH@
XINE_PLUGIN_MIN_SYMS = @XINE_PLUGIN_MIN_SYMS@
XINE_SCRIPTPATH = @XINE_SCRIPTPATH@
XINE_SUB = @XINE_SUB@
XVMC_LIB = @XVMC_LIB@
XV_LIB = @XV_LIB@
XXMC_LIB = @XXMC_LIB@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZLIB_INCLUDES = @ZLIB_INCLUDES@
ZLIB_LIBS = @ZLIB_LIBS@
ZLIB_LIBS_CONFIG = @ZLIB_LIBS_CONFIG@
ac_ct_AR = @ac_ct_AR@
ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
ac_ct_F77 = @ac_ct_F77@
ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__fastdepOBJC_FALSE = @am__fastdepOBJC_FALSE@
am__fastdepOBJC_TRUE = @am__fastdepOBJC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = $(XINE_PLUGINDIR)
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
w32_path = @w32_path@
XINE_LIB = $(top_builddir)/src/xine-engine/libxine.la
AM_CFLAGS = $(X_CFLAGS) $(LIBFAME_CFLAGS)
@HAVE_DXR3_TRUE@dxr3_modules = xineplug_decode_dxr3_video.la \
@HAVE_DXR3_TRUE@ xineplug_decode_dxr3_spu.la \
@HAVE_DXR3_TRUE@ xineplug_vo_out_dxr3.la
@HAVE_X11_TRUE@link_x_libs = $(X_LIBS) -lXext
@HAVE_LIBFAME_TRUE@link_fame = $(LIBFAME_LIBS)
@HAVE_LIBRTE_TRUE@link_rte = -lrte
lib_LTLIBRARIES = $(dxr3_modules)
xineplug_decode_dxr3_video_la_SOURCES = dxr3_decode_video.c
xineplug_decode_dxr3_video_la_LIBADD = $(XINE_LIB)
xineplug_decode_dxr3_video_la_LDFLAGS = -avoid-version -module
@HAVE_DVDNAV_FALSE@AM_CPPFLAGS = -I$(top_srcdir)/src/input/libdvdnav
@HAVE_DVDNAV_TRUE@AM_CPPFLAGS = $(DVDNAV_CFLAGS)
@HAVE_DVDNAV_FALSE@xineplug_decode_dxr3_spu_la_SOURCES = dxr3_decode_spu.c nav_read.c
@HAVE_DVDNAV_TRUE@xineplug_decode_dxr3_spu_la_SOURCES = dxr3_decode_spu.c
@HAVE_DVDNAV_FALSE@xineplug_decode_dxr3_spu_la_LIBADD = $(XINE_LIB)
@HAVE_DVDNAV_TRUE@xineplug_decode_dxr3_spu_la_LIBADD = $(XINE_LIB) $(DVDNAV_LIBS)
xineplug_decode_dxr3_spu_la_LDFLAGS = -avoid-version -module
xineplug_vo_out_dxr3_la_SOURCES = \
alphablend.c \
dxr3_mpeg_encoders.c \
dxr3_spu_encoder.c \
dxr3_scr.c \
video_out_dxr3.c
xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB)
xineplug_vo_out_dxr3_la_LDFLAGS = -avoid-version -module
noinst_HEADERS = \
em8300.h \
alphablend.h \
dxr3.h \
dxr3_scr.h \
video_out_dxr3.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/misc/Makefile.common $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/dxr3/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/dxr3/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
xineplug_decode_dxr3_spu.la: $(xineplug_decode_dxr3_spu_la_OBJECTS) $(xineplug_decode_dxr3_spu_la_DEPENDENCIES)
$(LINK) $(am_xineplug_decode_dxr3_spu_la_rpath) $(xineplug_decode_dxr3_spu_la_LDFLAGS) $(xineplug_decode_dxr3_spu_la_OBJECTS) $(xineplug_decode_dxr3_spu_la_LIBADD) $(LIBS)
xineplug_decode_dxr3_video.la: $(xineplug_decode_dxr3_video_la_OBJECTS) $(xineplug_decode_dxr3_video_la_DEPENDENCIES)
$(LINK) $(am_xineplug_decode_dxr3_video_la_rpath) $(xineplug_decode_dxr3_video_la_LDFLAGS) $(xineplug_decode_dxr3_video_la_OBJECTS) $(xineplug_decode_dxr3_video_la_LIBADD) $(LIBS)
xineplug_vo_out_dxr3.la: $(xineplug_vo_out_dxr3_la_OBJECTS) $(xineplug_vo_out_dxr3_la_DEPENDENCIES)
$(LINK) $(am_xineplug_vo_out_dxr3_la_rpath) $(xineplug_vo_out_dxr3_la_LDFLAGS) $(xineplug_vo_out_dxr3_la_OBJECTS) $(xineplug_vo_out_dxr3_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alphablend.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dxr3_decode_spu.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dxr3_decode_video.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dxr3_mpeg_encoders.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dxr3_scr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dxr3_spu_encoder.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nav_read.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_out_dxr3.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(mkdir_p) $(distdir)/../../misc
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-data-hook install-exec install-exec-am install-info \
install-info-am install-libLTLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am uninstall-hook \
uninstall-info-am uninstall-libLTLIBRARIES
$(XINE_LIB):
@cd $(top_srcdir)/src/xine-engine && $(MAKE)
install-data-hook:
@if test $$MAKELEVEL -le 4 ; then \
if test -x "$(top_srcdir)/post-install.sh" ; then \
$(top_srcdir)/post-install.sh ; \
fi \
fi
pass1:
@$(MAKE) MULTIPASS_CFLAGS="$(PASS1_CFLAGS)"
pass2:
@$(MAKE) MULTIPASS_CFLAGS="$(PASS2_CFLAGS)"
debug:
@$(MAKE) CFLAGS="$(DEBUG_CFLAGS)"
install-debug: debug
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
@list='$(SUBDIRS)'; for subdir in $$list; do \
(cd $$subdir && $(MAKE) $@) || exit; \
done;
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
$(install_sh) -d $(DESTDIR)$(includedir)/xine
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/xine/$$p; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
list='$(include_HEADERS)'; for p in $$list; do \
rm -f $(DESTDIR)$(includedir)/xine/$$p; \
done
uninstall-hook:
@if echo '$(libdir)' | egrep ^'$(XINE_PLUGINDIR)' >/dev/null; then \
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p="`echo $$p | sed -e 's/\.la$$/\.so/g;s|^.*/||'`"; \
echo " rm -f $(DESTDIR)$(libdir)/$$p"; \
rm -f $(DESTDIR)$(libdir)/$$p; \
done; \
fi
mostlyclean-generic:
-rm -f *~ \#* .*~ .\#*
maintainer-clean-generic:
-@echo "This command is intended for maintainers to use;"
-@echo "it deletes files that may require special tools to rebuild."
-rm -f Makefile.in
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
--- NEW FILE: dxr3_scr.h ---
/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_scr.h,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
#include "xine_internal.h"
/* plugin structure */
typedef struct dxr3_scr_s {
scr_plugin_t scr_plugin;
pthread_mutex_t mutex;
xine_t *xine;
int fd_control; /* to access the dxr3 control device */
int priority;
int64_t offset; /* difference between real scr and internal dxr3 clock */
uint32_t last_pts; /* last known value of internal dxr3 clock to detect wrap around */
int scanning; /* are we in a scanning mode */
int sync; /* are we in sync mode */
} dxr3_scr_t;
/* plugin initialization function */
dxr3_scr_t *dxr3_scr_init(xine_t *xine);
--- NEW FILE: nav_read.c ---
#include "../input/libdvdnav/nav_read.c"
--- NEW FILE: dxr3_mpeg_encoders.c ---
/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a unix video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_mpeg_encoders.c,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
/* mpeg encoders for the dxr3 video out plugin.
* supports the libfame and librte mpeg encoder libraries.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_LIBRTE
# define _GNU_SOURCE
# include <unistd.h>
# include <rte.h>
#endif
#ifdef HAVE_LIBFAME
# include <fame.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <string.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <errno.h>
#include <math.h>
#define LOG_MODULE "dxr3_mpeg_encoder"
/* #define LOG_VERBOSE */
/* #define LOG */
#include "xineutils.h"
#include "video_out_dxr3.h"
/* buffer size for encoded mpeg1 stream; will hold one intra frame
* at 640x480 typical sizes are <50 kB. 512 kB should be plenty */
#define DEFAULT_BUFFER_SIZE 512*1024
#ifdef HAVE_LIBRTE
/* initialization function */
int dxr3_rte_init(dxr3_driver_t *drv);
/* functions required by encoder api */
static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame);
static int rte_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame);
static int rte_on_unneeded(dxr3_driver_t *drv);
static int rte_on_close(dxr3_driver_t *drv);
/* helper function */
static void mp1e_callback(rte_context *context, void *data, ssize_t size,
void *user_data);
/* encoder structure */
typedef struct rte_data_s {
encoder_data_t encoder_data;
rte_context *context; /* handle for encoding */
int width, height;
void *rte_ptr; /* buffer maintened by librte */
double rte_bitrate; /* mpeg out bitrate, default 2.3e6 bits/s */
} rte_data_t;
#endif
#ifdef HAVE_LIBFAME
/* initialization function */
int dxr3_fame_init(dxr3_driver_t *drv);
/* functions required by encoder api */
static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame);
static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame);
static int fame_on_unneeded(dxr3_driver_t *drv);
static int fame_on_close(dxr3_driver_t *drv);
/* encoder structure */
typedef struct {
encoder_data_t encoder_data;
fame_context_t *context; /* needed for fame calls */
fame_parameters_t fp;
fame_yuv_t yuv;
char *buffer; /* temporary buffer for mpeg data */
/* temporary buffer for YUY2->YV12 conversion */
uint8_t *out[3]; /* aligned buffer for YV12 data */
uint8_t *buf; /* unaligned YV12 buffer */
} fame_data_t;
/* helper function */
static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv,
dxr3_frame_t *frame);
#endif
/* initialization function */
int dxr3_lavc_init(dxr3_driver_t *drv, plugin_node_t *node);
/* close function from encoder api */
static int lavc_on_close(dxr3_driver_t *drv);
#ifdef HAVE_LIBRTE
int dxr3_rte_init(dxr3_driver_t *drv)
{
rte_data_t* this;
if (!rte_init()) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to init librte\n"));
return 0;
}
this = xine_xmalloc(sizeof(rte_data_t));
if (!this) return 0;
this->encoder_data.type = ENC_RTE;
this->encoder_data.on_update_format = rte_on_update_format;
this->encoder_data.on_frame_copy = NULL;
this->encoder_data.on_display_frame = rte_on_display_frame;
this->encoder_data.on_unneeded = rte_on_unneeded;
this->encoder_data.on_close = rte_on_close;
this->context = 0;
drv->enc = &this->encoder_data;
return 1;
}
static int rte_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame)
{
rte_data_t *this = (rte_data_t *)drv->enc;
rte_context *context;
rte_codec *codec;
double fps;
if (this->context) { /* already running */
lprintf("closing current encoding context.\n");
rte_stop(this->context);
rte_context_destroy(this->context);
this->context = 0;
}
if ((frame->vo_frame.pitches[0] % 16 != 0) || (frame->oheight % 16 != 0)) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG,
_("dxr3_mpeg_encoder: rte only handles video dimensions which are multiples of 16\n"));
return 0;
}
this->width = frame->vo_frame.pitches[0];
this->height = frame->oheight;
/* create new rte context */
this->context = rte_context_new(this->width, this->height, "mp1e", drv);
if (!this->context) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: failed to get rte context.\n"));
return 0;
}
context = this->context; /* shortcut */
#if LOG_ENC
rte_set_verbosity(context, 2);
#endif
/* get mpeg codec handle */
codec = rte_codec_set(context, RTE_STREAM_VIDEO, 0, "mpeg1_video");
if (!codec) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG, _("dxr3_mpeg_encoder: could not create codec.\n"));
rte_context_destroy(context);
this->context = 0;
return 0;
}
this->rte_bitrate = drv->class->xine->config->register_range(drv->class->xine->config,
"dxr3.encoding.rte_bitrate", 10000, 1000, 20000,
_("rte mpeg output bitrate (kbit/s)"),
_("The bitrate the mpeg encoder library librte should use for DXR3's encoding mode. "
"Higher values will increase quality and CPU usage."), 10, NULL, NULL);
this->rte_bitrate *= 1000; /* config in kbit/s, rte wants bit/s */
/* FIXME: this needs to be replaced with a codec option call.
* However, there seems to be none for the colour format!
* So we'll use the deprecated set_video_parameters instead.
* Alternative is to manually set context->video_format (RTE_YU... )
* and context->video_bytes (= width * height * bytes/pixel)
*/
rte_set_video_parameters(context,
(frame->vo_frame.format == XINE_IMGFMT_YV12 ? RTE_YUV420 : RTE_YUYV),
context->width, context->height,
context->video_rate, context->output_video_bits,
context->gop_sequence);
/* Now set a whole bunch of codec options
* If I understand correctly, virtual_frame_rate is the frame rate
* of the source (can be anything), while coded_frame_rate must be
* one of the mpeg1 alloweds
*/
fps = 90000.0 / frame->vo_frame.duration;
if (!rte_option_set(codec, "virtual_frame_rate", fps))
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: WARNING: rte_option_set failed; virtual_frame_rate = %g.\n", fps);
if (!rte_option_set(codec, "coded_frame_rate", fps))
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: WARNING: rte_option_set failed; coded_frame_rate = %g.\n", fps);
if (!rte_option_set(codec, "bit_rate", (int)this->rte_bitrate))
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: WARNING: rte_option_set failed; bit_rate = %d.\n", (int)this->rte_bitrate);
if (!rte_option_set(codec, "gop_sequence", "I"))
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: WARNING: rte_option_set failed; gop_sequence = \"I\".\n");
/* just to be sure, disable motion comp (not needed in I frames) */
if (!rte_option_set(codec, "motion_compensation", 0))
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: WARNING: rte_option_set failed; motion_compensation = 0.\n");
rte_set_input(context, RTE_VIDEO, RTE_PUSH, FALSE, NULL, NULL, NULL);
rte_set_output(context, mp1e_callback, NULL, NULL);
if (!rte_init_context(context)) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG,
_("dxr3_mpeg_encoder: cannot init the context: %s\n"), context->error);
rte_context_destroy(context);
this->context = 0;
return 0;
}
/* do the sync'ing and start encoding */
if (!rte_start_encoding(context)) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG,
_("dxr3_mpeg_encoder: cannot start encoding: %s\n"), context->error);
rte_context_destroy(context);
this->context = 0;
return 0;
}
this->rte_ptr = rte_push_video_data(context, NULL, 0);
if (!this->rte_ptr) {
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: failed to get encoder buffer pointer.\n");
return 0;
}
return 1;
}
static int rte_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame)
{
int size;
rte_data_t* this = (rte_data_t *)drv->enc;
if ((this->width == frame->vo_frame.pitches[0]) && (this->height == frame->oheight)) {
/* This frame belongs to current context. */
size = frame->vo_frame.pitches[0] * frame->oheight;
if (frame->vo_frame.format == XINE_IMGFMT_YV12)
xine_fast_memcpy(this->rte_ptr, frame->real_base[0], size * 3/2);
else
xine_fast_memcpy(this->rte_ptr, frame->real_base[0], size * 2);
this->rte_ptr = rte_push_video_data(this->context, this->rte_ptr,
frame->vo_frame.vpts / 90000.0);
}
frame->vo_frame.free(&frame->vo_frame);
return 1;
}
static int rte_on_unneeded(dxr3_driver_t *drv)
{
rte_data_t *this = (rte_data_t *)drv->enc;
if (this->context) {
rte_stop(this->context);
rte_context_destroy(this->context);
this->context = 0;
}
return 1;
}
static int rte_on_close(dxr3_driver_t *drv)
{
rte_on_unneeded(drv);
free(drv->enc);
drv->enc = 0;
return 1;
}
static void mp1e_callback(rte_context *context, void *data, ssize_t size, void *user_data)
{
dxr3_driver_t *drv = (dxr3_driver_t *)user_data;
char tmpstr[128];
ssize_t written;
written = write(drv->fd_video, data, size);
if (written < 0) {
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: video device write failed (%s)\n", strerror(errno));
return;
}
if (written != size)
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n", written, size);
}
#endif
#ifdef HAVE_LIBFAME
int dxr3_fame_init(dxr3_driver_t *drv)
{
fame_data_t *this;
this = xine_xmalloc(sizeof(fame_data_t));
if (!this) return 0;
this->encoder_data.type = ENC_FAME;
this->encoder_data.on_update_format = fame_on_update_format;
this->encoder_data.on_frame_copy = NULL;
this->encoder_data.on_display_frame = fame_on_display_frame;
this->encoder_data.on_unneeded = fame_on_unneeded;
this->encoder_data.on_close = fame_on_close;
this->context = 0;
drv->enc = &this->encoder_data;
return 1;
}
static int fame_on_update_format(dxr3_driver_t *drv, dxr3_frame_t *frame)
{
fame_data_t *this = (fame_data_t *)drv->enc;
fame_parameters_t init_fp = FAME_PARAMETERS_INITIALIZER;
double fps;
if (this->buf) free(this->buf);
this->buf = 0;
this->out[0] = this->out[1] = this->out[2] = 0;
/* if YUY2 and dimensions changed, we need to re-allocate the
* internal YV12 buffer */
if (frame->vo_frame.format == XINE_IMGFMT_YUY2) {
int image_size = frame->vo_frame.width * frame->oheight;
this->out[0] = xine_xmalloc_aligned(16, image_size * 3/2,
(void *)&this->buf);
this->out[1] = this->out[0] + image_size;
this->out[2] = this->out[1] + image_size/4;
/* fill with black (yuv 16,128,128) */
memset(this->out[0], 16, image_size);
memset(this->out[1], 128, image_size/4);
memset(this->out[2], 128, image_size/4);
lprintf("Using YUY2->YV12 conversion\n");
}
if (this->context) {
lprintf("closing current encoding context.\n");
fame_close(this->context);
this->context = 0;
}
this->context = fame_open();
if (!this->context) {
xprintf(drv->class->xine, XINE_VERBOSITY_LOG,
_("dxr3_mpeg_encoder: Couldn't start the FAME library\n"));
return 0;
}
if (!this->buffer)
this->buffer = (unsigned char *)malloc(DEFAULT_BUFFER_SIZE);
if (!this->buffer) {
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: Couldn't allocate temp buffer for mpeg data\n");
return 0;
}
this->fp = init_fp;
this->fp.quality = drv->class->xine->config->register_range(drv->class->xine->config,
"dxr3.encoding.fame_quality", 90, 10, 100,
_("fame mpeg encoding quality"),
_("The encoding quality of the libfame mpeg encoder library. "
"Lower is faster but gives noticeable artifacts. Higher is better but slower."),
10, NULL,NULL);
/* the really interesting bit is the quantizer scale. The formula
* below is copied from libfame's sources (could be changed in the
* future) */
lprintf("quality %d -> quant scale = %d\n", this->fp.quality,
1 + (30 * (100 - this->fp.quality) + 50) / 100);
this->fp.width = frame->vo_frame.width;
this->fp.height = frame->oheight;
this->fp.profile = "mpeg1";
this->fp.coding = "I";
#if LOG_ENC
this->fp.verbose = 1;
#else
this->fp.verbose = 0;
#endif
/* start guessing the framerate */
fps = 90000.0 / frame->vo_frame.duration;
if (fps < 23.988) { /* NTSC-FILM */
lprintf("setting mpeg output framerate to NTSC-FILM (23.976 Hz)\n");
this->fp.frame_rate_num = 24000;
this->fp.frame_rate_den = 1001;
} else if (fps < 24.5) { /* FILM */
lprintf("setting mpeg output framerate to FILM (24 Hz)\n");
this->fp.frame_rate_num = 24;
this->fp.frame_rate_den = 1;
} else if (fps < 27.485) { /* PAL */
lprintf("setting mpeg output framerate to PAL (25 Hz)\n");
this->fp.frame_rate_num = 25;
this->fp.frame_rate_den = 1;
} else { /* NTSC */
lprintf("setting mpeg output framerate to NTSC (29.97 Hz)\n");
this->fp.frame_rate_num = 30000;
this->fp.frame_rate_den = 1001;
}
fame_init (this->context, &this->fp, this->buffer, DEFAULT_BUFFER_SIZE);
return 1;
}
static int fame_on_display_frame(dxr3_driver_t *drv, dxr3_frame_t *frame)
{
fame_data_t *this = (fame_data_t *)drv->enc;
char tmpstr[128];
ssize_t written;
int size;
if ((frame->vo_frame.width != this->fp.width) || (frame->oheight != this->fp.height)) {
/* probably an old frame for a previous context. ignore it */
frame->vo_frame.free(&frame->vo_frame);
return 1;
}
fame_prepare_frame(this, drv, frame);
#ifdef HAVE_NEW_LIBFAME
fame_start_frame(this->context, &this->yuv, NULL);
size = fame_encode_slice(this->context);
fame_end_frame(this->context, NULL);
#else
size = fame_encode_frame(this->context, &this->yuv, NULL);
#endif
frame->vo_frame.free(&frame->vo_frame);
written = write(drv->fd_video, this->buffer, size);
if (written < 0) {
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: video device write failed (%s)\n",
strerror(errno));
return 0;
}
if (written != size)
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: Could only write %d of %d mpeg bytes.\n",
written, size);
return 1;
}
static int fame_on_unneeded(dxr3_driver_t *drv)
{
fame_data_t *this = (fame_data_t *)drv->enc;
if (this->context) {
fame_close(this->context);
this->context = 0;
}
return 1;
}
static int fame_on_close(dxr3_driver_t *drv)
{
fame_on_unneeded(drv);
free(drv->enc);
drv->enc = 0;
return 1;
}
static int fame_prepare_frame(fame_data_t *this, dxr3_driver_t *drv, dxr3_frame_t *frame)
{
int i, j, w2;
uint8_t *y, *u, *v, *yuy2;
if (frame->vo_frame.bad_frame) return 1;
if (frame->vo_frame.format == XINE_IMGFMT_YUY2) {
/* need YUY2->YV12 conversion */
if (!(this->out[0] && this->out[1] && this->out[2]) ) {
xprintf(drv->class->xine, XINE_VERBOSITY_DEBUG,
"dxr3_mpeg_encoder: Internal YV12 buffer not created.\n");
return 0;
}
y = this->out[0] + frame->vo_frame.width * drv->top_bar;
u = this->out[1] + (frame->vo_frame.width / 2) * (drv->top_bar / 2);
v = this->out[2] + (frame->vo_frame.width / 2) * (drv->top_bar / 2);
yuy2 = frame->vo_frame.base[0];
w2 = frame->vo_frame.width / 2;
for (i = 0; i < frame->vo_frame.height; i += 2) {
for (j = 0; j < w2; j++) {
/* packed YUV 422 is: Y[i] U[i] Y[i+1] V[i] */
*(y++) = *(yuy2++);
*(u++) = *(yuy2++);
*(y++) = *(yuy2++);
*(v++) = *(yuy2++);
}
/* down sampling */
for (j = 0; j < w2; j++) {
/* skip every second line for U and V */
*(y++) = *(yuy2++);
yuy2++;
*(y++) = *(yuy2++);
yuy2++;
}
}
/* reset for encoder */
y = this->out[0];
u = this->out[1];
v = this->out[2];
}
else { /* YV12 */
y = frame->real_base[0];
u = frame->real_base[1];
v = frame->real_base[2];
}
this->yuv.y = y;
this->yuv.u = u;
this->yuv.v = v;
return 1;
}
#endif
int dxr3_lavc_init(dxr3_driver_t *drv, plugin_node_t *node)
{
void *ffmpeg;
int (*init)(dxr3_driver_t *);
int result;
ffmpeg = dlopen(node->filename, RTLD_LAZY);
if (!ffmpeg) return 0;
init = dlsym(ffmpeg, "dxr3_encoder_init");
if (!init) return 0;
result = init(drv);
/* the close function is implemented here, because it will call dlclose()
* and that should not be done be the library we are closing... */
drv->enc->on_close = lavc_on_close;
drv->enc->handle = ffmpeg;
return result;
}
static int lavc_on_close(dxr3_driver_t *drv)
{
drv->enc->on_unneeded(drv);
dlclose(drv->enc->handle);
free(drv->enc);
drv->enc = NULL;
return 1;
}
--- NEW FILE: video_out_dxr3.h ---
/*
* Copyright (C) 2000-2001 the xine project
*
* This file is part of xine, a unix video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: video_out_dxr3.h,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_X11
# include <X11/Xlib.h>
#endif
#include "xine_internal.h"
#include "vo_scale.h"
#include "dxr3_scr.h"
#include "dxr3.h"
#include "alphablend.h"
/* the number of supported encoders */
#define SUPPORTED_ENCODER_COUNT 3
/* plugin structures */
typedef struct encoder_data_s encoder_data_t;
typedef struct spu_encoder_s spu_encoder_t;
typedef enum { ENC_FAME, ENC_RTE, ENC_LAVC } encoder_type;
struct coeff {
float k,m;
};
typedef struct dxr3_overlay_s {
xine_t *xine;
int fd_control;
int xoffset;
int yoffset;
int xcorr;
int jitter;
int stability;
int colorkey;
float color_interval;
int screen_xres;
int screen_yres;
int screen_depth;
int shrink;
struct coeff colcal_upper[3];
struct coeff colcal_lower[3];
} dxr3_overlay_t;
typedef struct dxr3_driver_class_s {
video_driver_class_t video_driver_class;
xine_t *xine;
int visual_type;
int instance; /* we allow only one instance of this plugin */
int devnum;
dxr3_scr_t *scr; /* to provide dxr3 clocking */
} dxr3_driver_class_t;
typedef struct dxr3_driver_s {
vo_driver_t vo_driver;
dxr3_driver_class_t *class;
int fd_control;
pthread_mutex_t video_device_lock;
int fd_video;
pthread_mutex_t spu_device_lock;
int fd_spu; /* to access the relevant dxr3 devices */
int clut_cluttered; /* to tell spu decoder that it has to restore the palette */
int enhanced_mode;
int swap_fields; /* swap fields */
int add_bars; /* add black bars to correct a.r. */
int aspect;
int tv_mode;
int pan_scan;
int overlay_enabled;
int tv_switchable; /* can switch from overlay<->tvout */
int widescreen_enabled;
em8300_bcs_t bcs;
encoder_data_t *enc; /* mpeg encoder data */
spu_encoder_t *spu_enc; /* spu encoder */
int need_update; /* the mpeg encoder needs to be updated */
uint32_t video_iheight; /* input height (before adding black bars) */
uint32_t video_oheight; /* output height (after adding black bars) */
uint32_t video_width;
double video_ratio;
int video_aspect;
int top_bar; /* the height of the upper black bar */
vo_scale_t scale;
alphablend_t alphablend_extra_data;
dxr3_overlay_t overlay;
#ifdef HAVE_X11
Display *display;
Drawable win;
GC gc;
XColor black;
XColor key;
#endif
} dxr3_driver_t;
typedef struct dxr3_frame_s {
vo_frame_t vo_frame;
uint32_t oheight;
int aspect, pan_scan;
uint8_t *mem; /* allocated for YV12 or YUY2 buffers */
uint8_t *real_base[3]; /* yuv/yuy2 buffers in mem aligned on 16 */
int swap_fields; /* shifts Y buffer one line to exchange odd/even lines */
} dxr3_frame_t;
struct encoder_data_s {
encoder_type type;
int (*on_update_format)(dxr3_driver_t *, dxr3_frame_t *);
int (*on_frame_copy)(dxr3_driver_t *, dxr3_frame_t *, uint8_t **src);
int (*on_display_frame)(dxr3_driver_t *, dxr3_frame_t *);
int (*on_unneeded)(dxr3_driver_t *);
int (*on_close)(dxr3_driver_t *);
/* this is only used by the libavcodec encoder */
void *handle;
};
struct spu_encoder_s {
vo_overlay_t *overlay;
int need_reencode;
uint8_t *target;
int size;
int malloc_size;
uint32_t color[16];
uint8_t trans[4];
int map[OVL_PALETTE_SIZE];
uint32_t clip_color[16];
uint8_t clip_trans[4];
int clip_map[OVL_PALETTE_SIZE];
};
/* mpeg encoder plugins initialization functions */
#ifdef HAVE_LIBRTE
int dxr3_rte_init(dxr3_driver_t *);
#endif
#ifdef HAVE_LIBFAME
int dxr3_fame_init(dxr3_driver_t *);
#endif
int dxr3_lavc_init(dxr3_driver_t *, plugin_node_t *);
/* spu encoder functions */
spu_encoder_t *dxr3_spu_encoder_init(void);
void dxr3_spu_encode(spu_encoder_t *);
--- NEW FILE: dxr3_spu_encoder.c ---
/*
* Copyright (C) 2000-2004 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3_spu_encoder.c,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#define LOG_MODULE "dxr3_spu_encoder"
/* #define LOG_VERBOSE */
/* #define LOG */
#include "video_out_dxr3.h"
/* We use the following algorithm to reduce the given overlay palette
* to a spu palette with only four distinct colours:
* - create a histogram on the overlay palette
* - the color with the maximum histogram value becomes one spu color
* - modify the histogram so that the counts for colors very near to the
* chosen one are lowered; this is done by multiplying with a penalty
* function 1-1/(dist/DIST_COEFF + 1) where dist is the squared spatial
* distance between current color and chosen spu color
* - continue with the next maximum
* The used histogram modification function from above looks like that:
* ^
* 1 + ********
* | ******
* | ****
* | **
* | *
* 0 **--------------------> dist
*/
#define DIST_COEFF 1024.0
/* spu encoder function */
spu_encoder_t *dxr3_spu_encoder_init(void);
void dxr3_spu_encode(spu_encoder_t *this);
/* helper functions */
static void convert_palette(spu_encoder_t *this);
static void create_histogram(spu_encoder_t *this);
static void generate_clut(spu_encoder_t *this);
static void map_colors(spu_encoder_t *this);
static void convert_clut(spu_encoder_t *this);
static void convert_overlay(spu_encoder_t *this);
static void write_rle(spu_encoder_t *this, int *offset, int *higher_nibble, int length, int color);
static void write_byte(spu_encoder_t *this, int *offset, uint8_t byte);
static void write_nibble(spu_encoder_t *this, int *offset, int *higher_nibble, uint8_t nibble);
spu_encoder_t *dxr3_spu_encoder_init(void)
{
spu_encoder_t *this;
this = (spu_encoder_t *)malloc(sizeof(spu_encoder_t));
this->target = NULL;
this->need_reencode = 0;
this->malloc_size = 0;
lprintf("initialized\n");
return this;
}
void dxr3_spu_encode(spu_encoder_t *this)
{
if (!this->need_reencode || !this->overlay) return;
lprintf("overlay for encoding arrived.\n");
convert_palette(this);
create_histogram(this);
generate_clut(this);
map_colors(this);
convert_clut(this);
convert_overlay(this);
lprintf("overlay encoding completed\n");
}
static void convert_palette(spu_encoder_t *this)
{
int i, y, cb, cr, r, g, b;
if (!this->overlay->rgb_clut) {
for (i = 0; i < OVL_PALETTE_SIZE; i++) {
y = (this->overlay->color[i] >> 16) & 0xff;
cr = (this->overlay->color[i] >> 8) & 0xff;
cb = (this->overlay->color[i] ) & 0xff;
r = 1.164 * y + 1.596 * (cr - 128);
g = 1.164 * y - 0.813 * (cr - 128) - 0.392 * (cb - 128);
b = 1.164 * y + 2.017 * (cb - 128);
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
if (r > 0xff) r = 0xff;
if (g > 0xff) g = 0xff;
if (b > 0xff) b = 0xff;
this->overlay->color[i] = (r << 16) | (g << 8) | b;
}
this->overlay->rgb_clut = 1;
}
if (!this->overlay->clip_rgb_clut) {
for (i = 0; i < OVL_PALETTE_SIZE; i++) {
y = (this->overlay->clip_color[i] >> 16) & 0xff;
cr = (this->overlay->clip_color[i] >> 8) & 0xff;
cb = (this->overlay->clip_color[i] ) & 0xff;
r = 1.164 * y + 1.596 * (cr - 128);
g = 1.164 * y - 0.813 * (cr - 128) - 0.392 * (cb - 128);
b = 1.164 * y + 2.017 * (cb - 128);
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
if (r > 0xff) r = 0xff;
if (g > 0xff) g = 0xff;
if (b > 0xff) b = 0xff;
this->overlay->clip_color[i] = (r << 16) | (g << 8) | b;
}
this->overlay->clip_rgb_clut = 1;
}
}
static void create_histogram(spu_encoder_t *this)
{
rle_elem_t *rle;
int i, x, y, len, part;
for (i = 0; i < OVL_PALETTE_SIZE; i++)
this->map[i] = this->clip_map[i] = 0;
x = y = 0;
for (i = 0, rle = this->overlay->rle; i < this->overlay->num_rle; i++, rle++) {
len = rle->len;
if (y >= this->overlay->clip_top && y < this->overlay->clip_bottom) {
if (x < this->overlay->clip_left) {
part = (this->overlay->clip_left - x < len) ? (this->overlay->clip_left - x) : len;
this->map[rle->color] += part;
len -= part;
x += part;
}
if (x >= this->overlay->clip_left && x < this->overlay->clip_right) {
part = (this->overlay->clip_right - x < len) ? (this->overlay->clip_right - x) : len;
this->clip_map[rle->color] += part;
len -= part;
x += part;
}
}
this->map[rle->color] += len;
x += len;
if (x >= this->overlay->width) {
x = 0;
y++;
}
}
#ifdef LOG
for (i = 0; i < OVL_PALETTE_SIZE; i++)
if (this->map[i])
lprintf("histogram: color #%d 0x%.8x appears %d times\n",
i, this->overlay->color[i], this->map[i]);
for (i = 0; i < OVL_PALETTE_SIZE; i++)
if (this->clip_map[i])
lprintf("histogram: clip color #%d 0x%.8x appears %d times\n",
i, this->overlay->clip_color[i], this->clip_map[i]);
#endif
}
static void generate_clut(spu_encoder_t *this)
{
int i, max, spu_color;
double dist, diff;
/* find first maximum -> first spu color */
max = 0;
for (i = 1; i < OVL_PALETTE_SIZE; i++)
if (this->map[i] > this->map[max]) max = i;
this->color[0] = this->overlay->color[max];
this->trans[0] = this->overlay->trans[max];
for (spu_color = 1; spu_color < 4; spu_color++) {
/* modify histogram and find next maximum -> next spu color */
max = 0;
for (i = 0; i < OVL_PALETTE_SIZE; i++) {
/* subtract a correction based on the distance to the last spu color */
diff = ((this->overlay->color[i] ) & 0xff) - ((this->color[spu_color - 1] ) & 0xff);
dist = diff * diff;
diff = ((this->overlay->color[i] >> 8) & 0xff) - ((this->color[spu_color - 1] >> 8) & 0xff);
dist += diff * diff;
diff = ((this->overlay->color[i] >> 16) & 0xff) - ((this->color[spu_color - 1] >> 16) & 0xff);
dist += diff * diff;
diff = ((this->overlay->trans[i] ) ) - ((this->trans[spu_color - 1] ) );
dist += diff * diff;
this->map[i] *= 1 - 1.0 / (dist / DIST_COEFF + 1.0);
if (this->map[i] > this->map[max]) max = i;
}
this->color[spu_color] = this->overlay->color[max];
this->trans[spu_color] = this->overlay->trans[max];
}
#ifdef LOG
for (spu_color = 0; spu_color < 4; spu_color++)
lprintf("spu color %d: 0x%.8x, trans: %d\n", spu_color,
this->color[spu_color], this->trans[spu_color]);
#endif
/* now the same stuff again, this time for the palette of the clipping area */
/* find first maximum -> first spu color */
max = 0;
for (i = 1; i < OVL_PALETTE_SIZE; i++)
if (this->clip_map[i] > this->clip_map[max]) max = i;
this->clip_color[0] = this->overlay->clip_color[max];
this->clip_trans[0] = this->overlay->clip_trans[max];
for (spu_color = 1; spu_color < 4; spu_color++) {
/* modify histogram and find next maximum -> next spu color */
max = 0;
for (i = 0; i < OVL_PALETTE_SIZE; i++) {
/* subtract a correction based on the distance to the last spu color */
diff = ((this->overlay->clip_color[i] ) & 0xff) - ((this->clip_color[spu_color - 1] ) & 0xff);
dist = diff * diff;
diff = ((this->overlay->clip_color[i] >> 8) & 0xff) - ((this->clip_color[spu_color - 1] >> 8) & 0xff);
dist += diff * diff;
diff = ((this->overlay->clip_color[i] >> 16) & 0xff) - ((this->clip_color[spu_color - 1] >> 16) & 0xff);
dist += diff * diff;
diff = ((this->overlay->clip_trans[i] ) ) - ((this->clip_trans[spu_color - 1] ) );
dist += diff * diff;
this->clip_map[i] *= 1 - 1.0 / (dist / DIST_COEFF + 1.0);
if (this->clip_map[i] > this->clip_map[max]) max = i;
}
this->clip_color[spu_color] = this->overlay->clip_color[max];
this->clip_trans[spu_color] = this->overlay->clip_trans[max];
}
#ifdef LOG
for (spu_color = 0; spu_color < 4; spu_color++)
lprintf("spu clip color %d: 0x%.8x, trans: %d\n", spu_color,
this->clip_color[spu_color], this->clip_trans[spu_color]);
#endif
}
static void map_colors(spu_encoder_t *this)
{
int i, min, spu_color;
double dist, diff, min_dist;
/* for all colors in overlay palette find closest spu color */
for (i = 0; i < OVL_PALETTE_SIZE; i++) {
min = 0;
min_dist = DBL_MAX;
for (spu_color = 0; spu_color < 4; spu_color++) {
diff = ((this->overlay->color[i] ) & 0xff) - ((this->color[spu_color] ) & 0xff);
dist = diff * diff;
diff = ((this->overlay->color[i] >> 8) & 0xff) - ((this->color[spu_color] >> 8) & 0xff);
dist += diff * diff;
diff = ((this->overlay->color[i] >> 16) & 0xff) - ((this->color[spu_color] >> 16) & 0xff);
dist += diff * diff;
diff = ((this->overlay->trans[i] ) ) - ((this->trans[spu_color] ) );
dist += diff * diff;
if (dist < min_dist) {
min_dist = dist;
min = spu_color;
}
}
this->map[i] = min;
}
/* for all colors in overlay clip palette find closest spu color */
for (i = 0; i < OVL_PALETTE_SIZE; i++) {
min = 0;
min_dist = DBL_MAX;
for (spu_color = 0; spu_color < 4; spu_color++) {
diff = ((this->overlay->clip_color[i] ) & 0xff) - ((this->clip_color[spu_color] ) & 0xff);
dist = diff * diff;
diff = ((this->overlay->clip_color[i] >> 8) & 0xff) - ((this->clip_color[spu_color] >> 8) & 0xff);
dist += diff * diff;
diff = ((this->overlay->clip_color[i] >> 16) & 0xff) - ((this->clip_color[spu_color] >> 16) & 0xff);
dist += diff * diff;
diff = ((this->overlay->clip_trans[i] ) ) - ((this->clip_trans[spu_color] ) );
dist += diff * diff;
if (dist < min_dist) {
min_dist = dist;
min = spu_color;
}
}
this->clip_map[i] = min;
}
}
static void convert_clut(spu_encoder_t *this)
{
int i, r, g, b, y, cb, cr;
for (i = 0; i < 4; i++) {
r = (this->color[i] >> 16) & 0xff;
g = (this->color[i] >> 8) & 0xff;
b = (this->color[i] ) & 0xff;
y = 0.257 * r + 0.504 * g + 0.098 * b;
cr = 0.439 * r - 0.368 * g - 0.071 * b + 128;
cb = -0.148 * r - 0.291 * g + 0.439 * b + 128;
this->color[i] = (y << 16) | (cr << 8) | cb;
}
for (i = 4; i < 16; i++)
this->color[i] = 0x00008080;
for (i = 0; i < 4; i++) {
r = (this->clip_color[i] >> 16) & 0xff;
g = (this->clip_color[i] >> 8) & 0xff;
b = (this->clip_color[i] ) & 0xff;
y = 0.257 * r + 0.504 * g + 0.098 * b;
cr = 0.439 * r - 0.368 * g - 0.071 * b + 128;
cb = -0.148 * r - 0.291 * g + 0.439 * b + 128;
this->clip_color[i] = (y << 16) | (cr << 8) | cb;
}
for (i = 4; i < 16; i++)
this->clip_color[i] = 0x00008080;
}
static void convert_overlay(spu_encoder_t *this)
{
int offset = 0, field_start[2];
rle_elem_t *rle;
int field, i, len, part, x, y, higher_nibble = 1;
/* size will be determined later */
write_byte(this, &offset, 0x00);
write_byte(this, &offset, 0x00);
/* control sequence pointer will be determined later */
write_byte(this, &offset, 0x00);
write_byte(this, &offset, 0x00);
for (field = 0; field < 2; field++) {
write_byte(this, &offset, 0x00);
write_byte(this, &offset, 0x00);
lprintf("encoding field %d\n", field);
field_start[field] = offset;
x = y = 0;
for (i = 0, rle = this->overlay->rle; i < this->overlay->num_rle; i++, rle++) {
len = rle->len;
if ((y & 1) == field) {
if (y >= this->overlay->clip_top && y < this->overlay->clip_bottom) {
if (x < this->overlay->clip_left) {
part = (this->overlay->clip_left - x < len) ? (this->overlay->clip_left - x) : len;
write_rle(this, &offset, &higher_nibble, part, this->map[rle->color]);
len -= part;
x += part;
}
if (x >= this->overlay->clip_left && x < this->overlay->clip_right) {
part = (this->overlay->clip_right - x < len) ? (this->overlay->clip_right - x) : len;
write_rle(this, &offset, &higher_nibble, part, this->clip_map[rle->color]);
len -= part;
x += part;
}
}
write_rle(this, &offset, &higher_nibble, len, this->map[rle->color]);
}
x += len;
if (x >= this->overlay->width) {
if ((y & 1) == field && !higher_nibble)
write_nibble(this, &offset, &higher_nibble, 0);
x = 0;
y++;
}
}
}
/* we should be byte aligned here */
_x_assert(higher_nibble);
/* control sequence starts here */
this->target[2] = offset >> 8;
this->target[3] = offset & 0xff;
write_byte(this, &offset, 0x00);
write_byte(this, &offset, 0x00);
/* write pointer to end sequence */
write_byte(this, &offset, this->target[2]);
write_byte(this, &offset, this->target[3]);
/* write control sequence */
write_byte(this, &offset, 0x00);
/* clut indices */
write_byte(this, &offset, 0x03);
write_byte(this, &offset, 0x32);
write_byte(this, &offset, 0x10);
/* alpha information */
write_byte(this, &offset, 0x04);
write_nibble(this, &offset, &higher_nibble, this->trans[3] & 0xf);
write_nibble(this, &offset, &higher_nibble, this->trans[2] & 0xf);
write_nibble(this, &offset, &higher_nibble, this->trans[1] & 0xf);
write_nibble(this, &offset, &higher_nibble, this->trans[0] & 0xf);
/* on screen position */
lprintf("overlay position: x %d, y %d, width %d, height %d\n",
this->overlay->x, this->overlay->y, this->overlay->width, this->overlay->height);
write_byte(this, &offset, 0x05);
write_byte(this, &offset, this->overlay->x >> 4);
write_nibble(this, &offset, &higher_nibble, this->overlay->x & 0xf);
write_nibble(this, &offset, &higher_nibble, (this->overlay->x + this->overlay->width - 1) >> 8);
write_byte(this, &offset, (this->overlay->x + this->overlay->width - 1) & 0xff);
write_byte(this, &offset, this->overlay->y >> 4);
write_nibble(this, &offset, &higher_nibble, this->overlay->y & 0xf);
write_nibble(this, &offset, &higher_nibble, (this->overlay->y + this->overlay->height - 1) >> 8);
write_byte(this, &offset, (this->overlay->y + this->overlay->height - 1) & 0xff);
/* field pointers */
write_byte(this, &offset, 0x06);
write_byte(this, &offset, field_start[0] >> 8);
write_byte(this, &offset, field_start[0] & 0xff);
write_byte(this, &offset, field_start[1] >> 8);
write_byte(this, &offset, field_start[1] & 0xff);
/* end marker */
write_byte(this, &offset, 0xff);
if (offset & 1)
write_byte(this, &offset, 0xff);
/* write size information */
this->size = offset;
this->target[0] = offset >> 8;
this->target[1] = offset & 0xff;
}
static void write_rle(spu_encoder_t *this, int *offset, int *higher_nibble, int length, int color)
{
if (!length) return;
length <<= 2;
while (length > 0x03fc) {
write_nibble(this, offset, higher_nibble, 0x0);
write_nibble(this, offset, higher_nibble, 0x3);
write_nibble(this, offset, higher_nibble, 0xf);
write_nibble(this, offset, higher_nibble, 0xc | color);
length -= 0x03fc;
}
if ((length & ~0xc) == 0) {
write_nibble(this, offset, higher_nibble, length | color);
return;
}
if ((length & ~0x3c) == 0) {
write_nibble(this, offset, higher_nibble, length >> 4);
write_nibble(this, offset, higher_nibble, (length & 0xc) | color);
return;
}
if ((length & ~0xfc) == 0) {
write_nibble(this, offset, higher_nibble, 0x0);
write_nibble(this, offset, higher_nibble, length >> 4);
write_nibble(this, offset, higher_nibble, (length & 0xc) | color);
return;
}
if ((length & ~0x3fc) == 0) {
write_nibble(this, offset, higher_nibble, 0x0);
write_nibble(this, offset, higher_nibble, length >> 8);
write_nibble(this, offset, higher_nibble, (length >> 4) & 0xf);
write_nibble(this, offset, higher_nibble, (length & 0xc) | color);
return;
}
_x_abort();
}
static void write_byte(spu_encoder_t *this, int *offset, uint8_t byte)
{
if (*offset >= this->malloc_size)
this->target = realloc(this->target, this->malloc_size += 2048);
this->target[(*offset)++] = byte;
}
static void write_nibble(spu_encoder_t *this, int *offset, int *higher_nibble, uint8_t nibble)
{
if (*offset >= this->malloc_size)
this->target = realloc(this->target, this->malloc_size += 2048);
if (*higher_nibble) {
this->target[*offset] &= 0x0f;
this->target[*offset] |= nibble << 4;
*higher_nibble = 0;
} else {
this->target[*offset] &= 0xf0;
this->target[(*offset)++] |= nibble;
*higher_nibble = 1;
}
}
--- NEW FILE: video_out_dxr3.c ---
/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
[...1548 lines suppressed...]
this->add_bars = entry->num_value;
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
"video_out_dxr3: setting add_bars to correct aspect ratio to %s\n", (this->add_bars ? "on" : "off"));
}
static void dxr3_update_swap_fields(void *data, xine_cfg_entry_t *entry)
{
dxr3_driver_t *this = (dxr3_driver_t *)data;
this->swap_fields = entry->num_value;
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
"video_out_dxr3: setting swap fields to %s\n", (this->swap_fields ? "on" : "off"));
}
static void dxr3_update_enhanced_mode(void *data, xine_cfg_entry_t *entry)
{
dxr3_driver_t *this = (dxr3_driver_t *)data;
this->enhanced_mode = entry->num_value;
xprintf(this->class->xine, XINE_VERBOSITY_DEBUG,
"video_out_dxr3: setting enhanced encoding playback to %s\n", (this->enhanced_mode ? "on" : "off"));
}
--- NEW FILE: dxr3.h ---
/*
* Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: dxr3.h,v 1.1 2005/04/04 22:29:27 dsalt-guest Exp $
*/
#ifndef HAVE_DXR3_H
#define HAVE_DXR3_H
#include "em8300.h"
#include "xine_internal.h"
/* data for the device name config entry */
#define CONF_KEY "dxr3.device_number"
#define CONF_NAME _("DXR3 device number")
#define CONF_HELP _("If you have more than one DXR3 in your computer, you can specify which one to use here.")
/* image format used by dxr3_decoder to tag undecoded mpeg data */
#define XINE_IMGFMT_DXR3 (('3'<<24)|('R'<<16)|('X'<<8)|'D')
/* name of the dxr3 video out plugin
* (used by decoders to check for dxr3 presence) */
#define DXR3_VO_ID "dxr3"
#endif