[vlc-commits] [Git][videolan/vlc][master] 10 commits: lib/media_player: pass instance when creating from media
Rémi Denis-Courmont (@Courmisch)
gitlab at videolan.org
Sat Jun 18 19:45:21 UTC 2022
Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC
Commits:
d607bf76 by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib/media_player: pass instance when creating from media
The caller ought to be able to select which instance the player should
be instantiated from.
- - - - -
2f91254d by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib/media: remove instance from media
As discussed on vlc-devel a few years back, it is desirable, if not
sometimes necessary, for media objects to be independent from any given
instance.
A typical reason would be to preparse media in one instance but play
them in another.
- - - - -
9a887cbd by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib/media: remove unused argument
- - - - -
5aec19d5 by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib: remove useless libvlc_media_new_location() parameter
- - - - -
b18a6759 by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib: remove useless libvlc_media_new_path() parameter
- - - - -
cd72cc37 by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib: remove useless libvlc_media_new_fd() parameter
- - - - -
1943b381 by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib: remove useless libvlc_media_new_callbacks() parameter
- - - - -
dd3a55df by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
lib: remove useless libvlc_media_new_as_node() parameter
- - - - -
45e8dd9d by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
test: remove useless parameter
- - - - -
a11616f9 by Rémi Denis-Courmont at 2022-06-18T19:10:34+00:00
test: remove useless parameter
- - - - -
24 changed files:
- doc/libvlc/QtGL/qtvlcwidget.cpp
- doc/libvlc/QtPlayer/player.cpp
- doc/libvlc/appkit_player.m
- doc/libvlc/d3d11_player.cpp
- doc/libvlc/d3d9_player.c
- doc/libvlc/example.c
- doc/libvlc/gtk_player.c
- doc/libvlc/sdl_opengl_player.cpp
- doc/libvlc/vlc-thumb.c
- doc/libvlc/win_player.c
- doc/libvlc/wx_player.cpp
- include/vlc/libvlc_media.h
- include/vlc/libvlc_media_player.h
- lib/media.c
- lib/media_discoverer.c
- lib/media_internal.h
- lib/media_player.c
- test/libvlc/libvlc_additions.h
- test/libvlc/media.c
- test/libvlc/media_list.c
- test/libvlc/media_list_player.c
- test/libvlc/media_player.c
- test/libvlc/meta.c
- test/libvlc/slaves.c
Changes:
=====================================
doc/libvlc/QtGL/qtvlcwidget.cpp
=====================================
@@ -194,12 +194,12 @@ QtVLCWidget::QtVLCWidget(QWidget *parent)
bool QtVLCWidget::playMedia(const char* url)
{
- m_media = libvlc_media_new_location (m_vlc, url);
+ m_media = libvlc_media_new_location(url);
if (m_media == nullptr) {
fprintf(stderr, "unable to create media %s", url);
return false;
}
- m_mp = libvlc_media_player_new_from_media (m_media);
+ m_mp = libvlc_media_player_new_from_media (m_vlc, m_media);
if (m_mp == nullptr) {
fprintf(stderr, "unable to create media player");
libvlc_media_release(m_media);
=====================================
doc/libvlc/QtPlayer/player.cpp
=====================================
@@ -132,12 +132,12 @@ void Mwindow::openFile() {
stop();
/* Create a new Media */
- libvlc_media_t *vlcMedia = libvlc_media_new_path(vlcInstance, qtu(fileOpen));
+ libvlc_media_t *vlcMedia = libvlc_media_new_path(qtu(fileOpen));
if (!vlcMedia)
return;
/* Create a new libvlc player */
- vlcPlayer = libvlc_media_player_new_from_media (vlcMedia);
+ vlcPlayer = libvlc_media_player_new_from_media (vlcInstance, vlcMedia);
/* Release the media */
libvlc_media_release(vlcMedia);
=====================================
doc/libvlc/appkit_player.m
=====================================
@@ -82,7 +82,7 @@
NSArray *args = [[NSProcessInfo processInfo] arguments];
NSString *location = [args objectAtIndex:1];
- media = libvlc_media_new_location(instance, [location UTF8String]);
+ media = libvlc_media_new_location([location UTF8String]);
libvlc_media_player_set_media(player, media);
libvlc_media_player_set_nsobject(player, (__bridge void*)_view);
=====================================
doc/libvlc/d3d11_player.cpp
=====================================
@@ -637,9 +637,9 @@ int WINAPI WinMain(HINSTANCE hInstance,
file_path = _strdup( lpCmdLine );
p_libvlc = libvlc_new( 0, NULL );
- p_media = libvlc_media_new_path( p_libvlc, file_path );
+ p_media = libvlc_media_new_path( file_path );
free( file_path );
- Context.p_mp = libvlc_media_player_new_from_media( p_media );
+ Context.p_mp = libvlc_media_player_new_from_media( p_libvlc, p_media );
InitializeSRWLock(&Context.sizeLock);
InitializeSRWLock(&Context.swapchainLock);
=====================================
doc/libvlc/d3d9_player.c
=====================================
@@ -375,9 +375,9 @@ int WINAPI WinMain(HINSTANCE hInstance,
file_path = _strdup( lpCmdLine );
p_libvlc = libvlc_new( 0, NULL );
- p_media = libvlc_media_new_path( p_libvlc, file_path );
+ p_media = libvlc_media_new_path( file_path );
free( file_path );
- Context.p_mp = libvlc_media_player_new_from_media( p_media );
+ Context.p_mp = libvlc_media_player_new_from_media( p_libvlc, p_media );
InitializeCriticalSection(&Context.sizeLock);
=====================================
doc/libvlc/example.c
=====================================
@@ -17,11 +17,11 @@ int main(int argc, char* argv[])
inst = libvlc_new (0, NULL);
/* Create a new item */
- m = libvlc_media_new_location (inst, "http://mycool.movie.com/test.mov");
- //m = libvlc_media_new_path (inst, "/path/to/test.mov");
+ m = libvlc_media_new_location("http://mycool.movie.com/test.mov");
+ //m = libvlc_media_new_path("/path/to/test.mov");
/* Create a media player playing environement */
- mp = libvlc_media_player_new_from_media (m);
+ mp = libvlc_media_player_new_from_media (inst, m);
/* No need to keep the media now */
libvlc_media_release (m);
=====================================
doc/libvlc/gtk_player.c
=====================================
@@ -45,7 +45,7 @@ void on_open(GtkWidget *widget, gpointer data) {
void open_media(const char* uri) {
libvlc_media_t *media;
- media = libvlc_media_new_location(vlc_inst, uri);
+ media = libvlc_media_new_location(uri);
libvlc_media_player_set_media(media_player, media);
play();
libvlc_media_release(media);
=====================================
doc/libvlc/sdl_opengl_player.cpp
=====================================
@@ -67,12 +67,12 @@ public:
bool playMedia(const char* url)
{
- m_media = libvlc_media_new_location (m_vlc, url);
+ m_media = libvlc_media_new_location(url);
if (m_media == NULL) {
fprintf(stderr, "unable to create media %s", url);
return false;
}
- m_mp = libvlc_media_player_new_from_media (m_media);
+ m_mp = libvlc_media_player_new_from_media (m_vlc, m_media);
if (m_mp == NULL) {
fprintf(stderr, "unable to create media player");
libvlc_media_release(m_media);
=====================================
doc/libvlc/vlc-thumb.c
=====================================
@@ -189,7 +189,7 @@ int main(int argc, const char **argv)
libvlc = create_libvlc();
assert(libvlc);
- m = libvlc_media_new_path(libvlc, in);
+ m = libvlc_media_new_path(in);
assert(m);
/* takes snapshot */
=====================================
doc/libvlc/win_player.c
=====================================
@@ -45,7 +45,7 @@ static LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
if (DragQueryFile(hDrop, 0, file_path, sizeof(file_path)))
{
- libvlc_media_t *p_media = libvlc_media_new_path( ctx->p_libvlc, file_path );
+ libvlc_media_t *p_media = libvlc_media_new_path( file_path );
libvlc_media_t *p_old_media = libvlc_media_player_get_media( ctx->p_mediaplayer );
libvlc_media_player_set_media( ctx->p_mediaplayer, p_media );
libvlc_media_release( p_old_media );
@@ -116,9 +116,10 @@ int WINAPI WinMain(HINSTANCE hInstance,
file_path = _strdup( lpCmdLine );
Context.p_libvlc = libvlc_new( 0, NULL );
- p_media = libvlc_media_new_path( Context.p_libvlc, file_path );
+ p_media = libvlc_media_new_path( file_path );
free( file_path );
- Context.p_mediaplayer = libvlc_media_player_new_from_media( p_media );
+ Context.p_mediaplayer = libvlc_media_player_new_from_media(
+ Context.p_libvlc, p_media );
ZeroMemory(&wc, sizeof(WNDCLASSEX));
=====================================
doc/libvlc/wx_player.cpp
=====================================
@@ -154,7 +154,7 @@ void MainWindow::OnOpen(wxCommandEvent& event) {
libvlc_media_t *media;
wxFileName filename = wxFileName::FileName(openFileDialog.GetPath());
filename.MakeRelativeTo();
- media = libvlc_media_new_path(vlc_inst, filename.GetFullPath().mb_str());
+ media = libvlc_media_new_path(filename.GetFullPath().mb_str());
libvlc_media_player_set_media(media_player, media);
play();
libvlc_media_release(media);
=====================================
include/vlc/libvlc_media.h
=====================================
@@ -276,26 +276,20 @@ typedef void (*libvlc_media_close_cb)(void *opaque);
*
* \see libvlc_media_release
*
- * \param p_instance the instance
* \param psz_mrl the media location
* \return the newly created media or NULL on error
*/
-LIBVLC_API libvlc_media_t *libvlc_media_new_location(
- libvlc_instance_t *p_instance,
- const char * psz_mrl );
+LIBVLC_API libvlc_media_t *libvlc_media_new_location(const char * psz_mrl);
/**
* Create a media for a certain file path.
*
* \see libvlc_media_release
*
- * \param p_instance the instance
* \param path local filesystem path
* \return the newly created media or NULL on error
*/
-LIBVLC_API libvlc_media_t *libvlc_media_new_path(
- libvlc_instance_t *p_instance,
- const char *path );
+LIBVLC_API libvlc_media_t *libvlc_media_new_path(const char *path);
/**
* Create a media for an already open file descriptor.
@@ -317,18 +311,14 @@ LIBVLC_API libvlc_media_t *libvlc_media_new_path(
*
* \version LibVLC 1.1.5 and later.
*
- * \param p_instance the instance
* \param fd open file descriptor
* \return the newly created media or NULL on error
*/
-LIBVLC_API libvlc_media_t *libvlc_media_new_fd(
- libvlc_instance_t *p_instance,
- int fd );
+LIBVLC_API libvlc_media_t *libvlc_media_new_fd(int fd);
/**
* Create a media with custom callbacks to read the data from.
*
- * \param instance LibVLC instance
* \param open_cb callback to open the custom bitstream input media
* \param read_cb callback to read data (must not be NULL)
* \param seek_cb callback to seek, or NULL if seeking is not supported
@@ -352,7 +342,6 @@ LIBVLC_API libvlc_media_t *libvlc_media_new_fd(
* \version LibVLC 3.0.0 and later.
*/
LIBVLC_API libvlc_media_t *libvlc_media_new_callbacks(
- libvlc_instance_t *instance,
libvlc_media_open_cb open_cb,
libvlc_media_read_cb read_cb,
libvlc_media_seek_cb seek_cb,
@@ -364,13 +353,10 @@ LIBVLC_API libvlc_media_t *libvlc_media_new_callbacks(
*
* \see libvlc_media_release
*
- * \param p_instance the instance
* \param psz_name the name of the node
* \return the new empty media or NULL on error
*/
-LIBVLC_API libvlc_media_t *libvlc_media_new_as_node(
- libvlc_instance_t *p_instance,
- const char * psz_name );
+LIBVLC_API libvlc_media_t *libvlc_media_new_as_node(const char * psz_name);
/**
* Add an option to the media.
=====================================
include/vlc/libvlc_media_player.h
=====================================
@@ -167,12 +167,13 @@ LIBVLC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p
/**
* Create a Media Player object from a Media
*
+ * \param inst LibVLC instance to create a media player with
* \param p_md the media. Afterwards the p_md can be safely
* destroyed.
* \return a new media player object, or NULL on error.
* It must be released by libvlc_media_player_release().
*/
-LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
+LIBVLC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_instance_t *inst, libvlc_media_t *p_md );
/**
* Release a media_player after use
=====================================
lib/media.c
=====================================
@@ -162,8 +162,7 @@ static libvlc_media_t *input_item_add_subitem( libvlc_media_t *p_md,
libvlc_media_list_t *p_subitems;
libvlc_event_t event;
- p_md_child = libvlc_media_new_from_input_item( p_md->p_libvlc_instance,
- item );
+ p_md_child = libvlc_media_new_from_input_item( item );
/* Add this to our media list */
p_subitems = media_get_subitems( p_md, true );
@@ -468,9 +467,7 @@ static void uninstall_input_item_observer( libvlc_media_t *p_md )
*
* That's the generic constructor
*/
-libvlc_media_t * libvlc_media_new_from_input_item(
- libvlc_instance_t *p_instance,
- input_item_t *p_input_item )
+libvlc_media_t * libvlc_media_new_from_input_item(input_item_t *p_input_item )
{
libvlc_media_t * p_md;
@@ -487,7 +484,6 @@ libvlc_media_t * libvlc_media_new_from_input_item(
return NULL;
}
- p_md->p_libvlc_instance = p_instance;
p_md->p_input_item = p_input_item;
vlc_atomic_rc_init(&p_md->rc);
@@ -505,14 +501,11 @@ libvlc_media_t * libvlc_media_new_from_input_item(
input_item_Hold( p_md->p_input_item );
install_input_item_observer( p_md );
-
- libvlc_retain( p_instance );
return p_md;
}
// Create a media with a certain given media resource location
-libvlc_media_t *libvlc_media_new_location( libvlc_instance_t *p_instance,
- const char * psz_mrl )
+libvlc_media_t *libvlc_media_new_location(const char * psz_mrl)
{
input_item_t * p_input_item;
libvlc_media_t * p_md;
@@ -525,7 +518,7 @@ libvlc_media_t *libvlc_media_new_location( libvlc_instance_t *p_instance,
return NULL;
}
- p_md = libvlc_media_new_from_input_item( p_instance, p_input_item );
+ p_md = libvlc_media_new_from_input_item( p_input_item );
/* The p_input_item is retained in libvlc_media_new_from_input_item */
input_item_Release( p_input_item );
@@ -534,8 +527,7 @@ libvlc_media_t *libvlc_media_new_location( libvlc_instance_t *p_instance,
}
// Create a media for a certain file path
-libvlc_media_t *libvlc_media_new_path( libvlc_instance_t *p_instance,
- const char *path )
+libvlc_media_t *libvlc_media_new_path(const char *path)
{
char *mrl = vlc_path2uri( path, NULL );
if( unlikely(mrl == NULL) )
@@ -544,29 +536,28 @@ libvlc_media_t *libvlc_media_new_path( libvlc_instance_t *p_instance,
return NULL;
}
- libvlc_media_t *m = libvlc_media_new_location( p_instance, mrl );
+ libvlc_media_t *m = libvlc_media_new_location(mrl);
free( mrl );
return m;
}
// Create a media for an already open file descriptor
-libvlc_media_t *libvlc_media_new_fd( libvlc_instance_t *p_instance, int fd )
+libvlc_media_t *libvlc_media_new_fd(int fd)
{
char mrl[16];
snprintf( mrl, sizeof(mrl), "fd://%d", fd );
- return libvlc_media_new_location( p_instance, mrl );
+ return libvlc_media_new_location(mrl);
}
// Create a media with custom callbacks to read the data from
-libvlc_media_t *libvlc_media_new_callbacks(libvlc_instance_t *p_instance,
- libvlc_media_open_cb open_cb,
+libvlc_media_t *libvlc_media_new_callbacks(libvlc_media_open_cb open_cb,
libvlc_media_read_cb read_cb,
libvlc_media_seek_cb seek_cb,
libvlc_media_close_cb close_cb,
void *opaque)
{
- libvlc_media_t *m = libvlc_media_new_location(p_instance, "imem://");
+ libvlc_media_t *m = libvlc_media_new_location("imem://");
if (unlikely(m == NULL))
return NULL;
@@ -580,8 +571,7 @@ libvlc_media_t *libvlc_media_new_callbacks(libvlc_instance_t *p_instance,
}
// Create a media as an empty node with a given name
-libvlc_media_t * libvlc_media_new_as_node( libvlc_instance_t *p_instance,
- const char * psz_name )
+libvlc_media_t * libvlc_media_new_as_node(const char *psz_name)
{
input_item_t * p_input_item;
libvlc_media_t * p_md;
@@ -595,7 +585,7 @@ libvlc_media_t * libvlc_media_new_as_node( libvlc_instance_t *p_instance,
return NULL;
}
- p_md = libvlc_media_new_from_input_item( p_instance, p_input_item );
+ p_md = libvlc_media_new_from_input_item( p_input_item );
input_item_Release( p_input_item );
p_subitems = media_get_subitems( p_md, true );
@@ -647,7 +637,6 @@ void libvlc_media_release( libvlc_media_t *p_md )
input_item_Release( p_md->p_input_item );
libvlc_event_manager_destroy( &p_md->event_manager );
- libvlc_release( p_md->p_libvlc_instance );
free( p_md );
}
@@ -666,7 +655,7 @@ libvlc_media_duplicate( libvlc_media_t *p_md_orig )
input_item_t *dup = input_item_Copy( p_md_orig->p_input_item );
if( dup == NULL )
return NULL;
- return libvlc_media_new_from_input_item( p_md_orig->p_libvlc_instance, dup );
+ return libvlc_media_new_from_input_item( dup );
}
// Get mrl from a media descriptor object
=====================================
lib/media_discoverer.c
=====================================
@@ -65,8 +65,7 @@ static void services_discovery_item_added( services_discovery_t *sd,
libvlc_media_discoverer_t *p_mdis = sd->owner.sys;
libvlc_media_list_t * p_mlist = p_mdis->p_mlist;
- p_md = libvlc_media_new_from_input_item( p_mdis->p_libvlc_instance,
- p_item );
+ p_md = libvlc_media_new_from_input_item( p_item );
if( parent != NULL )
{
@@ -82,7 +81,7 @@ static void services_discovery_item_added( services_discovery_t *sd,
if( p_mlist == kVLCDictionaryNotFound )
{
libvlc_media_t * p_catmd;
- p_catmd = libvlc_media_new_as_node( p_mdis->p_libvlc_instance, psz_cat );
+ p_catmd = libvlc_media_new_as_node( psz_cat );
p_mlist = libvlc_media_subitems( p_catmd );
p_mlist->b_read_only = true;
=====================================
lib/media_internal.h
=====================================
@@ -37,7 +37,6 @@ struct libvlc_media_t
libvlc_event_manager_t event_manager;
input_item_t *p_input_item;
- libvlc_instance_t *p_libvlc_instance;
vlc_atomic_rc_t rc;
VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t*) p_subitems; /* A media descriptor can have Sub items. This is the only dependency we really have on media_list */
@@ -54,8 +53,7 @@ struct libvlc_media_t
};
/* Media Descriptor */
-libvlc_media_t * libvlc_media_new_from_input_item(
- libvlc_instance_t *, input_item_t * );
+libvlc_media_t * libvlc_media_new_from_input_item( input_item_t * );
void libvlc_media_add_subtree(libvlc_media_t *, input_item_node_t *);
=====================================
lib/media_player.c
=====================================
@@ -769,11 +769,12 @@ error1:
* Create a Media Instance object with a media descriptor.
**************************************************************************/
libvlc_media_player_t *
-libvlc_media_player_new_from_media( libvlc_media_t * p_md )
+libvlc_media_player_new_from_media( libvlc_instance_t *inst,
+ libvlc_media_t * p_md )
{
libvlc_media_player_t * p_mi;
- p_mi = libvlc_media_player_new( p_md->p_libvlc_instance );
+ p_mi = libvlc_media_player_new( inst );
if( !p_mi )
return NULL;
=====================================
test/libvlc/libvlc_additions.h
=====================================
@@ -19,9 +19,9 @@
* http://www.gnu.org/copyleft/gpl.html *
**********************************************************************/
-static void* media_list_add_file_path(libvlc_instance_t *vlc, libvlc_media_list_t *ml, const char * file_path)
+static void* media_list_add_file_path(libvlc_media_list_t *ml, const char * file_path)
{
- libvlc_media_t *md = libvlc_media_new_location (vlc, file_path);
+ libvlc_media_t *md = libvlc_media_new_location(file_path);
libvlc_media_list_add_media (ml, md);
libvlc_media_release (md);
return md;
=====================================
test/libvlc/media.c
=====================================
@@ -113,9 +113,9 @@ static void test_media_preparsed(libvlc_instance_t *vlc, const char *path,
libvlc_media_t *media;
if (path != NULL)
- media = libvlc_media_new_path (vlc, path);
+ media = libvlc_media_new_path(path);
else
- media = libvlc_media_new_location (vlc, location);
+ media = libvlc_media_new_location(location);
assert (media != NULL);
vlc_sem_t sem;
@@ -278,7 +278,7 @@ static void test_media_subitems_media(libvlc_instance_t *vlc,
* file to force parsing. */
libvlc_event_attach (em, libvlc_MediaSubItemTreeAdded, subitem_parse_ended, &sem);
- libvlc_media_player_t *mp = libvlc_media_player_new_from_media (media);
+ libvlc_media_player_t *mp = libvlc_media_player_new_from_media(vlc, media);
assert (mp);
assert (libvlc_media_player_play (mp) != -1);
vlc_sem_wait (&sem);
@@ -311,7 +311,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
libvlc_media_t *media;
test_log ("Testing media_subitems: path: '%s'\n", subitems_path);
- media = libvlc_media_new_path (vlc, subitems_path);
+ media = libvlc_media_new_path(subitems_path);
assert (media != NULL);
test_media_subitems_media(vlc, media, false, true);
libvlc_media_release (media);
@@ -324,7 +324,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
char *location;
assert (asprintf (&location, "%s%s", schemes[i], subitems_realpath) != -1);
test_log ("Testing media_subitems: location: '%s'\n", location);
- media = libvlc_media_new_location (vlc, location);
+ media = libvlc_media_new_location(location);
assert (media != NULL);
test_media_subitems_media(vlc, media, false, true);
free (location);
@@ -337,7 +337,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
int fd = open (subitems_path, O_RDONLY);
test_log ("Testing media_subitems: fd: '%d'\n", fd);
assert (fd >= 0);
- media = libvlc_media_new_fd (vlc, fd);
+ media = libvlc_media_new_fd(fd);
assert (media != NULL);
test_media_subitems_media(vlc, media, true, true);
libvlc_media_release (media);
@@ -347,7 +347,7 @@ static void test_media_subitems(libvlc_instance_t *vlc)
#endif
test_log ("Testing media_subitems failure\n");
- media = libvlc_media_new_location (vlc, "wrongfile://test");
+ media = libvlc_media_new_location("wrongfile://test");
assert (media != NULL);
test_media_subitems_media(vlc, media, false, false);
libvlc_media_release (media);
=====================================
test/libvlc/media_list.c
=====================================
@@ -37,11 +37,11 @@ static void test_media_list (const char ** argv, int argc)
ml = libvlc_media_list_new();
assert (ml != NULL);
- md1 = libvlc_media_new_path (vlc, "/dev/null");
+ md1 = libvlc_media_new_path("/dev/null");
assert (md1 != NULL);
- md2 = libvlc_media_new_path (vlc, "/dev/null");
+ md2 = libvlc_media_new_path("/dev/null");
assert (md2 != NULL);
- md3 = libvlc_media_new_path (vlc, "/dev/null");
+ md3 = libvlc_media_new_path("/dev/null");
assert (md3 != NULL);
ret = libvlc_media_list_add_media (ml, md1);
@@ -106,7 +106,7 @@ static void test_media_list (const char ** argv, int argc)
p_non_exist = libvlc_media_list_item_at_index (ml, -1);
assert (p_non_exist == NULL);
- md4 = libvlc_media_new_path (vlc, "/dev/null");
+ md4 = libvlc_media_new_path("/dev/null");
assert (md4 != NULL);
/* try to find non inserted item */
=====================================
test/libvlc/media_list_player.c
=====================================
@@ -121,7 +121,7 @@ static void test_media_list_player_items_queue(const char** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert(md);
ml = libvlc_media_list_new (vlc);
@@ -137,21 +137,21 @@ static void test_media_list_player_items_queue(const char** argv, int argc)
queue_expected_item(&check, md);
// Add three more media
- queue_expected_item(&check, media_list_add_file_path (vlc, ml, file));
- queue_expected_item(&check, media_list_add_file_path (vlc, ml, file));
- queue_expected_item(&check, media_list_add_file_path (vlc, ml, file));
+ queue_expected_item(&check, media_list_add_file_path(ml, file));
+ queue_expected_item(&check, media_list_add_file_path(ml, file));
+ queue_expected_item(&check, media_list_add_file_path(ml, file));
// Add a node
- libvlc_media_t *node = libvlc_media_new_as_node(vlc, "node");
+ libvlc_media_t *node = libvlc_media_new_as_node("node");
assert(node);
libvlc_media_list_add_media(ml, node);
queue_expected_item(&check, node);
// Add items to that node
libvlc_media_list_t *subitems = libvlc_media_subitems(node);
- queue_expected_item(&check, media_list_add_file_path(vlc, subitems, file));
- queue_expected_item(&check, media_list_add_file_path(vlc, subitems, file));
- queue_expected_item(&check, media_list_add_file_path(vlc, subitems, file));
+ queue_expected_item(&check, media_list_add_file_path(subitems, file));
+ queue_expected_item(&check, media_list_add_file_path(subitems, file));
+ queue_expected_item(&check, media_list_add_file_path(subitems, file));
libvlc_media_list_release(subitems);
libvlc_media_list_player_set_media_list (mlp, ml);
@@ -186,7 +186,7 @@ static void test_media_list_player_previous(const char** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert(md);
ml = libvlc_media_list_new (vlc);
@@ -198,9 +198,9 @@ static void test_media_list_player_previous(const char** argv, int argc)
libvlc_media_list_add_media (ml, md);
// Add three media
- media_list_add_file_path (vlc, ml, file);
- media_list_add_file_path (vlc, ml, file);
- media_list_add_file_path (vlc, ml, file);
+ media_list_add_file_path(ml, file);
+ media_list_add_file_path(ml, file);
+ media_list_add_file_path(ml, file);
libvlc_media_list_player_set_media_list (mlp, ml);
@@ -245,7 +245,7 @@ static void test_media_list_player_next(const char** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert(md);
ml = libvlc_media_list_new (vlc);
@@ -257,9 +257,9 @@ static void test_media_list_player_next(const char** argv, int argc)
libvlc_media_list_add_media (ml, md);
// Add three media
- media_list_add_file_path (vlc, ml, file);
- media_list_add_file_path (vlc, ml, file);
- media_list_add_file_path (vlc, ml, file);
+ media_list_add_file_path(ml, file);
+ media_list_add_file_path(ml, file);
+ media_list_add_file_path(ml, file);
libvlc_media_list_player_set_media_list (mlp, ml);
@@ -304,7 +304,7 @@ static void test_media_list_player_pause_stop(const char** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert(md);
ml = libvlc_media_list_new (vlc);
@@ -344,7 +344,7 @@ static void test_media_list_player_play_item_at_index(const char** argv, int arg
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert(md);
ml = libvlc_media_list_new (vlc);
@@ -403,19 +403,19 @@ static void test_media_list_player_playback_options (const char** argv, int argc
* ml5&6: 0 0 -- 1
*/
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert(md);
- md2 = libvlc_media_new_location (vlc, file);
+ md2 = libvlc_media_new_location(file);
assert(md2);
- md3 = libvlc_media_new_location (vlc, file);
+ md3 = libvlc_media_new_location(file);
assert(md3);
- md4 = libvlc_media_new_location (vlc, file);
+ md4 = libvlc_media_new_location(file);
assert(md4);
- md5 = libvlc_media_new_location (vlc, file);
+ md5 = libvlc_media_new_location(file);
assert(md5);
ml = libvlc_media_list_new (vlc);
@@ -436,25 +436,25 @@ static void test_media_list_player_playback_options (const char** argv, int argc
ml6 = libvlc_media_list_new (vlc);
assert (ml6 != NULL);
- media_list_add_file_path (vlc, ml2, file);
- media_list_add_file_path (vlc, ml2, file);
+ media_list_add_file_path(ml2, file);
+ media_list_add_file_path(ml2, file);
- media_list_add_file_path (vlc, ml3, file);
- media_list_add_file_path (vlc, ml3, file);
+ media_list_add_file_path(ml3, file);
+ media_list_add_file_path(ml3, file);
libvlc_media_list_add_media (ml3, md4);
- media_list_add_file_path (vlc, ml3, file);
- media_list_add_file_path (vlc, ml3, file);
- media_list_add_file_path (vlc, ml3, file);
+ media_list_add_file_path(ml3, file);
+ media_list_add_file_path(ml3, file);
+ media_list_add_file_path(ml3, file);
libvlc_media_list_add_media (ml3, md5);
- media_list_add_file_path (vlc, ml4, file);
- media_list_add_file_path (vlc, ml4, file);
- media_list_add_file_path (vlc, ml4, file);
+ media_list_add_file_path(ml4, file);
+ media_list_add_file_path(ml4, file);
+ media_list_add_file_path(ml4, file);
- media_list_add_file_path (vlc, ml5, file);
+ media_list_add_file_path(ml5, file);
- media_list_add_file_path (vlc, ml6, file);
- media_list_add_file_path (vlc, ml6, file);
+ media_list_add_file_path(ml6, file);
+ media_list_add_file_path(ml6, file);
md->p_subitems = ml2;
md2->p_subitems = ml3;
=====================================
test/libvlc/media_player.c
=====================================
@@ -167,7 +167,7 @@ static void test_media_player_set_media(const char** argv, int argc)
libvlc_instance_t *vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- libvlc_media_t *md = libvlc_media_new_location (vlc, file);
+ libvlc_media_t *md = libvlc_media_new_location(file);
assert (md != NULL);
libvlc_media_player_t *mp = libvlc_media_player_new (vlc);
@@ -196,10 +196,10 @@ static void test_media_player_play_stop(const char** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert (md != NULL);
- mi = libvlc_media_player_new_from_media (md);
+ mi = libvlc_media_player_new_from_media (vlc, md);
assert (mi != NULL);
libvlc_media_release (md);
@@ -223,10 +223,10 @@ static void test_media_player_pause_stop(const char** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- md = libvlc_media_new_location (vlc, file);
+ md = libvlc_media_new_location(file);
assert (md != NULL);
- mi = libvlc_media_player_new_from_media (md);
+ mi = libvlc_media_player_new_from_media (vlc, md);
assert (mi != NULL);
libvlc_media_release (md);
@@ -346,7 +346,7 @@ static void test_media_player_tracks(const char** argv, int argc)
/* Load the mock media */
libvlc_instance_t *vlc = libvlc_new (argc, new_argv);
assert (vlc != NULL);
- libvlc_media_t *md = libvlc_media_new_location (vlc, file);
+ libvlc_media_t *md = libvlc_media_new_location(file);
assert (md != NULL);
libvlc_media_player_t *mp = libvlc_media_player_new (vlc);
assert (mp != NULL);
@@ -552,7 +552,7 @@ static void test_media_player_programs(const char** argv, int argc)
/* Load the mock media */
libvlc_instance_t *vlc = libvlc_new (argc, new_argv);
assert (vlc != NULL);
- libvlc_media_t *md = libvlc_media_new_location (vlc, file);
+ libvlc_media_t *md = libvlc_media_new_location(file);
assert (md != NULL);
libvlc_media_player_t *mp = libvlc_media_player_new (vlc);
assert (mp != NULL);
@@ -675,7 +675,7 @@ static void test_media_player_multiple_instance(const char** argv, int argc)
libvlc_instance_t *instance2 = libvlc_new(argc, argv);
/* ...with the media and the player being on different instances */
- libvlc_media_t *media1 = libvlc_media_new_path(instance2, "foo");
+ libvlc_media_t *media1 = libvlc_media_new_path("foo");
libvlc_media_player_t *player1 = libvlc_media_player_new(instance1);
libvlc_media_player_set_media(player1, media1);
=====================================
test/libvlc/meta.c
=====================================
@@ -37,7 +37,7 @@ static void test_meta (const char ** argv, int argc)
vlc = libvlc_new (argc, argv);
assert (vlc != NULL);
- media = libvlc_media_new_path (vlc, SRCDIR "/samples/meta.mp3");
+ media = libvlc_media_new_path(SRCDIR "/samples/meta.mp3");
assert( media );
libvlc_media_parse_sync(vlc, media, libvlc_media_parse_local, -1);
=====================================
test/libvlc/slaves.c
=====================================
@@ -23,10 +23,9 @@
#define SLAVES_DIR SRCDIR "/samples/slaves"
-static char *
-path_to_mrl(libvlc_instance_t *p_vlc, const char *psz_path)
+static char *path_to_mrl(const char *psz_path)
{
- libvlc_media_t *p_m = libvlc_media_new_path(p_vlc, psz_path);
+ libvlc_media_t *p_m = libvlc_media_new_path(psz_path);
char *psz_mrl = libvlc_media_get_mrl(p_m);
libvlc_media_release(p_m);
return psz_mrl;
@@ -80,13 +79,13 @@ test_media_has_slaves_from_parent(libvlc_instance_t *p_vlc,
libvlc_media_slave_t *p_expected_slaves,
unsigned i_expected_slaves)
{
- libvlc_media_t *p_m = libvlc_media_new_path(p_vlc, SLAVES_DIR);
+ libvlc_media_t *p_m = libvlc_media_new_path(SLAVES_DIR);
assert(p_m != NULL);
printf("Parse media dir to get subitems\n");
libvlc_media_parse_sync(p_vlc, p_m, libvlc_media_parse_local, -1);
- char *psz_main_media_mrl = path_to_mrl(p_vlc, psz_main_media);
+ char *psz_main_media_mrl = path_to_mrl(psz_main_media);
assert(psz_main_media_mrl != NULL);
printf("Main media mrl: '%s'\n", psz_main_media_mrl);
@@ -159,7 +158,7 @@ main (void)
/* Fill p_expected_slaves with correct VLC mrls */
for (unsigned int i = 0; i < ARRAY_SIZE(p_expected_slaves); ++i)
{
- p_expected_slaves[i].psz_uri = path_to_mrl(p_vlc, pp_slave_paths[i]);
+ p_expected_slaves[i].psz_uri = path_to_mrl(pp_slave_paths[i]);
assert(p_expected_slaves[i].psz_uri != NULL);
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/245b5ca72c103ef42ecec7653d45c4e7fba23fd8...a11616f94aebb3b0e7279504052692a9b7a57769
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/245b5ca72c103ef42ecec7653d45c4e7fba23fd8...a11616f94aebb3b0e7279504052692a9b7a57769
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list