]> git.sesse.net Git - vlc/blob - bindings/libvlcpp/src/media.hpp
New C++ binding for libvlc.
[vlc] / bindings / libvlcpp / src / media.hpp
1 /*****************************************************************************
2  * media.hpp: represent a media
3  *****************************************************************************
4  * Copyright (C) 2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: RĂ©mi Duraffort <ivoire@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef LIBVLCPP_MEDIA_HPP
25 #define LIBVLCPP_MEDIA_HPP
26
27 #include <vlc/libvlc.h>
28 #include <vlc/libvlc_media.h>
29
30 #include "libvlc.hpp"
31
32 namespace libvlc
33 {
34
35 class MediaPlayer;
36
37 class Media
38 {
39 public:
40     /**
41      * Contructor
42      * @param libvlcInstance: instance of the libVLC class
43      * @param psz_mrl: MRL of the media
44      */
45     Media( libVLC &libvlcInstance, const char *psz_mrl );
46
47     /**
48      * Copy contructor
49      * @param original: the instance to copy
50      */
51     Media( const Media& original );
52
53     /** \todo: node contructor */
54
55     /** Destructor */
56     ~Media();
57
58     /**
59      * Add an option to the media
60      * @param ppsz_options: the options as a string
61      */
62     void addOption( const char *ppsz_options );
63
64     /**
65      * Add an option to the media
66      * @param ppsz_options: the options as a string
67      * @param flag: the flag for the options
68      */
69     void addOption( const char *ppsz_options, libvlc_media_option_t flag );
70
71
72     /**
73      * Get the duration of the media
74      * @return the duration
75      */
76     int64_t getDuration();
77
78     /**
79      * Get preparsed status of the media
80      * @return true if the media has been preparsed, false otherwise
81      */
82     int isPreparsed();
83
84     /**
85      * Get the MRL of the media
86      * @return the MRL of the media
87      */
88     char *getMrl();
89
90     /**
91      * Get the requiered meta
92      * @param e_meta: type of the meta
93      * @return the requiered meta
94      */
95     char *getMeta( libvlc_meta_t e_meta );
96
97     /**
98      * Set the given meta
99      * @param e_meta: type of the meta
100      * @param psz_value: value of the meta
101      */
102     void setMeta( libvlc_meta_t e_meta, const char *psz_value );
103
104     /**
105      * Save the meta to the file
106      * @return true if the operation was successfull
107      */
108     int saveMeta();
109
110     /**
111      * Get the state of the media
112      * @return the state of the media
113      */
114     libvlc_state_t getState();
115
116     /**
117      * Get some statistics about this media
118      * @return the statistics
119      */
120     libvlc_media_stats_t *getStats();
121
122     /**\todo: getSubItems */
123     /**\todo: getEventManager */
124
125     /**
126      * Set media descriptor's user data
127      * @param p_user_data: pointer to user data
128      */
129     void setUserData( void *p_user_data );
130
131     /**
132      * Retrive user data specified by a call to setUserData
133      * @return the user data pointer
134      */
135     void *getUserData();
136
137 private:
138     /**
139      * Get the instance of the libvlc_media_t
140      * @return the pointer to libvlc_media_t
141      */
142     libvlc_media_t *getInstance();
143
144     /** The media */
145     libvlc_media_t *m_media;
146
147     /** Friend class that can access the instance */
148     friend class MediaPlayer;
149
150 };
151
152 };
153
154 #endif // LIBVLCPP_MEDIA_HPP
155