コード例 #1
0
static int Playlist(vlc_object_t *obj, char const *cmd,
                    vlc_value_t oldval, vlc_value_t newval, void *p_data)
{
  intf_thread_t *intf = (intf_thread_t*)obj;
  intf_sys_t *sys = intf->p_sys;

  playlist_t *playlist = sys->playlist;
  input_thread_t * input = playlist_CurrentInput(playlist);
  int state;

  if(input) {
    state = var_GetInteger(input, "state");
    vlc_object_release(input);
  } else {
    return VLC_EGENERIC;
  }

  if(strcmp(cmd, "pause") == 0) {
    msg_Info(intf, "Pause");    
    if(state == PLAYING_S)
      playlist_Pause(sys->playlist);
  } else if(strcmp(cmd, "play") == 0) {
    msg_Info(intf, "Play");
    if(state != PLAYING_S)
      playlist_Play(sys->playlist);
  }
}
コード例 #2
0
ファイル: vout.c プロジェクト: Kubink/vlc
static void adjust_refresh_rate(vout_display_t *vd, const video_format_t *fmt)
{
    vout_display_sys_t *sys = vd->sys;
    TV_DISPLAY_STATE_T display_state;
    TV_SUPPORTED_MODE_NEW_T supported_modes[VC_TV_MAX_MODE_IDS];
    char response[20]; /* answer is hvs_update_fields=%1d */
    int num_modes;
    double frame_rate = (double)fmt->i_frame_rate / fmt->i_frame_rate_base;
    int best_id = -1;
    double best_score, score;
    int i;

    vc_tv_get_display_state(&display_state);
    if(display_state.display.hdmi.mode != HDMI_MODE_OFF) {
        num_modes = vc_tv_hdmi_get_supported_modes_new(display_state.display.hdmi.group,
                        supported_modes, VC_TV_MAX_MODE_IDS, NULL, NULL);

        for (i = 0; i < num_modes; ++i) {
            TV_SUPPORTED_MODE_NEW_T *mode = &supported_modes[i];
            if (!sys->native_interlaced) {
                if (mode->width != display_state.display.hdmi.width ||
                                mode->height != display_state.display.hdmi.height ||
                                mode->scan_mode == HDMI_INTERLACED)
                    continue;
            } else {
                if (mode->width != vd->fmt.i_visible_width ||
                        mode->height != vd->fmt.i_visible_height)
                    continue;
                if (mode->scan_mode != sys->b_progressive ? HDMI_NONINTERLACED : HDMI_INTERLACED)
                    continue;
            }

            score = fmod(supported_modes[i].frame_rate, frame_rate);
            if((best_id < 0) || (score < best_score)) {
                best_id = i;
                best_score = score;
            }
        }

        if((best_id >= 0) && (display_state.display.hdmi.mode != supported_modes[best_id].code)) {
            msg_Info(vd, "Setting HDMI refresh rate to %"PRIu32,
                            supported_modes[best_id].frame_rate);
            vc_tv_hdmi_power_on_explicit_new(HDMI_MODE_HDMI,
                            supported_modes[best_id].group,
                            supported_modes[best_id].code);
        }

        if (sys->native_interlaced &&
                supported_modes[best_id].scan_mode == HDMI_INTERLACED) {
            char hvs_mode = sys->b_top_field_first ? '1' : '2';
            if (vc_gencmd(response, sizeof(response), "hvs_update_fields %c",
                    hvs_mode) != 0 || response[18] != hvs_mode)
                msg_Warn(vd, "Could not set hvs field mode");
            else
                msg_Info(vd, "Configured hvs field mode for interlaced %s playback",
                        sys->b_top_field_first ? "tff" : "bff");
        }
    }
}
コード例 #3
0
ファイル: zvbi.c プロジェクト: nickoz5/vlc
static int EventKey( vlc_object_t *p_this, char const *psz_cmd,
                     vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    decoder_t *p_dec = p_data;
    decoder_sys_t *p_sys = p_dec->p_sys;

    VLC_UNUSED(psz_cmd);
    VLC_UNUSED(oldval);
    VLC_UNUSED( p_this );

    /* FIXME: Capture + and - key for subpage browsing */
    if( newval.i_int == '-' || newval.i_int == '+' )
    {
        vlc_mutex_lock( &p_sys->lock );
        if( p_sys->i_wanted_subpage == VBI_ANY_SUBNO && newval.i_int == '+' )
            p_sys->i_wanted_subpage = vbi_dec2bcd(1);
        else if ( newval.i_int == '+' )
            p_sys->i_wanted_subpage = vbi_add_bcd( p_sys->i_wanted_subpage, 1);
        else if( newval.i_int == '-')
            p_sys->i_wanted_subpage = vbi_add_bcd( p_sys->i_wanted_subpage, 0xF9999999); /* BCD complement - 1 */

        if ( !vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x00 ) || vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x99 ) )
            p_sys->i_wanted_subpage = VBI_ANY_SUBNO;
        else
            msg_Info( p_dec, "subpage: %d",
                      vbi_bcd2dec( p_sys->i_wanted_subpage) );

        p_sys->b_update = true;
        vlc_mutex_unlock( &p_sys->lock );
    }

    /* Capture 0-9 for page selection */
    if( newval.i_int < '0' || newval.i_int > '9' )
        return VLC_SUCCESS;

    vlc_mutex_lock( &p_sys->lock );
    p_sys->i_key[0] = p_sys->i_key[1];
    p_sys->i_key[1] = p_sys->i_key[2];
    p_sys->i_key[2] = (int)(newval.i_int - '0');
    msg_Info( p_dec, "page: %c%c%c", (char)(p_sys->i_key[0]+'0'),
              (char)(p_sys->i_key[1]+'0'), (char)(p_sys->i_key[2]+'0') );

    int i_new_page = 0;

    if( p_sys->i_key[0] > 0 && p_sys->i_key[0] <= 8 &&
            p_sys->i_key[1] >= 0 && p_sys->i_key[1] <= 9 &&
            p_sys->i_key[2] >= 0 && p_sys->i_key[2] <= 9 )
    {
        i_new_page = p_sys->i_key[0]*100 + p_sys->i_key[1]*10 + p_sys->i_key[2];
        p_sys->i_key[0] = p_sys->i_key[1] = p_sys->i_key[2] = '*' - '0';
    }
    vlc_mutex_unlock( &p_sys->lock );

    if( i_new_page > 0 )
        var_SetInteger( p_dec, "vbi-page", i_new_page );

    return VLC_SUCCESS;
}
コード例 #4
0
ファイル: demuxdump.c プロジェクト: Kafay/vlc
/*****************************************************************************
 * Open: initializes dump structures
 *****************************************************************************/
