~ubuntu-branches/ubuntu/trusty/gstreamer1.0/trusty

« back to all changes in this revision

Viewing changes to tests/examples/memory/memory_test.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2012-08-08 18:12:33 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120808181233-riejwxprfsxh1njl
Tags: 0.11.93-1
* New upstream release:
  + debian/libgstreamer.symbols:
    - Update symbols file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <gst/gst.h>
 
2
 
 
3
#include "my-memory.h"
 
4
#include "my-vidmem.h"
 
5
 
 
6
int
 
7
main (int argc, char **argv)
 
8
{
 
9
  GstAllocator *alloc;
 
10
  GstMemory *mem;
 
11
  GstAllocationParams params;
 
12
  GstMapInfo info;
 
13
  guint f, w, h;
 
14
 
 
15
  gst_init (&argc, &argv);
 
16
 
 
17
  /* memory using the default API */
 
18
  my_memory_init ();
 
19
 
 
20
  alloc = gst_allocator_find ("MyMemory");
 
21
 
 
22
  gst_allocation_params_init (&params);
 
23
  mem = gst_allocator_alloc (alloc, 1024, &params);
 
24
 
 
25
  gst_memory_map (mem, &info, GST_MAP_READ);
 
26
  gst_memory_unmap (mem, &info);
 
27
 
 
28
  gst_memory_unref (mem);
 
29
  gst_object_unref (alloc);
 
30
 
 
31
  /* allocator with custom alloc API */
 
32
  my_vidmem_init ();
 
33
 
 
34
  /* we can get the allocator but we can only make objects from it when we know
 
35
   * the API */
 
36
  alloc = gst_allocator_find ("MyVidmem");
 
37
 
 
38
  /* use custom api to alloc */
 
39
  mem = my_vidmem_alloc (0, 640, 480);
 
40
  g_assert (my_is_vidmem (mem));
 
41
 
 
42
  my_vidmem_get_format (mem, &f, &w, &h);
 
43
  g_assert (f == 0);
 
44
  g_assert (w == 640);
 
45
  g_assert (h == 480);
 
46
 
 
47
  gst_memory_map (mem, &info, GST_MAP_READ);
 
48
  gst_memory_unmap (mem, &info);
 
49
 
 
50
  gst_memory_unref (mem);
 
51
  gst_object_unref (alloc);
 
52
 
 
53
  return 0;
 
54
}