tsmux: Fix default new_stream_func

`tsmux_stream_new` is missing the `user_data` parameter and shouldn't be
cast to `TsMuxNewStreamFunc`.

Prefer not casting at all to make sure we don't miss such an issue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5516>
This commit is contained in:
Jan Alexander Steffens (heftig) 2023-10-10 10:22:44 +02:00 committed by GStreamer Marge Bot
parent 2d938d37a6
commit da02db0d95
3 changed files with 13 additions and 8 deletions

View file

@ -61,7 +61,7 @@ static GstStaticPadTemplate gst_atsc_mux_sink_factory =
static void static void
gst_atsc_mux_stream_get_es_descrs (TsMuxStream * stream, gst_atsc_mux_stream_get_es_descrs (TsMuxStream * stream,
GstMpegtsPMTStream * pmt_stream, GstBaseTsMux * mpegtsmux) GstMpegtsPMTStream * pmt_stream, gpointer user_data)
{ {
GstMpegtsDescriptor *descriptor; GstMpegtsDescriptor *descriptor;
@ -130,8 +130,8 @@ gst_atsc_mux_stream_get_es_descrs (TsMuxStream * stream,
} }
static TsMuxStream * static TsMuxStream *
gst_atsc_mux_create_new_stream (guint16 new_pid, gst_atsc_mux_create_new_stream (guint16 new_pid, TsMuxStreamType stream_type,
TsMuxStreamType stream_type, GstBaseTsMux * mpegtsmux) gpointer user_data)
{ {
TsMuxStream *ret = tsmux_stream_new (new_pid, stream_type); TsMuxStream *ret = tsmux_stream_new (new_pid, stream_type);
@ -146,7 +146,7 @@ gst_atsc_mux_create_new_stream (guint16 new_pid,
tsmux_stream_set_get_es_descriptors_func (ret, tsmux_stream_set_get_es_descriptors_func (ret,
(TsMuxStreamGetESDescriptorsFunc) gst_atsc_mux_stream_get_es_descrs, (TsMuxStreamGetESDescriptorsFunc) gst_atsc_mux_stream_get_es_descrs,
mpegtsmux); user_data);
return ret; return ret;
} }
@ -174,8 +174,7 @@ gst_atsc_mux_create_ts_mux (GstBaseTsMux * mpegtsmux)
section = gst_mpegts_section_from_atsc_rrt (rrt); section = gst_mpegts_section_from_atsc_rrt (rrt);
tsmux_add_mpegts_si_section (ret, section); tsmux_add_mpegts_si_section (ret, section);
tsmux_set_new_stream_func (ret, tsmux_set_new_stream_func (ret, gst_atsc_mux_create_new_stream, mpegtsmux);
(TsMuxNewStreamFunc) gst_atsc_mux_create_new_stream, mpegtsmux);
return ret; return ret;
} }

View file

@ -116,6 +116,12 @@ tsmux_section_free (TsMuxSection * section)
g_slice_free (TsMuxSection, section); g_slice_free (TsMuxSection, section);
} }
static TsMuxStream *
tsmux_new_stream_default (guint16 pid, guint stream_type, gpointer user_data)
{
return tsmux_stream_new (pid, stream_type);
}
/** /**
* tsmux_new: * tsmux_new:
* *
@ -150,7 +156,7 @@ tsmux_new (void)
mux->si_sections = g_hash_table_new_full (g_direct_hash, g_direct_equal, mux->si_sections = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) tsmux_section_free); NULL, (GDestroyNotify) tsmux_section_free);
mux->new_stream_func = (TsMuxNewStreamFunc) tsmux_stream_new; mux->new_stream_func = tsmux_new_stream_default;
mux->new_stream_data = NULL; mux->new_stream_data = NULL;
mux->first_pcr_ts = G_MININT64; mux->first_pcr_ts = G_MININT64;

View file

@ -86,7 +86,7 @@ typedef struct TsMux TsMux;
typedef gboolean (*TsMuxWriteFunc) (GstBuffer * buf, void *user_data, gint64 new_pcr); typedef gboolean (*TsMuxWriteFunc) (GstBuffer * buf, void *user_data, gint64 new_pcr);
typedef void (*TsMuxAllocFunc) (GstBuffer ** buf, void *user_data); typedef void (*TsMuxAllocFunc) (GstBuffer ** buf, void *user_data);
typedef TsMuxStream * (*TsMuxNewStreamFunc) (guint16 new_pid, guint stream_type, void *user_data); typedef TsMuxStream * (*TsMuxNewStreamFunc) (guint16 new_pid, guint stream_type, gpointer user_data);
struct TsMuxSection { struct TsMuxSection {
TsMuxPacketInfo pi; TsMuxPacketInfo pi;