static int Open( vlc_object_t * p_this )
{
    demux_t     *p_demux = (demux_t*)p_this;
    demux_sys_t *p_sys;
    const char  *psz_mode;
    vlc_value_t val;
    bool  b_append;

    /* Accept only if forced */
    if( !p_demux->b_force )
        return VLC_EGENERIC;

    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
    if( !p_sys )
        return VLC_ENOMEM;

    var_Create( p_demux, "demuxdump-append", VLC_VAR_BOOL|VLC_VAR_DOINHERIT );
    var_Get( p_demux, "demuxdump-append", &val );
    b_append = val.b_bool;
    if ( b_append )
        psz_mode = "ab";
    else
        psz_mode = "wb";

    p_demux->pf_demux = Demux;
    p_demux->pf_control = Control;

    p_sys->i_write = 0;
    p_sys->p_file = NULL;
    p_sys->psz_file = var_CreateGetString( p_demux, "demuxdump-file" );
    if( *p_sys->psz_file == '\0' )
    {
        msg_Warn( p_demux, "no dump file name given" );
        free( p_sys->psz_file );
        free( p_sys );
        return VLC_EGENERIC;
    }

    if( !strcmp( p_sys->psz_file, "-" ) )
    {
        msg_Info( p_demux, "dumping raw stream to standard output" );
        p_sys->p_file = stdout;
    }
    else if( ( p_sys->p_file = utf8_fopen( p_sys->psz_file, psz_mode ) ) == NULL )
    {
        msg_Err( p_demux, "cannot create `%s' for writing", p_sys->psz_file );
        free( p_sys->psz_file );
        free( p_sys );
        return VLC_EGENERIC;
    }
    msg_Info( p_demux, "%s raw stream to file `%s'",
              b_append ? "appending" : "dumping", p_sys->psz_file );

    return VLC_SUCCESS;
}
コード例 #5
0
static void Run(intf_thread_t *intf)
{
  intf_sys_t *sys = intf->p_sys;
  int fd;

  int canc = vlc_savecancel();

  RegisterCallbacks(intf);

  while(1) {
    msg_Info(intf, "Creating IRC connection...");

    fd = net_ConnectTCP(VLC_OBJECT(intf), sys->server, 6667);

    if(fd == -1) {
      msg_Err(intf, "Error connecting to server");
      return;
    }

    msg_Info(intf, "Connected to server");

    /* initialize context */
    sys->fd = fd;
    sys->line_loc = 0;

    SendBufferInit(intf);

    SendBufferAppend(intf, "NICK ");
    SendBufferAppend(intf, sys->nick);
    SendBufferAppend(intf, "\r\n");

    SendBufferAppend(intf, "USER ");
    SendBufferAppend(intf, sys->nick);
    SendBufferAppend(intf, " 8 * vlc\r\n");

    sys->playlist = pl_Get(intf);

    #ifdef STOP_HACK
    playlist_Pause(sys->playlist);
    input_thread_t * input = playlist_CurrentInput(sys->playlist);
    var_SetFloat(input, "position", 0.0);
    #endif

    EventLoop(fd, intf);

    free(sys->send_buffer->buffer);

    sleep(30);
  }

  free(sys);

  vlc_restorecancel(canc);
}
コード例 #6
0
ファイル: filter_win.cpp プロジェクト: entrity/moviesoap
	void FilterWin::toBlackoutFrame()
	{
		#ifdef MSDEBUG1
			msg_Info( p_obj, "calling blackoutFrame->load" );
		#endif
		blackoutFrame->load();
		#ifdef MSDEBUG1
			msg_Info( p_obj, "done blackoutFrame->load" );
		#endif
		setCurrentWidget(blackoutFrame);
	}
コード例 #7
0
ファイル: variables.c プロジェクト: OneDream/faplayer
/**
 * Finds the value of a variable. If the specified object does not hold a
 * variable with the specified name, try the parent object, and iterate until
 * the top of the tree. If no match is found, the value is read from the
 * configuration.
 */
