gst/mpegtsparse/: Remove signals for pat, pmt, nit, eit, sdt. Replace with bus messages.

Original commit message from CVS:
* gst/mpegtsparse/Makefile.am:
* gst/mpegtsparse/mpegtspacketizer.c:
* gst/mpegtsparse/mpegtsparse.c:
Remove signals for pat, pmt, nit, eit, sdt. Replace with bus
messages.
* sys/dvb/dvbbasebin.c:
Instead of attaching to signals, use the bus messages.
Also fix up so the dvbsrc starts only outputting the info tables
like PAT, CAT, NIT, SDT, EIT instead of the whole ts.
This commit is contained in:
Zaheer Abbas Merali 2007-12-03 18:28:32 +00:00
parent e415aeeb4f
commit cef8e5fe60
5 changed files with 85 additions and 70 deletions

View file

@ -1,3 +1,15 @@
2007-12-03 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* gst/mpegtsparse/Makefile.am:
* gst/mpegtsparse/mpegtspacketizer.c:
* gst/mpegtsparse/mpegtsparse.c:
Remove signals for pat, pmt, nit, eit, sdt. Replace with bus
messages.
* sys/dvb/dvbbasebin.c:
Instead of attaching to signals, use the bus messages.
Also fix up so the dvbsrc starts only outputting the info tables
like PAT, CAT, NIT, SDT, EIT instead of the whole ts.
2007-12-03 Edgard Lima <edgard.lima@indt.org.br>
* ext/metadata/gstmetadatamux.c:

View file

@ -3,35 +3,16 @@ plugin_LTLIBRARIES = libgstmpegtsparse.la
libgstmpegtsparse_la_SOURCES = \
mpegtsparse.c \
mpegtspacketizer.c\
mpegtsparsemarshal.c \
flutspatinfo.c \
flutspmtinfo.c \
flutspmtstreaminfo.c
BUILT_SOURCES = \
mpegtsparsemarshal.h \
mpegtsparsemarshal.c
CLEANFILES = $(BUILT_SOURCES)
EXTRA_libgstmpegtsparse_la_SOURCES = \
mpegtsparsemarshal.list
mpegtsparsemarshal.h: mpegtsparsemarshal.list
glib-genmarshal --header --prefix=mpegts_parse_marshal $(srcdir)/mpegtsparsemarshal.list > mpegtsparsemarshal.h.tmp
mv mpegtsparsemarshal.h.tmp mpegtsparsemarshal.h
mpegtsparsemarshal.c: mpegtsparsemarshal.list mpegtsparsemarshal.h
echo "#include \"mpegtsparsemarshal.h\"" >> mpegtsparsemarshal.c.tmp
glib-genmarshal --body --prefix=mpegts_parse_marshal $(srcdir)/mpegtsparsemarshal.list >> mpegtsparsemarshal.c.tmp
mv mpegtsparsemarshal.c.tmp mpegtsparsemarshal.c
libgstmpegtsparse_la_CFLAGS = $(GST_CFLAGS)
libgstmpegtsparse_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS)
libgstmpegtsparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
mpegtsparse.h \
mpegtsparsemarshal.h \
mpegtspacketizer.h \
flutspatinfo.h \
flutspmtinfo.h \

View file

