static int control(uint32_t request, void *data, ...){
  switch (request) {
  case VOCTRL_FULLSCREEN:
    if(!vo_fs){vo_fs=1;ShowWindow(hWndFS,SW_SHOW);SetForegroundWindow(hWndFS);}
    else {vo_fs=0; ShowWindow(hWndFS,SW_HIDE);}
    break;
  case VOCTRL_QUERY_FORMAT:
    return query_format(*((uint32_t*)data));
  case VOCTRL_SET_EQUALIZER:
  {
    va_list ap;
    int value;

    va_start(ap, data);
    value = va_arg(ap, int);
    va_end(ap);

    return vidix_control(request, data, (int *)value);
  }
  case VOCTRL_GET_EQUALIZER:
  {
    va_list ap;
    int *value;

    va_start(ap, data);
    value = va_arg(ap, int*);
    va_end(ap);

    return vidix_control(request, data, value);
  }
  }
  return vidix_control(request, data);
//  return VO_NOTIMPL;
}
Example #2
0
static int control(uint32_t request, void *data)
{
    switch (request)
    {
        case VOCTRL_PAUSE:
            return int_pause = 1;
        case VOCTRL_RESUME:
            return int_pause = 0;
        case VOCTRL_QUERY_FORMAT:
            return query_format(*((uint32_t *) data));
        case VOCTRL_GET_IMAGE:
            return get_image(data);
        case VOCTRL_FULLSCREEN:
            vo_x11_fullscreen();
            vo_x11_clearwindow(mDisplay, vo_window);
            return VO_TRUE;
        case VOCTRL_SET_EQUALIZER:
            {
                struct voctrl_set_equalizer_args *args = data;
                return vo_x11_set_equalizer(args->name, args->value);
            }
        case VOCTRL_GET_EQUALIZER:
            {
                struct voctrl_get_equalizer_args *args = data;
                return vo_x11_get_equalizer(args->name, args->valueptr);
            }
        case VOCTRL_ONTOP:
            vo_x11_ontop();
            return VO_TRUE;
        case VOCTRL_UPDATE_SCREENINFO:
            update_xinerama_info();
            return VO_TRUE;
    }
    return VO_NOTIMPL;
}
Example #3
0
static int control(uint32_t request, void *data) {
	switch (request) {
		case VOCTRL_QUERY_FORMAT:
			return query_format(*((uint32_t*)data));
  		}
  	return VO_NOTIMPL;
}
Example #4
0
static int control(uint32_t request, void *data, ...)
{
    switch (request) {
        case VOCTRL_QUERY_FORMAT:
            return query_format(*((uint32_t*)data));
        case VOCTRL_FULLSCREEN: {
            if (WinID > 0) return VO_FALSE;
            if (fullscreen_flag) {
                if (!fb_overlay_only)
                    vo_x11_fullscreen();
                fullscreen_flag = 0;
                omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1);
            } else {
                if (!fb_overlay_only)
                    vo_x11_fullscreen();
                fullscreen_flag = 1;
                omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1);
            }
            return VO_TRUE;
        }
        case VOCTRL_UPDATE_SCREENINFO:
            update_xinerama_info();
            return VO_TRUE;
    }
    return VO_NOTIMPL;
}
Example #5
0
// to set/get/query special features/parameters
static int control(sh_video_t *sh, int cmd, void* arg, ...) {
	switch (cmd) {
		case VDCTRL_QUERY_FORMAT:
			return query_format(sh, *((unsigned int*)arg));
	}
	return CONTROL_UNKNOWN;
}
Example #6
0
File: vo_xv.c Project: kax4/mpv
static int control(struct vo *vo, uint32_t request, void *data)
{
    struct xvctx *ctx = vo->priv;
    struct vo_x11_state *x11 = vo->x11;
    switch (request) {
    case VOCTRL_PAUSE:
        return (ctx->is_paused = 1);
    case VOCTRL_RESUME:
        return (ctx->is_paused = 0);
    case VOCTRL_QUERY_FORMAT:
        return query_format(ctx, *((uint32_t *) data));
    case VOCTRL_DRAW_IMAGE:
        return draw_image(vo, data);
    case VOCTRL_GET_PANSCAN:
        return VO_TRUE;
    case VOCTRL_FULLSCREEN:
        vo_x11_fullscreen(vo);
        /* indended, fallthrough to update panscan on fullscreen/windowed switch */
    case VOCTRL_SET_PANSCAN:
        resize(vo);
        return VO_TRUE;
    case VOCTRL_SET_EQUALIZER: {
        vo->want_redraw = true;
        struct voctrl_set_equalizer_args *args = data;
        return vo_xv_set_eq(vo, x11->xv_port, args->name, args->value);
    }
    case VOCTRL_GET_EQUALIZER: {
        struct voctrl_get_equalizer_args *args = data;
        return vo_xv_get_eq(vo, x11->xv_port, args->name, args->valueptr);
    }
    case VOCTRL_SET_YUV_COLORSPACE:;
        struct mp_csp_details* given_cspc = data;
        int is_709 = given_cspc->format == MP_CSP_BT_709;
        vo_xv_set_eq(vo, x11->xv_port, "bt_709", is_709 * 200 - 100);
        read_xv_csp(vo);
        vo->want_redraw = true;
        return true;
    case VOCTRL_GET_YUV_COLORSPACE:;
        struct mp_csp_details* cspc = data;
        read_xv_csp(vo);
        *cspc = ctx->cached_csp;
        return true;
    case VOCTRL_ONTOP:
        vo_x11_ontop(vo);
        return VO_TRUE;
    case VOCTRL_UPDATE_SCREENINFO:
        update_xinerama_info(vo);
        return VO_TRUE;
    case VOCTRL_REDRAW_FRAME:
        return redraw_frame(vo);
    case VOCTRL_SCREENSHOT: {
        struct voctrl_screenshot_args *args = data;
        args->out_image = get_screenshot(vo);
        return true;
    }
    }
    return VO_NOTIMPL;
}
Example #7
0
static int control(uint32_t request, void *data)
{
  if (request == VOCTRL_GET_IMAGE)
    return get_image(data);
  else if (request == VOCTRL_QUERY_FORMAT)
    return query_format(*((uint32_t*) data));

  return VO_NOTIMPL;
}
Example #8
0
static int control(uint32_t request, void *data, ...) {
	switch (request) {
  		case VOCTRL_QUERY_FORMAT:
			return query_format(*((uint32_t*)data));
		case VOCTRL_DRAW_IMAGE:
			return draw_image(data);
  	}
	return VO_NOTIMPL;
}
Example #9
0
static int control(uint32_t request, void *data)
{
    switch (request) {
    case VOCTRL_GET_IMAGE:
        return get_image(data);
    case VOCTRL_QUERY_FORMAT:
        return query_format(*(uint32_t*)data);
    }

    return VO_NOTIMPL;
}
Example #10
0
static int control(struct vo *vo, uint32_t request, void *data)
{
    switch (request) {
    case VOCTRL_QUERY_FORMAT:
        return query_format(*((uint32_t *)data));
    case VOCTRL_DRAW_IMAGE:
        return draw_image(vo, data);
    default:
        return VO_NOTIMPL;
    }
}
static int control(uint32_t request, void *data){
  switch (request) {
  case VOCTRL_FULLSCREEN:
    if(!vo_fs){vo_fs=1;ShowWindow(hWndFS,SW_SHOW);SetForegroundWindow(hWndFS);}
    else {vo_fs=0; ShowWindow(hWndFS,SW_HIDE);}
    break;
  case VOCTRL_QUERY_FORMAT:
    return query_format(*((uint32_t*)data));
  }
  return vidix_control(request, data);
//  return VO_NOTIMPL;
}
Example #12
0
static int control(uint32_t request, void *data)
{
  switch (request) {
  case VOCTRL_QUERY_FORMAT:
    return query_format(*((uint32_t*)data));
  case VOCTRL_UPDATE_SCREENINFO:
    vo_screenwidth  = fb_vinfo.xres;
    vo_screenheight = fb_vinfo.yres;
    aspect_save_screenres(vo_screenwidth, vo_screenheight);
    return VO_TRUE;
  }
  return VO_NOTIMPL;
}
Example #13
0
		db_table::list_column_t db_table::list_column()
		{
			column_t column;
			list_column_t list_column;
			std::string query(QUERY_SHOW_COLUMNS);
			auto rset = _dbq.perform(query_format(query))[0];

			for (auto& record : rset.list_record())
			{
				column.name = record[0]; // Field
				list_column.push_back(column);
			}
			return list_column;
		}
