Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gst-plugins-base
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
George Kiagiadakis
gst-plugins-base
Commits
cdd0a9c8
Commit
cdd0a9c8
authored
Jan 05, 2011
by
Edward Hervey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encodebin: Convert to new GstElementClass::request_new_pad_full vmethod
parent
0a26cd9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
55 deletions
+48
-55
gst/encoding/gstencodebin.c
gst/encoding/gstencodebin.c
+48
-55
No files found.
gst/encoding/gstencodebin.c
View file @
cdd0a9c8
...
...
@@ -198,7 +198,7 @@ static GstStateChangeReturn gst_encode_bin_change_state (GstElement * element,
GstStateChange
transition
);
static
GstPad
*
gst_encode_bin_request_new_pad
(
GstElement
*
element
,
GstPadTemplate
*
templ
,
const
gchar
*
name
);
GstPadTemplate
*
templ
,
const
gchar
*
name
,
const
GstCaps
*
caps
);
static
void
gst_encode_bin_release_pad
(
GstElement
*
element
,
GstPad
*
pad
);
static
gboolean
...
...
@@ -283,7 +283,7 @@ gst_encode_bin_class_init (GstEncodeBinClass * klass)
gstelement_klass
->
change_state
=
GST_DEBUG_FUNCPTR
(
gst_encode_bin_change_state
);
gstelement_klass
->
request_new_pad
=
gstelement_klass
->
request_new_pad
_full
=
GST_DEBUG_FUNCPTR
(
gst_encode_bin_request_new_pad
);
gstelement_klass
->
release_pad
=
GST_DEBUG_FUNCPTR
(
gst_encode_bin_release_pad
);
...
...
@@ -513,38 +513,22 @@ next_unused_stream_profile (GstEncodeBin * ebin, GType ptype, GstCaps * caps)
}
static
GstPad
*
gst_encode_bin_request_new_pad
(
GstElement
*
element
,
GstPadTemplate
*
templ
,
const
gchar
*
name
)
request_pad_for_stream
(
GstEncodeBin
*
encodebin
,
GType
ptype
,
const
gchar
*
name
,
GstCaps
*
caps
)
{
GstEncodeBin
*
ebin
=
(
GstEncodeBin
*
)
element
;
GType
ptype
;
StreamGroup
*
sgroup
;
GstEncodingProfile
*
sprof
;
GST_DEBUG_OBJECT
(
e
lement
,
"templ:%s, name:%s"
,
templ
->
name_template
,
name
);
GST_DEBUG_OBJECT
(
e
ncodebin
,
"name:%s caps:%"
GST_PTR_FORMAT
,
name
,
caps
);
/* Identify the stream group */
/* Figure out if we have a unused GstEncodingProfile we can use for
* these caps */
sprof
=
next_unused_stream_profile
(
encodebin
,
ptype
,
caps
);
if
(
!
strcmp
(
templ
->
name_template
,
"video_%d"
))
ptype
=
GST_TYPE_ENCODING_VIDEO_PROFILE
;
else
if
(
!
strcmp
(
templ
->
name_template
,
"audio_%d"
))
ptype
=
GST_TYPE_ENCODING_AUDIO_PROFILE
;
/* else if (!strcmp (templ->name_template, "text_%d")) */
/* ptype = GST_TYPE_ENCODING_TEXT_PROFILE; */
else
ptype
=
G_TYPE_NONE
;
/* FIXME : Check uniqueness of pad */
/* FIXME : Check that the requested number is the last one, and if not,
* update the last_pad_id variable so that we don't create a pad with
* the same name/number in the future */
/* Find GstEncodingProfile which we need */
sprof
=
next_unused_stream_profile
(
ebin
,
ptype
,
NULL
);
if
(
G_UNLIKELY
(
sprof
==
NULL
))
goto
no_stream_profile
;
sgroup
=
_create_stream_group
(
e
bin
,
sprof
,
name
,
NULL
);
sgroup
=
_create_stream_group
(
e
ncodebin
,
sprof
,
name
,
caps
);
if
(
G_UNLIKELY
(
sgroup
==
NULL
))
goto
no_stream_group
;
...
...
@@ -552,48 +536,56 @@ gst_encode_bin_request_new_pad (GstElement * element,
no_stream_profile:
{
GST_WARNING_OBJECT
(
ebin
,
"Couldn't find a compatible stream profile"
);
GST_WARNING_OBJECT
(
e
ncode
bin
,
"Couldn't find a compatible stream profile"
);
return
NULL
;
}
no_stream_group:
{
GST_WARNING_OBJECT
(
ebin
,
"Couldn't create a StreamGroup"
);
GST_WARNING_OBJECT
(
e
ncode
bin
,
"Couldn't create a StreamGroup"
);
return
NULL
;
}
}
static
GstPad
*
gst_encode_bin_request_pad_signal
(
GstEncodeBin
*
encodebin
,
GstCaps
*
caps
)
gst_encode_bin_request_new_pad
(
GstElement
*
element
,
GstPadTemplate
*
templ
,
const
gchar
*
name
,
const
GstCaps
*
caps
)
{
GstEncod
ingProfile
*
sprof
;
StreamGroup
*
sgroup
;
GstEncod
eBin
*
ebin
=
(
GstEncodeBin
*
)
element
;
GstPad
*
res
=
NULL
;
GST_DEBUG_OBJECT
(
e
ncodebin
,
"caps:%"
GST_PTR_FORMAT
,
caps
);
GST_DEBUG_OBJECT
(
e
lement
,
"templ:%s, name:%s"
,
templ
->
name_template
,
name
);
/* Figure out if we have a unused GstEncodingProfile we can use for
* these caps */
sprof
=
next_unused_stream_profile
(
encodebin
,
G_TYPE_NONE
,
caps
);
if
(
G_UNLIKELY
(
sprof
==
NULL
))
goto
no_stream_profile
;
/* Identify the stream group */
if
(
caps
!=
NULL
)
{
res
=
request_pad_for_stream
(
ebin
,
G_TYPE_NONE
,
name
,
(
GstCaps
*
)
caps
);
}
sgroup
=
_create_stream_group
(
encodebin
,
sprof
,
NULL
,
caps
);
if
(
G_UNLIKELY
(
sgroup
==
NULL
))
goto
no_stream_group
;
if
(
res
==
NULL
)
{
GType
ptype
=
G_TYPE_NONE
;
return
sgroup
->
ghostpad
;
if
(
!
strcmp
(
templ
->
name_template
,
"video_%d"
))
ptype
=
GST_TYPE_ENCODING_VIDEO_PROFILE
;
else
if
(
!
strcmp
(
templ
->
name_template
,
"audio_%d"
))
ptype
=
GST_TYPE_ENCODING_AUDIO_PROFILE
;
/* else if (!strcmp (templ->name_template, "text_%d")) */
/* ptype = GST_TYPE_ENCODING_TEXT_PROFILE; */
no_stream_profile:
{
GST_WARNING_OBJECT
(
encodebin
,
"Couldn't find a compatible stream profile"
);
return
NULL
;
}
/* FIXME : Check uniqueness of pad */
/* FIXME : Check that the requested number is the last one, and if not,
* update the last_pad_id variable so that we don't create a pad with
* the same name/number in the future */
no_stream_group:
{
GST_WARNING_OBJECT
(
encodebin
,
"Couldn't create a StreamGroup"
);
return
NULL
;
res
=
request_pad_for_stream
(
ebin
,
ptype
,
name
,
NULL
);
}
return
res
;
}
static
GstPad
*
gst_encode_bin_request_pad_signal
(
GstEncodeBin
*
encodebin
,
GstCaps
*
caps
)
{
return
request_pad_for_stream
(
encodebin
,
G_TYPE_NONE
,
NULL
,
caps
);
}
static
inline
StreamGroup
*
...
...
@@ -740,7 +732,7 @@ beach:
}
static
GstPad
*
gst
_element_request_pad
(
GstElement
*
element
,
GstPadTemplate
*
templ
,
local
_element_request_pad
(
GstElement
*
element
,
GstPadTemplate
*
templ
,
const
gchar
*
name
)
{
GstPad
*
newpad
=
NULL
;
...
...
@@ -780,7 +772,7 @@ gst_element_get_pad_from_template (GstElement * element, GstPadTemplate * templ)
break
;
case
GST_PAD_REQUEST
:
ret
=
gst_element_request_pad
(
element
,
templ
,
NULL
);
ret
=
gst_element_request_pad
(
element
,
templ
,
NULL
,
NULL
);
break
;
}
...
...
@@ -1015,7 +1007,8 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
/* Path 1 : Already-encoded data */
sinkpad
=
gst_element_request_pad
(
sgroup
->
combiner
,
NULL
,
"passthroughsink"
);
sinkpad
=
local_element_request_pad
(
sgroup
->
combiner
,
NULL
,
"passthroughsink"
);
if
(
G_UNLIKELY
(
sinkpad
==
NULL
))
goto
no_combiner_sinkpad
;
...
...
@@ -1042,7 +1035,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
g_object_unref
(
srcpad
);
}
srcpad
=
gst
_element_request_pad
(
sgroup
->
splitter
,
NULL
,
"passthroughsrc"
);
srcpad
=
local
_element_request_pad
(
sgroup
->
splitter
,
NULL
,
"passthroughsrc"
);
if
(
G_UNLIKELY
(
srcpad
==
NULL
))
goto
no_splitter_srcpad
;
...
...
@@ -1061,7 +1054,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
gst_bin_add
((
GstBin
*
)
ebin
,
sgroup
->
encoder
);
tosync
=
g_list_append
(
tosync
,
sgroup
->
encoder
);
sinkpad
=
gst
_element_request_pad
(
sgroup
->
combiner
,
NULL
,
"encodingsink"
);
sinkpad
=
local
_element_request_pad
(
sgroup
->
combiner
,
NULL
,
"encodingsink"
);
if
(
G_UNLIKELY
(
sinkpad
==
NULL
))
goto
no_combiner_sinkpad
;
srcpad
=
gst_element_get_static_pad
(
sgroup
->
encoder
,
"src"
);
...
...
@@ -1151,7 +1144,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
/* Link to stream splitter */
sinkpad
=
gst_element_get_static_pad
(
last
,
"sink"
);
srcpad
=
gst
_element_request_pad
(
sgroup
->
splitter
,
NULL
,
"encodingsrc"
);
srcpad
=
local
_element_request_pad
(
sgroup
->
splitter
,
NULL
,
"encodingsrc"
);
if
(
G_UNLIKELY
(
srcpad
==
NULL
))
goto
no_splitter_srcpad
;
if
(
G_UNLIKELY
(
fast_pad_link
(
srcpad
,
sinkpad
)
!=
GST_PAD_LINK_OK
))
...
...
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