mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-29 23:32:33 +00:00
isomp4: Use a function pointer for buffer splitting.
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>
This commit is contained in:
parent
df403df2ca
commit
c47c6b4c2b
2 changed files with 13 additions and 9 deletions
|
@ -1849,7 +1849,7 @@ _create_stream (GstQTDemux * demux, guint32 track_id)
|
|||
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;
|
||||
|
@ -6044,8 +6044,8 @@ gst_qtdemux_decorate_and_push_buffer (GstQTDemux * qtdemux,
|
|||
/* 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);
|
||||
|
||||
if (!buf) {
|
||||
goto exit;
|
||||
|
@ -14947,7 +14947,7 @@ qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
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");
|
||||
|
@ -14958,7 +14958,7 @@ qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
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");
|
||||
|
@ -14969,7 +14969,7 @@ qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
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:
|
||||
|
@ -14977,7 +14977,7 @@ qtdemux_sub_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
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;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -55,6 +55,8 @@ typedef struct _QtDemuxSegment QtDemuxSegment;
|
|||
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) */
|
||||
|
@ -391,8 +393,10 @@ struct _QtDemuxStream
|
|||
* 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue