Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Multimedia] Add MediaPacket TBM surface APIs #6278

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading