libvlc_media_get_tracks_info compiling error

*nix specific usage questions
bednar_r
New Cone
New Cone
Posts: 6
Joined: 23 Aug 2010 10:15

libvlc_media_get_tracks_info compiling error

Postby bednar_r » 23 Aug 2010 10:47

Hi,

I created a program using the libvlc, it works as I want.
But now I want to go further, I would like to use libvlc_media_get_tracks_info. But my compiler tells me it can not find this function.
So i checked include and flags compilation. They seems good.

I include vlc.h, and flags compilation is -lvlc, using g++.

If someone has an idea please answer me.
I hope you could help me.

Thanks you for reading.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: libvlc_media_get_tracks_info compiling error

Postby ivoire » 23 Aug 2010 10:58

Do you have the source code and the g++ output ?

bednar_r
New Cone
New Cone
Posts: 6
Joined: 23 Aug 2010 10:15

Re: libvlc_media_get_tracks_info compiling error

Postby bednar_r » 24 Aug 2010 09:22

The code:

Code: Select all

libvlc::libvlc() { initVLC(); // Create a new media from the Media Resource Locator m_vlcMedia = libvlc_media_new( m_vlcInstance, "rtsp://192.168.0.9", &m_ex ); libvlc_media_add_option(m_vlcMedia,":rtsp-caching=50", NULL); // We now need a struct for storing the video buffer // and a mutex to protect it. // The structure will be given as an arguments for the // lock/unlock callbacks. struct ctx* context; // Allocating the space for the structure context = ( struct ctx* )malloc( sizeof( *context ) ); // Allocating the video buffer context->pixels = ( uchar* )malloc( ( sizeof( *( context->pixels ) ) * VIDEO_WIDTH * VIDEO_HEIGHT ) * 4 ); // Allocating the mutex context->mutex = new QMutex(); context->mainWindow = this; // Creating some char[] to store the media options char clock[64], cunlock[64], cdata[64]; char width[32], height[32], chroma[32], pitch[32]; // Preparing the options for the media // The clock and cunlock contain a pointer to the associated // static method (note the use of %lld). // // In that specific case we can't use Qt: // The sprintf method of the QString does not support // length modifiers (like %lld). sprintf( clock, ":vmem-lock=%lld", (long long int)(intptr_t)lock ); sprintf( cunlock, ":vmem-unlock=%lld", (long long int)(intptr_t)unlock ); sprintf( cdata, ":vmem-data=%lld", (long long int)(intptr_t)context ); sprintf( width, ":vmem-width=%i", VIDEO_WIDTH ); sprintf( height, ":vmem-height=%i", VIDEO_HEIGHT ); sprintf( chroma, ":vmem-chroma=%s", "RV32" ); sprintf( pitch, ":vmem-pitch=%i", VIDEO_WIDTH * 4 ); // List of options // This part can be easily replaced by a QStringList // instead of a C array. char const* media_options[] = { ":vout=vmem", width, height, chroma, pitch, clock, cunlock, cdata }; int media_options_size = sizeof( media_options ) / sizeof( *media_options ); // Adding each option from the array to the media for ( int i = 0; i < media_options_size; ++i ) { libvlc_media_add_option( m_vlcMedia, media_options[i], &m_ex ); } [color=#FF0000] libvlc_media_track_info_t *tracks; libvlc_media_get_tracks_info(m_vlcMedia, &tracks);[/color] // Put the media into the mediaplayer libvlc_media_player_set_media( m_vlcMediaplayer, m_vlcMedia, &m_ex ); // Finally, start the playback. libvlc_media_player_play( m_vlcMediaplayer, &m_ex ); } void libvlc::initVLC() { // List of parameters used to initialize libvlc. // These arguments are same as those you can pass // the the VLC command line. char const* vlc_argv[] = { "--verbose", "3", // Edit this line if libvlc can't locate your plugins directory //"--plugin-path", "/path/to/vlc", }; int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv); // Initialize the libvlc exception mechanism libvlc_exception_init( &m_ex ); // Create a libvlc instance m_vlcInstance = libvlc_new( vlc_argc, vlc_argv, &m_ex ); // This for catching and printing exceptions // raised by libvlc // Create the mediaplayer used to play a media m_vlcMediaplayer = libvlc_media_player_new( m_vlcInstance, &m_ex ); // Re-checking for exceptions cvNamedWindow("win", CV_WINDOW_AUTOSIZE); // We're done with the initialization! }

g++ output :
At first:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../qtsdk-2010.04/qt/mkspecs/linux-g++ -I../libvlc -I../../qtsdk-2010.04/qt/include/QtCore -I../../qtsdk-2010.04/qt/include/QtGui -I../../qtsdk-2010.04/qt/include -I../libvlc -I. -I. -o libvlc.o ../libvlc/libvlc.cpp
../libvlc/libvlc.cpp: In constructor ‘libvlc::libvlc()’:
../libvlc/libvlc.cpp:70: error: ‘libvlc_media_track_info_t’ was not declared in this scope
../libvlc/libvlc.cpp:70: error: ‘tracks’ was not declared in this scope
../libvlc/libvlc.cpp:71: error: ‘libvlc_media_get_tracks_info’ was not declared in this scope
make: *** [libvlc.o] Erreur 1


And after declared function:
g++ -Wl,-rpath,/home/sevil/qtsdk-2010.04/qt/lib -o libvlc libvlc.o main.o moc_libvlc.o -L/home/sevil/qtsdk-2010.04/qt/lib -lvlc -lcv -lcvaux -lhighgui -lQtGui -L/home/sevil/qtsdk-2010.04/qt/lib -L/usr/X11R6/lib -lQtCore -lpthread
libvlc.o: In function `libvlc':
../libvlc/libvlc.cpp:77: undefined reference to `libvlc_media_get_tracks_info(libvlc_media_t*, libvlc_media_track_info_t**)'
../libvlc/libvlc.cpp:77: undefined reference to `libvlc_media_get_tracks_info(libvlc_media_t*, libvlc_media_track_info_t**)'
collect2: ld returned 1 exit status
make: *** [libvlc] Erreur 1

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: libvlc_media_get_tracks_info compiling error

Postby ivoire » 24 Aug 2010 10:25

You are not using the last version of libvlc don't you ?
The exceptions has been removed and it seems that your code has some.

bednar_r
New Cone
New Cone
Posts: 6
Joined: 23 Aug 2010 10:15

Re: libvlc_media_get_tracks_info compiling error

Postby bednar_r » 24 Aug 2010 10:47

I install libvlc-dev version 1.0.6-1ubuntu1.2 with synaptic.
Is it the last version?

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: libvlc_media_get_tracks_info compiling error

Postby ivoire » 24 Aug 2010 11:11

The last version is 1.1 but I'm not sure that you can have it in your version of ubuntu (I guess you need ubuntu 10.4).
Anyway, wich libvlc headers are you including (can I see the .hpp file)?

bednar_r
New Cone
New Cone
Posts: 6
Joined: 23 Aug 2010 10:15

Re: libvlc_media_get_tracks_info compiling error

Postby bednar_r » 24 Aug 2010 11:38

I use ubuntu 10.4.
I include vlc/vlc.h.

Code: Select all

/***************************************************************************** * vlc.h: global header for libvlc ***************************************************************************** * Copyright (C) 1998-2008 the VideoLAN team * $Id: 0f34b57f3f53f2bfdaad3fdc544752c902d37461 $ * * Authors: Vincent Seguin <seguin@via.ecp.fr> * Samuel Hocevar <sam@zoy.org> * Gildas Bazin <gbazin@netcourrier.com> * Derk-Jan Hartman <hartman at videolan dot org> * Pierre d'Herbemont <pdherbemont@videolan.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef VLC_VLC_H #define VLC_VLC_H 1 /** * \file * This file defines libvlc new external API */ # ifdef __cplusplus extern "C" { # endif #include <vlc/libvlc_structures.h> #include <vlc/libvlc.h> #include <vlc/libvlc_media.h> #include <vlc/libvlc_media_player.h> #include <vlc/libvlc_media_list.h> #include <vlc/libvlc_media_list_view.h> #include <vlc/libvlc_media_list_player.h> #include <vlc/libvlc_media_library.h> #include <vlc/libvlc_media_discoverer.h> #include <vlc/libvlc_events.h> #include <vlc/libvlc_vlm.h> #include <vlc/deprecated.h> # ifdef __cplusplus } # endif #endif /* _VLC_VLC_H */
I already check in libvlc_media and the prototype was here.

And i had compile the version 1.1.3 of vlc, wich write libvlc configuration ->> version 1.1.3.
After make install no changes.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: libvlc_media_get_tracks_info compiling error

Postby ivoire » 24 Aug 2010 12:59

The code:

Code: Select all

libvlc::libvlc() { [...] // Adding each option from the array to the media for ( int i = 0; i < media_options_size; ++i ) { libvlc_media_add_option( m_vlcMedia, media_options[i], &m_ex ); } libvlc_media_track_info_t *tracks; libvlc_media_get_tracks_info(m_vlcMedia, &tracks); // Put the media into the mediaplayer libvlc_media_player_set_media( m_vlcMediaplayer, m_vlcMedia, &m_ex ); // Finally, start the playback. libvlc_media_player_play( m_vlcMediaplayer, &m_ex ); [...] }}
The exception must be removed too.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: libvlc_media_get_tracks_info compiling error

Postby ivoire » 24 Aug 2010 13:00

And i had compile the version 1.1.3 of vlc, wich write libvlc configuration ->> version 1.1.3.
After make install no changes.
Are you sure that you compile your application with libvlc 1.1.3 ? (if you didn't specify anything, they won't replace the previous libvlc headers which are in /usr/include)

bednar_r
New Cone
New Cone
Posts: 6
Joined: 23 Aug 2010 10:15

Re: libvlc_media_get_tracks_info compiling error

Postby bednar_r » 25 Aug 2010 15:40

I completely remove vlc to reinstall version 1.1.3 properly.
And after having corrected the error due to the version I finally managed to compile.

Thanks you.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: libvlc_media_get_tracks_info compiling error

Postby ivoire » 25 Aug 2010 16:22

Nice.

bednar_r
New Cone
New Cone
Posts: 6
Joined: 23 Aug 2010 10:15

Re: libvlc_media_get_tracks_info compiling error

Postby bednar_r » 25 Aug 2010 16:35

I have now an other error.
I would use libvlc_media_track_info_t::i_height

So my code is:

Code: Select all

libvlc_media_track_info_t *tracks; libvlc_media_get_tracks_info(m_vlcMedia, &tracks); height_vlc = tracks->i_height; width_vlc = tracks->i_width;
My IDE say me it's good but not the compiler.

g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../qtsdk-2010.04/qt/mkspecs/linux-g++ -I../libvlc -I../../qtsdk-2010.04/qt/include/QtCore -I../../qtsdk-2010.04/qt/include/QtGui -I../../qtsdk-2010.04/qt/include -I../libvlc -I. -I. -o libvlc.o ../libvlc/libvlc.cpp
../libvlc/libvlc.cpp: In constructor ‘libvlc::libvlc()’:
../libvlc/libvlc.cpp:79: error: ‘struct libvlc_media_track_info_t’ has no member named ‘i_height’
../libvlc/libvlc.cpp:80: error: ‘struct libvlc_media_track_info_t’ has no member named ‘i_width’
make: *** [libvlc.o] Erreur 1

xtophe
Big Cone-huna
Big Cone-huna
Posts: 1209
Joined: 24 Nov 2003 10:12
Location: Bristol, England

Re: libvlc_media_get_tracks_info compiling error

Postby xtophe » 25 Aug 2010 21:47

Check the header file
Xtophe


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: Google [Bot] and 32 guests