Swap the `need_process` boolean check on qtdemux streams
for a direct function pointer to the splitting function,
so we can stop adding extra cases to the single growing
`gst_qtdemux_process_buffer()` function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1182>
stream->discont = TRUE;
/* we enable clipping for raw audio/video streams */
stream->need_clip = FALSE;
stream->discont = TRUE;
/* we enable clipping for raw audio/video streams */
stream->need_clip = FALSE;
- stream->need_process = FALSE;
+ stream->process_func = NULL;
stream->segment_index = -1;
stream->time_position = 0;
stream->sample_index = -1;
stream->segment_index = -1;
stream->time_position = 0;
stream->sample_index = -1;
/* we're going to modify the metadata */
buf = gst_buffer_make_writable (buf);
/* we're going to modify the metadata */
buf = gst_buffer_make_writable (buf);
- if (G_UNLIKELY (stream->need_process))
- buf = gst_qtdemux_process_buffer (qtdemux, stream, buf);
+ if (G_UNLIKELY (stream->process_func))
+ buf = stream->process_func (qtdemux, stream, buf);
case FOURCC_mp4s:
_codec ("DVD subtitle");
caps = gst_caps_new_empty_simple ("subpicture/x-dvd");
case FOURCC_mp4s:
_codec ("DVD subtitle");
caps = gst_caps_new_empty_simple ("subpicture/x-dvd");
- stream->need_process = TRUE;
+ stream->process_func = gst_qtdemux_process_buffer;
break;
case FOURCC_text:
_codec ("Quicktime timed text");
break;
case FOURCC_text:
_codec ("Quicktime timed text");
caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING,
"utf8", NULL);
/* actual text piece needs to be extracted */
caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING,
"utf8", NULL);
/* actual text piece needs to be extracted */
- stream->need_process = TRUE;
+ stream->process_func = gst_qtdemux_process_buffer;
break;
case FOURCC_stpp:
_codec ("XML subtitles");
break;
case FOURCC_stpp:
_codec ("XML subtitles");
caps =
gst_caps_new_simple ("closedcaption/x-cea-608", "format",
G_TYPE_STRING, "s334-1a", NULL);
caps =
gst_caps_new_simple ("closedcaption/x-cea-608", "format",
G_TYPE_STRING, "s334-1a", NULL);
- stream->need_process = TRUE;
+ stream->process_func = gst_qtdemux_process_buffer;
stream->need_split = TRUE;
break;
case FOURCC_c708:
stream->need_split = TRUE;
break;
case FOURCC_c708:
caps =
gst_caps_new_simple ("closedcaption/x-cea-708", "format",
G_TYPE_STRING, "cdp", NULL);
caps =
gst_caps_new_simple ("closedcaption/x-cea-708", "format",
G_TYPE_STRING, "cdp", NULL);
- stream->need_process = TRUE;
+ stream->process_func = gst_qtdemux_process_buffer;
typedef struct _QtDemuxRandomAccessEntry QtDemuxRandomAccessEntry;
typedef struct _QtDemuxStreamStsdEntry QtDemuxStreamStsdEntry;
typedef struct _QtDemuxRandomAccessEntry QtDemuxRandomAccessEntry;
typedef struct _QtDemuxStreamStsdEntry QtDemuxStreamStsdEntry;
+typedef GstBuffer * (*QtDemuxProcessFunc)(GstQTDemux * qtdemux, QtDemuxStream * stream, GstBuffer * buf);
+
enum QtDemuxState
{
QTDEMUX_STATE_INITIAL, /* Initial state (haven't got the header yet) */
enum QtDemuxState
{
QTDEMUX_STATE_INITIAL, /* Initial state (haven't got the header yet) */
* data */
gboolean need_clip;
* data */
gboolean need_clip;
- /* buffer needs some custom processing, e.g. subtitles */
- gboolean need_process;
+ /* If the buffer needs some custom processing, e.g. subtitles, pass them
+ * through this function */
+ QtDemuxProcessFunc process_func;
+
/* buffer needs potentially be split, e.g. CEA608 subtitles */
gboolean need_split;
/* buffer needs potentially be split, e.g. CEA608 subtitles */
gboolean need_split;