Example #14
0
static int control(uint32_t request, void *data)
{
    switch (request) {
    case VOCTRL_PAUSE:
    case VOCTRL_RESUME:
        int_pause = (request == VOCTRL_PAUSE);
        return VO_TRUE;
    case VOCTRL_QUERY_FORMAT:
        return query_format(*(uint32_t*)data);
    case VOCTRL_ONTOP:
        glctx.ontop();
        return VO_TRUE;
    case VOCTRL_FULLSCREEN:
        glctx.fullscreen();
        matrixview_reshape(vo_dwidth, vo_dheight);
        return VO_TRUE;
    case VOCTRL_BORDER:
        glctx.border();
        return VO_TRUE;
    case VOCTRL_GET_EQUALIZER:
        {
            vf_equalizer_t *eq=data;

            if (strcasecmp(eq->item, "contrast") == 0) {
                eq->value = eq_contrast;
            } else if (strcasecmp(eq->item, "brightness") == 0) {
                eq->value = eq_brightness;
            }
        }
        return VO_TRUE;
    case VOCTRL_SET_EQUALIZER:
        {
            vf_equalizer_t *eq=data;
            if (strcasecmp(eq->item, "contrast") == 0) {
                contrast_set(eq->value);
            } else if (strcasecmp(eq->item, "brightness") == 0) {
                brightness_set(eq->value);
            }
        }
        return VO_TRUE;
    case VOCTRL_UPDATE_SCREENINFO:
        glctx.update_xinerama_info();
        return VO_TRUE;
    case VOCTRL_GUI_RESIZE:
        matrixview_reshape(vo_dwidth, vo_dheight);
        return VO_TRUE;
    }
    return VO_NOTIMPL;
}
Example #15
0
static int control(uint32_t request, void *data, ...)
{
    switch (request)
    {
        case VOCTRL_PAUSE:
            return int_pause = 1;
        case VOCTRL_RESUME:
            return int_pause = 0;
        case VOCTRL_QUERY_FORMAT:
            return query_format(*((uint32_t *) data));
        case VOCTRL_GET_IMAGE:
            return get_image(data);
        case VOCTRL_GUISUPPORT:
            return VO_TRUE;
        case VOCTRL_FULLSCREEN:
            vo_x11_fullscreen();
            vo_x11_clearwindow(mDisplay, vo_window);
            return VO_TRUE;
        case VOCTRL_SET_EQUALIZER:
            {
                va_list ap;
                int value;

                va_start(ap, data);
                value = va_arg(ap, int);

                va_end(ap);
                return vo_x11_set_equalizer(data, value);
            }
        case VOCTRL_GET_EQUALIZER:
            {
                va_list ap;
                int *value;

                va_start(ap, data);
                value = va_arg(ap, int *);

                va_end(ap);
                return vo_x11_get_equalizer(data, value);
            }
        case VOCTRL_ONTOP:
            vo_x11_ontop();
            return VO_TRUE;
        case VOCTRL_UPDATE_SCREENINFO:
            update_xinerama_info();
            return VO_TRUE;
    }
    return VO_NOTIMPL;
}
Example #16
0
static int control(uint32_t request, void *data, ...)
{
    switch (request) {
    case VOCTRL_QUERY_FORMAT:
        return query_format(*((uint32_t *) data));
    case VOCTRL_GET_IMAGE:
        return get_image(data);
#ifdef HAVE_GGIWMH
    case VOCTRL_ONTOP:
        vo_ontop = (!(vo_ontop));
        window_ontop();
        return VO_TRUE;
#endif
    }
    return VO_NOTIMPL;
}
/** @brief libvo Callback: Handle control requests.
 *  @return VO_TRUE on success, VO_NOTIMPL when not implemented
 */
