Skip to content

Commit eb53560

Browse files
VincentJousseVincent Jousse
andauthored
fix!: remove filter::Context generic lifetime parameter (#194)
issue #193 Co-authored-by: Vincent Jousse <vincent.jousse@luminvent.com>
1 parent 40ea5fd commit eb53560

File tree

4 files changed

+16
-34
lines changed

4 files changed

+16
-34
lines changed

src/filter/context/context.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
use std::marker::PhantomData;
2-
31
use super::{Sink, Source};
42
use ffi::*;
53
use libc::c_void;
64
use {format, option, ChannelLayout};
75

8-
pub struct Context<'a> {
6+
pub struct Context {
97
ptr: *mut AVFilterContext,
10-
11-
_marker: PhantomData<&'a ()>,
128
}
139

14-
impl<'a> Context<'a> {
10+
impl Context {
1511
pub unsafe fn wrap(ptr: *mut AVFilterContext) -> Self {
16-
Context {
17-
ptr,
18-
_marker: PhantomData,
19-
}
12+
Context { ptr }
2013
}
2114

2215
pub unsafe fn as_ptr(&self) -> *const AVFilterContext {
@@ -28,12 +21,12 @@ impl<'a> Context<'a> {
2821
}
2922
}
3023

31-
impl<'a> Context<'a> {
32-
pub fn source(&'a mut self) -> Source<'a> {
24+
impl Context {
25+
pub fn source(&mut self) -> Source {
3326
unsafe { Source::wrap(self) }
3427
}
3528

36-
pub fn sink(&'a mut self) -> Sink<'a> {
29+
pub fn sink(&mut self) -> Sink {
3730
unsafe { Sink::wrap(self) }
3831
}
3932

@@ -61,7 +54,7 @@ impl<'a> Context<'a> {
6154
}
6255
}
6356

64-
unsafe impl<'a> option::Target for Context<'a> {
57+
unsafe impl option::Target for Context {
6558
fn as_ptr(&self) -> *const c_void {
6659
self.ptr as *const _
6760
}
@@ -71,4 +64,4 @@ unsafe impl<'a> option::Target for Context<'a> {
7164
}
7265
}
7366

74-
impl<'a> option::Settable for Context<'a> {}
67+
impl option::Settable for Context {}

src/filter/context/sink.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use libc::c_int;
44
use {Error, Frame, Rational};
55

66
pub struct Sink<'a> {
7-
ctx: &'a mut Context<'a>,
7+
ctx: &'a mut Context,
88
}
99

1010
impl<'a> Sink<'a> {
11-
pub unsafe fn wrap<'b>(ctx: &'b mut Context<'b>) -> Sink<'b> {
12-
Sink { ctx }
11+
pub unsafe fn wrap(ctx: &'a mut Context) -> Self {
12+
Self { ctx }
1313
}
1414
}
1515

src/filter/context/source.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ use ffi::*;
55
use {Error, Frame};
66

77
pub struct Source<'a> {
8-
ctx: &'a mut Context<'a>,
8+
ctx: &'a mut Context,
99
}
1010

1111
impl<'a> Source<'a> {
12-
pub unsafe fn wrap<'b>(ctx: &'b mut Context<'b>) -> Source<'b> {
13-
Source { ctx }
12+
pub unsafe fn wrap(ctx: &'a mut Context) -> Self {
13+
Self { ctx }
1414
}
1515
}
1616

src/filter/graph.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,7 @@ impl Graph {
5050
}
5151
}
5252

53-
pub fn add<'a, 'b>(
54-
&'a mut self,
55-
filter: &Filter,
56-
name: &str,
57-
args: &str,
58-
) -> Result<Context<'b>, Error>
59-
where
60-
'a: 'b,
61-
{
53+
pub fn add(&mut self, filter: &Filter, name: &str, args: &str) -> Result<Context, Error> {
6254
unsafe {
6355
let name = CString::new(name).unwrap();
6456
let args = CString::new(args).unwrap();
@@ -78,10 +70,7 @@ impl Graph {
7870
}
7971
}
8072

81-
pub fn get<'a, 'b>(&'b mut self, name: &str) -> Option<Context<'b>>
82-
where
83-
'a: 'b,
84-
{
73+
pub fn get(&mut self, name: &str) -> Option<Context> {
8574
unsafe {
8675
let name = CString::new(name).unwrap();
8776
let ptr = avfilter_graph_get_filter(self.as_mut_ptr(), name.as_ptr());

0 commit comments

Comments
 (0)