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-rs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GStreamer
gstreamer-rs
Commits
8421cec1
Commit
8421cec1
authored
Jul 12, 2017
by
Sebastian Dröge
🍵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement message types that use tag lists / structures
parent
49ea4e45
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
26 deletions
+55
-26
gstreamer/src/message.rs
gstreamer/src/message.rs
+55
-26
No files found.
gstreamer/src/message.rs
View file @
8421cec1
...
...
@@ -11,6 +11,7 @@ use Object;
use
Element
;
use
miniobject
::
*
;
use
structure
::
*
;
use
TagList
;
use
std
::
ptr
;
use
std
::
mem
;
...
...
@@ -289,7 +290,13 @@ impl<'a> Info<'a> {
pub
struct
Tag
<
'a
>
(
&
'a
MessageRef
);
impl
<
'a
>
Tag
<
'a
>
{
// TODO: get_tags()
pub
fn
get_tags
(
&
self
)
->
TagList
{
unsafe
{
let
mut
tags
=
ptr
::
null_mut
();
ffi
::
gst_message_parse_tag
(
self
.0
.as_mut_ptr
(),
&
mut
tags
);
from_glib_full
(
tags
)
}
}
}
pub
struct
Buffering
<
'a
>
(
&
'a
MessageRef
);
...
...
@@ -831,26 +838,37 @@ impl<'a> StreamsSelected<'a> {
}
pub
struct
Redirect
<
'a
>
(
&
'a
MessageRef
);
impl
<
'a
>
StreamsSelected
<
'a
>
{
// TODO: tags, structure
impl
<
'a
>
Redirect
<
'a
>
{
#[cfg(feature
=
"v1_10"
)]
pub
fn
get_entries
(
&
self
)
->
Vec
<
&
str
>
{
pub
fn
get_entries
(
&
self
)
->
Vec
<
(
&
str
,
Option
<
TagList
>
,
Option
<&
StructureRef
>
)
>
{
unsafe
{
let
n
=
ffi
::
gst_message_get_num_redirect_entries
(
self
.0
.as_mut_ptr
());
(
0
..
n
)
.map
(|
i
|
{
let
mut
location
=
ptr
::
null
();
let
mut
tags
=
ptr
::
null_mut
();
let
mut
structure
=
ptr
::
null
();
ffi
::
gst_message_parse_redirect_entry
(
self
.0
.as_mut_ptr
(),
i
,
&
mut
location
,
ptr
::
null_mut
()
,
ptr
::
null_mut
()
,
&
mut
tags
,
&
mut
structure
,
);
CStr
::
from_ptr
(
location
)
.to_str
()
.unwrap
()
let
structure
=
if
structure
.is_null
()
{
None
}
else
{
Some
(
StructureRef
::
from_glib_borrow
(
structure
))
};
(
CStr
::
from_ptr
(
location
)
.to_str
()
.unwrap
(),
from_glib_none
(
tags
),
structure
,
)
})
.collect
()
}
...
...
@@ -1083,11 +1101,10 @@ impl<'a> InfoBuilder<'a> {
pub
struct
TagBuilder
<
'a
>
{
src
:
Option
<&
'a
Object
>
,
seqnum
:
Option
<
u32
>
,
tags
:
(),
// TODO tags
tags
:
&
'a
TagList
,
}
impl
<
'a
>
TagBuilder
<
'a
>
{
pub
fn
new
(
tags
:
()
)
->
Self
{
pub
fn
new
(
tags
:
&
'a
TagList
)
->
Self
{
Self
{
src
:
None
,
seqnum
:
None
,
...
...
@@ -1095,12 +1112,8 @@ impl<'a> TagBuilder<'a> {
}
}
message_builder_generic_impl!
(|
_
,
src
|
{
ffi
::
gst_message_new_tag
(
src
,
/*s.tags.to_glib_full().0*/
ptr
::
null_mut
(),
)
message_builder_generic_impl!
(|
s
:
&
Self
,
src
|
{
ffi
::
gst_message_new_tag
(
src
,
s
.tags
.to_glib_full
())
});
}
...
...
@@ -1913,18 +1926,21 @@ impl<'a> StreamsSelectedBuilder<'a> {
});
}
// TODO TagList, Structure
pub
struct
RedirectBuilder
<
'a
>
{
src
:
Option
<&
'a
Object
>
,
seqnum
:
Option
<
u32
>
,
location
:
&
'a
str
,
tag_list
:
Option
<
()
>
,
entry_struct
:
Option
<
()
>
,
entries
:
Option
<&
'a
[(
&
'a
str
,
(
&
'a
()),
(
&
'a
())
)]
>
,
tag_list
:
Option
<
&
'a
TagList
>
,
entry_struct
:
Option
<
Structure
>
,
entries
:
Option
<&
'a
[(
&
'a
str
,
Option
<&
'a
TagList
>
,
Option
<&
'a
Structure
>
)]
>
,
}
#[cfg(feature
=
"v1_10"
)]
impl
<
'a
>
RedirectBuilder
<
'a
>
{
pub
fn
new
(
location
:
&
'a
str
,
tag_list
:
Option
<
()
>
,
entry_struct
:
Option
<
()
>
)
->
Self
{
pub
fn
new
(
location
:
&
'a
str
,
tag_list
:
Option
<&
'a
TagList
>
,
entry_struct
:
Option
<
Structure
>
,
)
->
Self
{
Self
{
src
:
None
,
seqnum
:
None
,
...
...
@@ -1935,7 +1951,7 @@ impl<'a> RedirectBuilder<'a> {
}
}
pub
fn
entries
(
self
,
entries
:
&
'a
[(
&
'a
str
,
(
&
'a
()),
(
&
'a
())
)])
->
Self
{
pub
fn
entries
(
self
,
entries
:
&
'a
[(
&
'a
str
,
Option
<&
'a
TagList
>
,
Option
<&
'a
Structure
>
)])
->
Self
{
Self
{
entries
:
Some
(
entries
),
..
self
...
...
@@ -1943,19 +1959,32 @@ impl<'a> RedirectBuilder<'a> {
}
message_builder_generic_impl!
(|
s
:
&
mut
Self
,
src
|
{
let
entry_struct
=
s
.entry_struct
.take
();
let
entry_struct_ptr
=
if
let
Some
(
entry_struct
)
=
entry_struct
{
entry_struct
.into_ptr
()
}
else
{
ptr
::
null_mut
()
};
let
msg
=
ffi
::
gst_message_new_redirect
(
src
,
s
.location
.to_glib_none
()
.0
,
ptr
::
null_mut
(),
ptr
::
null_mut
()
,
s
.tag_list
.to_glib_full
(),
entry_struct_ptr
,
);
if
let
Some
(
entries
)
=
s
.entries
{
for
&
(
location
,
tag_list
,
entry_struct
)
in
entries
{
let
entry_struct
=
entry_struct
.map
(|
s
|
s
.clone
());
let
entry_struct_ptr
=
if
let
Some
(
entry_struct
)
=
entry_struct
{
entry_struct
.into_ptr
()
}
else
{
ptr
::
null_mut
()
};
ffi
::
gst_message_add_redirect_entry
(
msg
,
location
.to_glib_none
()
.0
,
ptr
::
null_mut
(),
ptr
::
null_mut
()
,
tag_list
.to_glib_full
(),
entry_struct_ptr
,
);
}
}
...
...
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