static int control(uint32_t request, void *data, ...)
{
    switch (request) {
    case VOCTRL_QUERY_FORMAT:
        return query_format(*(uint32_t*) data);
    case VOCTRL_GET_IMAGE: /* Direct Rendering. Not implemented yet. */
        mp_msg(MSGT_VO, MSGL_V,
               "<vo_direct3d>Direct Rendering request. Not implemented yet.\n");
        return VO_NOTIMPL;
    case VOCTRL_DRAW_IMAGE:
        return render_d3d_frame(data);
    case VOCTRL_FULLSCREEN:
        vo_w32_fullscreen();
        resize_d3d();
        return VO_TRUE;
    case VOCTRL_RESET:
        return VO_NOTIMPL;
    case VOCTRL_PAUSE:
        priv->is_paused = 1;
        return VO_TRUE;
    case VOCTRL_RESUME:
        priv->is_paused = 0;
        return VO_TRUE;
    case VOCTRL_GUISUPPORT:
        return VO_NOTIMPL;
    case VOCTRL_SET_EQUALIZER:
        return VO_NOTIMPL;
    case VOCTRL_GET_EQUALIZER:
        return VO_NOTIMPL;
    case VOCTRL_ONTOP:
        vo_w32_ontop();
        return VO_TRUE;
    case VOCTRL_BORDER:
        vo_w32_border();
        resize_d3d();
        return VO_TRUE;
    case VOCTRL_UPDATE_SCREENINFO:
        w32_update_xinerama_info();
        return VO_TRUE;
    case VOCTRL_SET_PANSCAN:
        calc_fs_rect();
        return VO_TRUE;
    case VOCTRL_GET_PANSCAN:
        return VO_TRUE;
    }
    return VO_FALSE;
}
Example #18
0
static int control(uint32_t request, void *data)
{
  switch (request) {
  	case VOCTRL_QUERY_FORMAT:
  	{
    	return query_format(*((uint32_t*)data));
  	}
    case VOCTRL_FULLSCREEN: 
    {
    	vo_fs = !vo_fs;
      	if(haiku_wnd)
	       	haiku_wnd->SetFullscreen(vo_fs);
      	return VO_TRUE; 
	}
  }
  return VO_NOTIMPL;
}
static int
control (uint32_t request, void *data)
{
  switch (request)
  {
  case VOCTRL_PAUSE:
  case VOCTRL_RESUME:
    return ivtv_reset (0);

  case VOCTRL_RESET:
    return ivtv_reset (1);

  case VOCTRL_QUERY_FORMAT:
    return query_format (*((uint32_t*) data));
  }

  return VO_NOTIMPL;
}
Example #20
0
static int control(uint32_t request, void *data, ...)
{
  switch (request) {
    case VOCTRL_QUERY_FORMAT:
      return query_format(*((uint32_t*)data));
    case VOCTRL_DRAW_IMAGE:
      return svga_draw_image( (mp_image_t *)data);
    case VOCTRL_GET_IMAGE:
      return get_image(data);
  }

#ifdef CONFIG_VIDIX
  if (vidix_name) {
    switch (request) {
    case VOCTRL_SET_EQUALIZER:
    {
      va_list ap;
      int value;
    
      va_start(ap, data);
      value = va_arg(ap, int);
      va_end(ap);

      return vidix_control(request, data, value);
    }
    case VOCTRL_GET_EQUALIZER:
    {
      va_list ap;
      int *value;
    
      va_start(ap, data);
      value = va_arg(ap, int*);
      va_end(ap);

      return vidix_control(request, data, value);
    }
    }
    return vidix_control(request, data);
  }
#endif

  return VO_NOTIMPL;
}
Example #21
0
static int control(uint32_t request, void *data, ...)
{
	switch (request) {
		case VOCTRL_QUERY_FORMAT:
			return query_format(*((uint32_t *)data));
		case VOCTRL_DRAW_IMAGE:
			return draw_image(data);
		case VOCTRL_FULLSCREEN:
			vo_fs = !vo_fs;
			resize();
			return VO_TRUE;
		case VOCTRL_GET_PANSCAN:
			return VO_TRUE;
		case VOCTRL_SET_PANSCAN:
			resize();
			return VO_TRUE;
		default:
			return VO_NOTIMPL;
	}
}
Example #22
0
File: vo_x11.c Project: kax4/mpv
static int control(struct vo *vo, uint32_t request, void *data)
{
    struct priv *p = vo->priv;
    switch (request) {
    case VOCTRL_PAUSE:
        return p->int_pause = 1;
    case VOCTRL_RESUME:
        return p->int_pause = 0;
    case VOCTRL_QUERY_FORMAT:
        return query_format(vo, *((uint32_t *) data));
    case VOCTRL_FULLSCREEN:
        vo_x11_fullscreen(vo);
        vo_x11_clearwindow(vo, vo->x11->window);
        return VO_TRUE;
    case VOCTRL_SET_EQUALIZER:
    {
        struct voctrl_set_equalizer_args *args = data;
        return vo_x11_set_equalizer(vo, args->name, args->value);
    }
    case VOCTRL_GET_EQUALIZER:
    {
        struct voctrl_get_equalizer_args *args = data;
        return vo_x11_get_equalizer(args->name, args->valueptr);
    }
    case VOCTRL_ONTOP:
        vo_x11_ontop(vo);
        return VO_TRUE;
    case VOCTRL_UPDATE_SCREENINFO:
        update_xinerama_info(vo);
        return VO_TRUE;
    case VOCTRL_REDRAW_FRAME:
        return redraw_frame(vo);
    case VOCTRL_SCREENSHOT: {
        struct voctrl_screenshot_args *args = data;
        args->out_image = get_screenshot(vo);
        return true;
    }
    }
    return VO_NOTIMPL;
}
Example #23
0
static int config(struct vf_instance_s* vf,
        int width, int height, int d_width, int d_height,
	unsigned int flags, unsigned int outfmt){

    if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0))
    {
	mp_msg(MSGT_CPLAYER, MSGL_ERR, "VO: invalid dimensions!\n");
	return 0;
    }

  if(video_out->info)
  { const vo_info_t *info = video_out->info;
    mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
         width, height,
         d_width, d_height,
	 vo_format_name(outfmt),
         (flags&VOFLAG_FULLSCREEN)?" [fs]":"",
         (flags&VOFLAG_MODESWITCHING)?" [vm]":"",
         (flags&VOFLAG_SWSCALE)?" [zoom]":"",
         (flags&VOFLAG_FLIPPING)?" [flip]":"");
    mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Description: %s\n",info->name);
    mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
    if(info->comment && strlen(info->comment) > 0)
        mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
  }

    // save vo's stride capability for the wanted colorspace:
    vf->default_caps=query_format(vf,outfmt);

    if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
	return 0;

