Page 1 of 1

Point video to x window number in media_list mode

Posted: 26 Nov 2011 18:06
by brushhead
Hello,
I have been able to show video in an x window using a call to the libvlc_media_player_set_xwindow and that works fine. I am now hoping to use a player in medialist mode using libvlc_media_list_player_new but I cannot seem to find a function for point my video to the relevant window.

I am programming in bog standard C.

Have I misunderstood how this works?

Thanks,

Rob.

Re: Point video to x window number in media_list mode

Posted: 26 Nov 2011 18:45
by Rémi Denis-Courmont
You need to retrieve the underling media_player object from the list player. Yes, the list API is confusing.

Re: Point video to x window number in media_list mode

Posted: 28 Nov 2011 21:24
by brushhead
Hello Rémi,
Thanks for responding. Been at Uni today and not been able to respond.

I did some more reading and I think i've got code that'll work.

I am calling in sequence:

// Define pointers and set them NULL.
//
libvlc_media_list_t* MediaListing = NULL;
libvlc_instance_t * VLC_Inst = NULL;
libvlc_media_t *Media = NULL;
libvlc_media_player_t * ThePlayer = NULL;
libvlc_media_list_player_t * ListPlayer = NULL;
int Loop = 0;

// First thing's first.
//
VLC_Inst = libvlc_new(0, NULL);

// Create a new media listing based on our player object.
//
MediaListing = libvlc_media_list_new(VLC_Inst);

//Create the list player.
//
ListPlayer = libvlc_media_list_player_new(VLC_Inst);

// The main player to which we will tie to the xwindow.
//
ThePlayer = libvlc_media_player_new(VLC_Inst);

// Build up media listing for list_player
//
while(ChannelsData[Loop].MulticastAddress !=NULL){

Media = libvlc_media_new_path(VLC_Inst, ChannelsData[Loop].MulticastAddress);
libvlc_media_list_add_media(MediaListing, Media);
Loop++;
}

// Point the media list at our media list player. This is the crucial bit I think I missed.
//
libvlc_media_list_player_set_media_player(ListPlayer, ThePlayer);


// Get the handle to the main window.
//
xwin = GDK_WINDOW_XWINDOW (GTK_WIDGET (window)->window);

// Set the window into which our video will be played.
//
libvlc_media_player_set_xwindow ( ThePlayer, xwin);

// Start the player off based on our media listing.
//
libvlc_media_list_player_play(ListPlayer);

I think i've got this right but thought it might be helpful to post some code. I'm running 1.1.3 on Debian Squeeze. I did try and build VLC from source but found it quite difficult. Am looking forward to 1.2 because of the enhanced DVD navitation functions.

Thanks,

Rob.