* <refsect2>
* <title>Example pipelines</title>
* |[
- * gst-launch v4l2src num-buffers=500 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=video.ogg
+ * gst-launch v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! videoconvert ! theoraenc ! oggmux ! filesink location=video.ogg
* ]| Encodes a video stream captured from a v4l2-compatible camera to Ogg/Theora
* (the encoding will stop automatically after 500 frames)
* </refsect2>
"subtitle/x-kate; application/x-kate")
);
-static void gst_ogg_mux_base_init (gpointer g_class);
-static void gst_ogg_mux_class_init (GstOggMuxClass * klass);
-static void gst_ogg_mux_init (GstOggMux * ogg_mux);
static void gst_ogg_mux_finalize (GObject * object);
static GstFlowReturn
gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux);
static gboolean gst_ogg_mux_handle_src_event (GstPad * pad, GstEvent * event);
static GstPad *gst_ogg_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * name);
+ GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
static void gst_ogg_mux_release_pad (GstElement * element, GstPad * pad);
static void gst_ogg_mux_set_property (GObject * object,
static GstStateChangeReturn gst_ogg_mux_change_state (GstElement * element,
GstStateChange transition);
-static GstElementClass *parent_class = NULL;
-
/*static guint gst_ogg_mux_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_ogg_mux_get_type (void)
-{
- static GType ogg_mux_type = 0;
-
- if (G_UNLIKELY (ogg_mux_type == 0)) {
- static const GTypeInfo ogg_mux_info = {
- sizeof (GstOggMuxClass),
- gst_ogg_mux_base_init,
- NULL,
- (GClassInitFunc) gst_ogg_mux_class_init,
- NULL,
- NULL,
- sizeof (GstOggMux),
- 0,
- (GInstanceInitFunc) gst_ogg_mux_init,
- };
- static const GInterfaceInfo preset_info = {
- NULL,
- NULL,
- NULL
- };
-
- ogg_mux_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstOggMux", &ogg_mux_info,
- 0);
-
- g_type_add_interface_static (ogg_mux_type, GST_TYPE_PRESET, &preset_info);
- }
- return ogg_mux_type;
-}
-
-static void
-gst_ogg_mux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
-
- gst_element_class_set_details_simple (element_class,
- "Ogg muxer", "Codec/Muxer",
- "mux ogg streams (info about ogg: http://xiph.org)",
- "Wim Taymans <wim@fluendo.com>");
-}
+#define gst_ogg_mux_parent_class parent_class
+G_DEFINE_TYPE_WITH_CODE (GstOggMux, gst_ogg_mux, GST_TYPE_ELEMENT,
+ G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
static void
gst_ogg_mux_class_init (GstOggMuxClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_peek_parent (klass);
-
gobject_class->finalize = gst_ogg_mux_finalize;
gobject_class->get_property = gst_ogg_mux_get_property;
gobject_class->set_property = gst_ogg_mux_set_property;
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_factory));
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Ogg muxer", "Codec/Muxer",
+ "mux ogg streams (info about ogg: http://xiph.org)",
+ "Wim Taymans <wim@fluendo.com>");
+
gstelement_class->request_new_pad = gst_ogg_mux_request_new_pad;
gstelement_class->release_pad = gst_ogg_mux_release_pad;
GST_DEBUG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
- case GST_EVENT_NEWSEGMENT:{
- gboolean update;
- gdouble rate;
- gdouble applied_rate;
- GstFormat format;
- gint64 start, stop, position;
+ case GST_EVENT_SEGMENT:
+ {
+ const GstSegment *segment;
- gst_event_parse_new_segment_full (event, &update, &rate,
- &applied_rate, &format, &start, &stop, &position);
+ gst_event_parse_segment (event, &segment);
/* We don't support non time NEWSEGMENT events */
- if (format != GST_FORMAT_TIME) {
+ if (segment->format != GST_FORMAT_TIME) {
gst_event_unref (event);
event = NULL;
break;
}
- gst_segment_set_newsegment_full (&ogg_pad->segment, update, rate,
- applied_rate, format, start, stop, position);
-
+ gst_segment_copy_into (segment, &ogg_pad->segment);
break;
}
case GST_EVENT_FLUSH_STOP:{
static GstPad *
gst_ogg_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * req_name)
+ GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
{
GstOggMux *ogg_mux;
GstPad *newpad;
/* allocate space for header and body */
buffer = gst_buffer_new_and_alloc (page->header_len + page->body_len);
- memcpy (GST_BUFFER_DATA (buffer), page->header, page->header_len);
- memcpy (GST_BUFFER_DATA (buffer) + page->header_len,
- page->body, page->body_len);
+ gst_buffer_fill (buffer, 0, page->header, page->header_len);
+ gst_buffer_fill (buffer, page->header_len, page->body, page->body_len);
/* Here we set granulepos as our OFFSET_END to give easy direct access to
* this value later. Before we push it, we reset this to OFFSET + SIZE
gst_ogg_mux_push_buffer (GstOggMux * mux, GstBuffer * buffer,
GstOggPadData * oggpad)
{
- GstCaps *caps;
-
/* fix up OFFSET and OFFSET_END again */
GST_BUFFER_OFFSET (buffer) = mux->offset;
- mux->offset += GST_BUFFER_SIZE (buffer);
+ mux->offset += gst_buffer_get_size (buffer);
GST_BUFFER_OFFSET_END (buffer) = mux->offset;
/* Ensure we have monotonically increasing timestamps in the output. */
mux->last_ts = run_time;
}
- caps = gst_pad_get_negotiated_caps (mux->srcpad);
- gst_buffer_set_caps (buffer, caps);
- if (caps)
- gst_caps_unref (caps);
-
return gst_pad_push (mux->srcpad, buffer);
}
GstClockTime next_time;
GstClockTimeDiff diff;
ogg_packet packet;
+ gsize size;
/* ensure messing with metadata is ok */
- buf = gst_buffer_make_metadata_writable (buf);
+ buf = gst_buffer_make_writable (buf);
/* convert time to running time, so we need no longer bother about that */
time = GST_BUFFER_TIMESTAMP (buf);
pad->map.granulerate_n <= 0 || pad->map.granulerate_d <= 0)
goto no_granule;
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
+ packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ packet.bytes = size;
duration = gst_ogg_stream_get_packet_duration (&pad->map, &packet);
+ gst_buffer_unmap (buf, packet.packet, size);
/* give up if no duration can be determined, relying on upstream */
if (G_UNLIKELY (duration < 0)) {
/* and we have one */
ogg_packet packet;
gboolean is_header;
+ gsize size;
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
+ packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ packet.bytes = size;
/* if we're not yet in data mode, ensure we're setup on the first packet */
if (!pad->have_type) {
+ GstCaps *caps;
+
/* Use headers in caps, if any; this will allow us to be resilient
* to starting streams on the fly, and some streams (like VP8
* at least) do not send headers packets, as other muxers don't
* expect/need them. */
+ caps = gst_pad_get_current_caps (GST_PAD_CAST (data->pad));
pad->have_type =
- gst_ogg_stream_setup_map_from_caps_headers (&pad->map,
- GST_BUFFER_CAPS (buf));
+ gst_ogg_stream_setup_map_from_caps_headers (&pad->map, caps);
if (!pad->have_type) {
/* fallback on the packet */
}
if (!pad->have_type) {
GST_ERROR_OBJECT (pad, "mapper didn't recognise input stream "
- "(pad caps: %" GST_PTR_FORMAT ")", GST_PAD_CAPS (pad));
+ "(pad caps: %" GST_PTR_FORMAT ")", caps);
} else {
GST_DEBUG_OBJECT (pad, "caps detected: %" GST_PTR_FORMAT,
pad->map.caps);
}
+ if (caps)
+ gst_caps_unref (caps);
}
if (pad->have_type)
else /* fallback (FIXME 0.11: remove IN_CAPS hack) */
is_header = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
+ gst_buffer_unmap (buf, packet.packet, size);
+
if (is_header) {
GST_DEBUG_OBJECT (ogg_mux,
"got header buffer in control state, ignoring");
walk = walk->next;
/* mark buffer */
- GST_LOG ("Setting IN_CAPS on buffer of length %d", GST_BUFFER_SIZE (buf));
+ GST_LOG ("Setting IN_CAPS on buffer of length %d",
+ gst_buffer_get_size (buf));
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_IN_CAPS);
g_value_init (&value, GST_TYPE_BUFFER);
GstCaps *caps;
GstStructure *structure;
GstBuffer *hbuf;
+ gsize size;
pad = (GstOggPadData *) walk->data;
thepad = pad->collect.pad;
}
/* create a packet from the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
+ packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ packet.bytes = size;
packet.granulepos = GST_BUFFER_OFFSET_END (buf);
if (packet.granulepos == -1)
packet.granulepos = 0;
/* swap the packet in */
ogg_stream_packetin (&pad->map.stream, &packet);
+
+ gst_buffer_unmap (buf, packet.packet, size);
gst_buffer_unref (buf);
GST_LOG_OBJECT (thepad, "flushing out BOS page");
GstBuffer *buf = GST_BUFFER (hwalk->data);
ogg_packet packet;
ogg_page page;
+ gsize size;
hwalk = hwalk->next;
/* create a packet from the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
+ packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ packet.bytes = size;
packet.granulepos = GST_BUFFER_OFFSET_END (buf);
if (packet.granulepos == -1)
packet.granulepos = 0;
/* swap the packet in */
ogg_stream_packetin (&pad->map.stream, &packet);
+ gst_buffer_unmap (buf, packet.packet, size);
gst_buffer_unref (buf);
/* if last header, flush page */
/* hbufs holds all buffers for the headers now */
/* create caps with the buffers */
- caps = gst_pad_get_caps (mux->srcpad);
+ caps = gst_pad_get_caps (mux->srcpad, NULL);
if (caps) {
caps = gst_ogg_mux_set_header_on_caps (caps, hbufs);
gst_pad_set_caps (mux->srcpad, caps);
GST_LOG_OBJECT (ogg_mux, "best pad %" GST_PTR_FORMAT
", currently pulling from %" GST_PTR_FORMAT, best->collect.pad,
- ogg_mux->pulling);
+ ogg_mux->pulling ? ogg_mux->pulling->collect.pad : NULL);
+
+ if (ogg_mux->pulling) {
+ next_buf = gst_collect_pads_peek (ogg_mux->collect,
+ &ogg_mux->pulling->collect);
+ if (next_buf) {
+ ogg_mux->pulling->eos = FALSE;
+ gst_buffer_unref (next_buf);
+ } else {
+ GST_DEBUG_OBJECT (ogg_mux->pulling->collect.pad, "setting eos to true");
+ ogg_mux->pulling->eos = TRUE;
+ }
+ }
- next_buf = gst_collect_pads_peek (ogg_mux->collect, &best->collect);
- if (next_buf) {
- best->eos = FALSE;
- gst_buffer_unref (next_buf);
- } else {
- best->eos = TRUE;
+ /* We could end up pushing from the best pad instead, so check that
+ * as well */
+ if (best && best != ogg_mux->pulling) {
+ next_buf = gst_collect_pads_peek (ogg_mux->collect, &best->collect);
+ if (next_buf) {
+ best->eos = FALSE;
+ gst_buffer_unref (next_buf);
+ } else {
+ GST_DEBUG_OBJECT (best->collect.pad, "setting eos to true");
+ best->eos = TRUE;
+ }
}
/* if we were already pulling from one pad, but the new "best" buffer is
GstOggPadData *pad = ogg_mux->pulling;
gint64 duration;
gboolean force_flush;
+ gsize size;
GST_LOG_OBJECT (ogg_mux->pulling->collect.pad, "pulling from pad");
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
}
/* create a packet from the buffer */
- packet.packet = GST_BUFFER_DATA (buf);
- packet.bytes = GST_BUFFER_SIZE (buf);
+ packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ packet.bytes = size;
packet.granulepos = GST_BUFFER_OFFSET_END (buf);
if (packet.granulepos == -1)
packet.granulepos = 0;
GST_GP_CAST (packet.granulepos), (gint64) packet.packetno,
packet.bytes);
- packet.e_o_s = best->eos ? 1 : 0;
+ packet.e_o_s = ogg_mux->pulling->eos ? 1 : 0;
tmpbuf = NULL;
/* we flush when we see a new keyframe */
GST_DEBUG_OBJECT (pad->collect.pad, "swapping in BOS packet");
ogg_stream_packetin (&pad->map.stream, &packet);
+ gst_buffer_unmap (buf, packet.packet, size);
pad->data_pushed = TRUE;
gp_time = GST_BUFFER_OFFSET (pad->buffer);
while (walk) {
GstOggPadData *oggpad = (GstOggPadData *) walk->data;
- GST_DEBUG ("oggpad %p eos %d", oggpad, oggpad->eos);
+ GST_DEBUG_OBJECT (oggpad->collect.pad,
+ "oggpad %p eos %d", oggpad, oggpad->eos);
if (oggpad->eos == FALSE)
return FALSE;
utf8_type_find_have_valid_utf8_at_offset (GstTypeFind * tf, guint64 offset,
GstTypeFindProbability * prob)
{
- guint8 *data;
+ const guint8 *data;
/* randomly decided values */
guint min_size = 16; /* minimum size */
static void
uri_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, BUFFER_SIZE);
+ const guint8 *data = gst_type_find_peek (tf, 0, BUFFER_SIZE);
guint pos = 0;
guint offset = 0;
gboolean strict)
{
gboolean got_xmldec;
- guint8 *data;
+ const guint8 *data;
guint offset = 0;
guint pos = 0;
static gboolean
sdp_check_header (GstTypeFind * tf)
{
- guint8 *data;
+ const guint8 *data;
data = gst_type_find_peek (tf, 0, 5);
if (!data)
static void
html_type_find (GstTypeFind * tf, gpointer unused)
{
- gchar *d, *data;
+ const gchar *d, *data;
- data = (gchar *) gst_type_find_peek (tf, 0, 16);
+ data = (const gchar *) gst_type_find_peek (tf, 0, 16);
if (!data)
return;
} else if (xml_check_first_element (tf, "html", 4, FALSE)) {
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
} else if ((d = memchr (data, '<', 16))) {
- data = (gchar *) gst_type_find_peek (tf, d - data, 6);
+ data = (const gchar *) gst_type_find_peek (tf, d - data, 6);
if (data && g_ascii_strncasecmp (data, "<html>", 6) == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, HTML_CAPS);
}
static void
mid_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
/* http://jedi.ks.uiuc.edu/~johns/links/music/midifile.html */
if (data && data[0] == 'M' && data[1] == 'T' && data[2] == 'h'
static void
mxmf_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = NULL;
+ const guint8 *data = NULL;
/* Search FileId "XMF_" 4 bytes */
data = gst_type_find_peek (tf, 0, 4);
static void
flx_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 134);
+ const guint8 *data = gst_type_find_peek (tf, 0, 134);
if (data) {
/* check magic and the frame type of the first frame */
static void
id3v2_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 10);
+ const guint8 *data = gst_type_find_peek (tf, 0, 10);
if (data && memcmp (data, "ID3", 3) == 0 &&
data[3] != 0xFF && data[4] != 0xFF &&
static void
id3v1_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, -128, 3);
+ const guint8 *data = gst_type_find_peek (tf, -128, 3);
if (data && memcmp (data, "TAG", 3) == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, ID3_CAPS);
static void
apetag_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data;
+ const guint8 *data;
/* APEv1/2 at start of file */
data = gst_type_find_peek (tf, 0, 8);
static void
tta_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 3);
+ const guint8 *data = gst_type_find_peek (tf, 0, 3);
if (data) {
if (memcmp (data, "TTA", 3) == 0) {
mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off,
guint * found_layer, GstTypeFindProbability * found_prob)
{
- guint8 *data = NULL;
- guint8 *data_end = NULL;
+ const guint8 *data = NULL;
+ const guint8 *data_end = NULL;
guint size;
guint64 skipped;
gint last_free_offset = -1;
data_end = data + size;
}
if (*data == 0xFF) {
- guint8 *head_data = NULL;
+ const guint8 *head_data = NULL;
guint layer = 0, bitrate, samplerate, channels;
guint found = 0; /* number of valid headers found */
guint64 offset = skipped;
mp3_type_find (GstTypeFind * tf, gpointer unused)
{
GstTypeFindProbability prob, mid_prob;
- guint8 *data;
+ const guint8 *data;
guint layer, mid_layer;
guint64 length;
static void
musepack_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
GstTypeFindProbability prop = GST_TYPE_FIND_MINIMUM;
gint streamversion = -1;
{
guint64 offset;
guint32 blocksize;
- guint8 *data;
+ const guint8 *data;
data = gst_type_find_peek (tf, 0, 32);
if (!data)
static void
postscript_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 3);
+ const guint8 *data = gst_type_find_peek (tf, 0, 3);
if (!data)
return;
static void
multipart_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data;
- guint8 *x;
+ const guint8 *data;
+ const guint8 *x;
#define MULTIPART_MAX_BOUNDARY_OFFSET 16
data = gst_type_find_peek (tf, 0, MULTIPART_MAX_BOUNDARY_OFFSET);
}
static gboolean
-mpeg_sys_is_valid_pes (GstTypeFind * tf, guint8 * data, guint len,
+mpeg_sys_is_valid_pes (GstTypeFind * tf, const guint8 * data, guint len,
guint * pack_size)
{
guint pes_packet_len;
}
static gboolean
-mpeg_sys_is_valid_sys (GstTypeFind * tf, guint8 * data, guint len,
+mpeg_sys_is_valid_sys (GstTypeFind * tf, const guint8 * data, guint len,
guint * pack_size)
{
guint sys_hdr_len;
static void
mpeg_sys_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data, *data0, *first_sync, *end;
+ const guint8 *data, *data0, *first_sync, *end;
gint mpegversion = 0;
guint pack_headers = 0;
guint pes_headers = 0;
{
/* We always enter this function having found at least one header already */
gint found = 1;
- guint8 *data = NULL;
+ const guint8 *data = NULL;
GST_LOG ("looking for mpeg-ts packets of size %u", packet_size);
while (found < GST_MPEGTS_TYPEFIND_MAX_HEADERS) {
/* TS packet sizes to test: normal, DVHS packet size and
* FEC with 16 or 20 byte codes packet size. */
const gint pack_sizes[] = { 188, 192, 204, 208 };
-
- guint8 *data = NULL;
+ const guint8 *data = NULL;
guint size = 0;
guint64 skipped = 0;
static void
aiff_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data && memcmp (data, "FORM", 4) == 0) {
data += 8;
static void
svx_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data && memcmp (data, "FORM", 4) == 0) {
data += 8;
static void
shn_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data && memcmp (data, "ajkg", 4) == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, SHN_CAPS);
static void
ape_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data && memcmp (data, "MAC ", 4) == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 10, APE_CAPS);
static void
m4a_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 4, 8);
+ const guint8 *data = gst_type_find_peek (tf, 4, 8);
if (data && (memcmp (data, "ftypM4A ", 8) == 0)) {
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, M4A_CAPS);
const gchar *profile;
guint32 ftyp_size = 0;
gint offset = 0;
- guint8 *data = NULL;
+ const guint8 *data = NULL;
if ((data = gst_type_find_peek (tf, 0, 12)) == NULL) {
return;
static void
jp2_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data;
+ const guint8 *data;
data = gst_type_find_peek (tf, 0, 24);
if (!data)
static void
qt_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data;
+ const guint8 *data;
guint tip = 0;
guint64 offset = 0;
guint64 size;
}
}
if (size == 1) {
- guint8 *sizedata;
+ const guint8 *sizedata;
sizedata = gst_type_find_peek (tf, offset + 8, 8);
if (sizedata == NULL)
static void
mod_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data;
+ const guint8 *data;
/* MOD */
if ((data = gst_type_find_peek (tf, 1080, 4)) != NULL) {
}
/* DSM */
if (memcmp (data, "RIFF", 4) == 0) {
- guint8 *data2 = gst_type_find_peek (tf, 8, 4);
+ const guint8 *data2 = gst_type_find_peek (tf, 8, 4);
if (data2) {
if (memcmp (data2, "DSMF", 4) == 0) {
}
/* FAM */
if (memcmp (data, "FAM\xFE", 4) == 0) {
- guint8 *data2 = gst_type_find_peek (tf, 44, 3);
+ const guint8 *data2 = gst_type_find_peek (tf, 44, 3);
if (data2) {
if (memcmp (data2, "compare", 3) == 0) {
}
/* GDM */
if (memcmp (data, "GDM\xFE", 4) == 0) {
- guint8 *data2 = gst_type_find_peek (tf, 71, 4);
+ const guint8 *data2 = gst_type_find_peek (tf, 71, 4);
if (data2) {
if (memcmp (data2, "GMFS", 4) == 0) {
if ((data = gst_type_find_peek (tf, 20, 8)) != NULL) {
if (g_ascii_strncasecmp ((gchar *) data, "!Scream!", 8) == 0 ||
g_ascii_strncasecmp ((gchar *) data, "BMOD2STM", 8) == 0) {
- guint8 *id, *stmtype;
+ const guint8 *id, *stmtype;
if ((id = gst_type_find_peek (tf, 28, 1)) == NULL)
return;
static void
swf_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data && (data[0] == 'F' || data[0] == 'C') &&
data[1] == 'W' && data[2] == 'S') {
static void
tiff_type_find (GstTypeFind * tf, gpointer ununsed)
{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
+ const guint8 *data = gst_type_find_peek (tf, 0, 8);
guint8 le_header[4] = { 0x49, 0x49, 0x2A, 0x00 };
guint8 be_header[4] = { 0x4D, 0x4D, 0x00, 0x2A };
static void
sds_type_find (GstTypeFind * tf, gpointer ununsed)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
guint8 mask[4] = { 0xFF, 0xFF, 0x80, 0xFF };
guint8 match[4] = { 0xF0, 0x7E, 0, 0x01 };
gint x;
static void
ircam_type_find (GstTypeFind * tf, gpointer ununsed)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
guint8 mask[4] = { 0xFF, 0xFF, 0xF8, 0xFF };
guint8 match[4] = { 0x64, 0xA3, 0x00, 0x00 };
gint x;
ebml_check_header (GstTypeFind * tf, const gchar * doctype, int doctype_len)
{
/* 4 bytes for EBML ID, 1 byte for header length identifier */
- guint8 *data = gst_type_find_peek (tf, 0, 4 + 1);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4 + 1);
gint len_mask = 0x80, size = 1, n = 1, total;
if (!data)
static void
dv_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data;
+ const guint8 *data;
data = gst_type_find_peek (tf, 0, 5);
static void
ogganx_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if ((data != NULL) && (memcmp (data, "OggS", 4) == 0)) {
static void
vorbis_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 30);
+ const guint8 *data = gst_type_find_peek (tf, 0, 30);
if (data) {
guint blocksize_0;
static void
theora_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 7); //42);
+ const guint8 *data = gst_type_find_peek (tf, 0, 7); //42);
if (data) {
if (data[0] != 0x80)
static void
kate_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 64);
+ const guint8 *data = gst_type_find_peek (tf, 0, 64);
gchar category[16] = { 0, };
if (G_UNLIKELY (data == NULL))
static void
ogmvideo_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 9);
+ const guint8 *data = gst_type_find_peek (tf, 0, 9);
if (data) {
if (memcmp (data, "\001video\000\000\000", 9) != 0)
static void
ogmaudio_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 9);
+ const guint8 *data = gst_type_find_peek (tf, 0, 9);
if (data) {
if (memcmp (data, "\001audio\000\000\000", 9) != 0)
static void
ogmtext_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 9);
+ const guint8 *data = gst_type_find_peek (tf, 0, 9);
if (data) {
if (memcmp (data, "\001text\000\000\000\000", 9) != 0)
static void
speex_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 80);
+ const guint8 *data = gst_type_find_peek (tf, 0, 80);
if (data) {
/* 8 byte string "Speex "
static void
celt_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
+ const guint8 *data = gst_type_find_peek (tf, 0, 8);
if (data) {
/* 8 byte string "CELT " */
static void
oggskel_type_find (GstTypeFind * tf, gpointer private)
{
- guint8 *data = gst_type_find_peek (tf, 0, 12);
+ const guint8 *data = gst_type_find_peek (tf, 0, 12);
if (data) {
/* 8 byte string "fishead\0" for the ogg skeleton stream */
cmml_type_find (GstTypeFind * tf, gpointer private)
{
/* Header is 12 bytes minimum (though we don't check the minor version */
- guint8 *data = gst_type_find_peek (tf, 0, 12);
+ const guint8 *data = gst_type_find_peek (tf, 0, 12);
if (data) {
static void
tar_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 257, 8);
+ const guint8 *data = gst_type_find_peek (tf, 257, 8);
/* of course we are not certain, but we don't want other typefind funcs
* to detect formats of files within the tar archive, e.g. mp3s */
static void
ar_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 24);
+ const guint8 *data = gst_type_find_peek (tf, 0, 24);
if (data && memcmp (data, "!<arch>", 7) == 0) {
gint i;
static void
au_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data) {
if (memcmp (data, ".snd", 4) == 0 || memcmp (data, "dns.", 4) == 0) {
static void
nuv_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 11);
+ const guint8 *data = gst_type_find_peek (tf, 0, 11);
if (data) {
if (memcmp (data, "MythTVVideo", 11) == 0
static void
paris_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 4);
+ const guint8 *data = gst_type_find_peek (tf, 0, 4);
if (data) {
if (memcmp (data, " paf", 4) == 0 || memcmp (data, "fap ", 4) == 0) {
static void
ilbc_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
+ const guint8 *data = gst_type_find_peek (tf, 0, 8);
if (data) {
if (memcmp (data, "#!iLBC30", 8) == 0 || memcmp (data, "#!iLBC20", 8) == 0) {
static void
msdos_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 64);
+ const guint8 *data = gst_type_find_peek (tf, 0, 64);
if (data && data[0] == 'M' && data[1] == 'Z' &&
GST_READ_UINT16_LE (data + 8) == 4) {
0xcf, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
};
- guint8 *data;
+ const guint8 *data;
data = gst_type_find_peek (tf, 0, 2 + 2 + 4 + 2 + 2 + 16);
if (data && data[0] == 0x24 && data[1] == 0x48 &&
static void
dirac_type_find (GstTypeFind * tf, gpointer unused)
{
- guint8 *data = gst_type_find_peek (tf, 0, 8);
+ const guint8 *data = gst_type_find_peek (tf, 0, 8);
if (data) {
if (memcmp (data, "BBCD", 4) == 0 || memcmp (data, "KW-DIRAC", 8) == 0) {
static const guint8 vivo_marker[] = { 'V', 'e', 'r', 's', 'i', 'o', 'n',
':', 'V', 'i', 'v', 'o', '/'
};
- guint8 *data;
+ const guint8 *data;
guint hdr_len, pos;
data = gst_type_find_peek (tf, 0, 1024);
gchar *mimetype;
gsize length = 16384;
guint64 tf_length;
- guint8 *data;
+ const guint8 *data;
gchar *tmp;
if ((tf_length = gst_type_find_get_length (find)) > 0)
static void
windows_icon_typefind (GstTypeFind * find, gpointer user_data)
{
- guint8 *data;
+ const guint8 *data;
gint64 datalen;
guint16 type, nimages;
gint32 size, offset;
static void
wbmp_typefind (GstTypeFind * find, gpointer user_data)
{
- guint8 *data;
+ const guint8 *data;
gint64 datalen;
guint w, h, size;
if (resolution <= 2) {
data = gst_type_find_peek (tf, len - 16, 8);
if (G_UNLIKELY (data == NULL))
- return;
+ return;
for (n = 0; n < 4; n++) {
if (GST_READ_UINT16_BE (data + n * 2) > 2)
return;
if ((resolution & 0x8000) && (resolution & 0x7fff) <= 2) {
data = gst_type_find_peek (tf, len - 16, 8);
if (G_UNLIKELY (data == NULL))
- return;
+ return;
for (n = 0; n < 4; n++) {
if (GST_READ_UINT16_BE (data + n * 2) > 2)
return;
start_with_type_find (GstTypeFind * tf, gpointer private)
{
GstTypeFindData *start_with = (GstTypeFindData *) private;
- guint8 *data;
+ const guint8 *data;
GST_LOG ("trying to find mime type %s with the first %u bytes of data",
gst_structure_get_name (gst_caps_get_structure (start_with->caps, 0)),
riff_type_find (GstTypeFind * tf, gpointer private)
{
GstTypeFindData *riff_data = (GstTypeFindData *) private;
- guint8 *data = gst_type_find_peek (tf, 0, 12);
+ const guint8 *data = gst_type_find_peek (tf, 0, 12);
if (data && (memcmp (data, "RIFF", 4) == 0 || memcmp (data, "AVF0", 4) == 0)) {
data += 8;
TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-vgm",
GST_RANK_SECONDARY, vgm_exts, "Vgm\x20", 4, GST_TYPE_FIND_MAXIMUM);
TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-sap",
- GST_RANK_SECONDARY, sap_exts, "SAP\x0d\x0aAUTHOR\x20", 12,
+ GST_RANK_SECONDARY, sap_exts, "SAP\x0d\x0a" "AUTHOR\x20", 12,
GST_TYPE_FIND_MAXIMUM);
TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-ivf", GST_RANK_SECONDARY,
ivf_exts, "DKIF", 4, GST_TYPE_FIND_NEARLY_CERTAIN);