Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
b7566793
Commit
b7566793
authored
4 years ago
by
George Kiagiadakis
Browse files
Options
Downloads
Patches
Plain Diff
session-item: make WpSiTransition more generic to reuse it in _default_export()
parent
1cc28375
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/wp/session-item.c
+53
-42
53 additions, 42 deletions
lib/wp/session-item.c
with
53 additions
and
42 deletions
lib/wp/session-item.c
+
53
−
42
View file @
b7566793
...
...
@@ -16,6 +16,55 @@
#include
"error.h"
#include
"wpenums.h"
struct
_WpSiTransition
{
WpTransition
parent
;
guint
(
*
get_next_step
)
(
WpSessionItem
*
self
,
WpTransition
*
transition
,
guint
step
);
void
(
*
execute_step
)
(
WpSessionItem
*
self
,
WpTransition
*
transition
,
guint
step
);
};
G_DECLARE_FINAL_TYPE
(
WpSiTransition
,
wp_si_transition
,
WP
,
SI_TRANSITION
,
WpTransition
);
G_DEFINE_TYPE
(
WpSiTransition
,
wp_si_transition
,
WP_TYPE_TRANSITION
)
static
void
wp_si_transition_init
(
WpSiTransition
*
transition
)
{}
static
guint
wp_si_transition_get_next_step
(
WpTransition
*
transition
,
guint
step
)
{
WpSiTransition
*
self
=
WP_SI_TRANSITION
(
transition
);
WpSessionItem
*
item
=
wp_transition_get_source_object
(
transition
);
g_return_val_if_fail
(
self
->
get_next_step
,
WP_TRANSITION_STEP_ERROR
);
step
=
self
->
get_next_step
(
item
,
transition
,
step
);
g_return_val_if_fail
(
step
==
WP_TRANSITION_STEP_NONE
||
self
->
execute_step
,
WP_TRANSITION_STEP_ERROR
);
return
step
;
}
static
void
wp_si_transition_execute_step
(
WpTransition
*
transition
,
guint
step
)
{
WpSiTransition
*
self
=
WP_SI_TRANSITION
(
transition
);
WpSessionItem
*
item
=
wp_transition_get_source_object
(
transition
);
self
->
execute_step
(
item
,
transition
,
step
);
}
static
void
wp_si_transition_class_init
(
WpSiTransitionClass
*
klass
)
{
WpTransitionClass
*
transition_class
=
(
WpTransitionClass
*
)
klass
;
transition_class
->
get_next_step
=
wp_si_transition_get_next_step
;
transition_class
->
execute_step
=
wp_si_transition_execute_step
;
}
typedef
struct
_WpSessionItemPrivate
WpSessionItemPrivate
;
struct
_WpSessionItemPrivate
{
...
...
@@ -312,48 +361,6 @@ wp_session_item_get_configuration (WpSessionItem * self)
return
WP_SESSION_ITEM_GET_CLASS
(
self
)
->
get_configuration
(
self
);
}
typedef
WpTransition
WpSiTransition
;
typedef
WpTransitionClass
WpSiTransitionClass
;
G_DEFINE_TYPE
(
WpSiTransition
,
wp_si_transition
,
WP_TYPE_TRANSITION
)
static
void
wp_si_transition_init
(
WpSiTransition
*
transition
)
{}
static
guint
wp_si_transition_get_next_step
(
WpTransition
*
transition
,
guint
step
)
{
WpSessionItem
*
item
=
wp_transition_get_source_object
(
transition
);
g_return_val_if_fail
(
WP_SESSION_ITEM_GET_CLASS
(
item
)
->
get_next_step
,
WP_TRANSITION_STEP_ERROR
);
step
=
WP_SESSION_ITEM_GET_CLASS
(
item
)
->
get_next_step
(
item
,
transition
,
step
);
g_return_val_if_fail
(
step
==
WP_TRANSITION_STEP_NONE
||
WP_SESSION_ITEM_GET_CLASS
(
item
)
->
execute_step
,
WP_TRANSITION_STEP_ERROR
);
return
step
;
}
static
void
wp_si_transition_execute_step
(
WpTransition
*
transition
,
guint
step
)
{
WpSessionItem
*
item
=
wp_transition_get_source_object
(
transition
);
WP_SESSION_ITEM_GET_CLASS
(
item
)
->
execute_step
(
item
,
transition
,
step
);
}
static
void
wp_si_transition_class_init
(
WpSiTransitionClass
*
klass
)
{
WpTransitionClass
*
transition_class
=
(
WpTransitionClass
*
)
klass
;
transition_class
->
get_next_step
=
wp_si_transition_get_next_step
;
transition_class
->
execute_step
=
wp_si_transition_execute_step
;
}
static
void
on_transition_completed
(
WpTransition
*
transition
,
GParamSpec
*
pspec
,
WpSessionItem
*
self
)
...
...
@@ -408,6 +415,10 @@ wp_session_item_activate (WpSessionItem * self,
priv
->
flags
|=
WP_SI_FLAG_ACTIVATING
;
g_signal_emit
(
self
,
signals
[
SIGNAL_FLAGS_CHANGED
],
0
,
priv
->
flags
);
WP_SI_TRANSITION
(
transition
)
->
get_next_step
=
WP_SESSION_ITEM_GET_CLASS
(
self
)
->
get_next_step
;
WP_SI_TRANSITION
(
transition
)
->
execute_step
=
WP_SESSION_ITEM_GET_CLASS
(
self
)
->
execute_step
;
wp_transition_advance
(
transition
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment