Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gstreamer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
luzpaz
gstreamer
Commits
f0105dd8
Commit
f0105dd8
authored
Feb 28, 2012
by
Wim Taymans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
meta: add return vale to transform
Add a boolean return value so that we can see when a transform fails.
parent
6e0e7820
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
29 deletions
+37
-29
gst/gstmeta.h
gst/gstmeta.h
+5
-3
libs/gst/net/gstnetaddressmeta.c
libs/gst/net/gstnetaddressmeta.c
+19
-13
tests/check/gst/gstmeta.c
tests/check/gst/gstmeta.c
+13
-13
No files found.
gst/gstmeta.h
View file @
f0105dd8
...
...
@@ -148,10 +148,12 @@ typedef struct {
* Implementations should check the @type of the transform and parse
* additional type specific fields in @data that should be used to update
* the metadata on @transbuf.
*
* Returns: %TRUE if the transform could be performed
*/
typedef
void
(
*
GstMetaTransformFunction
)
(
GstBuffer
*
transbuf
,
GstMeta
*
meta
,
GstBuffer
*
buffer
,
GQuark
type
,
gpointer
data
);
typedef
gboolean
(
*
GstMetaTransformFunction
)
(
GstBuffer
*
transbuf
,
GstMeta
*
meta
,
GstBuffer
*
buffer
,
GQuark
type
,
gpointer
data
);
/**
* GstMetaInfo:
...
...
libs/gst/net/gstnetaddressmeta.c
View file @
f0105dd8
...
...
@@ -33,28 +33,35 @@
#include "gstnetaddressmeta.h"
static
gboolean
net_address_meta_init
(
GstNetAddressMeta
*
meta
,
gpointer
params
,
GstBuffer
*
buffer
)
net_address_meta_init
(
GstMeta
*
meta
,
gpointer
params
,
GstBuffer
*
buffer
)
{
meta
->
addr
=
NULL
;
GstNetAddressMeta
*
nmeta
=
(
GstNetAddressMeta
*
)
meta
;
nmeta
->
addr
=
NULL
;
return
TRUE
;
}
static
void
net_address_meta_transform
(
GstBuffer
*
transbuf
,
Gst
NetAddress
Meta
*
meta
,
static
gboolean
net_address_meta_transform
(
GstBuffer
*
transbuf
,
GstMeta
*
meta
,
GstBuffer
*
buffer
,
GQuark
type
,
gpointer
data
)
{
GstNetAddressMeta
*
nmeta
=
(
GstNetAddressMeta
*
)
meta
;
/* we always copy no matter what transform */
gst_buffer_add_net_address_meta
(
transbuf
,
meta
->
addr
);
gst_buffer_add_net_address_meta
(
transbuf
,
nmeta
->
addr
);
return
TRUE
;
}
static
void
net_address_meta_free
(
Gst
NetAddress
Meta
*
meta
,
GstBuffer
*
buffer
)
net_address_meta_free
(
GstMeta
*
meta
,
GstBuffer
*
buffer
)
{
if
(
meta
->
addr
)
g_object_unref
(
meta
->
addr
);
meta
->
addr
=
NULL
;
GstNetAddressMeta
*
nmeta
=
(
GstNetAddressMeta
*
)
meta
;
if
(
nmeta
->
addr
)
g_object_unref
(
nmeta
->
addr
);
nmeta
->
addr
=
NULL
;
}
const
GstMetaInfo
*
...
...
@@ -66,9 +73,8 @@ gst_net_address_meta_get_info (void)
if
(
meta_info
==
NULL
)
{
meta_info
=
gst_meta_register
(
"GstNetAddressMeta"
,
"GstNetAddressMeta"
,
sizeof
(
GstNetAddressMeta
),
(
GstMetaInitFunction
)
net_address_meta_init
,
(
GstMetaFreeFunction
)
net_address_meta_free
,
(
GstMetaTransformFunction
)
net_address_meta_transform
,
tags
);
net_address_meta_init
,
net_address_meta_free
,
net_address_meta_transform
,
tags
);
}
return
meta_info
;
}
...
...
tests/check/gst/gstmeta.c
View file @
f0105dd8
...
...
@@ -63,27 +63,28 @@ gst_meta_test_init (GstMetaTest * meta)
}
#endif
static
void
test_init_func
(
GstMeta
Test
*
meta
,
GstBuffer
*
buffer
)
static
gboolean
test_init_func
(
GstMeta
*
meta
,
gpointer
params
,
GstBuffer
*
buffer
)
{
GST_DEBUG
(
"init called on buffer %p, meta %p"
,
buffer
,
meta
);
/* nothing to init really, the init function is mostly for allocating
* additional memory or doing special setup as part of adding the metadata to
* the buffer*/
return
TRUE
;
}
static
void
test_free_func
(
GstMeta
Test
*
meta
,
GstBuffer
*
buffer
)
test_free_func
(
GstMeta
*
meta
,
GstBuffer
*
buffer
)
{
GST_DEBUG
(
"free called on buffer %p, meta %p"
,
buffer
,
meta
);
/* nothing to free really */
}
static
void
test_transform_func
(
GstBuffer
*
transbuf
,
GstMeta
Test
*
meta
,
static
gboolean
test_transform_func
(
GstBuffer
*
transbuf
,
GstMeta
*
meta
,
GstBuffer
*
buffer
,
GQuark
type
,
gpointer
data
)
{
GstMetaTest
*
test
;
GstMetaTest
*
test
,
*
tmeta
=
(
GstMetaTest
*
)
meta
;
GST_DEBUG
(
"transform %s called from buffer %p to %p, meta %p"
,
g_quark_to_string
(
type
),
buffer
,
transbuf
,
meta
);
...
...
@@ -94,11 +95,11 @@ test_transform_func (GstBuffer * transbuf, GstMetaTest * meta,
test
=
GST_META_TEST_ADD
(
transbuf
);
if
(
copy_data
->
offset
==
0
)
{
/* same offset, copy timestamps */
test
->
pts
=
meta
->
pts
;
test
->
dts
=
meta
->
dts
;
test
->
pts
=
t
meta
->
pts
;
test
->
dts
=
t
meta
->
dts
;
if
(
copy_data
->
size
==
gst_buffer_get_size
(
buffer
))
{
/* same size, copy duration */
test
->
duration
=
meta
->
duration
;
test
->
duration
=
t
meta
->
duration
;
}
else
{
/* else clear */
test
->
duration
=
GST_CLOCK_TIME_NONE
;
...
...
@@ -108,8 +109,9 @@ test_transform_func (GstBuffer * transbuf, GstMetaTest * meta,
test
->
dts
=
-
1
;
test
->
duration
=
-
1
;
}
test
->
clock_rate
=
meta
->
clock_rate
;
test
->
clock_rate
=
t
meta
->
clock_rate
;
}
return
TRUE
;
}
static
const
GstMetaInfo
*
...
...
@@ -121,9 +123,7 @@ gst_meta_test_get_info (void)
if
(
meta_test_info
==
NULL
)
{
meta_test_info
=
gst_meta_register
(
"GstMetaTest"
,
"GstMetaTest"
,
sizeof
(
GstMetaTest
),
(
GstMetaInitFunction
)
test_init_func
,
(
GstMetaFreeFunction
)
test_free_func
,
(
GstMetaTransformFunction
)
test_transform_func
,
tags
);
test_init_func
,
test_free_func
,
test_transform_func
,
tags
);
}
return
meta_test_info
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment