gst_memory_unref()
のタイミングでなんらかの処理を実行したい時には、
_new_wrapped()
の notify に callback 関数を登録する。
Created
May 25, 2016 02:48
-
-
Save tetkuz/080a942a4947310d7cbddd10fc92c8e5 to your computer and use it in GitHub Desktop.
gst_memory and notify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <gst/gst.h> | |
void notify_func(gpointer data) | |
{ | |
(void) data; | |
g_print ("from buffer_notify()\n"); | |
} | |
int main (int argc, char *argv[]) | |
{ | |
GstMemory *mem; | |
GString *text; | |
gst_init (&argc, &argv); | |
text = g_string_new ("Hello"); | |
mem = gst_memory_new_wrapped (GST_MEMORY_FLAG_NO_SHARE, | |
text->str, text->allocated_len, 0, text->len, | |
NULL, (GDestroyNotify)notify_func); | |
{ | |
GstMapInfo info; | |
if (gst_memory_map (mem, &info, GST_MAP_READ)) { | |
g_print ("data: %s\n", info.data); | |
gst_memory_unmap (mem, &info); | |
} | |
} | |
gst_memory_unref(mem); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment