codec: refactor API
This commit is contained in:
@ -19,7 +19,7 @@ impl<'a> Codec<'a> {
|
|||||||
Codec { ptr: ptr, _marker: PhantomData }
|
Codec { ptr: ptr, _marker: PhantomData }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open(&self) -> Result<Opened<'a>, Error> {
|
pub fn open(&self) -> Result<Opened, Error> {
|
||||||
Context::new().open(self)
|
Context::new().open(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,31 @@
|
|||||||
use std::marker::PhantomData;
|
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use libc::c_int;
|
|
||||||
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use ::media;
|
use ::media;
|
||||||
use ::{Error, Codec, Dictionary, Packet, Subtitle};
|
use ::{Error, Codec, Dictionary};
|
||||||
use super::{Id, Encode, Decode};
|
use super::Id;
|
||||||
use ::frame;
|
use super::decoder::Decoder;
|
||||||
|
use super::encoder::Encoder;
|
||||||
|
|
||||||
pub struct Context<'a> {
|
pub struct Context {
|
||||||
pub ptr: *mut AVCodecContext,
|
pub ptr: *mut AVCodecContext,
|
||||||
|
|
||||||
_own: bool,
|
_own: bool,
|
||||||
_marker: PhantomData<&'a ()>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Context<'a> {
|
impl Context {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
Context { ptr: avcodec_alloc_context3(ptr::null()), _own: true, _marker: PhantomData }
|
Context { ptr: avcodec_alloc_context3(ptr::null()), _own: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn wrap(ptr: *mut AVCodecContext) -> Self {
|
pub fn wrap(ptr: *mut AVCodecContext) -> Self {
|
||||||
Context { ptr: ptr, _own: false, _marker: PhantomData }
|
Context { ptr: ptr, _own: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open(self, codec: &Codec) -> Result<Opened<'a>, Error> {
|
pub fn open(self, codec: &Codec) -> Result<Opened, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match avcodec_open2(self.ptr, codec.ptr, ptr::null_mut()) {
|
match avcodec_open2(self.ptr, codec.ptr, ptr::null_mut()) {
|
||||||
0 => Ok(Opened(self)),
|
0 => Ok(Opened(self)),
|
||||||
@ -36,7 +34,7 @@ impl<'a> Context<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_with(self, codec: &Codec, mut options: Dictionary) -> Result<Opened<'a>, Error> {
|
pub fn open_with(self, codec: &Codec, mut options: Dictionary) -> Result<Opened, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match avcodec_open2(self.ptr, codec.ptr, &mut options.ptr) {
|
match avcodec_open2(self.ptr, codec.ptr, &mut options.ptr) {
|
||||||
0 => Ok(Opened(self)),
|
0 => Ok(Opened(self)),
|
||||||
@ -45,6 +43,35 @@ impl<'a> Context<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn decoder(&self) -> Result<Decoder, Error> {
|
||||||
|
if let Some(ref codec) = super::decoder::find(self.id()) {
|
||||||
|
self.clone().open(codec).and_then(|c| c.decoder())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_DECODER_NOT_FOUND))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn encoder(&self) -> Result<Encoder, Error> {
|
||||||
|
if let Some(ref codec) = super::encoder::find(self.id()) {
|
||||||
|
self.clone().open(codec).and_then(|c| c.encoder())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_ENCODER_NOT_FOUND))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn codec(&self) -> Option<Codec> {
|
||||||
|
unsafe {
|
||||||
|
if (*self.ptr).codec == ptr::null() {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Some(Codec::wrap((*self.ptr).codec as *mut _))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn medium(&self) -> media::Type {
|
pub fn medium(&self) -> media::Type {
|
||||||
unsafe {
|
unsafe {
|
||||||
media::Type::from((*self.ptr).codec_type)
|
media::Type::from((*self.ptr).codec_type)
|
||||||
@ -58,7 +85,7 @@ impl<'a> Context<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Drop for Context<'a> {
|
impl Drop for Context {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self._own {
|
if self._own {
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -68,7 +95,7 @@ impl<'a> Drop for Context<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Clone for Context<'a> {
|
impl Clone for Context {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
let mut ctx = Context::new();
|
let mut ctx = Context::new();
|
||||||
ctx.clone_from(self);
|
ctx.clone_from(self);
|
||||||
@ -83,105 +110,41 @@ impl<'a> Clone for Context<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Decode for Context<'a> {
|
pub struct Opened(pub Context);
|
||||||
fn video(&self, packet: &Packet, out: &mut frame::Video) -> Result<bool, Error> {
|
|
||||||
unsafe {
|
|
||||||
let mut got: c_int = 0;
|
|
||||||
|
|
||||||
match avcodec_decode_video2(self.ptr, out.ptr, &mut got, &packet.val) {
|
impl Opened {
|
||||||
e if e < 0 => Err(Error::new(e)),
|
pub fn decoder(self) -> Result<Decoder, Error> {
|
||||||
_ => Ok(got != 0)
|
let mut valid = false;
|
||||||
}
|
|
||||||
|
if let Some(codec) = self.codec() {
|
||||||
|
valid = codec.is_decoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
if valid {
|
||||||
|
Ok(Decoder(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn audio(&self, packet: &Packet, out: &mut frame::Audio) -> Result<bool, Error> {
|
pub fn encoder(self) -> Result<Encoder, Error> {
|
||||||
unsafe {
|
let mut valid = false;
|
||||||
let mut got: c_int = 0;
|
|
||||||
|
|
||||||
match avcodec_decode_audio4(self.ptr, out.ptr, &mut got, &packet.val) {
|
if let Some(codec) = self.codec() {
|
||||||
e if e < 0 => Err(Error::new(e)),
|
valid = codec.is_encoder();
|
||||||
_ => Ok(got != 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn subtitle(&self, packet: &Packet, out: &mut Subtitle) -> Result<bool, Error> {
|
if valid {
|
||||||
unsafe {
|
Ok(Encoder(self))
|
||||||
let mut got: c_int = 0;
|
}
|
||||||
|
else {
|
||||||
match avcodec_decode_subtitle2(self.ptr, &mut out.val, &mut got, &packet.val) {
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
e if e < 0 => Err(Error::new(e)),
|
|
||||||
_ => Ok(got != 0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Encode for Context<'a> {
|
impl Drop for Opened {
|
||||||
fn video(&self, frame: &frame::Video, out: &mut Packet) -> Result<bool, Error> {
|
|
||||||
unsafe {
|
|
||||||
let mut got: c_int = 0;
|
|
||||||
|
|
||||||
match avcodec_encode_video2(self.ptr, &mut out.val, frame.ptr, &mut got) {
|
|
||||||
e if e < 0 => Err(Error::new(e)),
|
|
||||||
_ => Ok(got != 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn audio(&self, frame: &frame::Audio, out: &mut Packet) -> Result<bool, Error> {
|
|
||||||
unsafe {
|
|
||||||
let mut got: c_int = 0;
|
|
||||||
|
|
||||||
match avcodec_encode_audio2(self.ptr, &mut out.val, frame.ptr, &mut got) {
|
|
||||||
e if e < 0 => Err(Error::new(e)),
|
|
||||||
_ => Ok(got != 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subtitle(&self, subtitle: &Subtitle, out: &mut [u8]) -> Result<bool, Error> {
|
|
||||||
unsafe {
|
|
||||||
match avcodec_encode_subtitle(self.ptr, out.as_mut_ptr(), out.len() as c_int, &subtitle.val) {
|
|
||||||
e if e < 0 => Err(Error::new(e)),
|
|
||||||
_ => Ok(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Opened<'a>(Context<'a>);
|
|
||||||
|
|
||||||
impl<'a> Decode for Opened<'a> {
|
|
||||||
fn video(&self, packet: &Packet, out: &mut frame::Video) -> Result<bool, Error> {
|
|
||||||
Decode::video(&self.0, packet, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn audio(&self, packet: &Packet, out: &mut frame::Audio) -> Result<bool, Error> {
|
|
||||||
Decode::audio(&self.0, packet, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subtitle(&self, packet: &Packet, out: &mut Subtitle) -> Result<bool, Error> {
|
|
||||||
Decode::subtitle(&self.0, packet, out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Encode for Opened<'a> {
|
|
||||||
fn video(&self, frame: &frame::Video, out: &mut Packet) -> Result<bool, Error> {
|
|
||||||
Encode::video(&self.0, frame, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn audio(&self, frame: &frame::Audio, out: &mut Packet) -> Result<bool, Error> {
|
|
||||||
Encode::audio(&self.0, frame, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn subtitle(&self, subtitle: &Subtitle, out: &mut [u8]) -> Result<bool, Error> {
|
|
||||||
Encode::subtitle(&self.0, subtitle, out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Drop for Opened<'a> {
|
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
avcodec_close(self.0.ptr);
|
avcodec_close(self.0.ptr);
|
||||||
@ -189,10 +152,10 @@ impl<'a> Drop for Opened<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Deref for Opened<'a> {
|
impl Deref for Opened {
|
||||||
type Target = Context<'a>;
|
type Target = Context;
|
||||||
|
|
||||||
fn deref(&self) -> &Context<'a> {
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,121 @@
|
|||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
use libc::c_int;
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use ::codec::Id;
|
use super::Id;
|
||||||
use ::{Codec, Packet, Subtitle, Error};
|
use super::context::Opened;
|
||||||
|
use ::{Codec, Packet, Error};
|
||||||
use ::frame;
|
use ::frame;
|
||||||
|
use ::media;
|
||||||
|
|
||||||
pub trait Decode {
|
pub struct Decoder(pub Opened);
|
||||||
fn video(&self, packet: &Packet, out: &mut frame::Video) -> Result<bool, Error>;
|
|
||||||
fn audio(&self, packet: &Packet, out: &mut frame::Audio) -> Result<bool, Error>;
|
impl Decoder {
|
||||||
fn subtitle(&self, packet: &Packet, out: &mut Subtitle) -> Result<bool, Error>;
|
pub fn video(self) -> Result<Video, Error> {
|
||||||
|
if self.medium() == media::Type::Video {
|
||||||
|
Ok(Video(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn audio(self) -> Result<Audio, Error> {
|
||||||
|
if self.medium() == media::Type::Audio {
|
||||||
|
Ok(Audio(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn subtitle(self) -> Result<Subtitle, Error> {
|
||||||
|
if self.medium() == media::Type::Subtitle {
|
||||||
|
Ok(Subtitle(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Decoder {
|
||||||
|
type Target = Opened;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Video(pub Decoder);
|
||||||
|
|
||||||
|
impl Video {
|
||||||
|
pub fn decode(&self, packet: &Packet, out: &mut frame::Video) -> Result<bool, Error> {
|
||||||
|
unsafe {
|
||||||
|
let mut got: c_int = 0;
|
||||||
|
|
||||||
|
match avcodec_decode_video2(self.ptr, out.ptr, &mut got, &packet.val) {
|
||||||
|
e if e < 0 => Err(Error::new(e)),
|
||||||
|
_ => Ok(got != 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Video {
|
||||||
|
type Target = Decoder;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Audio(pub Decoder);
|
||||||
|
|
||||||
|
impl Audio {
|
||||||
|
pub fn decode(&self, packet: &Packet, out: &mut frame::Audio) -> Result<bool, Error> {
|
||||||
|
unsafe {
|
||||||
|
let mut got: c_int = 0;
|
||||||
|
|
||||||
|
match avcodec_decode_audio4(self.ptr, out.ptr, &mut got, &packet.val) {
|
||||||
|
e if e < 0 => Err(Error::new(e)),
|
||||||
|
_ => Ok(got != 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Audio {
|
||||||
|
type Target = Decoder;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Subtitle(pub Decoder);
|
||||||
|
|
||||||
|
impl Subtitle {
|
||||||
|
pub fn decode(&self, packet: &Packet, out: &mut ::Subtitle) -> Result<bool, Error> {
|
||||||
|
unsafe {
|
||||||
|
let mut got: c_int = 0;
|
||||||
|
|
||||||
|
match avcodec_decode_subtitle2(self.ptr, &mut out.val, &mut got, &packet.val) {
|
||||||
|
e if e < 0 => Err(Error::new(e)),
|
||||||
|
_ => Ok(got != 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Subtitle {
|
||||||
|
type Target = Decoder;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn find(id: Id) -> Option<Codec<'static>> {
|
pub fn find(id: Id) -> Option<Codec<'static>> {
|
||||||
|
@ -1,15 +1,119 @@
|
|||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
use libc::c_int;
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use ::codec::Id;
|
use super::Id;
|
||||||
use ::{Codec, Packet, Subtitle, Error};
|
use super::context::Opened;
|
||||||
|
use ::{Codec, Packet, Error};
|
||||||
use ::frame;
|
use ::frame;
|
||||||
|
use ::media;
|
||||||
|
|
||||||
pub trait Encode {
|
pub struct Encoder(pub Opened);
|
||||||
fn video(&self, frame: &frame::Video, out: &mut Packet) -> Result<bool, Error>;
|
|
||||||
fn audio(&self, frame: &frame::Audio, out: &mut Packet) -> Result<bool, Error>;
|
impl Encoder {
|
||||||
fn subtitle(&self, subtitle: &Subtitle, out: &mut [u8]) -> Result<bool, Error>;
|
pub fn video(self) -> Result<Video, Error> {
|
||||||
|
if self.medium() == media::Type::Video {
|
||||||
|
Ok(Video(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn audio(self) -> Result<Audio, Error> {
|
||||||
|
if self.medium() == media::Type::Audio {
|
||||||
|
Ok(Audio(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn subtitle(self) -> Result<Subtitle, Error> {
|
||||||
|
if self.medium() == media::Type::Subtitle {
|
||||||
|
Ok(Subtitle(self))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Err(Error::from(AVERROR_INVALIDDATA))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Encoder {
|
||||||
|
type Target = Opened;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Video(pub Encoder);
|
||||||
|
|
||||||
|
impl Video {
|
||||||
|
pub fn encode(&self, frame: &frame::Video, out: &mut Packet) -> Result<bool, Error> {
|
||||||
|
unsafe {
|
||||||
|
let mut got: c_int = 0;
|
||||||
|
|
||||||
|
match avcodec_encode_video2(self.ptr, &mut out.val, frame.ptr, &mut got) {
|
||||||
|
e if e < 0 => Err(Error::new(e)),
|
||||||
|
_ => Ok(got != 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Video {
|
||||||
|
type Target = Encoder;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Audio(pub Encoder);
|
||||||
|
|
||||||
|
impl Audio {
|
||||||
|
pub fn encode(&self, frame: &frame::Audio, out: &mut Packet) -> Result<bool, Error> {
|
||||||
|
unsafe {
|
||||||
|
let mut got: c_int = 0;
|
||||||
|
|
||||||
|
match avcodec_encode_audio2(self.ptr, &mut out.val, frame.ptr, &mut got) {
|
||||||
|
e if e < 0 => Err(Error::new(e)),
|
||||||
|
_ => Ok(got != 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Audio {
|
||||||
|
type Target = Encoder;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Subtitle(pub Encoder);
|
||||||
|
|
||||||
|
impl Subtitle {
|
||||||
|
pub fn encode(&self, subtitle: &::Subtitle, out: &mut [u8]) -> Result<bool, Error> {
|
||||||
|
unsafe {
|
||||||
|
match avcodec_encode_subtitle(self.ptr, out.as_mut_ptr(), out.len() as c_int, &subtitle.val) {
|
||||||
|
e if e < 0 => Err(Error::new(e)),
|
||||||
|
_ => Ok(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Deref for Subtitle {
|
||||||
|
type Target = Encoder;
|
||||||
|
|
||||||
|
fn deref(&self) -> &<Self as Deref>::Target {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn find(id: Id) -> Option<Codec<'static>> {
|
pub fn find(id: Id) -> Option<Codec<'static>> {
|
||||||
|
@ -15,10 +15,7 @@ pub use self::context::Context;
|
|||||||
pub mod codec;
|
pub mod codec;
|
||||||
|
|
||||||
pub mod encoder;
|
pub mod encoder;
|
||||||
pub use self::encoder::Encode;
|
|
||||||
|
|
||||||
pub mod decoder;
|
pub mod decoder;
|
||||||
pub use self::decoder::Decode;
|
|
||||||
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
@ -34,10 +34,6 @@ pub use codec::picture::Picture;
|
|||||||
pub use codec::discard::Discard;
|
pub use codec::discard::Discard;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::codec::Codec;
|
pub use codec::codec::Codec;
|
||||||
#[cfg(feature = "codec")]
|
|
||||||
pub use codec::encoder::{self, Encode};
|
|
||||||
#[cfg(feature = "codec")]
|
|
||||||
pub use codec::decoder::{self, Decode};
|
|
||||||
|
|
||||||
#[cfg(feature = "device")]
|
#[cfg(feature = "device")]
|
||||||
pub mod device;
|
pub mod device;
|
||||||
|
Reference in New Issue
Block a user