- /* Prepend a dummy argv[0] so that users of the API do not have to
- do it themselves, and can simply provide the args list. */
- ppsz_argv = malloc( ( argc + 2 ) * sizeof( char * ) ) ;
- if( ! ppsz_argv )
- RAISE_NULL( mediacontrol_InternalException, "Out of memory" );
-
- ppsz_argv[0] = strdup("vlc");
- for ( i_index = 0; i_index < argc; i_index++ )
- ppsz_argv[i_index + 1] = argv[i_index];
- ppsz_argv[argc + 1] = NULL;
-
- retval->p_instance = libvlc_new( argc + 1, ppsz_argv, &ex );
- retval->p_playlist = retval->p_instance->p_libvlc_int->p_playlist;
- HANDLE_LIBVLC_EXCEPTION_NULL( &ex );
- return retval;
-};
+ retval->p_instance = libvlc_new( argc, (const char**)argv );
+ if( !retval->p_instance )
+ RAISE_NULL( mediacontrol_InternalException, "Out of memory" );
+ retval->p_media_player = libvlc_media_player_new( retval->p_instance );
+ if( !retval->p_media_player )
+ RAISE_NULL( mediacontrol_InternalException, "Out of memory" );
+ return retval;
+}