Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eta
gajim
Commits
6207e607
Commit
6207e607
authored
6 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
Fix NoneType Error
element can be None if there was a error while calling Gst.ElementFactory.make()
parent
0fb19c2b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/common/multimedia_helpers.py
+6
-2
6 additions, 2 deletions
gajim/common/multimedia_helpers.py
with
6 additions
and
2 deletions
gajim/common/multimedia_helpers.py
+
6
−
2
View file @
6207e607
...
...
@@ -14,9 +14,12 @@
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import
gi
import
logging
gi
.
require_version
(
'
Gst
'
,
'
1.0
'
)
from
gi.repository
import
Gst
log
=
logging
.
getLogger
(
'
gajim.c.multimedia_helpers
'
)
class
DeviceManager
(
object
):
def
__init__
(
self
):
...
...
@@ -33,6 +36,8 @@ class DeviceManager(object):
def
detect_element
(
self
,
name
,
text
,
pipe
=
'
%s
'
):
if
Gst
.
ElementFactory
.
find
(
name
):
element
=
Gst
.
ElementFactory
.
make
(
name
,
'
%spresencetest
'
%
name
)
if
element
is
None
:
log
.
warning
(
'
could not create %spresencetest
'
,
name
)
if
hasattr
(
element
.
props
,
'
device
'
):
element
.
set_state
(
Gst
.
State
.
READY
)
devices
=
element
.
get_properties
(
'
device
'
)
...
...
@@ -49,7 +54,7 @@ class DeviceManager(object):
else
:
self
.
devices
[
text
]
=
pipe
%
name
else
:
print
(
'
element
\'
%s
\'
not found
'
%
name
)
log
.
info
(
'
element
%s
not found
'
,
name
)
class
AudioInputManager
(
DeviceManager
):
...
...
@@ -108,4 +113,3 @@ class VideoOutputManager(DeviceManager):
# ximagesink
self
.
detect_element
(
'
ximagesink
'
,
_
(
'
X Window System (without Xv)
'
))
self
.
detect_element
(
'
autovideosink
'
,
_
(
'
Autodetect
'
))
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