Changeset 66af5fd9ea0c7f4c22406b24cc728af3b6b2ced1
- Timestamp:
- 10/26/07 19:14:26
(10 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1193418866 +0000
- git-parent:
[a1251a8d8907d3e05eb7190734453e4ea05f8b07]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1193418866 +0000
- Message:
Some more doc
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| ra2aa6ae |
r66af5fd |
|
| 32 | 32 | public class VLCException : Exception |
|---|
| 33 | 33 | { |
|---|
| | 34 | /** |
|---|
| | 35 | * Creates a managed VLC exception. |
|---|
| | 36 | */ |
|---|
| 34 | 37 | public VLCException () |
|---|
| 35 | 38 | { |
|---|
| 36 | 39 | } |
|---|
| 37 | 40 | |
|---|
| | 41 | /** |
|---|
| | 42 | * Creates a managed VLC exception. |
|---|
| | 43 | * @param message exception error message |
|---|
| | 44 | */ |
|---|
| 38 | 45 | public VLCException (string message) |
|---|
| 39 | 46 | : base (message) |
|---|
| … | … | |
| 41 | 48 | } |
|---|
| 42 | 49 | |
|---|
| | 50 | /** |
|---|
| | 51 | * Creates a managed VLC exception wrapping another exception. |
|---|
| | 52 | * @param message exception error message |
|---|
| | 53 | * @param inner inner wrapped exception |
|---|
| | 54 | */ |
|---|
| 43 | 55 | public VLCException (string message, Exception inner) |
|---|
| 44 | 56 | : base (message, inner) |
|---|
| … | … | |
| 73 | 85 | } |
|---|
| 74 | 86 | |
|---|
| | 87 | /** |
|---|
| | 88 | * Throws a managed exception if LibVLC has returned a native |
|---|
| | 89 | * unmanaged exception. Clears the native exception. |
|---|
| | 90 | */ |
|---|
| 75 | 91 | public void Raise () |
|---|
| 76 | 92 | { |
|---|
| … | … | |
| 87 | 103 | } |
|---|
| 88 | 104 | |
|---|
| | 105 | /** IDisposable implementation. */ |
|---|
| 89 | 106 | public void Dispose () |
|---|
| 90 | 107 | { |
|---|
| ra2aa6ae |
r66af5fd |
|
| 1 | | /* |
|---|
| 2 | | * libvlc.cs - libvlc-control CIL bindings |
|---|
| | 1 | /** |
|---|
| | 2 | * @file libvlc.cs |
|---|
| | 3 | * @brief libvlc-control CIL bindings |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * $Id$ |
|---|
| … | … | |
| 28 | 29 | namespace VideoLAN.LibVLC |
|---|
| 29 | 30 | { |
|---|
| | 31 | /** |
|---|
| | 32 | * The VLC class is used to create LibVLC Instance objects. |
|---|
| | 33 | * The VLC class has only one static method and cannot be instanciated. |
|---|
| | 34 | * |
|---|
| | 35 | * @code |
|---|
| | 36 | * string[] argv = new string[]{ "-vvv", "-I", "dummy" }; |
|---|
| | 37 | * |
|---|
| | 38 | * Instance vlc = VLC.CreateInstance (argv); |
|---|
| | 39 | * @endcode |
|---|
| | 40 | */ |
|---|
| 30 | 41 | public sealed class VLC |
|---|
| 31 | 42 | { |
|---|
| | 43 | /** |
|---|
| | 44 | * Loads native LibVLC and creates a LibVLC instance. |
|---|
| | 45 | * |
|---|
| | 46 | * @param args VLC command line parameters for the LibVLC Instance. |
|---|
| | 47 | * |
|---|
| | 48 | * @return a new LibVLC Instance |
|---|
| | 49 | */ |
|---|
| 32 | 50 | public static Instance CreateInstance (string[] args) |
|---|
| 33 | 51 | { |
|---|
| … | … | |
| 45 | 63 | }; |
|---|
| 46 | 64 | |
|---|
| 47 | | /** Safe handle for unmanaged LibVLC instance pointer */ |
|---|
| | 65 | /** |
|---|
| | 66 | * Safe handle for unmanaged LibVLC instance pointer. |
|---|
| | 67 | */ |
|---|
| 48 | 68 | public sealed class InstanceHandle : NonNullHandle |
|---|
| 49 | 69 | { |
|---|
| … | … | |
| 53 | 73 | |
|---|
| 54 | 74 | [DllImport ("libvlc-control.dll", EntryPoint="libvlc_new")] |
|---|
| 55 | | public static extern |
|---|
| | 75 | internal static extern |
|---|
| 56 | 76 | InstanceHandle Create (int argc, U8String[] argv, NativeException ex); |
|---|
| 57 | 77 | |
|---|
| … | … | |
| 59 | 79 | static extern void Destroy (IntPtr ptr, NativeException ex); |
|---|
| 60 | 80 | |
|---|
| | 81 | /** |
|---|
| | 82 | * System.Runtime.InteropServices.SafeHandle::ReleaseHandle. |
|---|
| | 83 | */ |
|---|
| 61 | 84 | protected override bool ReleaseHandle () |
|---|
| 62 | 85 | { |
|---|
| … | … | |
| 67 | 90 | |
|---|
| 68 | 91 | /** |
|---|
| 69 | | * Managed class for LibVLC instance (including playlist) |
|---|
| | 92 | * LibVLC Instance provides basic media player features from VLC, |
|---|
| | 93 | * such as play/pause/stop and flat playlist management. |
|---|
| 70 | 94 | */ |
|---|
| 71 | 95 | public class Instance : BaseObject<InstanceHandle> |
|---|
| … | … | |
| 78 | 102 | } |
|---|
| 79 | 103 | |
|---|
| | 104 | /** |
|---|
| | 105 | * Creates a MediaDescriptor. |
|---|
| | 106 | * @param mrl Media Resource Locator (file path or URL) |
|---|
| | 107 | * @return create MediaDescriptor object. |
|---|
| | 108 | */ |
|---|
| 80 | 109 | public MediaDescriptor CreateDescriptor (string mrl) |
|---|
| 81 | 110 | { |
|---|
| … | … | |
| 90 | 119 | static extern void PlaylistLoop (InstanceHandle self, bool b, |
|---|
| 91 | 120 | NativeException ex); |
|---|
| 92 | | /** Sets the playlist loop flag */ |
|---|
| | 121 | /** Sets the playlist loop flag. */ |
|---|
| 93 | 122 | public bool Loop |
|---|
| 94 | 123 | { |
|---|
| … | … | |
| 103 | 132 | static extern void PlaylistPlay (InstanceHandle self, int id, int optc, |
|---|
| 104 | 133 | U8String[] optv, NativeException ex); |
|---|
| 105 | | /** Plays the next playlist item */ |
|---|
| | 134 | /** Plays the next playlist item (if not already playing). */ |
|---|
| 106 | 135 | public void Play () |
|---|
| 107 | 136 | { |
|---|
| … | … | |
| 113 | 142 | static extern void PlaylistPause (InstanceHandle self, |
|---|
| 114 | 143 | NativeException ex); |
|---|
| 115 | | /** Toggles pause */ |
|---|
| | 144 | /** Toggles pause (starts playing if stopped, pauses if playing). */ |
|---|
| 116 | 145 | public void TogglePause () |
|---|
| 117 | 146 | { |
|---|
| … | … | |
| 124 | 153 | static extern int PlaylistIsPlaying (InstanceHandle self, |
|---|
| 125 | 154 | NativeException ex); |
|---|
| 126 | | /** Whether the playlist is running, or in pause/stop */ |
|---|
| | 155 | /** Whether the playlist is running, or paused/stopped. */ |
|---|
| 127 | 156 | public bool IsPlaying |
|---|
| 128 | 157 | { |
|---|
| … | … | |
| 138 | 167 | static extern void PlaylistStop (InstanceHandle self, |
|---|
| 139 | 168 | NativeException ex); |
|---|
| 140 | | /** Stops playing */ |
|---|
| | 169 | /** Stops playing. */ |
|---|
| 141 | 170 | public void Stop () |
|---|
| 142 | 171 | { |
|---|
| … | … | |
| 148 | 177 | static extern void PlaylistNext (InstanceHandle self, |
|---|
| 149 | 178 | NativeException ex); |
|---|
| 150 | | /** Goes to next playlist item (and start playing it) */ |
|---|
| | 179 | /** Switches to next playlist item, and starts playing it. */ |
|---|
| 151 | 180 | public void Next () |
|---|
| 152 | 181 | { |
|---|
| … | … | |
| 158 | 187 | static extern void PlaylistPrev (InstanceHandle self, |
|---|
| 159 | 188 | NativeException ex); |
|---|
| 160 | | /** Goes to previous playlist item (and start playing it) */ |
|---|
| | 189 | /** Switches to previous playlist item, and starts playing it. */ |
|---|
| 161 | 190 | public void Prev () |
|---|
| 162 | 191 | { |
|---|
| … | … | |
| 168 | 197 | static extern void PlaylistClear (InstanceHandle self, |
|---|
| 169 | 198 | NativeException ex); |
|---|
| 170 | | /** Clears the whole playlist */ |
|---|
| | 199 | /** Clears the whole playlist. */ |
|---|
| 171 | 200 | public void Clear () |
|---|
| 172 | 201 | { |
|---|
| … | … | |
| 184 | 213 | U8String name, int optc, |
|---|
| 185 | 214 | U8String[] optv, NativeException e); |
|---|
| 186 | | /** Appends an item to the playlist with options */ |
|---|
| | 215 | /** |
|---|
| | 216 | * Appends an item to the playlist, with options. |
|---|
| | 217 | * @param mrl Media Resource Locator (file name or URL) |
|---|
| | 218 | * @param name playlist item user-visible name |
|---|
| | 219 | * @param opts item options (see LibVLC documentation for details) |
|---|
| | 220 | * @return created playlist item. |
|---|
| | 221 | */ |
|---|
| 187 | 222 | public PlaylistItem Add (string mrl, string name, string[] opts) |
|---|
| 188 | 223 | { |
|---|
| … | … | |
| 200 | 235 | return item; |
|---|
| 201 | 236 | } |
|---|
| | 237 | /** |
|---|
| | 238 | * Appends an item with options. |
|---|
| | 239 | * @param mrl Media Resource Locator (file name or URL) |
|---|
| | 240 | * @param opts item options (see LibVLC documentation for details) |
|---|
| | 241 | * @return created playlist item. |
|---|
| | 242 | */ |
|---|
| 202 | 243 | public PlaylistItem Add (string mrl, string[] opts) |
|---|
| 203 | 244 | { |
|---|
| 204 | 245 | return Add (mrl, null, opts); |
|---|
| 205 | 246 | } |
|---|
| | 247 | /** |
|---|
| | 248 | * Appends an item to the playlist. |
|---|
| | 249 | * @param mrl Media Resource Locator (file name or URL) |
|---|
| | 250 | * @param name playlist item user-visible name |
|---|
| | 251 | * @return created playlist item. |
|---|
| | 252 | */ |
|---|
| 206 | 253 | public PlaylistItem Add (string mrl, string name) |
|---|
| 207 | 254 | { |
|---|
| 208 | 255 | return Add (mrl, name, new string[0]); |
|---|
| 209 | 256 | } |
|---|
| | 257 | /** |
|---|
| | 258 | * Appends an item to the playlist. |
|---|
| | 259 | * @param mrl Media Resource Locator (file name or URL) |
|---|
| | 260 | * @return created playlist item. |
|---|
| | 261 | */ |
|---|
| 210 | 262 | public PlaylistItem Add (string mrl) |
|---|
| 211 | 263 | { |
|---|
| … | … | |
| 217 | 269 | static extern int PlaylistDelete (InstanceHandle self, int id, |
|---|
| 218 | 270 | NativeException e); |
|---|
| | 271 | /** |
|---|
| | 272 | * Removes an item from the playlist. |
|---|
| | 273 | * @param item playlist item (as obtained from Add()) |
|---|
| | 274 | */ |
|---|
| 219 | 275 | public void Delete (PlaylistItem item) |
|---|
| 220 | 276 | { |
|---|
| … | … | |
| 228 | 284 | }; |
|---|
| 229 | 285 | |
|---|
| | 286 | /** |
|---|
| | 287 | * A playlist item. |
|---|
| | 288 | */ |
|---|
| 230 | 289 | public class PlaylistItem |
|---|
| 231 | 290 | { |
|---|
| … | … | |
| 279 | 338 | }; |
|---|
| 280 | 339 | |
|---|
| | 340 | /** |
|---|
| | 341 | * Media descriptor. Not implemented yet. |
|---|
| | 342 | */ |
|---|
| 281 | 343 | public class MediaDescriptor : BaseObject<DescriptorHandle> |
|---|
| 282 | 344 | { |
|---|
| ra2aa6ae |
r66af5fd |
|
| 1 | | /* |
|---|
| 2 | | * libvlc.cs - libvlc-control CIL bindings |
|---|
| | 1 | /** |
|---|
| | 2 | * @file marshal.cs |
|---|
| | 3 | * @brief LibVLC marshalling utilities |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * $Id$ |
|---|
| … | … | |
| 29 | 30 | /** |
|---|
| 30 | 31 | * Abstract safe handle class for non-NULL pointers |
|---|
| 31 | | * (Microsoft.* namespace has a similar class, but lets stick to System.*) |
|---|
| | 32 | * (Microsoft.* namespace has a similar class, |
|---|
| | 33 | * but lets stick to System.*). |
|---|
| 32 | 34 | */ |
|---|
| 33 | 35 | public abstract class NonNullHandle : SafeHandle |
|---|
| … | … | |
| 47 | 49 | }; |
|---|
| 48 | 50 | |
|---|
| | 51 | /** |
|---|
| | 52 | * Generic class for managed wrapper around a native safe handle. |
|---|
| | 53 | */ |
|---|
| 49 | 54 | public class BaseObject<HandleT> : IDisposable where HandleT : SafeHandle |
|---|
| 50 | 55 | { |
|---|