int var_Inherit( vlc_object_t *p_this, const char *psz_name, int i_type,
                 vlc_value_t *p_val )
{
#ifndef NDEBUG
    if (p_this != VLC_OBJECT(p_this->p_libvlc)
     && unlikely(p_this->p_parent == NULL))
    {
        msg_Info (p_this, "%s(%s) on detached object", __func__, psz_name);
        //vlc_backtrace ();
    }
#endif
    i_type &= VLC_VAR_CLASS;
    for( vlc_object_t *obj = p_this; obj != NULL; obj = obj->p_parent )
    {
        if( var_GetChecked( obj, psz_name, i_type, p_val ) == VLC_SUCCESS )
            return VLC_SUCCESS;
#ifndef NDEBUG
        if (obj != p_this && obj != VLC_OBJECT(p_this->p_libvlc)
         && unlikely(obj->p_parent == NULL))
        {
            msg_Info (p_this, "%s(%s) on detached tree [%p] %s", __func__,
                      psz_name, obj, obj->psz_object_type);
            //vlc_backtrace ();
        }
#endif
    }

    /* else take value from config */
    switch( i_type & VLC_VAR_CLASS )
    {
        case VLC_VAR_STRING:
            p_val->psz_string = config_GetPsz( p_this, psz_name );
            if( !p_val->psz_string ) p_val->psz_string = strdup("");
            break;
        case VLC_VAR_FLOAT:
            p_val->f_float = config_GetFloat( p_this, psz_name );
            break;
        case VLC_VAR_INTEGER:
            p_val->i_int = config_GetInt( p_this, psz_name );
            break;
        case VLC_VAR_BOOL:
            p_val->b_bool = config_GetInt( p_this, psz_name );
            break;
        case VLC_VAR_ADDRESS:
            return VLC_ENOOBJ;
        default:
            msg_Warn( p_this, "Could not inherit value for var %s "
                              "from config. Invalid Type", psz_name );
            return VLC_ENOOBJ;
    }
    /*msg_Dbg( p_this, "Inherited value for var %s from config", psz_name );*/
    return VLC_SUCCESS;
}
コード例 #8
0
ファイル: logger.c プロジェクト: BossKing/vlc
/*****************************************************************************
 * Open: initialize and create stuff
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    intf_thread_t *p_intf = (intf_thread_t *)p_this;

    msg_Err( p_intf, "The logger interface no longer exists." );
    msg_Info( p_intf, "As of VLC version 0.9.0, use --file-logging to write "
              "logs to a file." );
# ifndef _WIN32
    msg_Info( p_intf, "Use --syslog to send logs to the system logger." );
# endif
    return VLC_EGENERIC;
}
コード例 #9
0
ファイル: mtp.c プロジェクト: etix/vlc
/*****************************************************************************
 * Everything else
 *****************************************************************************/
static int AddDevice( services_discovery_t *p_sd,
                      LIBMTP_raw_device_t *p_raw_device )
{
    char *psz_name = NULL;
    LIBMTP_mtpdevice_t *p_device;
    LIBMTP_track_t *p_track, *p_tmp;

    if( ( p_device = LIBMTP_Open_Raw_Device( p_raw_device ) ) != NULL )
    {
        if( !( psz_name = LIBMTP_Get_Friendlyname( p_device ) ) )
            if( !( psz_name = LIBMTP_Get_Modelname( p_device ) ) )
                if( !( psz_name = strdup( N_( "MTP Device" ) ) ) )
                    return VLC_ENOMEM;
        msg_Info( p_sd, "Found device: %s", psz_name );
        p_sd->p_sys->i_bus = p_raw_device->bus_location;
        p_sd->p_sys->i_dev = p_raw_device->devnum;
        p_sd->p_sys->i_product_id = p_raw_device->device_entry.product_id;
        if( ( p_track = LIBMTP_Get_Tracklisting_With_Callback( p_device,
                            CountTracks, p_sd ) ) == NULL )
        {
            msg_Warn( p_sd, "No tracks on the device" );
        }
        else
        {
            if( !( p_sd->p_sys->pp_items = calloc( p_sd->p_sys->i_tracks_num,
                                                   sizeof( input_item_t * ) ) ) )
            {
                free( psz_name );
                return VLC_ENOMEM;
            }
            p_sd->p_sys->i_count = 0;
            while( p_track != NULL )
            {
                msg_Dbg( p_sd, "Track found: %s - %s", p_track->artist,
                         p_track->title );
                AddTrack( p_sd, p_track );
                p_tmp = p_track;
                p_track = p_track->next;
                LIBMTP_destroy_track_t( p_tmp );
            }
        }
        p_sd->p_sys->psz_name = psz_name;
        LIBMTP_Release_Device( p_device );
        return VLC_SUCCESS;
    }
    else
    {
        msg_Info( p_sd, "The device seems to be mounted, unmount it first" );
        return VLC_EGENERIC;
    }
}
コード例 #10
0
ファイル: blendbench.c プロジェクト: videolan/vlc
/*****************************************************************************
 * Render: displays previously rendered output
 *****************************************************************************/
