Commit 4b4ae6d5 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

flvdemux: Port to new subclassing API

Fixes #49
parent 1e399270
......@@ -4,17 +4,20 @@ version = "0.4.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
[dependencies]
url = "1.1"
glib = { git = "https://github.com/gtk-rs/glib" }
gst-plugin = { path="../gst-plugin" }
gst-plugin-simple = { path="../gst-plugin-simple" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["subclassing"] }
gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
num-rational = { version = "0.2", default-features = false, features = [] }
nom = "3.0"
flavors = {git = "https://github.com/rust-av/flavors.git"}
muldiv = "0.2"
byteorder = "1.0"
lazy_static = "1.0"
smallvec = "0.6"
[lib]
name = "gstrsflv"
......
// Copyright (C) 2016-2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
use std::io;
pub trait ReadBytesExtShort: io::Read {
fn read_u16le(&mut self) -> io::Result<u16> {
self.read_u16::<LittleEndian>()
}
fn read_i16le(&mut self) -> io::Result<i16> {
self.read_i16::<LittleEndian>()
}
fn read_u32le(&mut self) -> io::Result<u32> {
self.read_u32::<LittleEndian>()
}
fn read_i32le(&mut self) -> io::Result<i32> {
self.read_i32::<LittleEndian>()
}
fn read_u64le(&mut self) -> io::Result<u64> {
self.read_u64::<LittleEndian>()
}
fn read_i64le(&mut self) -> io::Result<i64> {
self.read_i64::<LittleEndian>()
}
fn read_uintle(&mut self, nbytes: usize) -> io::Result<u64> {
self.read_uint::<LittleEndian>(nbytes)
}
fn read_intle(&mut self, nbytes: usize) -> io::Result<i64> {
self.read_int::<LittleEndian>(nbytes)
}
fn read_f32le(&mut self) -> io::Result<f32> {
self.read_f32::<LittleEndian>()
}
fn read_f64le(&mut self) -> io::Result<f64> {
self.read_f64::<LittleEndian>()
}
fn read_u16be(&mut self) -> io::Result<u16> {
self.read_u16::<BigEndian>()
}
fn read_i16be(&mut self) -> io::Result<i16> {
self.read_i16::<BigEndian>()
}
fn read_u32be(&mut self) -> io::Result<u32> {
self.read_u32::<BigEndian>()
}
fn read_i32be(&mut self) -> io::Result<i32> {
self.read_i32::<BigEndian>()
}
fn read_u64be(&mut self) -> io::Result<u64> {
self.read_u64::<BigEndian>()
}
fn read_i64be(&mut self) -> io::Result<i64> {
self.read_i64::<BigEndian>()
}
fn read_uintbe(&mut self, nbytes: usize) -> io::Result<u64> {
self.read_uint::<BigEndian>(nbytes)
}
fn read_intbe(&mut self, nbytes: usize) -> io::Result<i64> {
self.read_int::<BigEndian>(nbytes)
}
fn read_f32be(&mut self) -> io::Result<f32> {
self.read_f32::<BigEndian>()
}
fn read_f64be(&mut self) -> io::Result<f64> {
self.read_f64::<BigEndian>()
}
}
impl<T> ReadBytesExtShort for T where T: ReadBytesExt {}
pub trait WriteBytesExtShort: WriteBytesExt {
fn write_u16le(&mut self, n: u16) -> io::Result<()> {
self.write_u16::<LittleEndian>(n)
}
fn write_i16le(&mut self, n: i16) -> io::Result<()> {
self.write_i16::<LittleEndian>(n)
}
fn write_u32le(&mut self, n: u32) -> io::Result<()> {
self.write_u32::<LittleEndian>(n)
}
fn write_i32le(&mut self, n: i32) -> io::Result<()> {
self.write_i32::<LittleEndian>(n)
}
fn write_u64le(&mut self, n: u64) -> io::Result<()> {
self.write_u64::<LittleEndian>(n)
}
fn write_i64le(&mut self, n: i64) -> io::Result<()> {
self.write_i64::<LittleEndian>(n)
}
fn write_uintle(&mut self, n: u64, nbytes: usize) -> io::Result<()> {
self.write_uint::<LittleEndian>(n, nbytes)
}
fn write_intle(&mut self, n: i64, nbytes: usize) -> io::Result<()> {
self.write_int::<LittleEndian>(n, nbytes)
}
fn write_f32le(&mut self, n: f32) -> io::Result<()> {
self.write_f32::<LittleEndian>(n)
}
fn write_f64le(&mut self, n: f64) -> io::Result<()> {
self.write_f64::<LittleEndian>(n)
}
fn write_u16be(&mut self, n: u16) -> io::Result<()> {
self.write_u16::<BigEndian>(n)
}
fn write_i16be(&mut self, n: i16) -> io::Result<()> {
self.write_i16::<BigEndian>(n)
}
fn write_u32be(&mut self, n: u32) -> io::Result<()> {
self.write_u32::<BigEndian>(n)
}
fn write_i32be(&mut self, n: i32) -> io::Result<()> {
self.write_i32::<BigEndian>(n)
}
fn write_u64be(&mut self, n: u64) -> io::Result<()> {
self.write_u64::<BigEndian>(n)
}
fn write_i64be(&mut self, n: i64) -> io::Result<()> {
self.write_i64::<BigEndian>(n)
}
fn write_uintbe(&mut self, n: u64, nbytes: usize) -> io::Result<()> {
self.write_uint::<BigEndian>(n, nbytes)
}
fn write_intbe(&mut self, n: i64, nbytes: usize) -> io::Result<()> {
self.write_int::<BigEndian>(n, nbytes)
}
fn write_f32be(&mut self, n: f32) -> io::Result<()> {
self.write_f32::<BigEndian>(n)
}
fn write_f64be(&mut self, n: f64) -> io::Result<()> {
self.write_f64::<BigEndian>(n)
}
}
impl<T> WriteBytesExtShort for T where T: WriteBytesExt {}
This diff is collapsed.
......@@ -8,51 +8,30 @@
#![crate_type = "cdylib"]
extern crate flavors;
extern crate glib;
#[macro_use]
extern crate gst_plugin;
extern crate gst_plugin_simple;
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate muldiv;
extern crate nom;
extern crate num_rational;
extern crate url;
extern crate gstreamer_base as gst_base;
use gst_plugin_simple::demuxer::*;
#[macro_use]
extern crate lazy_static;
mod bytes;
mod flvdemux;
use flvdemux::FlvDemux;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
demuxer_register(
plugin,
DemuxerInfo {
name: "rsflvdemux".into(),
long_name: "FLV Demuxer".into(),
description: "Demuxes FLV Streams".into(),
classification: "Codec/Demuxer".into(),
author: "Sebastian Dröge <sebastian@centricular.com>".into(),
rank: 256 + 100,
create_instance: FlvDemux::new_boxed,
input_caps: gst::Caps::new_simple("video/x-flv", &[]),
output_caps: gst::Caps::new_any(),
},
)?;
Ok(())
flvdemux::register(plugin)
}
plugin_define!(
b"rsflv\0",
b"Rust FLV Plugin\0",
gst_plugin_define!(
"rsflv",
"Rust FLV Plugin",
plugin_init,
b"1.0\0",
b"MIT/X11\0",
b"rsflv\0",
b"rsflv\0",
b"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs\0",
b"2016-12-08\0"
"1.0",
"MIT/X11",
"rsflv",
"rsflv",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2016-12-08"
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment