Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
George Kiagiadakis
gst-plugins-base
Commits
c8fa8085
Commit
c8fa8085
authored
Dec 22, 2010
by
Edward Hervey
Committed by
Edward Hervey
Jan 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoding-target: Add method to get a profile by name
API: gst_encoding_target_get_profile
parent
cdd0a9c8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
8 deletions
+60
-8
docs/libs/gst-plugins-base-libs-sections.txt
docs/libs/gst-plugins-base-libs-sections.txt
+1
-0
gst-libs/gst/pbutils/encoding-profile.c
gst-libs/gst/pbutils/encoding-profile.c
+2
-8
gst-libs/gst/pbutils/encoding-target.c
gst-libs/gst/pbutils/encoding-target.c
+29
-0
gst-libs/gst/pbutils/encoding-target.h
gst-libs/gst/pbutils/encoding-target.h
+2
-0
tests/check/libs/profile.c
tests/check/libs/profile.c
+25
-0
win32/common/libgstpbutils.def
win32/common/libgstpbutils.def
+1
-0
No files found.
docs/libs/gst-plugins-base-libs-sections.txt
View file @
c8fa8085
...
...
@@ -1957,6 +1957,7 @@ gst_encoding_target_get_name
gst_encoding_target_get_category
gst_encoding_target_get_description
gst_encoding_target_get_profiles
gst_encoding_target_get_profile
gst_encoding_target_add_profile
gst_encoding_target_save
gst_encoding_target_save_to
...
...
gst-libs/gst/pbutils/encoding-profile.c
View file @
c8fa8085
...
...
@@ -95,20 +95,14 @@
*{
* GstEncodingProfile *prof = NULL;
* GstEncodingTarget *target = NULL;
* GList *tmp;
*
* target = gst_encoding_target_load_from (path);
* if (target == NULL)
* return NULL;
*
* for (tmp = target->profiles; tmp; tmp = tmp->next) {
* GstEncodingProfile *ptmp = (GstEncodingProfile*) tmp->data;
* prof = gst_encoding_target_get_profile (target, profilename);
*
* if (!strcmp(gst_encoding_profile_get_name(ptmp), profilename)) {
* prof = ptmp;
* break;
* }
* }
* gst_encoding_target_unref (target);
*
* return prof;
*}
...
...
gst-libs/gst/pbutils/encoding-target.c
View file @
c8fa8085
...
...
@@ -152,6 +152,35 @@ gst_encoding_target_get_profiles (GstEncodingTarget * target)
return
target
->
profiles
;
}
/**
* gst_encoding_target_get_profile:
* @target: a #GstEncodingTarget
* @name: the name of the profile to retrieve
*
* Since: 0.10.32
*
* Returns: (transfer full): The matching #GstEncodingProfile, or %NULL.
*/
GstEncodingProfile
*
gst_encoding_target_get_profile
(
GstEncodingTarget
*
target
,
const
gchar
*
name
)
{
GList
*
tmp
;
g_return_val_if_fail
(
GST_IS_ENCODING_TARGET
(
target
),
NULL
);
g_return_val_if_fail
(
name
!=
NULL
,
NULL
);
for
(
tmp
=
target
->
profiles
;
tmp
;
tmp
=
tmp
->
next
)
{
GstEncodingProfile
*
tprof
=
(
GstEncodingProfile
*
)
tmp
->
data
;
if
(
!
g_strcmp0
(
gst_encoding_profile_get_name
(
tprof
),
name
))
{
gst_encoding_profile_ref
(
tprof
);
return
tprof
;
}
}
return
NULL
;
}
static
inline
gboolean
validate_name
(
const
gchar
*
name
)
{
...
...
gst-libs/gst/pbutils/encoding-target.h
View file @
c8fa8085
...
...
@@ -85,6 +85,8 @@ const gchar *gst_encoding_target_get_name (GstEncodingTarget *target);
const
gchar
*
gst_encoding_target_get_category
(
GstEncodingTarget
*
target
);
const
gchar
*
gst_encoding_target_get_description
(
GstEncodingTarget
*
target
);
const
GList
*
gst_encoding_target_get_profiles
(
GstEncodingTarget
*
target
);
GstEncodingProfile
*
gst_encoding_target_get_profile
(
GstEncodingTarget
*
target
,
const
gchar
*
name
);
gboolean
gst_encoding_target_add_profile
(
GstEncodingTarget
*
target
,
GstEncodingProfile
*
profile
);
...
...
tests/check/libs/profile.c
View file @
c8fa8085
...
...
@@ -253,6 +253,30 @@ create_saveload_target (void)
return
target
;
}
GST_START_TEST
(
test_target_profile
)
{
GstEncodingTarget
*
target
;
GstEncodingProfile
*
prof
;
target
=
create_saveload_target
();
/* NULL isn't a valid profile name */
ASSERT_CRITICAL
(
gst_encoding_target_get_profile
(
target
,
NULL
));
/* try finding a profile that doesn't exist */
fail_if
(
gst_encoding_target_get_profile
(
target
,
"no-really-does-not-exist"
));
/* try finding a profile that exists */
prof
=
gst_encoding_target_get_profile
(
target
,
"pony"
);
fail_if
(
prof
==
NULL
);
gst_encoding_profile_unref
(
prof
);
gst_encoding_target_unref
(
target
);
}
GST_END_TEST
;
GST_START_TEST
(
test_saving_profile
)
{
GstEncodingTarget
*
orig
,
*
loaded
=
NULL
;
...
...
@@ -473,6 +497,7 @@ profile_suite (void)
tcase_add_test
(
tc_chain
,
test_profile_creation
);
tcase_add_test
(
tc_chain
,
test_profile_output_caps
);
tcase_add_test
(
tc_chain
,
test_target_naming
);
tcase_add_test
(
tc_chain
,
test_target_profile
);
if
(
can_write
)
{
tcase_add_test
(
tc_chain
,
test_loading_profile
);
tcase_add_test
(
tc_chain
,
test_saving_profile
);
...
...
win32/common/libgstpbutils.def
View file @
c8fa8085
...
...
@@ -85,6 +85,7 @@ EXPORTS
gst_encoding_target_get_category
gst_encoding_target_get_description
gst_encoding_target_get_name
gst_encoding_target_get_profile
gst_encoding_target_get_profiles
gst_encoding_target_get_type
gst_encoding_target_load
...
...
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