static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
{
    filter_sys_t *p_sys = p_filter->p_sys;
    filter_t *p_blend;

    if( p_sys->b_done )
        return p_pic;

    p_blend = vlc_object_create( p_filter, sizeof(filter_t) );
    if( !p_blend )
    {
        picture_Release( p_pic );
        return NULL;
    }
    p_blend->fmt_out.video = p_sys->p_base_image->format;
    p_blend->fmt_in.video = p_sys->p_blend_image->format;
    p_blend->p_module = module_need( p_blend, "video blending", NULL, false );
    if( !p_blend->p_module )
    {
        picture_Release( p_pic );
        vlc_object_delete(p_blend);
        return NULL;
    }

    vlc_tick_t time = vlc_tick_now();
    for( int i_iter = 0; i_iter < p_sys->i_loops; ++i_iter )
    {
        p_blend->pf_video_blend( p_blend,
                                 p_sys->p_base_image, p_sys->p_blend_image,
                                 0, 0, p_sys->i_alpha );
    }
    time = vlc_tick_now() - time;

    msg_Info( p_filter, "Blended %d images in %f sec", p_sys->i_loops,
              secf_from_vlc_tick(time) );
    msg_Info( p_filter, "Speed is: %f images/second, %f pixels/second",
              (float) p_sys->i_loops / time * CLOCK_FREQ,
              (float) p_sys->i_loops / time * CLOCK_FREQ *
                  p_sys->p_blend_image->p[Y_PLANE].i_visible_pitch *
                  p_sys->p_blend_image->p[Y_PLANE].i_visible_lines );

    module_unneed( p_blend, p_blend->p_module );

    vlc_object_delete(p_blend);

    p_sys->b_done = true;
    return p_pic;
}
コード例 #11
0
/*****************************************************************************
 * Open: initialize dummy interface
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    intf_thread_t *p_intf = (intf_thread_t*) p_this;
    vlm_t *mediatheque;
    char *psz_address;
    vlc_url_t url;
    int i_telnetport;

    if( !(mediatheque = vlm_New( p_intf )) )
    {
        msg_Err( p_intf, "cannot start VLM" );
        return VLC_EGENERIC;
    }

    msg_Info( p_intf, "using the VLM interface plugin..." );

    i_telnetport = config_GetInt( p_intf, "telnet-port" );
    psz_address  = config_GetPsz( p_intf, "telnet-host" );

    vlc_UrlParse(&url, psz_address, 0);

    // There might be two ports given, resolve any potentially
    // conflict
    url.i_port = getPort(p_intf, url, i_telnetport);

    p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
    if( ( p_intf->p_sys->pi_fd = net_ListenTCP( p_intf, url.psz_host, url.i_port ) )
                == NULL )
    {
        msg_Err( p_intf, "cannot listen for telnet" );
        vlc_UrlClean(&url);
        free( psz_address );
        free( p_intf->p_sys );
        return VLC_EGENERIC;
    }
    msg_Info( p_intf, 
              "telnet interface started on interface %s %d",
              url.psz_host, url.i_port );

    p_intf->p_sys->i_clients   = 0;
    p_intf->p_sys->clients     = NULL;
    p_intf->p_sys->mediatheque = mediatheque;
    p_intf->pf_run = Run;

    vlc_UrlClean(&url);
    free( psz_address );
    return VLC_SUCCESS;
}
コード例 #12
0
ファイル: dxva2.c プロジェクト: Tilka/vlc
/**
 * It creates a Direct3D device manager
 */
static int D3dCreateDeviceManager(vlc_va_dxva2_t *va)
{
    HRESULT (WINAPI *CreateDeviceManager9)(UINT *pResetToken,
                                           IDirect3DDeviceManager9 **);
    CreateDeviceManager9 =
      (void *)GetProcAddress(va->hdxva2_dll,
                             TEXT("DXVA2CreateDirect3DDeviceManager9"));

    if (!CreateDeviceManager9) {
        msg_Err(va->log, "cannot load function");
        return VLC_EGENERIC;
    }
    msg_Dbg(va->log, "OurDirect3DCreateDeviceManager9 Success!");

    UINT token;
    IDirect3DDeviceManager9 *devmng;
    if (FAILED(CreateDeviceManager9(&token, &devmng))) {
        msg_Err(va->log, " OurDirect3DCreateDeviceManager9 failed");
        return VLC_EGENERIC;
    }
    va->token  = token;
    va->devmng = devmng;
    msg_Info(va->log, "obtained IDirect3DDeviceManager9");

    HRESULT hr = IDirect3DDeviceManager9_ResetDevice(devmng, va->d3ddev, token);
    if (FAILED(hr)) {
        msg_Err(va->log, "IDirect3DDeviceManager9_ResetDevice failed: %08x", (unsigned)hr);
        return VLC_EGENERIC;
    }
    return VLC_SUCCESS;
}
コード例 #13
0
/**
 * Add an interface plugin and run it
 */
int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, const char *name )
{
    int ret;

    if( !p_libvlc )
        return VLC_EGENERIC;

    if( name != NULL )
        ret = intf_Create( p_libvlc, name );
    else
    {   /* Default interface */
        char *intf = var_InheritString( p_libvlc, "intf" );
        if( intf == NULL ) /* "intf" has not been set */
        {
            char *pidfile = var_InheritString( p_libvlc, "pidfile" );
            if( pidfile != NULL )
                free( pidfile );
            else
                msg_Info( p_libvlc, "%s",
                          _("Running vlc with the default interface. "
                            "Use 'cvlc' to use vlc without interface.") );
        }
        ret = intf_Create( p_libvlc, intf );
        name = "default";
    }
    if( ret )
        msg_Err( p_libvlc, "interface \"%s\" initialization failed", name );
    return ret;
}
コード例 #14
0
/**
 * Load a certain playlist file into the playlist
 * This file will replace the contents of the "current" view
 *
 * \param p_playlist the playlist to which the new items will be added
 * \param psz_filename the name of the playlistfile to import
 * \return VLC_SUCCESS on success
 */
