CefMediaRoute.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Represents the route between a media source and sink. Instances of this
  10. /// object are created via CefMediaRouter::CreateRoute and retrieved via
  11. /// CefMediaObserver::OnRoutes. Contains the status and metadata of a
  12. /// routing operation. The methods of this class may be called on any browser
  13. /// process thread unless otherwise indicated.
  14. /// </summary>
  15. public sealed unsafe partial class CefMediaRoute
  16. {
  17. /// <summary>
  18. /// Returns the ID for this route.
  19. /// </summary>
  20. public string Id
  21. {
  22. get
  23. {
  24. var n_result = cef_media_route_t.get_id(_self);
  25. return cef_string_userfree.ToString(n_result);
  26. }
  27. }
  28. /// <summary>
  29. /// Returns the source associated with this route.
  30. /// </summary>
  31. public CefMediaSource GetSource()
  32. {
  33. return CefMediaSource.FromNative(
  34. cef_media_route_t.get_source(_self)
  35. );
  36. }
  37. /// <summary>
  38. /// Returns the sink associated with this route.
  39. /// </summary>
  40. public CefMediaSink GetSink()
  41. {
  42. return CefMediaSink.FromNative(
  43. cef_media_route_t.get_sink(_self)
  44. );
  45. }
  46. /// <summary>
  47. /// Send a message over this route. |message| will be copied if necessary.
  48. /// </summary>
  49. public void SendRouteMessage(IntPtr message, int messageSize)
  50. {
  51. var n_messageSize = checked((UIntPtr)messageSize);
  52. cef_media_route_t.send_route_message(_self, (void*)message, n_messageSize);
  53. }
  54. /// <summary>
  55. /// Terminate this route. Will result in an asynchronous call to
  56. /// CefMediaObserver::OnRoutes on all registered observers.
  57. /// </summary>
  58. public void Terminate()
  59. {
  60. cef_media_route_t.terminate(_self);
  61. }
  62. }
  63. }