Skip to content

Commit b1cc89d

Browse files
committed
Update: update to mdk-sdk 0.30.1
1 parent c074805 commit b1cc89d

File tree

4 files changed

+37
-12
lines changed

4 files changed

+37
-12
lines changed

src/Gen/Player.cs

+7
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ internal unsafe partial struct mdkPlayerAPI
351351
[NativeTypeName("int (*)(struct mdkPlayer *, int64_t *, int)")]
352352
public delegate* unmanaged[Cdecl]<mdkPlayer*, long*, int, int> bufferedTimeRanges;
353353

354+
[NativeTypeName("bool (*)(struct mdkPlayer *, const uint8_t *, size_t, int)")]
355+
public delegate* unmanaged[Cdecl]<mdkPlayer*, byte*, nuint, int, byte> appendBuffer;
356+
354357
[UnscopedRef]
355358
internal ref void* reserved2
356359
{
@@ -391,6 +394,10 @@ internal static unsafe partial class Methods
391394
[UnmanagedCallConv(CallConvs = [typeof(System.Runtime.CompilerServices.CallConvCdecl)])]
392395
internal static partial void mdkPlayerAPI_delete([NativeTypeName("const struct mdkPlayerAPI **")] mdkPlayerAPI** param0);
393396

397+
[LibraryImport("mdk")]
398+
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
399+
internal static partial void mdkPlayerAPI_reset([NativeTypeName("const struct mdkPlayerAPI **")] mdkPlayerAPI** param0, [NativeTypeName("bool")] byte release);
400+
394401
[LibraryImport("mdk")]
395402
[UnmanagedCallConv(CallConvs = [typeof(System.Runtime.CompilerServices.CallConvCdecl)])]
396403
internal static partial void MDK_foreignGLContextDestroyed();

src/Gen/global.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ internal static unsafe partial class Methods
240240
[NativeTypeName("#define MDK_MAJOR 0")]
241241
internal const int MDK_MAJOR = 0;
242242

243-
[NativeTypeName("#define MDK_MINOR 29")]
244-
internal const int MDK_MINOR = 29;
243+
[NativeTypeName("#define MDK_MINOR 30")]
244+
internal const int MDK_MINOR = 30;
245245

246-
[NativeTypeName("#define MDK_MICRO 0")]
247-
internal const int MDK_MICRO = 0;
246+
[NativeTypeName("#define MDK_MICRO 1")]
247+
internal const int MDK_MICRO = 1;
248248

249249
[NativeTypeName("#define MDK_VERSION MDK_VERSION_INT(MDK_MAJOR, MDK_MINOR, MDK_MICRO)")]
250-
internal const int MDK_VERSION = (((0 & 0xff) << 16) | ((29 & 0xff) << 8) | (0 & 0xff));
250+
internal const int MDK_VERSION = (((0 & 0xff) << 16) | ((30 & 0xff) << 8) | (1 & 0xff));
251251
}
252252
}

src/Global.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ public static void SetLogLevel(LogLevel logLevel = LogLevel.All)
382382
}
383383

384384
/// <summary>
385-
///
385+
/// https://github.com/wang-bin/mdk-sdk/wiki/Global-Options
386386
/// </summary>
387387
/// <param name="key">
388388
/// - "avutil_lib", "avcodec_lib", "avformat_lib", "swresample_lib", "avfilter_lib": path to ffmpeg runtime libraries<br/>

src/Player.cs

+24-6
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ public string Url()
175175
}
176176
}
177177

178+
/// <summary>
179+
/// iff media url is "stream:"
180+
/// setTimeout can abort current stream playback
181+
/// </summary>
182+
/// <param name="data"></param>
183+
/// <param name="size"></param>
184+
/// <param name="options"></param>
185+
/// <returns></returns>
186+
public bool AppendBuffer(IntPtr data, nuint size, int options = 0)
187+
{
188+
unsafe
189+
{
190+
return p->appendBuffer(p->@object, (byte*)data, size, options) != 0;
191+
}
192+
}
193+
178194
public void SetPreloadImmediately(bool value = true)
179195
{
180196
unsafe
@@ -578,10 +594,12 @@ public void Snapshot(IntPtr request, CallBackOnSnapshot cb, IntPtr vo_opaque = 0
578594
/// <para>"avcodec.some_name": AVCodecContext option, will apply for all FFmpeg based video/audio/subtitle decoders. To set for a single decoder, use setDecoders() with options</para>
579595
/// <para>"audio.decoders": decoder list for setDecoders(), with or without decoder properties. "name1,name2:key21=val21"</para>
580596
/// <para>"video.decoders": decoder list for setDecoders(), with or without decoder properties. "name1,name2:key21=val21"</para>
581-
/// <para>"audio.decoder": audio decoder property, value is "key=value" or "key1=value1:key2=value2". override "decoder" property</para>
582-
/// <para>"video.decoder": video decoder property, value is "key=value" or "key1=value1:key2=value2". override "decoder" property</para>
583-
/// <para>"decoder": video and audio decoder property, value is "key=value" or "key1=value1:key2=value2"</para>
584-
/// <para>"recorder.copyts": "1" or "0"(default), use input packet timestamp, or correct packet timestamp to be continuous.</para>
597+
/// <para>"audio.decoder": audio decoder properties, value is "key=value" or "key1=value1:key2=value2". override "decoder" properties</para>
598+
/// <para>"video.decoder": video decoder properties, value is "key=value" or "key1=value1:key2=value2". override "decoder" properties</para>
599+
/// <para>"decoder": video and audio decoder properties, value is "key=value" or "key1=value1:key2=value2"</para>
600+
/// <para>"record.copyts", "recorder.copyts": "1" or "0"(default), use input packet timestamp, or correct packet timestamp to be continuous.</para>
601+
/// <para>"record.$opt_name": option for recorder's muxer or io, opt_name can also be an ffmpeg option, e.g. "record.avformat.$opt_name" and "record.avio.$opt_name".</para>
602+
/// <para>"reader.decoder.$DecoderName": $DecoderName decoder properties, value is "key=value" or "key1=value1:key2=value2". override "decoder" properties</para>
585603
/// <para>"reader.starts_with_key": "0" or "1"(default). if "1", video decoder starts with key-frame, and drop non-key packets before the first decode.</para>
586604
/// <para>"reader.pause": "0"(default) or "1". if "1", will try to pause/resume stream(rtsp) in set(State)</para>
587605
/// <para>"buffer" or "buffer.range": parameters setBufferRange(). value is "minMs", "minMs+maxMs", "minMs+maxMs-", "minMs-". the last '-' indicates drop mode</para>
@@ -925,7 +943,7 @@ public List<TimeRange> BufferedRanges
925943
{
926944
var block = stackalloc TimeRange[16];
927945
var count = p->bufferedTimeRanges(p->@object, (long*)block, 16 * sizeof(TimeRange));
928-
if(count > 16)
946+
if (count > 16)
929947
{
930948
block = (TimeRange*)Marshal.AllocHGlobal(Marshal.SizeOf<TimeRange>() * count);
931949
count = p->bufferedTimeRanges(p->@object, (long*)block, count * sizeof(TimeRange));
@@ -1287,7 +1305,7 @@ public void Dispose()
12871305
{
12881306
fixed (mdkPlayerAPI** pp = &p)
12891307
{
1290-
Methods.mdkPlayerAPI_delete(pp);
1308+
Methods.mdkPlayerAPI_reset(pp, (byte)(owner_ ? 1 : 0));
12911309
}
12921310
}
12931311
}

0 commit comments

Comments
 (0)