int playlist_Load( playlist_t * p_playlist, const char *psz_filename )
{
    playlist_item_t *p_item;
    char *psz_uri;
    int i_id;

    msg_Info( p_playlist, "clearing playlist");
    playlist_Clear( p_playlist );


    psz_uri = (char *)malloc(sizeof(char)*strlen(psz_filename) + 17 );
    sprintf( psz_uri, "file/playlist://%s", psz_filename);

    i_id = playlist_Add( p_playlist, psz_uri, psz_uri,
                  PLAYLIST_INSERT  , PLAYLIST_END);

    vlc_mutex_lock( &p_playlist->object_lock );
    p_item = playlist_ItemGetById( p_playlist, i_id );
    p_item->b_autodeletion = VLC_TRUE;
    vlc_mutex_unlock( &p_playlist->object_lock );

    playlist_Play(p_playlist);

    return VLC_SUCCESS;
}
コード例 #15
0
ファイル: announce.c プロジェクト: forthyen/SDesk
/*****************************************************************************
 * sout_SLDePReg: Unregisters the program from SLP
 *****************************************************************************/
int sout_SLPDereg( sout_instance_t *p_sout, char * psz_url,
                               char * psz_name)
{
#ifdef HAVE_SLP_H

    SLPHandle   slp_handle;
    SLPError    slp_res;
    char *psz_service= sout_SLPBuildName(psz_url,psz_name);

    if( SLPOpen( NULL, SLP_FALSE, &slp_handle ) != SLP_OK)
    {
        msg_Warn(p_sout,"Unable to initialize SLP");
        return -1;
    }

    msg_Info(p_sout , "Unregistering %s from SLP",
                      psz_service);

    slp_res = SLPDereg ( slp_handle,
            psz_service,
            sout_SLPReport,
            NULL );

    if( slp_res != SLP_OK )
    {
        msg_Warn(p_sout,"Error while registering service: %i", slp_res );
        return -1;
    }

    return 0;

#else /* This function should never be called if this is false */
    return -1;
#endif
}
コード例 #16
0
ファイル: dxva2.c プロジェクト: joshkosh/vlc
/**
 * It creates a Direct3D device manager
 */
static int D3dCreateDeviceManager(vlc_va_t *va)
{
    vlc_va_sys_t *sys = va->sys;
    directx_sys_t *dx_sys = &va->sys->dx_sys;

    HRESULT (WINAPI *CreateDeviceManager9)(UINT *pResetToken,
                                           IDirect3DDeviceManager9 **);
    CreateDeviceManager9 =
        (void *)GetProcAddress(dx_sys->hdecoder_dll,
                               "DXVA2CreateDirect3DDeviceManager9");

    if (!CreateDeviceManager9) {
        msg_Err(va, "cannot load function");
        return VLC_EGENERIC;
    }
    msg_Dbg(va, "OurDirect3DCreateDeviceManager9 Success!");

    UINT token;
    IDirect3DDeviceManager9 *devmng;
    if (FAILED(CreateDeviceManager9(&token, &devmng))) {
        msg_Err(va, " OurDirect3DCreateDeviceManager9 failed");
        return VLC_EGENERIC;
    }
    sys->devmng = devmng;
    msg_Info(va, "obtained IDirect3DDeviceManager9");

    HRESULT hr = IDirect3DDeviceManager9_ResetDevice(devmng, (IDirect3DDevice9*) dx_sys->d3ddev, token);
    if (FAILED(hr)) {
        msg_Err(va, "IDirect3DDeviceManager9_ResetDevice failed: %08x", (unsigned)hr);
        return VLC_EGENERIC;
    }
    return VLC_SUCCESS;
}
コード例 #17
0
ファイル: libvlc.c プロジェクト: RodrigoNieves/vlc
/**
 * Add an interface plugin and run it
 */
int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
{
    if( !p_libvlc )
        return VLC_EGENERIC;

    if( !psz_module ) /* requesting the default interface */
    {
        char *psz_interface = var_CreateGetNonEmptyString( p_libvlc, "intf" );
        if( !psz_interface ) /* "intf" has not been set */
        {
#if !defined( WIN32 ) && !defined( __OS2__ )
            if( b_daemon )
                 /* Daemon mode hack.
                  * We prefer the dummy interface if none is specified. */
                psz_module = "dummy";
            else
#endif
                msg_Info( p_libvlc, "%s",
                          _("Running vlc with the default interface. "
                            "Use 'cvlc' to use vlc without interface.") );
        }
        free( psz_interface );
        var_Destroy( p_libvlc, "intf" );
    }

    /* Try to create the interface */
    int ret = intf_Create( p_libvlc, psz_module ? psz_module : "$intf" );
    if( ret )
        msg_Err( p_libvlc, "interface \"%s\" initialization failed",
                 psz_module ? psz_module : "default" );
    return ret;
}
コード例 #18
0
ファイル: Main_SingleDecay.C プロジェクト: alisw/SHERPA
void InitialiseGenerator(int argc, char *argv[])
{
  if(argc<2) {
    cout<<"Usage: ./SingleDecay <PDG_CODE>"<<endl;
    THROW(normal_exit,"you didn't specify the decaying particle by PDG code.");
  }

  small_sherpa_init(argc, argv);

  hadrons = new SHERPA::Hadron_Decay_Handler(".", "Fragmentation.dat");

  mother_flav = Flavour( (kf_code) abs(ToType<int>(argv[1])) );
  mother_flav.SetStable(false);
  if(ToType<int>(argv[1])<0) mother_flav=mother_flav.Bar();
  if(hadrons->DecayMap()->FindDecay(mother_flav)==NULL)
    THROW(fatal_error, "Didn't find "+ToString<Flavour>(mother_flav)+
	  " in HadronDecays.dat.");
  
  // set all decay channel BR's equal, such that we generate the same amount of
  // each decay channel to be tested
  PHASIC::Decay_Table* table=hadrons->DecayMap()->FindDecay(mother_flav);
  for(size_t i(0);i<table->size();++i)
    table->UpdateWidth(table->at(i), 1.0);

  rpa->gen.SetEcms(mother_flav.HadMass());
  msg_Info()<<"Welcome. I am decaying a "<<mother_flav<<endl;
}
コード例 #19
0
ファイル: smooth.c プロジェクト: xswm1123/vlc
static void print_chunk( stream_t *s, chunk_t *ck )
{
    msg_Info( s, "chunk %u type %i: duration is %"PRIu64", stime is %"PRIu64", "\
            "size is %i, offset is %"PRIu64", read_pos is %i.",
            ck->sequence, ck->type, ck->duration,
            ck->start_time, ck->size, ck->offset, ck->read_pos );
}
コード例 #20
0
/**
 * Starts an interface plugin.
 */
