Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
savoirfairelinux
jami-daemon
Commits
7a1d95be
Commit
7a1d95be
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
media filter: cleanup
Change-Id: I72147bfa7fcf06d69a9cd911300ce3dada1f2649
parent
ff72b5a8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/media/media_filter.cpp
+11
-13
11 additions, 13 deletions
src/media/media_filter.cpp
src/media/media_filter.h
+4
-4
4 additions, 4 deletions
src/media/media_filter.h
with
15 additions
and
17 deletions
src/media/media_filter.cpp
+
11
−
13
View file @
7a1d95be
...
@@ -49,7 +49,7 @@ MediaFilter::getFilterDesc() const
...
@@ -49,7 +49,7 @@ MediaFilter::getFilterDesc() const
}
}
int
int
MediaFilter
::
initialize
(
const
std
::
string
&
filterDesc
,
std
::
vector
<
MediaStream
>
msps
)
MediaFilter
::
initialize
(
const
std
::
string
&
filterDesc
,
const
std
::
vector
<
MediaStream
>
&
msps
)
{
{
int
ret
=
0
;
int
ret
=
0
;
desc_
=
filterDesc
;
desc_
=
filterDesc
;
...
@@ -88,18 +88,16 @@ MediaFilter::initialize(const std::string& filterDesc, std::vector<MediaStream>
...
@@ -88,18 +88,16 @@ MediaFilter::initialize(const std::string& filterDesc, std::vector<MediaStream>
for
(
AVFilterInOut
*
current
=
inputs
.
get
();
current
;
current
=
current
->
next
)
{
for
(
AVFilterInOut
*
current
=
inputs
.
get
();
current
;
current
=
current
->
next
)
{
if
(
!
current
->
name
)
if
(
!
current
->
name
)
return
fail
(
"Filters require non empty names"
,
AVERROR
(
EINVAL
));
return
fail
(
"Filters require non empty names"
,
AVERROR
(
EINVAL
));
std
::
string
name
=
current
->
name
;
std
::
string
_view
name
=
current
->
name
;
const
auto
&
it
=
std
::
find_if
(
msps
.
begin
(),
msps
.
end
(),
[
name
](
const
MediaStream
&
msp
)
{
auto
it
=
std
::
find_if
(
msps
.
begin
(),
msps
.
end
(),
[
name
](
const
MediaStream
&
msp
)
{
return
msp
.
name
==
name
;
return
msp
.
name
==
name
;
});
});
if
(
it
!=
msps
.
end
())
{
if
(
it
!=
msps
.
end
())
{
if
((
ret
=
initInputFilter
(
current
,
*
it
))
<
0
)
{
if
((
ret
=
initInputFilter
(
current
,
*
it
))
<
0
)
{
std
::
string
msg
=
"Failed to initialize input: "
+
name
;
return
fail
(
fmt
::
format
(
"Failed to initialize input: {}"
,
name
),
ret
);
return
fail
(
msg
,
ret
);
}
}
}
else
{
}
else
{
std
::
string
msg
=
"Failed to find matching parameters for: "
+
name
;
return
fail
(
fmt
::
format
(
"Failed to find matching parameters for: {}"
,
name
),
ret
);
return
fail
(
msg
,
ret
);
}
}
}
}
...
@@ -111,10 +109,10 @@ MediaFilter::initialize(const std::string& filterDesc, std::vector<MediaStream>
...
@@ -111,10 +109,10 @@ MediaFilter::initialize(const std::string& filterDesc, std::vector<MediaStream>
return
0
;
return
0
;
}
}
MediaStream
const
MediaStream
&
MediaFilter
::
getInputParams
(
const
std
::
string
&
inputName
)
const
MediaFilter
::
getInputParams
(
const
std
::
string
&
inputName
)
const
{
{
for
(
auto
ms
:
inputParams_
)
for
(
const
auto
&
ms
:
inputParams_
)
if
(
ms
.
name
==
inputName
)
if
(
ms
.
name
==
inputName
)
return
ms
;
return
ms
;
return
{};
return
{};
...
@@ -265,7 +263,7 @@ MediaFilter::initOutputFilter(AVFilterInOut* out)
...
@@ -265,7 +263,7 @@ MediaFilter::initOutputFilter(AVFilterInOut* out)
}
}
int
int
MediaFilter
::
initInputFilter
(
AVFilterInOut
*
in
,
MediaStream
msp
)
MediaFilter
::
initInputFilter
(
AVFilterInOut
*
in
,
const
MediaStream
&
msp
)
{
{
int
ret
=
0
;
int
ret
=
0
;
AVBufferSrcParameters
*
params
=
av_buffersrc_parameters_alloc
();
AVBufferSrcParameters
*
params
=
av_buffersrc_parameters_alloc
();
...
@@ -309,8 +307,8 @@ MediaFilter::initInputFilter(AVFilterInOut* in, MediaStream msp)
...
@@ -309,8 +307,8 @@ MediaFilter::initInputFilter(AVFilterInOut* in, MediaStream msp)
return
fail
(
"Failed to link buffer source to graph"
,
ret
);
return
fail
(
"Failed to link buffer source to graph"
,
ret
);
inputs_
.
push_back
(
buffersrcCtx
);
inputs_
.
push_back
(
buffersrcCtx
);
msp
.
name
=
in
->
name
;
inputParams_
.
emplace_back
(
msp
)
;
inputParams_
.
push_back
(
msp
)
;
inputParams_
.
back
().
name
=
in
->
name
;
return
ret
;
return
ret
;
}
}
...
@@ -328,7 +326,7 @@ MediaFilter::reinitialize()
...
@@ -328,7 +326,7 @@ MediaFilter::reinitialize()
}
}
int
int
MediaFilter
::
fail
(
std
::
string
msg
,
int
err
)
const
MediaFilter
::
fail
(
std
::
string
_view
msg
,
int
err
)
const
{
{
if
(
!
msg
.
empty
())
if
(
!
msg
.
empty
())
JAMI_ERR
()
<<
msg
<<
": "
<<
libav_utils
::
getError
(
err
);
JAMI_ERR
()
<<
msg
<<
": "
<<
libav_utils
::
getError
(
err
);
...
...
This diff is collapsed.
Click to expand it.
src/media/media_filter.h
+
4
−
4
View file @
7a1d95be
...
@@ -73,12 +73,12 @@ public:
...
@@ -73,12 +73,12 @@ public:
* @brief Initializes the filter graph with one or more inputs and one output. Returns a
* @brief Initializes the filter graph with one or more inputs and one output. Returns a
* negative code on error.
* negative code on error.
*/
*/
int
initialize
(
const
std
::
string
&
filterDesc
,
std
::
vector
<
MediaStream
>
msps
);
int
initialize
(
const
std
::
string
&
filterDesc
,
const
std
::
vector
<
MediaStream
>
&
msps
);
/**
/**
* @brief Returns a MediaStream object describing the input specified by @inputName.
* @brief Returns a MediaStream object describing the input specified by @inputName.
*/
*/
MediaStream
getInputParams
(
const
std
::
string
&
inputName
)
const
;
const
MediaStream
&
getInputParams
(
const
std
::
string
&
inputName
)
const
;
/**
/**
* @brief Returns a MediaStream struct describing the frames that will be output.
* @brief Returns a MediaStream struct describing the frames that will be output.
...
@@ -121,7 +121,7 @@ private:
...
@@ -121,7 +121,7 @@ private:
/**
/**
* @brief Initializes an input of filter graph.
* @brief Initializes an input of filter graph.
*/
*/
int
initInputFilter
(
AVFilterInOut
*
in
,
MediaStream
msp
);
int
initInputFilter
(
AVFilterInOut
*
in
,
const
MediaStream
&
msp
);
/**
/**
* @brief Reinitializes the filter graph.
* @brief Reinitializes the filter graph.
...
@@ -135,7 +135,7 @@ private:
...
@@ -135,7 +135,7 @@ private:
*
*
* NOTE @msg should not be null.
* NOTE @msg should not be null.
*/
*/
int
fail
(
std
::
string
msg
,
int
err
)
const
;
int
fail
(
std
::
string
_view
msg
,
int
err
)
const
;
/**
/**
* @brief Frees resources used by MediaFilter.
* @brief Frees resources used by MediaFilter.
...
...
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