#ifdef USE_ASS
    if (vf->priv->ass_priv)
	ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED));
#endif

    ++vo_config_count;
    return 1;
}
Example #24
0
static int control(uint32_t request, void *data, ...)
{
  switch (request) {
  case VOCTRL_QUERY_FORMAT:
    return query_format(*((uint32_t*)data));
  case VOCTRL_GET_IMAGE:
    return get_image(data);
  case VOCTRL_DRAW_IMAGE:
    return draw_image(data);
  case VOCTRL_START_SLICE:
    return start_slice(data);
  case VOCTRL_FULLSCREEN:
    return fullscreen();
  case VOCTRL_XOVERLAY_SUPPORT:
    return VO_TRUE;
  case VOCTRL_XOVERLAY_SET_COLORKEY:
    return set_colorkey(data);
  case VOCTRL_XOVERLAY_SET_WIN:
    return set_window(data);
  }
  return VO_NOTIMPL;
}
Example #25
0
int emu10k1_wavein_setformat(struct emu10k1_wavedevice *wave_dev, struct wave_format *format)
{
	struct emu10k1_card *card = wave_dev->card;
	struct wiinst *wiinst = wave_dev->wiinst;
	u16 delay;

	DPF(2, "emu10k1_wavein_setformat()\n");

	if (wiinst->state & WAVE_STATE_STARTED)
		return -1;

	query_format(wiinst->recsrc, format);

	if ((wiinst->format.samplingrate != format->samplingrate)
	    || (wiinst->format.bitsperchannel != format->bitsperchannel)
	    || (wiinst->format.channels != format->channels)) {

		wiinst->format = *format;

		if (wiinst->state == WAVE_STATE_CLOSED)
			return 0;

		wiinst->buffer.size *= wiinst->buffer.cov;

		if (wiinst->format.bytesperchannel == 1) {
			wiinst->buffer.cov = 2;
			wiinst->buffer.size /= wiinst->buffer.cov;
		} else
			wiinst->buffer.cov = 1;

		emu10k1_timer_uninstall(card, &wiinst->timer);

		delay = (48000 * wiinst->buffer.fragment_size) / wiinst->format.bytespersec;

		emu10k1_timer_install(card, &wiinst->timer, delay / 2);
	}

	return 0;
}
Example #26
0
static int config(struct vf_instance *vf,
                  int width, int height, int d_width, int d_height,
                  unsigned int flags, unsigned int outfmt)
{

    if ((width <= 0) || (height <= 0) || (d_width <= 0) || (d_height <= 0)) {
        mp_msg(MSGT_CPLAYER, MSGL_ERR, "VO: invalid dimensions!\n");
        return 0;
    }

    const vo_info_t *info = video_out->driver->info;
    mp_msg(MSGT_CPLAYER, MSGL_INFO, "VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",
           info->short_name,
           width, height,
           d_width, d_height,
           vo_format_name(outfmt),
           (flags & VOFLAG_FULLSCREEN) ? " [fs]" : "",
           (flags & VOFLAG_MODESWITCHING) ? " [vm]" : "",
           (flags & VOFLAG_SWSCALE) ? " [zoom]" : "",
           (flags & VOFLAG_FLIPPING) ? " [flip]" : "");
    mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Description: %s\n", info->name);
    mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Author: %s\n", info->author);
    if (info->comment && strlen(info->comment) > 0)
        mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Comment: %s\n", info->comment);

    // save vo's stride capability for the wanted colorspace:
    vf->default_caps = query_format(vf, outfmt);
    vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;

    if (vo_config(video_out, width, height, d_width, d_height, flags, outfmt))
        return 0;

    vf->priv->scale_ratio = (double) d_width / d_height * height / width;

    return 1;
}
Example #27
0
		std::string db_table::query_select_all() const
		{
			std::string query(QUERY_SELECT_ALL);
			return query_format(query);
		}