int libvlc_InternalAddIntf(libvlc_int_t *libvlc, const char *name)
{
    playlist_t *playlist = intf_GetPlaylist(libvlc);
    int ret;

    if (unlikely(playlist == NULL))
        ret = VLC_ENOMEM;
    else
    if (name != NULL)
        ret = intf_Create(playlist, name);
    else
    {   /* Default interface */
        char *intf = var_InheritString(libvlc, "intf");
        if (intf == NULL) /* "intf" has not been set */
        {
            char *pidfile = var_InheritString(libvlc, "pidfile");
            if (pidfile != NULL)
                free(pidfile);
            else
                msg_Info(libvlc, _("Running vlc with the default interface. "
                         "Use 'cvlc' to use vlc without interface."));
        }
        ret = intf_Create(playlist, intf);
        name = "default";
    }
    if (ret != VLC_SUCCESS)
        msg_Err(libvlc, "interface \"%s\" initialization failed", name);
    return ret;
}
コード例 #21
0
ファイル: y4mpipe.c プロジェクト: walisser/vlc-filter-pipe
/**
 * @brief VLC flush callback
 * @param intf
 */
static void y4m_flush(filter_t* intf)
{
    filter_sys_t* sys = intf->p_sys;

    msg_Info(intf, "flush: enter: buffers=%d:%d:%d",
        sys->bufferedIn, sys->bufferedOut, sys->minBuffered);

    // flush what we can, there can still be frames outstanding
    // after the flush so the counts need to be updated

    // block the input thread while flushing its fifo.
//    vlc_mutex_lock(&sys->inputMutex);
//    picture_t* pic;
//    while ((pic = picture_fifo_Pop(sys->inputFifo)))
//    {
//        picture_Release(pic);
//        sys->bufferedIn--;
//        sys->bufferedOut -= sys->bufferRatio;
//    }
//    vlc_mutex_unlock(&sys->inputMutex);

    picture_t* pic;
    while ((pic = picture_fifo_Pop(sys->outputFifo)))
    {
        picture_Release(pic);
        sys->bufferedOut--;
    }

    // check our accounting, if it goes below zero there is race somewhere
    if (sys->bufferedOut < 0)
    {
        msg_Err(intf, "flush: race condition on output count");
        sys->bufferedOut = 0;
    }

    if (sys->bufferedIn < 0)
    {
        msg_Err(intf, "flush: race condition on input count");
        sys->bufferedIn = 0;
    }

    sys->minBuffered = sys->bufferedOut;
    sys->lastDate = 0;

    msg_Info(intf, "flush: exit:  buffers=%d:%d:%d",
        sys->bufferedIn, sys->bufferedOut, sys->minBuffered);
}
コード例 #22
0
ファイル: dvblast.c プロジェクト: koshkoshka/dvblast
static void sighandler(struct ev_loop *loop, struct ev_signal *w, int revents)
{
    switch (w->signum)
    {
        case SIGINT:
        case SIGTERM:
        default:
            msg_Info( NULL, "Shutdown was requested." );
            ev_break(loop, EVBREAK_ALL);
            break;

        case SIGHUP:
            msg_Info( NULL, "Configuration reload was requested." );
            config_ReadFile();
            break;
    }
}
コード例 #23
0
ファイル: callbacks.cpp プロジェクト: entrity/moviesoap
	/* Fires when user clicks position bar. - Restart loaded Filter. */
	static MOVIESOAP_CALLBACK(InputCbPosition)
	{
		#ifdef MSDEBUG3
		msg_Info( p_this, "!!! CALLBACK input position !!! : %s ... new: %f ... old: %f", psz_var, (float) newval.f_float, (float) oldval.f_float );
		#endif

		if (p_loadedFilter) {
			mtime_t new_time = newval.f_float * var_GetTime( p_input, "length" );
			#ifdef MSDEBUG2
				char buffer[12];
				strftime(new_time / MOVIESOAP_MOD_TIME_FACTOR, buffer);
				msg_Info(p_this, "new time %lld\n%s", new_time, &buffer[0]);
			#endif
			StopAndStartFilter(new_time);
		}
		return 0;
	}
