Commit 89b0220e authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

Build each component into its own GStreamer plugin

parent e25f644f
[package]
name = "rsplugin"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
build = "build.rs"
repository = "https://github.com/sdroege/rsplugin"
license = "LGPL-2.1+"
[workspace]
[dependencies]
libc = "0.2"
url = "1.1"
bitflags = "0.7"
reqwest = "0.2"
nom = "2.0"
flavors = {git = "https://github.com/sdroege/flavors.git"}
[build-dependencies]
gcc = "0.3"
pkg-config = "0.3"
[lib]
name = "rsplugin"
crate-type = ["cdylib"]
path = "src/lib.rs"
members = ["gst-plugin", "gst-plugin-file", "gst-plugin-http", "gst-plugin-flv"]
This diff is collapsed.
[package]
name = "gst-plugin-file"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://github.com/sdroege/rsplugin"
license = "LGPL-2.1+"
[dependencies]
url = "1.1"
gst-plugin = { path="../gst-plugin" }
[lib]
name = "gstrsfile"
crate-type = ["cdylib"]
path = "src/lib.rs"
......@@ -22,9 +22,9 @@ use url::Url;
use std::io::Write;
use std::convert::From;
use error::*;
use rssink::*;
use buffer::*;
use gst_plugin::error::*;
use gst_plugin::sink::*;
use gst_plugin::buffer::*;
#[derive(Debug)]
enum StreamingState {
......
......@@ -20,9 +20,9 @@ use std::io::{Read, Seek, SeekFrom};
use std::fs::File;
use url::Url;
use error::*;
use rssource::*;
use buffer::*;
use gst_plugin::error::*;
use gst_plugin::source::*;
use gst_plugin::buffer::*;
#[derive(Debug)]
enum StreamingState {
......
// Copyright (C) 2016 Sebastian Dröge <sebastian@centricular.com>
// 2016 Luis de Bethencourt <luisbg@osg.samsung.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
......@@ -18,39 +17,19 @@
#![crate_type="cdylib"]
extern crate libc;
extern crate url;
extern crate reqwest;
#[macro_use]
extern crate bitflags;
#[macro_use]
extern crate nom;
extern crate flavors;
extern crate gst_plugin;
#[macro_use]
pub mod utils;
#[macro_use]
pub mod error;
pub mod buffer;
pub mod adapter;
#[macro_use]
pub mod plugin;
pub mod rssource;
pub mod rssink;
pub mod rsfilesrc;
pub mod rshttpsrc;
pub mod rsfilesink;
pub mod rsdemuxer;
pub mod flvdemux;
use gst_plugin::plugin::*;
use gst_plugin::source::*;
use gst_plugin::sink::*;
mod filesrc;
mod filesink;
use plugin::*;
use rssource::*;
use rsfilesrc::FileSrc;
use rshttpsrc::HttpSrc;
use rssink::*;
use rsfilesink::FileSink;
use rsdemuxer::*;
use flvdemux::FlvDemux;
use filesrc::FileSrc;
use filesink::FileSink;
fn plugin_init(plugin: &Plugin) -> bool {
source_register(plugin,
......@@ -66,19 +45,6 @@ fn plugin_init(plugin: &Plugin) -> bool {
push_only: false,
});
source_register(plugin,
&SourceInfo {
name: "rshttpsrc",
long_name: "HTTP Source",
description: "Reads HTTP/HTTPS streams",
classification: "Source/Network/HTTP",
author: "Sebastian Dröge <sebastian@centricular.com>",
rank: 256 + 100,
create_instance: HttpSrc::new_boxed,
protocols: "http:https",
push_only: true,
});
sink_register(plugin,
&SinkInfo {
name: "rsfilesink",
......@@ -91,28 +57,15 @@ fn plugin_init(plugin: &Plugin) -> bool {
protocols: "file",
});
demuxer_register(plugin,
&DemuxerInfo {
name: "rsflvdemux",
long_name: "FLV Demuxer",
description: "Demuxes FLV Streams",
classification: "Codec/Demuxer",
author: "Sebastian Dröge <sebastian@centricular.com>",
rank: 256 + 100,
create_instance: FlvDemux::new_boxed,
input_formats: "video/x-flv",
output_formats: "ANY",
});
true
}
plugin_define!(b"rsplugin\0",
b"Rust Plugin\0",
plugin_define!(b"rsfile\0",
b"Rust File Plugin\0",
plugin_init,
b"1.0\0",
b"LGPL\0",
b"rsplugin\0",
b"rsplugin\0",
b"rsfile\0",
b"rsfile\0",
b"https://github.com/sdroege/rsplugin\0",
b"2016-12-08\0");
// Copyright (C) 2016 Sebastian Dröge <sebastian@centricular.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301, USA.
#![crate_type="cdylib"]
extern crate url;
#[macro_use]
extern crate gst_plugin;
use gst_plugin::plugin::*;
use gst_plugin::source::*;
use gst_plugin::sink::*;
mod filesrc;
mod filesink;
use filesrc::FileSrc;
use filesink::FileSink;
fn plugin_init(plugin: &Plugin) -> bool {
source_register(plugin,
&SourceInfo {
name: "rsfilesrc",
long_name: "File Source",
description: "Reads local files",
classification: "Source/File",
author: "Sebastian Dröge <sebastian@centricular.com>",
rank: 256 + 100,
create_instance: FileSrc::new_boxed,
protocols: "file",
push_only: false,
});
sink_register(plugin,
&SinkInfo {
name: "rsfilesink",
long_name: "File Sink",
description: "Writes to local files",
classification: "Sink/File",
author: "Luis de Bethencourt <luisbg@osg.samsung.com>",
rank: 256 + 100,
create_instance: FileSink::new_boxed,
protocols: "file",
});
true
}
plugin_define!(b"rsfile\0",
b"Rust File Plugin\0",
plugin_init,
b"1.0\0",
b"LGPL\0",
b"rsfile\0",
b"rsfile\0",
b"https://github.com/sdroege/rsplugin\0",
b"2016-12-08\0");
This diff is collapsed.
[package]
name = "gst-plugin-flv"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://github.com/sdroege/rsplugin"
license = "LGPL-2.1+"
[dependencies]
url = "1.1"
gst-plugin = { path="../gst-plugin" }
nom = "2.0"
flavors = {git = "https://github.com/sdroege/flavors.git"}
[lib]
name = "gstrsflv"
crate-type = ["cdylib"]
path = "src/lib.rs"
......@@ -22,11 +22,11 @@ use nom::IResult;
use flavors::parser as flavors;
use error::*;
use rsdemuxer::*;
use buffer::*;
use adapter::*;
use utils;
use gst_plugin::error::*;
use gst_plugin::demuxer::*;
use gst_plugin::buffer::*;
use gst_plugin::adapter::*;
use gst_plugin::utils;
const AUDIO_STREAM_ID: u32 = 0;
const VIDEO_STREAM_ID: u32 = 1;
......
// Copyright (C) 2016 Sebastian Dröge <sebastian@centricular.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301, USA.
#![crate_type="cdylib"]
extern crate url;
#[macro_use]
extern crate gst_plugin;
#[macro_use]
extern crate nom;
extern crate flavors;
use gst_plugin::plugin::*;
use gst_plugin::demuxer::*;
mod flvdemux;
use flvdemux::FlvDemux;
fn plugin_init(plugin: &Plugin) -> bool {
demuxer_register(plugin,
&DemuxerInfo {
name: "rsflvdemux",
long_name: "FLV Demuxer",
description: "Demuxes FLV Streams",
classification: "Codec/Demuxer",
author: "Sebastian Dröge <sebastian@centricular.com>",
rank: 256 + 100,
create_instance: FlvDemux::new_boxed,
input_formats: "video/x-flv",
output_formats: "ANY",
});
true
}
plugin_define!(b"rsflv\0",
b"Rust FLV Plugin\0",
plugin_init,
b"1.0\0",
b"LGPL\0",
b"rsflv\0",
b"rsflv\0",
b"https://github.com/sdroege/rsplugin\0",
b"2016-12-08\0");
This diff is collapsed.
[package]
name = "gst-plugin-http"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://github.com/sdroege/rsplugin"
license = "LGPL-2.1+"
[dependencies]
url = "1.1"
gst-plugin = { path="../gst-plugin" }
reqwest = "0.2"
[lib]
name = "gstrshttp"
crate-type = ["cdylib"]
path = "src/lib.rs"
......@@ -22,9 +22,9 @@ use reqwest::{Client, Response};
use reqwest::header::{ContentLength, ContentRange, ContentRangeSpec, Range, ByteRangeSpec,
AcceptRanges, RangeUnit};
use error::*;
use rssource::*;
use buffer::*;
use gst_plugin::error::*;
use gst_plugin::source::*;
use gst_plugin::buffer::*;
#[derive(Debug)]
enum StreamingState {
......
// Copyright (C) 2016 Sebastian Dröge <sebastian@centricular.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the
// Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301, USA.
#![crate_type="cdylib"]
extern crate url;
#[macro_use]
extern crate gst_plugin;
extern crate reqwest;
use gst_plugin::plugin::*;
use gst_plugin::source::*;
mod httpsrc;
use httpsrc::HttpSrc;
fn plugin_init(plugin: &Plugin) -> bool {
source_register(plugin,
&SourceInfo {
name: "rshttpsrc",
long_name: "HTTP/HTTPS Source",
description: "Reads HTTP/HTTPS streams",
classification: "Source/File",
author: "Sebastian Dröge <sebastian@centricular.com>",
rank: 256 + 100,
create_instance: HttpSrc::new_boxed,
protocols: "http:https",
push_only: true,
});
true
}
plugin_define!(b"rshttp\0",
b"Rust HTTP Plugin\0",
plugin_init,
b"1.0\0",
b"LGPL\0",
b"rshttp\0",
b"rshttp\0",
b"https://github.com/sdroege/rsplugin\0",
b"2016-12-08\0");
This diff is collapsed.
[package]
name = "gst-plugin"
version = "0.1.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
build = "build.rs"
repository = "https://github.com/sdroege/rsplugin/gst-plugin"
license = "LGPL-2.1+"
[dependencies]
libc = "0.2"
url = "1.1"
bitflags = "0.7"
[build-dependencies]
gcc = "0.3"
pkg-config = "0.3"
[lib]
name = "gst_plugin"
path = "src/lib.rs"
......@@ -23,7 +23,7 @@ fn main() {
let gstbase = pkg_config::probe_library("gstreamer-base-1.0").unwrap();
let includes = [gstreamer.include_paths, gstbase.include_paths];
let files = ["src/lib.c", "src/rssource.c", "src/rssink.c", "src/rsdemuxer.c"];
let files = ["src/error.c", "src/buffer.c", "src/source.c", "src/sink.c", "src/demuxer.c"];
let mut config = gcc::Config::new();
config.include("src");
......
......@@ -18,19 +18,6 @@
#include <gst/gst.h>
#include "rssource.h"
#include "rssink.h"
#include "rsdemuxer.h"
void
gst_rs_element_error (GstElement * element, GQuark error_domain,
gint error_code, const gchar * message, const gchar * debug,
const gchar * file, const gchar * function, guint line)
{
gst_element_message_full (element, GST_MESSAGE_ERROR, error_domain,
error_code, g_strdup (message), g_strdup (debug), file, function, line);
}
guint64
gst_rs_buffer_get_pts (GstBuffer * buffer)
{
......
Supports Markdown
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