Example #28
0
int main(int argc, char * const argv[]) {
	struct soap soap, soap_comm;
	struct _jpelem__QueryJobs qj;
	char *server, *example_file, *query_file, *test_file;
	const char *prog_name;
	int retval, opt, example_fd, query_fd, test_fd;
	format_t format = FORMAT_XML;

	prog_name = server = NULL;
	example_file = query_file = test_file = NULL;
	query_fd = example_fd = test_fd = -1;
	retval = 1;

	soap_init(&soap);
	soap_set_namespaces(&soap, jp__namespaces);

	/* 
	 * Soap with registered plugin can't be used for reading XML.
	 * For communications with JP IS glite_gsplugin needs to be registered yet.
	 */
	soap_init(&soap_comm);
	soap_set_namespaces(&soap_comm, jp__namespaces);
	soap_register_plugin(&soap_comm, glite_gsplugin);

	/* program name */
	prog_name = strrchr(argv[0], '/');
	if (prog_name) prog_name++;
	else prog_name = argv[0];

	if (argc <= 1) {
		usage(prog_name);
		goto cleanup;
	}

	/* handle arguments */
	while ((opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF) switch (opt) {
		case 'i': 
			free(server);
			server = strdup(optarg);
			break;
		case 'e':
			free(example_file);
			example_file = strdup(optarg);
			break;
		case 'q':
			free(query_file);
			query_file = strdup(optarg);
			break;
		case 't':
			free(test_file);
			test_file = strdup(optarg);
			break;
		case 'f':
			if (strcasecmp(optarg, "xml") == 0) format = FORMAT_XML;
			else if (strcasecmp(optarg, "strippedxml") == 0) format = FORMAT_STRIPPEDXML;
			else format = FORMAT_HR;
			break;
		default:
			usage(prog_name);
			goto cleanup;
	}
	if (optind < argc) {
		usage(prog_name);
		goto cleanup;
	}
	if (!server) server = strdup(DEFAULT_JPIS);
#ifdef SOAP_XML_INDENT
	if (format != FORMAT_STRIPPEDXML) soap_omode(&soap, SOAP_XML_INDENT);
#endif


	/* prepare steps according to the arguments */
	if (query_file) {
		if (strcmp(query_file, "-") == 0) query_fd = STDIN_FILENO;
		else if ((query_fd = open(query_file, 0)) < 0) {
			fprintf(stderr, "error opening %s: %s\n", query_file, strerror(errno));
			goto cleanup;
		}
		free(query_file);
		query_file = NULL;
	}
	if (example_file) {
		if (strcmp(example_file, "-") == 0) example_fd = STDOUT_FILENO;
		else if ((example_fd = creat(example_file, S_IREAD | S_IWRITE | S_IRGRP)) < 0) {
			fprintf(stderr, "error creating %s: %s\n", example_file, strerror(errno));
			goto cleanup;
		}
		free(example_file);
		example_file = NULL;
	}
	if (test_file) {
		if (strcmp(test_file, "-") == 0) test_fd = STDIN_FILENO;
		else if ((test_fd = open(test_file, 0)) < 0) {
			fprintf(stderr, "error opening %s: %s\n", test_file, strerror(errno));
			goto cleanup;
		}
		free(test_file);
		test_file = NULL;
	}

	/* the dump action */
	if (example_fd >= 0) {
		if (query_example_dump(&soap, example_fd) != 0) {
			fprintf(stderr, "Error dumping example query XML.\n");
		}
	}

	/* the test XML file action */
	if (test_fd >= 0) {
		soap_begin(&soap);
		if (query_recv(&soap, test_fd, &qj) != 0) {
			fprintf(stderr, "test: Error getting query XML\n");
		} else {
			query_format(&soap, format, stdout, &qj);
		}
		soap_end(&soap);
	}

	/* query action */
	if (query_fd >= 0) {
		struct _jpelem__QueryJobs in;
		struct _jpelem__QueryJobsResponse out;
		int ret;

		soap_begin(&soap);
		memset(&in, 0, sizeof(in));
		memset(&out, 0, sizeof(out));
		/* 
		 * Right way would be copy data from client query structure to IS query
		 * structure. Just ugly retype to client here.
		 */
		if (query_recv(&soap, query_fd, (struct _jpelem__QueryJobs *)&in) != 0) {
			fprintf(stderr, "query: Error getting query XML\n");
		} else {
			fprintf(stderr, "query: using JPIS %s\n\n", server);
			query_print(stderr, &in);
			fprintf(stderr, "\n");
			soap_begin(&soap_comm);
			ret = check_fault(&soap_comm, soap_call___jpsrv__QueryJobs(&soap_comm, server, "", &in, &out));
			if (ret == 0) {
				queryresult_format(&soap, format, stdout, (struct _jpelem__QueryJobsResponse *)&out);
			} else {
				soap_end(&soap_comm);
				soap_end(&soap);
				goto cleanup;
			}
			soap_end(&soap_comm);
		}
		soap_end(&soap);
	}

	retval = 0;

cleanup:
	soap_done(&soap);
	soap_done(&soap_comm);
	if (example_fd > STDERR_FILENO) close(example_fd);
	if (query_fd > STDERR_FILENO) close(query_fd);
	if (test_fd > STDERR_FILENO) close(test_fd);
	free(server);
	free(example_file);
	free(query_file);
	free(test_file);

	return retval;
}
Example #29
0
static int config(uint32_t width, uint32_t height, uint32_t d_width,
	uint32_t d_height, uint32_t flags, char *title, uint32_t format) {
	int fields = 1, top_first = 1, err = 0;
	int stretchx = 1, stretchy = 1;
	struct mjpeg_params zptmp;
	vo_zr2_priv_t *p = &priv;
	VERBOSE("config() called\n");

	/* paranoia check */
	if (!query_format(format)) {
		ERROR("called with wrong format, should be impossible\n");
		return 1;
	}

	if ((int)height > p->vc.maxheight) {
		ERROR("input height %d is too large, maxheight=%d\n",
				height, p->vc.maxheight);
		err = 1;
	}

	if (format != IMGFMT_ZRMJPEGNI) {
		fields = 2;
		if (format == IMGFMT_ZRMJPEGIB)
			top_first = 0;
	} else if ((int)height > p->vc.maxheight/2) {
		ERROR("input is too high (%d) for non-interlaced playback"
				"max=%d\n", height, p->vc.maxheight);
		err = 1;
	}

	if (width%16 != 0) {
		ERROR("input width=%d, must be multiple of 16\n", width);
		err = 1;
	}

	if (height%(fields*8) != 0) {
		ERROR("input height=%d, must be multiple of %d\n",
				height, 2*fields);
		err = 1;
	}

	/* we assume sample_aspect = 1 */
	if (fields == 1) {
		if (2*d_width <= (uint32_t)p->vc.maxwidth) {
			VERBOSE("stretching x direction to preserve aspect\n");
			d_width *= 2;
		} else VERBOSE("unable to preserve aspect, screen width "
					"too small\n");
	}

	if (d_width == width) stretchx = 1;
	else if (d_width == 2*width) stretchx = 2;
#if 0 /* do minimal stretching for now */
	else if (d_width == 4*width) stretchx = 4;
	else WARNING("d_width must be {1,2,4}*width, using defaults\n");

	if (d_height == height) stretchy = 1;
	else if (d_height == 2*height) stretchy = 2;
	else if (d_height == 4*height) stretchy = 4;
	else WARNING("d_height must be {1,2,4}*height, using defaults\n");
#endif

	if (stretchx*width > (uint32_t)p->vc.maxwidth) {
		ERROR("movie to be played is too wide, width=%d>maxwidth=%d\n",
				width*stretchx, p->vc.maxwidth);
		err = 1;
	}

	if (stretchy*height > (uint32_t)p->vc.maxheight) {
		ERROR("movie to be played is too heigh, height=%d>maxheight"
				"=%d\n", height*stretchy, p->vc.maxheight);
		err = 1;
	}

	if (err == 1) return 1;

	/* some video files (eg. concatenated MPEG files), make MPlayer
	 * call config() during playback while no parameters have changed.
	 * We make configuration changes to a temporary params structure,
	 * compare it with the old params structure and only apply the new
	 * config if it is different from the old one. */
	memcpy(&zptmp, &p->zp, sizeof(zptmp));

	/* translate the configuration to zoran understandable format */
	zptmp.decimation = 0;
	zptmp.HorDcm = stretchx;
	zptmp.VerDcm = stretchy;
	zptmp.TmpDcm = 1;
	zptmp.field_per_buff = fields;
	zptmp.odd_even = top_first;

	/* center the image on screen */
	zptmp.img_x = (p->vc.maxwidth - width*stretchx)/2;
	zptmp.img_y = (p->vc.maxheight - height*stretchy*(3-fields))/4;

	zptmp.img_width = stretchx*width;
	zptmp.img_height = stretchy*height/fields;

	VERBOSE("tv: %dx%d, out: %dx%d+%d+%d, in: %ux%u %s%s%s\n",
			p->vc.maxwidth, p->vc.maxheight,
			zptmp.img_width, 2*zptmp.img_height,
			zptmp.img_x, 2*zptmp.img_y,
			width, height, (fields == 1) ? "non-interlaced" : "",
			(fields == 2 && top_first == 1)
			?  "interlaced top first" : "",
			(fields == 2 && top_first == 0)
			? "interlaced bottom first" : "");

	if (memcmp(&zptmp, &p->zp, sizeof(zptmp))) {
		/* config differs, we must update */
		memcpy(&p->zp, &zptmp, sizeof(zptmp));
		stop_playing(p);
		if (ioctl(p->vdes, MJPIOC_S_PARAMS, &p->zp) < 0) {
			ERROR("error writing display params to card\n");
			return 1;
		}
		VERBOSE("successfully written display parameters to card\n");
	} else VERBOSE("config didn't change, no need to write it to card\n");

	return 0;
}
Example #30
0
static int control(uint32_t request, void *data, ...)
{
  switch (request) {
  case VOCTRL_QUERY_FORMAT:
    return query_format(*((uint32_t*)data));
  case VOCTRL_GET_IMAGE:
    return get_image(data);
  case VOCTRL_DRAW_IMAGE:
    return draw_image(data);
  case VOCTRL_SET_EQUALIZER:
    {
     va_list ap;
     short value;
     uint32_t luma,prev;

     if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;

     if (ioctl(f,MGA_VID_GET_LUMA,&prev)) {
	perror("Error in mga_vid_config ioctl()");
    mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule);
	return VO_FALSE;
     }

//     printf("GET: 0x%4X 0x%4X  \n",(prev>>16),(prev&0xffff));

     va_start(ap, data);
     value = va_arg(ap, int);
     va_end(ap);

//     printf("value: %d -> ",value);
     value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127
//     printf("%d  \n",value);

     if(!strcmp(data,"contrast"))
         luma = (prev&0xFFFF0000)|(value&0xFFFF);
     else
         luma = (prev&0xFFFF)|(value<<16);

     if (ioctl(f,MGA_VID_SET_LUMA,luma)) {
	perror("Error in mga_vid_config ioctl()");
        mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotSetLumaValuesFromTheKernelModule);
	return VO_FALSE;
     }

     return VO_TRUE;
    }

  case VOCTRL_GET_EQUALIZER:
    {
     va_list ap;
     int * value;
     short val;
     uint32_t luma;

     if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;

     if (ioctl(f,MGA_VID_GET_LUMA,&luma)) {
	perror("Error in mga_vid_config ioctl()");
        mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule);
	return VO_FALSE;
     }

     if ( !strcmp( data,"contrast" ) )
	 val=(luma & 0xFFFF);
     else
	 val=(luma >> 16);

     va_start(ap, data);
     value = va_arg(ap, int*);
     va_end(ap);

     *value = (val*200)/255;

     return VO_TRUE;
    }