コード例 #24
0
ファイル: upnp.cpp プロジェクト: ZMacer/vlc
UpnpInstanceWrapper *UpnpInstanceWrapper::get(vlc_object_t *p_obj, Upnp_FunPtr callback, SD::MediaServerList *opaque)
{
    vlc_mutex_locker lock( &s_lock );
    if ( s_instance == NULL )
    {
        UpnpInstanceWrapper* instance = new(std::nothrow) UpnpInstanceWrapper;
        if ( unlikely( !instance ) )
            return NULL;

    #ifdef UPNP_ENABLE_IPV6
        char* psz_miface = var_InheritString( p_obj, "miface" );
        msg_Info( p_obj, "Initializing libupnp on '%s' interface", psz_miface );
        int i_res = UpnpInit2( psz_miface, 0 );
        free( psz_miface );
    #else
        /* If UpnpInit2 isnt available, initialize on first IPv4-capable interface */
        int i_res = UpnpInit( 0, 0 );
    #endif
        if( i_res != UPNP_E_SUCCESS )
        {
            msg_Err( p_obj, "Initialization failed: %s", UpnpGetErrorMessage( i_res ) );
            delete instance;
            return NULL;
        }

        ixmlRelaxParser( 1 );

        /* Register a control point */
        i_res = UpnpRegisterClient( Callback, instance, &instance->handle_ );
        if( i_res != UPNP_E_SUCCESS )
        {
            msg_Err( p_obj, "Client registration failed: %s", UpnpGetErrorMessage( i_res ) );
            delete instance;
            return NULL;
        }

        /* libupnp does not treat a maximum content length of 0 as unlimited
         * until 64dedf (~ pupnp v1.6.7) and provides no sane way to discriminate
         * between versions */
        if( (i_res = UpnpSetMaxContentLength( INT_MAX )) != UPNP_E_SUCCESS )
        {
            msg_Err( p_obj, "Failed to set maximum content length: %s",
                    UpnpGetErrorMessage( i_res ));
            delete instance;
            return NULL;
        }
        s_instance = instance;
    }
    s_instance->refcount_++;
    // This assumes a single UPNP SD instance
    if (callback && opaque)
    {
        assert(!s_instance->callback_ && !s_instance->opaque_);
        s_instance->opaque_ = opaque;
        s_instance->callback_ = callback;
    }
    return s_instance;
}
コード例 #25
0
ファイル: y4mpipe.c プロジェクト: walisser/vlc-filter-pipe
/**
 * @brief Thread reading frames from the subprocess
 */
static void* outputThread(void* userData)
{
    filter_t*    intf = (filter_t*)userData;
    filter_sys_t* sys = intf->p_sys;

    msg_Info(intf, "outputThread: enter");

    bool gotHeader = false;

    while (true)
    {
        if (!gotHeader)
        {
            video_format_Init(&sys->outFormat, VLC_CODEC_I420);
            if (1 != readY4mHeader(intf, &sys->outFormat, sys->stdout))
                break;
            gotHeader = true;
        }

        picture_t* outPic = picture_NewFromFormat(&sys->outFormat);
        if(1 != readY4mFrame(intf, outPic, sys->stdout))
        {
            picture_Release(outPic);
            break;
        }

        //msg_Info(intf, "outputThread: read picture");

        // fixme: deinterlace filter does this, not sure if we need to;
        // y4m header contains this information
        outPic->b_progressive = true;
        outPic->i_nb_fields = 2;

        picture_fifo_Push(sys->outputFifo, outPic);

        vlc_cond_signal(&sys->outputCond);
    }

    msg_Info(intf, "outputThread: exit");

    sys->threadExit = true;
    vlc_cond_signal(&sys->outputCond);

    return userData;
}
コード例 #26
0
ファイル: messages.c プロジェクト: CSRedRat/vlc
static int vlclua_msg_info( lua_State *L )
{
    int i_top = lua_gettop( L );
    vlc_object_t *p_this = vlclua_get_this( L );
    int i;
    for( i = 1; i <= i_top; i++ )
        msg_Info( p_this, "%s", luaL_checkstring( L, i ) );
    return 0;
}
コード例 #27
0
ファイル: input.c プロジェクト: FLYKingdom/vlc
/*****************************************************************************
 * OpenDemux: initialize the target, ie. parse the command
 *****************************************************************************/
