mpegtsmux: add an ATSC subclass

This commit is contained in:
Mathieu Duponchelle 2019-04-25 18:26:27 +02:00 committed by Mathieu Duponchelle
parent 98c98c7c53
commit 80bfa16c95
5 changed files with 122 additions and 22 deletions

44
gst/mpegtsmux/atscmux.c Normal file
View file

@ -0,0 +1,44 @@
/* ATSC Transport Stream muxer
* Copyright (C) 2019 Mathieu Duponchelle <mathieu@centricular.com>
*
* atscmux.c:
*
* 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.
*/
#include "atscmux.h"
GST_DEBUG_CATEGORY (atscmux_debug);
#define GST_CAT_DEFAULT atscmux_debug
G_DEFINE_TYPE (ATSCMux, atscmux, GST_TYPE_MPEG_TSMUX)
static void atscmux_class_init (ATSCMuxClass * klass)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
GST_DEBUG_CATEGORY_INIT (atscmux_debug, "atscmux", 0, "ATSC muxer");
gst_element_class_set_static_metadata (gstelement_class,
"ATSC Transport Stream Muxer", "Codec/Muxer",
"Multiplexes media streams into an ATSC-compliant Transport Stream",
"Mathieu Duponchelle <mathieu@centricular.com>");
}
static void
atscmux_init (ATSCMux * mux)
{
}

46
gst/mpegtsmux/atscmux.h Normal file
View file

@ -0,0 +1,46 @@
/* ATSC Transport Stream muxer
* Copyright (C) 2019 Mathieu Duponchelle <mathieu@centricular.com>
*
* atscmux.h:
*
* 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.
*/
#ifndef __ATSCMUX_H__
#define __ATSCMUX_H__
#include "mpegtsmux.h"
G_BEGIN_DECLS
#define GST_TYPE_ATSCMUX (atscmux_get_type())
typedef struct ATSCMux ATSCMux;
typedef struct ATSCMuxClass ATSCMuxClass;
struct ATSCMux {
MpegTsMux parent;
};
struct ATSCMuxClass {
MpegTsMuxClass parent_class;
};
GType atscmux_get_type (void);
G_END_DECLS
#endif /* __ATSCMUX_H__ */

View file

@ -1,11 +1,13 @@
tsmux_sources = [
'mpegtsmuxplugin.c',
'mpegtsmux.c',
'atscmux.c',
'mpegtsmux_aac.c',
'mpegtsmux_opus.c',
'mpegtsmux_ttxt.c',
'mpegtsmux_jpeg2000.c',
'tsmux/tsmux.c',
'tsmux/tsmuxstream.c',
'tsmux/tsmuxstream.c'
]
gstmpegtsmux = library('gstmpegtsmux',

View file

@ -82,9 +82,6 @@
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
@ -247,6 +244,9 @@ mpegtsmux_class_init (MpegTsMuxClass * klass)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GST_DEBUG_CATEGORY_INIT (mpegtsmux_debug, "mpegtsmux", 0,
"MPEG Transport Stream muxer");
gst_element_class_add_static_pad_template (gstelement_class,
&mpegtsmux_sink_factory);
gst_element_class_add_static_pad_template (gstelement_class,
@ -2063,21 +2063,3 @@ mpegtsmux_send_event (GstElement * element, GstEvent * event)
return FALSE;
}
static gboolean
plugin_init (GstPlugin * plugin)
{
gst_mpegts_initialize ();
if (!gst_element_register (plugin, "mpegtsmux", GST_RANK_PRIMARY,
mpegtsmux_get_type ()))
return FALSE;
GST_DEBUG_CATEGORY_INIT (mpegtsmux_debug, "mpegtsmux", 0,
"MPEG Transport Stream muxer");
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
mpegtsmux, "MPEG-TS muxer",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);

View file

@ -0,0 +1,26 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mpegtsmux.h"
#include "atscmux.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gst_mpegts_initialize ();
if (!gst_element_register (plugin, "mpegtsmux", GST_RANK_PRIMARY,
mpegtsmux_get_type ()))
return FALSE;
if (!gst_element_register (plugin, "atscmux", GST_RANK_PRIMARY,
atscmux_get_type ()))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
mpegtsmux, "MPEG-TS muxer",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);