format/context: some style fixes

This commit is contained in:
meh 2015-05-12 18:18:14 +02:00
parent e004eb9124
commit ebdd8fb349

View File

@ -12,17 +12,17 @@ use ::device;
pub struct Context<'a> { pub struct Context<'a> {
pub ptr: *mut AVFormatContext, pub ptr: *mut AVFormatContext,
input: bool, _input: bool,
_marker: PhantomData<&'a i32>, _marker: PhantomData<&'a ()>,
} }
impl<'a> Context<'a> { impl<'a> Context<'a> {
pub fn new() -> Self { pub fn new() -> Self {
unsafe { unsafe {
Context { Context {
ptr: avformat_alloc_context(), ptr: avformat_alloc_context(),
input: false, _input: false,
_marker: PhantomData, _marker: PhantomData,
} }
} }
@ -32,7 +32,7 @@ impl<'a> Context<'a> {
Context { Context {
ptr: ptr, ptr: ptr,
input: true, _input: true,
_marker: PhantomData, _marker: PhantomData,
} }
} }
@ -135,7 +135,7 @@ impl<'a> Context<'a> {
impl<'a> Drop for Context<'a> { impl<'a> Drop for Context<'a> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
if self.input { if self._input {
avformat_close_input(&mut self.ptr); avformat_close_input(&mut self.ptr);
} }
else { else {
@ -224,7 +224,7 @@ pub struct DeviceIter<'a> {
ptr: *mut AVDeviceInfoList, ptr: *mut AVDeviceInfoList,
cur: c_int, cur: c_int,
_marker: PhantomData<&'a i32>, _marker: PhantomData<&'a ()>,
} }
impl<'a> DeviceIter<'a> { impl<'a> DeviceIter<'a> {
@ -382,7 +382,7 @@ pub fn dump(ctx: &Context, index: i32, url: Option<&str>) {
}; };
unsafe { unsafe {
if ctx.input { if ctx._input {
av_dump_format(ctx.ptr, index, url, 0); av_dump_format(ctx.ptr, index, url, 0);
} }
else { else {