Skip to content

Commit

Permalink
[Multimedia] Add MediaPacket TBM surface APIs (#6278)
Browse files Browse the repository at this point in the history
* [Multimedia] Add MediaPacket TBM surface API
  • Loading branch information
hsgwon authored Aug 28, 2024
1 parent 6d66068 commit 63f4b54
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Tizen.Multimedia/Interop/Interop.MediaTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ internal static class MediaPacket

[DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_duration")]
internal static extern int GetDuration(IntPtr handle, out ulong value);

[DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_tbm_surface")]
internal static extern int GetTbmSurface(IntPtr handle, out IntPtr surface);

[DllImport(Libraries.MediaTool, EntryPoint = "media_packet_has_tbm_surface_buffer")]
internal static extern int HasTbmSurface(IntPtr handle, out bool hasTbmSurface);

}

internal static class MediaFormat
Expand Down
41 changes: 41 additions & 0 deletions src/Tizen.Multimedia/MediaTool/MediaPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,47 @@ public MediaPacketBufferFlags BufferFlags
}
}

/// <summary>
/// Gets the pointer to the TBM surface object associated with the packet.
/// </summary>
/// <value>
/// The pointer to the TBM surface object.<br/>
/// If packet doesn't have TBM surface, this will return IntPtr.Zero.
/// </value>
/// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
/// <since_tizen> 12 </since_tizen>
public IntPtr TbmSurface
{
get
{
ValidateNotDisposed();

int ret = Native.GetTbmSurface(_handle, out var value);
MultimediaDebug.AssertNoError(ret);

return value;
}
}

/// <summary>
/// Gets a value indicating whether the packet has TBM surface or not.
/// </summary>
/// <value>true if the packet has TBM surface; otherwise, false.</value>
/// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
/// <since_tizen> 12 </since_tizen>
public bool HasTbmSurface
{
get
{
ValidateNotDisposed();

int ret = Native.HasTbmSurface(_handle, out var value);
MultimediaDebug.AssertNoError(ret);

return value;
}
}

#region Dispose support
/// <summary>
/// Gets a value indicating whether the packet has been disposed.
Expand Down

0 comments on commit 63f4b54

Please sign in to comment.