int OpenDemux ( vlc_object_t *p_this )
{
    demux_t *p_demux = (demux_t*)p_this;
    char * psz_name = p_demux->psz_path;

    p_demux->pf_control = DemuxControl;
    p_demux->p_sys = NULL;

    /* Check for a "vlc://nop" command */
    if( !strcasecmp( psz_name, "nop" ) )
    {
        msg_Info( p_demux, "command `nop'" );
        p_demux->pf_demux = DemuxNoOp;
        return VLC_SUCCESS;
    }

    /* Check for a "vlc://quit" command */
    if( !strcasecmp( psz_name, "quit" ) )
    {
        msg_Info( p_demux, "command `quit'" );
        p_demux->pf_demux = DemuxNoOp;
        libvlc_Quit( p_demux->p_libvlc );
        return VLC_SUCCESS;
    }

    /* Check for a "vlc://pause:***" command */
    if( !strncasecmp( psz_name, "pause:", 6 ) )
    {
        double f = us_atof( psz_name + 6 );
        mtime_t end = mdate() + f * (mtime_t)1000000;

        msg_Info( p_demux, "command `pause %f'", f );
        p_demux->pf_demux = DemuxPause;

        p_demux->p_sys = malloc( sizeof( end ) );
        if( p_demux->p_sys == NULL )
            return VLC_ENOMEM;
        memcpy( p_demux->p_sys, &end, sizeof( end ) );
        return VLC_SUCCESS;
    }
 
    msg_Err( p_demux, "unknown command `%s'", psz_name );
    return VLC_EGENERIC;
}
コード例 #28
0
ファイル: filter_win.cpp プロジェクト: entrity/moviesoap
	void loadFilterDialogue(QWidget * parent)
	{		// Get filepath from user
		QString filepath = QFileDialog::getOpenFileName( parent,
			QString("Open Moviesoap filter file"),
			QString(saveDir().c_str()),
			QString(MOVIESOAP_FILECHOOSER_FILTER));
		if ( !filepath.isEmpty() ) {			
			vlc_mutex_lock( &Moviesoap::lock );
			// Ensure existence of loaded filter
			if (Moviesoap::p_loadedFilter == NULL)
				Moviesoap::p_loadedFilter = new Filter;
			// Stop loaded filter in case it is running
			vlc_mutex_unlock( &Moviesoap::lock );
			Moviesoap::spawn_stop_filter();
			// Overwrite loaded filter with data from filter file
			const char * c_filepath = qPrintable(filepath);
			int err = Moviesoap::p_loadedFilter->load( c_filepath );
			// Display error (if any) in QMessageBox
			if (err) {
				stringstream msgs;
				msgs << "Failure to load filter from file.\nError code " << err;
				QMessageBox::warning( parent, 
					QString("File IO failure"),
					QString(msgs.str().c_str()),
					QMessageBox::Ok);
				return;
			}
			// if no error:
			#ifdef MSDEBUG1
				msg_Info( p_obj, "OLD FILTER OVERWRITTEN" );
				msg_Info( p_obj, "IS ACTIVE SELECTED: %d", isActiveSelected() );
			#endif
			// Start loaded filter if menu has active selected
			if ( isActiveSelected() ) {
				if (Moviesoap::p_input == NULL)
					 spawn_set_p_input(false);
				#ifdef MSDEBUG1
					msg_Info(p_obj, "p input: %x", p_input);
				#endif
				if (Moviesoap::p_input)
					Moviesoap::spawn_restart_filter();
			}
		}
	}
コード例 #29
0
ファイル: y4mpipe.c プロジェクト: walisser/vlc-filter-pipe
/**
 * @brief Thread writing frames to the subprocess
 */
static void* inputThread(void* userData)
{
    filter_t*    intf = (filter_t*)userData;
    filter_sys_t* sys = intf->p_sys;

    msg_Info(intf, "inputThread: enter");

    while (true)
    {
        picture_t* pic;

        // acquire a frame pushed from y4m_filter()
        vlc_mutex_lock(&sys->inputMutex);
        mutex_cleanup_push(&sys->inputMutex);

        while (NULL == (pic = picture_fifo_Pop(sys->inputFifo)))
        {
            //msg_Info(intf, "inputThread: wait picture");
            vlc_cond_wait(&sys->inputCond, &sys->inputMutex);
        }

        sys->bufferedIn--;

        vlc_mutex_unlock(&sys->inputMutex);
        vlc_cleanup_pop();

        //msg_Info(intf, "inputThread: write picture");

        if (1 != writeY4mFrame(intf, pic, sys->stdin))
        {
            msg_Err(intf, "inputThread: Failed to write y4m frame");
            break;
        }

        picture_Release(pic);
    }

    msg_Info(intf, "inputThread: exit");

    sys->threadExit = true;

    return userData;
}
コード例 #30
0
static void LoopRequest( playlist_t *p_playlist )
{
    playlist_private_t *p_sys = pl_priv(p_playlist);
    assert( !p_sys->p_input );

    /* No input. Several cases
     *  - No request, running status -> start new item
     *  - No request, stopped status -> collect garbage
     *  - Request, running requested -> start new item
     *  - Request, stopped requested -> collect garbage
    */
    const int i_status = p_sys->request.b_request ?
                         p_sys->request.i_status : p_sys->status.i_status;

    if( i_status == PLAYLIST_STOPPED || !vlc_object_alive( p_playlist ) )
    {
        p_sys->status.i_status = PLAYLIST_STOPPED;

        if( p_sys->p_input_resource &&
            input_resource_HasVout( p_sys->p_input_resource ) )
        {
            /* XXX We can unlock if we don't issue the wait as we will be
             * call again without anything else done between the calls */
            PL_UNLOCK;

            /* input_resource_t must be manipulated without playlist lock */
            input_resource_TerminateVout( p_sys->p_input_resource );

            PL_LOCK;
        }
        else
        {
            if( vlc_object_alive( p_playlist ) )
                vlc_cond_wait( &p_sys->signal, &p_sys->lock );
        }
        return;
    }

    playlist_item_t *p_item = NextItem( p_playlist );
    if( p_item )
    {
        msg_Dbg( p_playlist, "starting playback of the new playlist item" );
        PlayItem( p_playlist, p_item );
        return;
    }

    msg_Dbg( p_playlist, "nothing to play" );
    p_sys->status.i_status = PLAYLIST_STOPPED;

    if( var_GetBool( p_playlist, "play-and-exit" ) )
    {
        msg_Info( p_playlist, "end of playlist, exiting" );
        libvlc_Quit( p_playlist->p_libvlc );
    }
}