#ifndef VO_XMGA
  case VOCTRL_FULLSCREEN:
    if (vo_screenwidth && vo_screenheight)
	mga_fullscreen();
    else
	mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ScreenWidthHeightUnknown);
    return VO_TRUE;
  case VOCTRL_GET_PANSCAN:
      if ( !vo_fs ) return VO_FALSE;
      return VO_TRUE;
#endif

#if defined(VO_XMGA) && defined(CONFIG_GUI)
  case VOCTRL_GUISUPPORT:
    return VO_TRUE;
#endif

#ifdef VO_XMGA
  case VOCTRL_ONTOP:
      vo_x11_ontop();
      return VO_TRUE;
  case VOCTRL_GET_PANSCAN:
      if ( !initialized || !vo_fs ) return VO_FALSE;
      return VO_TRUE;
  case VOCTRL_FULLSCREEN:
      vo_x11_fullscreen();
      vo_panscan_amount=0;
    /* indended, fallthrough to update panscan on fullscreen/windowed switch */
#endif
  case VOCTRL_SET_PANSCAN:
      if ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) // || ( !vo_fs && vo_panscan_amount ) )
       {
//        int old_y = vo_panscan_y;
	panscan_calc();
//        if ( old_y != vo_panscan_y )
	set_window();
       }
      return VO_TRUE;
  }
  return VO_NOTIMPL;
}