@ -398,7 +398,7 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
program_info_length = GST_READ_UINT16_BE (data) & 0x0FFF;
data += 2;
struct_name = g_strdup_printf ("program-%d", program_number);
struct_name = g_strdup ("pmt");
pmt = gst_structure_new (struct_name,
"program-number", G_TYPE_UINT, program_number,
"pcr-pid", G_TYPE_UINT, pcr_pid,

View file

@ -28,7 +28,6 @@
#include <stdlib.h>
#include "mpegtsparse.h"
#include "mpegtsparsemarshal.h"
GST_DEBUG_CATEGORY_STATIC (mpegts_parse_debug);
#define GST_CAT_DEFAULT mpegts_parse_debug
@ -93,17 +92,6 @@ GST_STATIC_PAD_TEMPLATE ("program_%d", GST_PAD_SRC,
GST_STATIC_CAPS ("video/mpegts, " "systemstream = (boolean) true ")
);
enum
{
SIGNAL_PAT,
SIGNAL_PMT,
SIGNAL_NIT,
SIGNAL_SDT,
SIGNAL_EIT,
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0,
@ -138,8 +126,6 @@ static gboolean mpegts_parse_sink_event (GstPad * pad, GstEvent * event);
static GstStateChangeReturn mpegts_parse_change_state (GstElement * element,
GstStateChange transition);
static guint signals[LAST_SIGNAL] = { 0 };
GST_BOILERPLATE (MpegTSParse, mpegts_parse, GstElement, GST_TYPE_ELEMENT);
static guint32 crc_tab[256] = {
@ -238,27 +224,6 @@ mpegts_parse_class_init (MpegTSParseClass * klass)
g_param_spec_string ("program-numbers",
"Program Numbers",
"Colon separated list of programs", "", G_PARAM_READWRITE));
signals[SIGNAL_PAT] =
g_signal_new ("pat-info", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MpegTSParseClass, pat_info), NULL, NULL,
g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_STRUCTURE);
signals[SIGNAL_PMT] =
g_signal_new ("pmt-info", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MpegTSParseClass, pmt_info), NULL, NULL,
g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_STRUCTURE);
signals[SIGNAL_NIT] =
g_signal_new ("nit-info", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MpegTSParseClass, nit_info), NULL, NULL,
g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_STRUCTURE);
signals[SIGNAL_SDT] =
g_signal_new ("sdt-info", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MpegTSParseClass, sdt_info), NULL, NULL,
g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_STRUCTURE);
signals[SIGNAL_EIT] =
g_signal_new ("eit-info", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (MpegTSParseClass, eit_info), NULL, NULL,
g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_STRUCTURE);
}
static gboolean
@ -808,7 +773,9 @@ mpegts_parse_apply_pat (MpegTSParse * parse, GstStructure * pat_info)
GST_INFO_OBJECT (parse, "PAT %s", dbg);
g_free (dbg);
g_signal_emit (parse, signals[SIGNAL_PAT], 0, pat_info);
gst_element_post_message (GST_ELEMENT_CAST (parse),
gst_message_new_element (GST_OBJECT (parse),
gst_structure_copy (pat_info)));
GST_OBJECT_LOCK (parse);
programs = gst_structure_get_value (pat_info, "programs");
@ -964,28 +931,39 @@ mpegts_parse_apply_pmt (MpegTSParse * parse,
g_free (dbg);
}
g_signal_emit (parse, signals[SIGNAL_PMT], 0, pmt_info);
gst_element_post_message (GST_ELEMENT_CAST (parse),
gst_message_new_element (GST_OBJECT (parse),
gst_structure_copy (pmt_info)));
}
static void
mpegts_parse_apply_nit (MpegTSParse * parse,
guint16 pmt_pid, GstStructure * nit_info)
{
g_signal_emit (parse, signals[SIGNAL_NIT], 0, nit_info);
/*gst_element_post_message(GST_ELEMENT_CAST(parse),
* gst_message_new_element (GST_OBJECT(parse),
* gst_structure_copy(nit_info)));
*/
}
static void
mpegts_parse_apply_sdt (MpegTSParse * parse,
guint16 pmt_pid, GstStructure * sdt_info)
{
g_signal_emit (parse, signals[SIGNAL_SDT], 0, sdt_info);
/*gst_element_post_message(GST_ELEMENT_CAST(parse),
* gst_message_new_element (GST_OBJECT(parse),
* gst_structure_copy(sdt_info)));
*/
}
static void
mpegts_parse_apply_eit (MpegTSParse * parse,
guint16 pmt_pid, GstStructure * eit_info)
{
g_signal_emit (parse, signals[SIGNAL_EIT], 0, eit_info);
/*gst_element_post_message(GST_ELEMENT_CAST(parse),
* gst_message_new_element (GST_OBJECT(parse),
* gst_structure_copy(eit_info)));
*/
}
static gboolean

View file

