Skip to content

Instantly share code, notes, and snippets.

@yashi
Created December 28, 2016 07:50
Show Gist options
  • Save yashi/2393c61d64976bad5f6375dc217e04cd to your computer and use it in GitHub Desktop.
Save yashi/2393c61d64976bad5f6375dc217e04cd to your computer and use it in GitHub Desktop.
GstAdapter example 2
#include <gst/base/gstadapter.h>
int main(int argc, char *argv[])
{
GstAdapter *a;
GstBuffer *b, *b1, *b2;
gst_init(&argc, &argv);
a = gst_adapter_new();
b1 = gst_buffer_new_allocate(NULL, 10, NULL);
g_print("b1 %p\n", b1);
b2 = gst_buffer_new_allocate(NULL, 20, NULL);
gst_adapter_push(a, b1);
gst_adapter_push(a, b2);
g_print("size: %" G_GSIZE_FORMAT "\n", gst_adapter_available(a));
b = gst_adapter_get_buffer(a, 5);
g_print("size: %" G_GSIZE_FORMAT "\n", gst_adapter_available(a));
g_print("b %p\n", b);
b = gst_adapter_take_buffer(a, 5);
g_print("size: %" G_GSIZE_FORMAT "\n", gst_adapter_available(a));
g_print("b %p\n", b);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment