diff options
Diffstat (limited to 'src/dxr3/dxr3_decode_spu.c')
-rw-r--r-- | src/dxr3/dxr3_decode_spu.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 90cfe4bed..07d342a10 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.c @@ -17,7 +17,7 @@ * 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.29 2003/01/02 12:00:52 mroi Exp $ + * $Id: dxr3_decode_spu.c,v 1.30 2003/01/13 18:09:54 mroi Exp $ */ /* dxr3 spu decoder plugin. @@ -100,9 +100,6 @@ typedef struct dxr3_spudec_class_s { spu_decoder_class_t spu_decoder_class; int instance; /* we allow only one instance of this plugin */ - - char devname[128]; - char devnum[3]; } dxr3_spudec_class_t; typedef struct dxr3_spudec_s { @@ -112,6 +109,8 @@ typedef struct dxr3_spudec_s { dxr3_driver_t *dxr3_vo; /* we need to talk to the video out */ xine_event_queue_t *event_queue; + char devname[128]; + char devnum[3]; int fd_spu; /* to access the dxr3 spu device */ dxr3_spu_stream_state_t spu_stream_state[MAX_SPU_STREAMS]; @@ -136,27 +135,10 @@ static void dxr3_swab_clut(int* clut); static void *dxr3_spudec_init_plugin(xine_t *xine, void* data) { dxr3_spudec_class_t *this; - const char *confstr; - int dashpos; this = (dxr3_spudec_class_t *)malloc(sizeof(dxr3_spudec_class_t)); if (!this) return NULL; - confstr = xine->config->register_string(xine->config, - CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); - strncpy(this->devname, confstr, 128); - this->devname[127] = '\0'; - dashpos = strlen(this->devname) - 2; /* the dash in the new device naming scheme would be here */ - if (this->devname[dashpos] == '-') { - /* use new device naming scheme with trailing number */ - strncpy(this->devnum, &this->devname[dashpos], 3); - this->devname[dashpos] = '\0'; - } else { - /* use old device naming scheme without trailing number */ - /* FIXME: remove this when everyone uses em8300 >=0.12.0 */ - this->devnum[0] = '\0'; - } - 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; @@ -172,6 +154,8 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi { dxr3_spudec_t *this; dxr3_spudec_class_t *class = (dxr3_spudec_class_t *)class_gen; + const char *confstr; + int dashpos; char tmpstr[128]; int i; @@ -194,12 +178,27 @@ static spu_decoder_t *dxr3_spudec_open_plugin(spu_decoder_class_t *class_gen, xi this->dxr3_vo = (dxr3_driver_t *)stream->video_driver; this->event_queue = xine_event_new_queue(stream); + confstr = stream->xine->config->register_string(stream->xine->config, + CONF_LOOKUP, CONF_DEFAULT, CONF_NAME, CONF_HELP, 0, NULL, NULL); + strncpy(this->devname, confstr, 128); + this->devname[127] = '\0'; + dashpos = strlen(this->devname) - 2; /* the dash in the new device naming scheme would be here */ + if (this->devname[dashpos] == '-') { + /* use new device naming scheme with trailing number */ + strncpy(this->devnum, &this->devname[dashpos], 3); + this->devname[dashpos] = '\0'; + } else { + /* use old device naming scheme without trailing number */ + /* FIXME: remove this when everyone uses em8300 >=0.12.0 */ + this->devnum[0] = '\0'; + } + 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), "%s_sp%s", class->devname, class->devnum); + snprintf(tmpstr, sizeof(tmpstr), "%s_sp%s", this->devname, this->devnum); if ((this->fd_spu = open(tmpstr, O_WRONLY)) < 0) { printf("dxr3_decode_spu: Failed to open spu device %s (%s)\n", tmpstr, strerror(errno)); |