memory: Use lock flags for map flags

We implement the locking in gst_memory_map with the lock flags, make matching
flags the same number so that we can use the map flags directly as lock flags.
This commit is contained in:
Wim Taymans 2012-07-03 13:45:03 +02:00
parent 76b30712f5
commit 61a9de98d9

View file

@ -155,6 +155,23 @@ struct _GstMemory {
gsize size; gsize size;
}; };
/**
* GstLockFlags:
* @GST_LOCK_FLAG_READ: lock for read access
* @GST_LOCK_FLAG_WRITE: lock for write access
* @GST_LOCK_FLAG_EXCLUSIVE: lock for exclusive access
* @GST_LOCK_FLAG_LAST: first flag that can be used for custom purposes
*
* Flags used when locking memory
*/
typedef enum {
GST_LOCK_FLAG_READ = (1 << 0),
GST_LOCK_FLAG_WRITE = (1 << 1),
GST_LOCK_FLAG_EXCLUSIVE = (1 << 2),
GST_LOCK_FLAG_LAST = (1 << 4)
} GstLockFlags;
/** /**
* GstMapFlags: * GstMapFlags:
* @GST_MAP_READ: map for read access * @GST_MAP_READ: map for read access
@ -164,8 +181,8 @@ struct _GstMemory {
* Flags used when mapping memory * Flags used when mapping memory
*/ */
typedef enum { typedef enum {
GST_MAP_READ = (1 << 0), GST_MAP_READ = GST_LOCK_FLAG_READ,
GST_MAP_WRITE = (1 << 1), GST_MAP_WRITE = GST_LOCK_FLAG_WRITE,
GST_MAP_FLAG_LAST = (1 << 16) GST_MAP_FLAG_LAST = (1 << 16)
} GstMapFlags; } GstMapFlags;
@ -464,22 +481,6 @@ gst_memory_unref (GstMemory * memory)
} }
/* locking */ /* locking */
/**
* GstLockFlags:
* @GST_LOCK_FLAG_READ: lock for read access
* @GST_LOCK_FLAG_WRITE: lock for write access
* @GST_LOCK_FLAG_EXCLUSIVE: lock for exclusive access
* @GST_LOCK_FLAG_LAST: first flag that can be used for custom purposes
*
* Flags used when locking memory
*/
typedef enum {
GST_LOCK_FLAG_READ = (1 << 0),
GST_LOCK_FLAG_WRITE = (1 << 1),
GST_LOCK_FLAG_EXCLUSIVE = (1 << 2),
GST_LOCK_FLAG_LAST = (1 << 4)
} GstLockFlags;
gboolean gst_memory_is_exclusive (GstMemory *mem); gboolean gst_memory_is_exclusive (GstMemory *mem);