@ -107,10 +107,11 @@ static gboolean dvb_base_bin_ts_pad_probe_cb (GstPad * pad,
GstBuffer * buf, gpointer user_data);
static GstStateChangeReturn dvb_base_bin_change_state (GstElement * element,
GstStateChange transition);
static void dvb_base_bin_pat_info_cb (GstElement * mpegtsparse,
GstStructure * pat, DvbBaseBin * dvbbasebin);
static void dvb_base_bin_pmt_info_cb (GstElement * mpegtsparse,
GstStructure * pmt, DvbBaseBin * dvbbasebin);
static void dvb_base_bin_handle_message (GstBin * bin, GstMessage * message);
static void dvb_base_bin_pat_info_cb (DvbBaseBin * dvbbasebin,
GstStructure * pat);
static void dvb_base_bin_pmt_info_cb (DvbBaseBin * dvbbasebin,
GstStructure * pmt);
static void dvb_base_bin_pad_added_cb (GstElement * mpegtsparse,
GstPad * pad, DvbBaseBin * dvbbasebin);
static void dvb_base_bin_pad_removed_cb (GstElement * mpegtsparse,
@ -118,6 +119,7 @@ static void dvb_base_bin_pad_removed_cb (GstElement * mpegtsparse,
static GstPad *dvb_base_bin_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name);
static void dvb_base_bin_release_pad (GstElement * element, GstPad * pad);
static void dvb_base_bin_rebuild_filter (DvbBaseBin * dvbbasebin);
static DvbBaseBinStream *
dvb_base_bin_add_stream (DvbBaseBin * dvbbasebin, guint16 pid)
@ -195,6 +197,7 @@ dvb_base_bin_class_init (DvbBaseBinClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *element_class;
GstBinClass *bin_class;
GstElementFactory *dvbsrc_factory;
GObjectClass *dvbsrc_class;
typedef struct
@ -222,6 +225,9 @@ dvb_base_bin_class_init (DvbBaseBinClass * klass)
{0, NULL}
};
bin_class = GST_BIN_CLASS (klass);
bin_class->handle_message = dvb_base_bin_handle_message;
element_class = GST_ELEMENT_CLASS (klass);
element_class->change_state = dvb_base_bin_change_state;
@ -309,9 +315,8 @@ dvb_base_bin_init (DvbBaseBin * dvbbasebin, DvbBaseBinClass * klass)
dvbbasebin->dvbsrc = gst_element_factory_make ("dvbsrc", NULL);
dvbbasebin->buffer_queue = gst_element_factory_make ("queue", NULL);
dvbbasebin->mpegtsparse = gst_element_factory_make ("mpegtsparse", NULL);
g_object_connect (dvbbasebin->mpegtsparse,
"signal::pat-info", dvb_base_bin_pat_info_cb, dvbbasebin,
"signal::pmt-info", dvb_base_bin_pmt_info_cb, dvbbasebin,
"signal::pad-added", dvb_base_bin_pad_added_cb, dvbbasebin,
"signal::pad-removed", dvb_base_bin_pad_removed_cb, dvbbasebin, NULL);
@ -331,6 +336,14 @@ dvb_base_bin_init (DvbBaseBin * dvbbasebin, DvbBaseBinClass * klass)
dvbbasebin->disposed = FALSE;
dvb_base_bin_reset (dvbbasebin);
/* add PAT, CAT, NIT, SDT, EIT to pids filter for dvbsrc */
dvb_base_bin_add_stream (dvbbasebin, 0);
dvb_base_bin_add_stream (dvbbasebin, 1);
dvb_base_bin_add_stream (dvbbasebin, 10);
dvb_base_bin_add_stream (dvbbasebin, 11);
dvb_base_bin_add_stream (dvbbasebin, 12);
dvb_base_bin_rebuild_filter (dvbbasebin);
}
static void
@ -749,8 +762,40 @@ dvb_base_bin_deactivate_program (DvbBaseBin * dvbbasebin,
}
static void
dvb_base_bin_pat_info_cb (GstElement * mpegtsparse,
GstStructure * pat_info, DvbBaseBin * dvbbasebin)
dvb_base_bin_handle_message (GstBin * bin, GstMessage * message)
{
DvbBaseBin *dvbbasebin;
dvbbasebin = GST_DVB_BASE_BIN (bin);
if (message->type == GST_MESSAGE_ELEMENT &&
GST_ELEMENT (message->src) == GST_ELEMENT (dvbbasebin->mpegtsparse)) {
const gchar *structure_name = gst_structure_get_name (message->structure);
if (strcmp (structure_name, "pat") == 0)
dvb_base_bin_pat_info_cb (dvbbasebin, message->structure);
else if (strcmp (structure_name, "pmt") == 0)
dvb_base_bin_pmt_info_cb (dvbbasebin, message->structure);
/*else if (strcmp (structure_name, "nit") == 0)
dvb_base_bin_nit_info_cb (dvbbasebin, message->structure);
else if (strcmp (structure_name, "sdt") == 0)
dvb_base_bin_sdt_info_cb (dvbbasebin, message->structure);
else if (strcmp (structure_name, "eit") == 0)
dvb_base_bin_eit_info_cb (dvbbasebin, message->structure); */
/* forward the message on */
gst_element_post_message (GST_ELEMENT_CAST (bin), message);
} else {
/* chain up */
GST_BIN_CLASS (parent_class)->handle_message (bin, message);
}
}
static void
dvb_base_bin_pat_info_cb (DvbBaseBin * dvbbasebin, GstStructure * pat_info)
{
DvbBaseBinProgram *program;
DvbBaseBinStream *stream;
@ -798,8 +843,7 @@ dvb_base_bin_pat_info_cb (GstElement * mpegtsparse,
}
static void
dvb_base_bin_pmt_info_cb (GstElement * mpegtsparse,
GstStructure * pmt, DvbBaseBin * dvbbasebin)
dvb_base_bin_pmt_info_cb (DvbBaseBin * dvbbasebin, GstStructure * pmt)
{
DvbBaseBinProgram *program;
guint program_number;