2008-08-02 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * gst/matroska/ebml-read.c: (gst_ebml_read_class_init),
+ (gst_ebml_read_change_state), (gst_ebml_read_element_level_up),
+ (gst_ebml_read_peek_bytes), (gst_ebml_read_element_id),
+ (gst_ebml_read_element_length), (gst_ebml_peek_id),
+ (gst_ebml_read_get_length), (gst_ebml_read_skip),
+ (gst_ebml_read_buffer), (gst_ebml_read_bytes),
+ (gst_ebml_read_uint), (gst_ebml_read_sint), (_ext2dbl),
+ (gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_date),
+ (gst_ebml_read_master), (gst_ebml_read_binary),
+ (gst_ebml_read_header):
+ * gst/matroska/ebml-write.c: (gst_ebml_write_element_id),
+ (gst_ebml_write_element_size), (gst_ebml_write_uint),
+ (gst_ebml_write_sint), (gst_ebml_write_ascii),
+ (gst_ebml_write_master_start), (gst_ebml_write_master_finish),
+ (gst_ebml_replace_uint):
+ * gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
+ (gst_matroska_demux_read_track_encoding),
+ (gst_matroska_demux_read_track_encodings),
+ (gst_matroska_demux_add_stream), (gst_matroskademux_do_index_seek),
+ (gst_matroska_demux_send_event),
+ (gst_matroska_demux_element_send_event),
+ (gst_matroska_demux_handle_seek_event),
+ (gst_matroska_demux_handle_src_event),
+ (gst_matroska_demux_init_stream),
+ (gst_matroska_demux_parse_tracks),
+ (gst_matroska_demux_parse_index_cuetrack),
+ (gst_matroska_demux_parse_index_pointentry),
+ (gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
+ (gst_matroska_demux_parse_metadata_id_simple_tag),
+ (gst_matroska_demux_parse_metadata_id_tag),
+ (gst_matroska_demux_parse_metadata),
+ (gst_matroska_demux_parse_attached_file),
+ (gst_matroska_demux_parse_attachments),
+ (gst_matroska_demux_parse_chapters), (gst_matroska_ebmlnum_uint),
+ (gst_matroska_ebmlnum_sint), (gst_matroska_demux_push_hdr_buf),
+ (gst_matroska_demux_push_flac_codec_priv_data),
+ (gst_matroska_demux_push_xiph_codec_priv_data),
+ (gst_matroska_demux_push_dvd_clut_change_event),
+ (gst_matroska_demux_add_mpeg_seq_header),
+ (gst_matroska_demux_add_wvpk_header),
+ (gst_matroska_demux_check_subtitle_buffer),
+ (gst_matroska_decode_buffer),
+ (gst_matroska_demux_parse_blockgroup_or_simpleblock),
+ (gst_matroska_demux_parse_cluster),
+ (gst_matroska_demux_parse_contents_seekentry),
+ (gst_matroska_demux_parse_contents),
+ (gst_matroska_demux_loop_stream_parse_id),
+ (gst_matroska_demux_loop_stream), (gst_matroska_demux_loop),
+ (gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
+ (gst_matroska_demux_subtitle_caps),
+ (gst_matroska_demux_change_state):
+ * gst/matroska/matroska-ids.c:
+ * gst/matroska/matroska-mux.c: (gst_matroska_mux_class_init),
+ (gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
+ (gst_matroska_mux_video_pad_setcaps),
+ (xiph3_streamheader_to_codecdata),
+ (vorbis_streamheader_to_codecdata),
+ (theora_streamheader_to_codecdata),
+ (gst_matroska_mux_audio_pad_setcaps),
+ (gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
+ (gst_matroska_mux_track_header), (gst_matroska_mux_start),
+ (gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
+ (gst_matroska_mux_best_pad), (gst_matroska_mux_write_data),
+ (gst_matroska_mux_collected), (gst_matroska_mux_change_state):
+ Fix indention everywhere. A broken indent version has added newlines
+ after every single declaration some time ago.
+
+2008-08-02 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_loop_stream_parse_id):
If no Tracks are found error out instead of trying it again until the
gst_ebml_read_class_init (GstEbmlReadClass * klass)
{
GstElementClass *gstelement_class = (GstElementClass *) klass;
-
GObjectClass *gobject_class = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gst_ebml_read_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret;
-
GstEbmlRead *ebml = GST_EBML_READ (element);
switch (transition) {
gst_ebml_read_element_level_up (GstEbmlRead * ebml)
{
guint num = 0;
-
guint64 pos = ebml->offset;
while (ebml->level != NULL) {
* We do it mainly to avoid pulling buffers of 1 byte all the time */
if (ebml->cached_buffer) {
guint64 cache_offset = GST_BUFFER_OFFSET (ebml->cached_buffer);
-
guint cache_size = GST_BUFFER_SIZE (ebml->cached_buffer);
if (cache_offset <= ebml->offset &&
gst_ebml_read_element_id (GstEbmlRead * ebml, guint32 * id, guint * level_up)
{
guint8 *buf;
-
gint len_mask = 0x80, read = 1, n = 1;
-
guint32 total;
-
guint8 b;
-
GstFlowReturn ret;
ret = gst_ebml_read_peek_bytes (ebml, 1, NULL, &buf);
gint * rread)
{
GstFlowReturn ret;
-
guint8 *buf;
-
gint len_mask = 0x80, read = 1, n = 1, num_ffs = 0;
-
guint64 total;
-
guint8 b;
ret = gst_ebml_read_peek_bytes (ebml, 1, NULL, &buf);
gst_ebml_peek_id (GstEbmlRead * ebml, guint * level_up, guint32 * id)
{
guint64 off;
-
guint level_up_tmp = 0;
-
GstFlowReturn ret;
g_assert (level_up);
gst_ebml_read_get_length (GstEbmlRead * ebml)
{
GstFormat fmt = GST_FORMAT_BYTES;
-
gint64 end;
/* FIXME: what to do if we don't get the upstream length */
gst_ebml_read_skip (GstEbmlRead * ebml)
{
guint64 length;
-
guint32 id;
-
GstFlowReturn ret;
ret = gst_ebml_read_element_id (ebml, &id, NULL);
gst_ebml_read_buffer (GstEbmlRead * ebml, guint32 * id, GstBuffer ** buf)
{
guint64 length;
-
GstFlowReturn ret;
ret = gst_ebml_read_element_id (ebml, id, NULL);
guint * size)
{
guint64 length;
-
GstFlowReturn ret;
*size = 0;
gst_ebml_read_uint (GstEbmlRead * ebml, guint32 * id, guint64 * num)
{
guint8 *data;
-
guint size;
-
GstFlowReturn ret;
ret = gst_ebml_read_bytes (ebml, id, &data, &size);
gst_ebml_read_sint (GstEbmlRead * ebml, guint32 * id, gint64 * num)
{
guint8 *data;
-
guint size;
-
gboolean negative = 0;
-
GstFlowReturn ret;
ret = gst_ebml_read_bytes (ebml, id, &data, &size);
_ext2dbl (guint8 * data)
{
struct _ext_float ext;
-
guint64 m = 0;
-
gint e, i;
memcpy (&ext.exponent, data, 2);
gst_ebml_read_float (GstEbmlRead * ebml, guint32 * id, gdouble * num)
{
guint8 *data;
-
guint size;
-
GstFlowReturn ret;
ret = gst_ebml_read_bytes (ebml, id, &data, &size);
gst_ebml_read_ascii (GstEbmlRead * ebml, guint32 * id, gchar ** str)
{
guint8 *data;
-
guint size;
-
GstFlowReturn ret;
ret = gst_ebml_read_bytes (ebml, id, &data, &size);
gst_ebml_read_date (GstEbmlRead * ebml, guint32 * id, gint64 * date)
{
gint64 ebml_date;
-
GstFlowReturn ret;
ret = gst_ebml_read_sint (ebml, id, &ebml_date);
gst_ebml_read_master (GstEbmlRead * ebml, guint32 * id)
{
GstEbmlLevel *level;
-
guint64 length;
-
GstFlowReturn ret;
ret = gst_ebml_read_element_id (ebml, id, NULL);
guint32 * id, guint8 ** binary, guint64 * length)
{
guint8 *data;
-
guint size;
-
GstFlowReturn ret;
ret = gst_ebml_read_bytes (ebml, id, &data, &size);
{
/* this function is the first to be called */
guint32 id;
-
guint level_up;
-
GstFlowReturn ret;
/* default init */
gst_ebml_write_element_id (GstBuffer * buf, guint32 id)
{
guint8 *data = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
-
guint bytes = 4, mask = 0x10;
/* get ID length */
gst_ebml_write_element_size (GstBuffer * buf, guint64 size)
{
guint8 *data = GST_BUFFER_DATA (buf) + GST_BUFFER_SIZE (buf);
-
guint bytes = 1, mask = 0x80;
if (size != GST_EBML_SIZE_UNKNOWN) {
gst_ebml_write_uint (GstEbmlWrite * ebml, guint32 id, guint64 num)
{
GstBuffer *buf = gst_ebml_write_element_new (ebml, sizeof (num));
-
guint size = gst_ebml_write_get_uint_size (num);
/* write */
* have a number (-)0x8000 (G_MINSHORT), then my abs()<<1
* will be 0x10000; this is G_MAXUSHORT+1! So: if (<0) -1. */
guint64 unum = (num < 0 ? (-num - 1) << 1 : num << 1);
-
guint size = gst_ebml_write_get_uint_size (unum);
/* make unsigned */
gst_ebml_write_ascii (GstEbmlWrite * ebml, guint32 id, const gchar * str)
{
gint len = strlen (str) + 1; /* add trailing '\0' */
-
GstBuffer *buf = gst_ebml_write_element_new (ebml, len);
gst_ebml_write_element_id (buf, id);
gst_ebml_write_master_start (GstEbmlWrite * ebml, guint32 id)
{
guint64 pos = ebml->pos, t;
-
GstBuffer *buf = gst_ebml_write_element_new (ebml, 0);
t = GST_BUFFER_SIZE (buf);
gst_ebml_write_master_finish (GstEbmlWrite * ebml, guint64 startpos)
{
guint64 pos = ebml->pos;
-
GstBuffer *buf;
gst_ebml_write_seek (ebml, startpos);
gst_ebml_replace_uint (GstEbmlWrite * ebml, guint64 pos, guint64 num)
{
guint64 oldpos = ebml->pos;
-
GstBuffer *buf = gst_buffer_new_and_alloc (8);
gst_ebml_write_seek (ebml, pos);
static gboolean gst_matroska_demux_element_send_event (GstElement * element,
GstEvent * event);
-
static gboolean gst_matroska_demux_element_query (GstElement * element,
GstQuery * query);
gst_matroska_demux_reset (GstElement * element)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
-
guint i;
GST_DEBUG_OBJECT (demux, "Resetting state");
{
GstMatroskaTrackEncoding enc = { 0, };
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret;
-
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "ContentEncoding");
}
case GST_MATROSKA_ID_CONTENTCOMPSETTINGS:{
guint8 *data;
-
guint64 size;
-
if ((ret =
gst_ebml_read_binary (ebml, &id, &data,
&size)) != GST_FLOW_OK) {
GstMatroskaTrackContext * context)
{
GstFlowReturn ret;
-
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "ContentEncodings");
gst_matroska_demux_add_stream (GstMatroskaDemux * demux)
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (demux);
-
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstMatroskaTrackContext *context;
-
GstPadTemplate *templ = NULL;
-
GstCaps *caps = NULL;
-
gchar *padname = NULL;
-
GstFlowReturn ret;
-
guint32 id;
-
GstTagList *list = NULL;
-
gchar *codec = NULL;
if (demux->num_streams >= GST_MATROSKA_DEMUX_MAX_STREAMS) {
/* colourspace (only matters for raw video) fourcc */
case GST_MATROSKA_ID_VIDEOCOLOURSPACE:{
guint8 *data;
-
guint64 datalen;
if ((ret =
/* codec private data */
case GST_MATROSKA_ID_CODECPRIVATE:{
guint8 *data;
-
guint64 size;
if ((ret =
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
GstMatroskaTrackVideoContext *videocontext =
(GstMatroskaTrackVideoContext *) context;
+
padname = g_strdup_printf ("video_%02d", demux->num_v_streams++);
templ = gst_element_class_get_pad_template (klass, "video_%02d");
caps = gst_matroska_demux_video_caps (videocontext,
case GST_MATROSKA_TRACK_TYPE_AUDIO:{
GstMatroskaTrackAudioContext *audiocontext =
(GstMatroskaTrackAudioContext *) context;
+
padname = g_strdup_printf ("audio_%02d", demux->num_a_streams++);
templ = gst_element_class_get_pad_template (klass, "audio_%02d");
caps = gst_matroska_demux_audio_caps (audiocontext,
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:{
GstMatroskaTrackSubtitleContext *subtitlecontext =
(GstMatroskaTrackSubtitleContext *) context;
+
padname = g_strdup_printf ("subtitle_%02d", demux->num_t_streams++);
templ = gst_element_class_get_pad_template (klass, "subtitle_%02d");
caps = gst_matroska_demux_subtitle_caps (subtitlecontext,
gint64 segment_stop, gboolean keyunit)
{
GstMatroskaIndex *entry = NULL;
-
guint n;
if (!demux->index || !demux->index->len)
*/
if (entry && n < demux->index->len) {
GstMatroskaIndex *index;
-
GstClockTimeDiff d_this, d_entry;
index = &g_array_index (demux->index, GstMatroskaIndex, n);
gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
{
gboolean ret = TRUE;
-
gint i;
g_return_val_if_fail (event != NULL, FALSE);
gst_matroska_demux_element_send_event (GstElement * element, GstEvent * event)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
-
gboolean res;
g_return_val_if_fail (event != NULL, FALSE);
GstEvent * event)
{
GstMatroskaIndex *entry;
-
GstSeekFlags flags;
-
GstSeekType cur_type, stop_type;
-
GstFormat format;
-
GstEvent *newsegment_event;
-
gboolean flush, keyunit;
-
gdouble rate;
-
gint64 cur, stop;
-
gint64 segment_start, segment_stop;
-
gint i;
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
gst_matroska_demux_handle_src_event (GstPad * pad, GstEvent * event)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (gst_pad_get_parent (pad));
-
gboolean res = TRUE;
switch (GST_EVENT_TYPE (event)) {
gst_matroska_demux_init_stream (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
gchar *doctype;
-
guint version;
-
GstFlowReturn ret;
GST_DEBUG_OBJECT (demux, "Init stream");
gst_matroska_demux_parse_tracks (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
-
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "Tracks");
guint * nentries)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret;
-
GstMatroskaIndex idx;
idx.pos = (guint64) - 1;
gst_matroska_demux_parse_index_pointentry (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret;
-
GstClockTime time = GST_CLOCK_TIME_NONE;
-
guint nentries = 0;
DEBUG_ELEMENT_START (demux, ebml, "CuePoint");
gst_matroska_demux_parse_index (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret = GST_FLOW_OK;
if (demux->index)
gst_matroska_demux_parse_info (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
-
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "SegmentInfo");
case GST_MATROSKA_ID_DURATION:{
gdouble num;
-
GstClockTime dur;
if ((ret = gst_ebml_read_float (ebml, &id, &num)) != GST_FLOW_OK)
GST_MATROSKA_TAG_ID_GENRE, GST_TAG_GENRE}
};
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret;
-
guint32 id;
-
gchar *value = NULL;
-
gchar *tag = NULL;
DEBUG_ELEMENT_START (demux, ebml, "SimpleTag");
GstTagList ** p_taglist)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret;
DEBUG_ELEMENT_START (demux, ebml, "Tag");
gst_matroska_demux_parse_metadata (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstTagList *taglist;
-
GstFlowReturn ret = GST_FLOW_OK;
-
guint32 id;
-
GList *l;
-
GstEbmlLevel *curlevel;
/* Can't be NULL at this point */
GstTagList * taglist)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret;
-
gchar *description = NULL;
-
gchar *filename = NULL;
-
gchar *mimetype = NULL;
-
guint8 *data = NULL;
-
guint64 datalen = 0;
DEBUG_ELEMENT_START (demux, ebml, "AttachedFile");
break;
default:
- GST_WARNING ("Unknown AttachedFile subelement 0x%x - ignoring", id);
+ GST_WARNING_OBJECT (demux,
+ "Unknown AttachedFile subelement 0x%x - ignoring", id);
/* fall through */
case GST_MATROSKA_ID_FILEUID:
ret = gst_ebml_read_skip (ebml);
if (filename && mimetype && data && datalen > 0) {
GstTagImageType image_type = GST_TAG_IMAGE_TYPE_NONE;
-
GstBuffer *tagbuffer = NULL;
-
GstCaps *caps;
-
gchar *filename_lc = g_utf8_strdown (filename, -1);
GST_DEBUG_OBJECT (demux, "Creating tag for attachment with filename '%s', "
gst_matroska_demux_parse_attachments (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret = GST_FLOW_OK;
-
GstTagList *taglist;
DEBUG_ELEMENT_START (demux, ebml, "Attachments");
gst_matroska_demux_parse_chapters (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
guint32 id;
-
GstFlowReturn ret = GST_FLOW_OK;
GST_WARNING_OBJECT (demux, "Parsing of chapters not implemented yet");
gst_matroska_ebmlnum_uint (guint8 * data, guint size, guint64 * num)
{
gint len_mask = 0x80, read = 1, n = 1, num_ffs = 0;
-
guint64 total;
if (size <= 0) {
gst_matroska_ebmlnum_sint (guint8 * data, guint size, gint64 * num)
{
guint64 unum;
-
gint res;
/* read as unsigned number first */
GstMatroskaTrackContext * stream, guint8 * data, guint len)
{
GstFlowReturn ret, cret;
-
GstBuffer *header_buf = NULL;
ret = gst_pad_alloc_buffer_and_set_caps (stream->pad,
GstMatroskaTrackContext * stream)
{
GstFlowReturn ret;
-
guint8 *pdata;
-
guint off, len;
GST_LOG_OBJECT (demux, "priv data size = %u", stream->codec_priv_size);
GstMatroskaTrackContext * stream)
{
GstFlowReturn ret;
-
guint8 *p = (guint8 *) stream->codec_priv;
-
gint i, offset, length, num_packets;
/* start of the stream and vorbis audio or theora video, need to
start = strstr (stream->codec_priv, "palette:");
if (start) {
gint i;
-
guint32 clut[16];
-
guint32 col;
-
guint8 r, g, b, y, u, v;
start += 8;
GstMatroskaTrackContext * stream, GstBuffer ** buf)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
-
guint8 *seq_header;
-
guint seq_header_len;
-
guint32 header;
if (stream->codec_state) {
/* Sequence start code, if not found prepend */
if (header != 0x000001b3) {
GstBuffer *newbuf;
-
GstFlowReturn ret, cret;
ret = gst_pad_alloc_buffer_and_set_caps (stream->pad,
GstMatroskaTrackContext * stream, GstBuffer ** buf)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
-
GstMatroskaTrackAudioContext *audiocontext =
(GstMatroskaTrackAudioContext *) stream;
GstBuffer *newbuf = NULL;
-
guint8 *data;
-
guint newlen;
-
GstFlowReturn ret, cret = GST_FLOW_OK;
-
Wavpack4Header wvh;
wvh.ck_id[0] = 'w';
audiocontext->wvpk_block_index += block_samples;
} else {
guint8 *outdata;
-
guint outpos = 0;
-
guint size;
-
guint32 block_samples, flags, crc, blocksize;
data = GST_BUFFER_DATA (*buf);
GstMatroskaTrackContext * stream, GstBuffer ** buf)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
-
GstMatroskaTrackSubtitleContext *sub_stream;
-
const gchar *encoding, *data;
-
GError *err = NULL;
-
GstBuffer *newbuf;
-
gchar *utf8;
-
guint size;
sub_stream = (GstMatroskaTrackSubtitleContext *) stream;
for (i = 0; i < context->encodings->len; i++) {
GstMatroskaTrackEncoding *enc;
-
guint8 *new_data = NULL;
-
guint new_size = 0;
-
GstBuffer *new_buf;
enc = &g_array_index (context->encodings, GstMatroskaTrackEncoding, i);
#ifdef HAVE_ZLIB
/* zlib encoded track */
z_stream zstream;
-
guint orig_size;
-
int result;
orig_size = GST_BUFFER_SIZE (buf);
guint64 cluster_time, gboolean is_simpleblock)
{
GstMatroskaTrackContext *stream = NULL;
-
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
-
gboolean readblock = FALSE;
-
guint32 id;
-
guint64 block_duration = 0;
-
GstBuffer *buf = NULL;
-
gint stream_num = -1, n, laces = 0;
-
guint size = 0;
-
gint *lace_size = NULL;
-
gint64 time = 0;
-
gint flags = 0;
-
gint64 referenceblock = 0;
while (ret == GST_FLOW_OK) {
case GST_MATROSKA_ID_BLOCK:
{
guint64 num;
-
guint8 *data;
if ((ret = gst_ebml_read_buffer (ebml, &id, &buf)) != GST_FLOW_OK)
total = lace_size[0] = num;
for (n = 1; ret == GST_FLOW_OK && n < laces - 1; n++) {
gint64 snum;
-
gint r;
if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0) {
case GST_MATROSKA_ID_CODECSTATE:{
guint8 *data;
-
guint64 data_len = 0;
if ((ret =
if (ret == GST_FLOW_OK && readblock) {
guint64 duration = 0;
-
gint64 lace_time = 0;
stream = demux->src[stream_num];
/* else duration is diff between timecode of this and next block */
for (n = 0; n < laces; n++) {
GstBuffer *sub;
-
GstClockTimeDiff diff;
if (lace_size[n] == 0)
gst_matroska_demux_parse_cluster (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
-
guint64 cluster_time = GST_CLOCK_TIME_NONE;
-
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "Cluster");
gst_matroska_demux_parse_contents_seekentry (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret;
-
guint64 seek_pos = (guint64) - 1;
-
guint32 seek_id = 0;
-
guint32 id;
DEBUG_ELEMENT_START (demux, ebml, "Seek");
case GST_MATROSKA_ID_CHAPTERS:
{
guint level_up = demux->level_up;
-
guint64 before_pos, length;
-
GstEbmlLevel *level;
/* remember */
gst_matroska_demux_parse_contents (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
-
guint32 id;
while (ret == GST_FLOW_OK) {
guint32 id, gboolean * p_run_loop)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
switch (id) {
/* attachments - contains files attached to the mkv container
* like album art, etc */
case GST_MATROSKA_ID_ATTACHMENTS:{
-
if (!demux->attachments_parsed) {
if ((ret = gst_matroska_demux_parse_attachments (demux)) != GST_FLOW_OK)
return ret;
gst_matroska_demux_loop_stream (GstMatroskaDemux * demux)
{
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret = GST_FLOW_OK;
-
gboolean run_loop = TRUE;
-
guint32 id;
/* we've found our segment, start reading the different contents in here */
gst_matroska_demux_loop (GstPad * pad)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (GST_PAD_PARENT (pad));
-
GstEbmlRead *ebml = GST_EBML_READ (demux);
-
GstFlowReturn ret;
/* first, if we're to start, let's actually get starting */
gchar ** codec_name)
{
GstMatroskaTrackContext *context = (GstMatroskaTrackContext *) videocontext;
-
GstCaps *caps = NULL;
g_assert (videocontext != NULL);
if (caps != NULL) {
int i;
-
GstStructure *structure;
for (i = 0; i < gst_caps_get_size (caps); i++) {
gchar ** codec_name)
{
GstMatroskaTrackContext *context = (GstMatroskaTrackContext *) audiocontext;
-
GstCaps *caps = NULL;
g_assert (audiocontext != NULL);
}
} else if (g_str_has_prefix (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AAC)) {
GstBuffer *priv = NULL;
-
gint mpegversion = -1;
-
gint rate_idx, profile;
-
guint8 *data = NULL;
/* unspecified AAC profile with opaque private codec data */
subtitlecontext, const gchar * codec_id, gpointer data, guint size)
{
GstCaps *caps = NULL;
-
GstMatroskaTrackContext *context =
(GstMatroskaTrackContext *) subtitlecontext;
GstStateChange transition)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
-
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
/* handle upwards state changes here */
gst_matroska_mux_class_init (GstMatroskaMuxClass * klass)
{
GObjectClass *gobject_class;
-
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gst_matroska_mux_reset (GstElement * element)
{
GstMatroskaMux *mux = GST_MATROSKA_MUX (element);
-
GSList *walk;
/* reset EBML write */
/* clean up existing streams */
while ((walk = mux->collect->data) != NULL) {
GstMatroskaPad *collect_pad;
-
GstPad *thepad;
collect_pad = (GstMatroskaPad *) walk->data;
gst_matroska_mux_handle_sink_event (GstPad * pad, GstEvent * event)
{
GstMatroskaTrackContext *context;
-
GstMatroskaPad *collect_pad;
-
GstMatroskaMux *mux;
-
GstTagList *list;
-
gboolean ret;
mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad));
gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
{
GstMatroskaTrackContext *context = NULL;
-
GstMatroskaTrackVideoContext *videocontext;
-
GstMatroskaMux *mux;
-
GstMatroskaPad *collect_pad;
-
GstStructure *structure;
-
const gchar *mimetype;
-
gint width, height, pixel_width, pixel_height;
-
gint fps_d, fps_n;
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|| !strcmp (mimetype, "video/x-dv")
|| !strcmp (mimetype, "video/x-h263")) {
BITMAPINFOHEADER *bih;
-
const GValue *codec_data;
-
gint size = sizeof (BITMAPINFOHEADER);
bih = g_new0 (BITMAPINFOHEADER, 1);
if (codec_data != NULL) {
guint8 *priv_data = NULL;
-
guint priv_data_size = 0;
-
GstBuffer *codec_data_buf = g_value_peek_pointer (codec_data);
priv_data_size = GST_BUFFER_SIZE (codec_data_buf);
GstMatroskaTrackContext * context, GstBuffer ** p_buf0)
{
GstBuffer *buf[3];
-
GArray *bufarr;
-
guint8 *priv_data;
-
guint i, offset, priv_data_size;
if (streamheader == NULL)
} else {
if (memcmp (GST_BUFFER_DATA (buf0) + 1, "vorbis", 6) == 0) {
GstMatroskaTrackAudioContext *audiocontext;
-
guint8 *hdr;
hdr = GST_BUFFER_DATA (buf0) + 1 + 6 + 4;
GST_WARNING ("First header not a theora identification header, ignoring");
} else {
GstMatroskaTrackVideoContext *videocontext;
-
guint fps_num, fps_denom, par_num, par_denom;
-
guint8 *hdr;
hdr = GST_BUFFER_DATA (buf0) + 1 + 6 + 3 + 2 + 2;
gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
{
GstMatroskaTrackContext *context = NULL;
-
GstMatroskaTrackAudioContext *audiocontext;
-
GstMatroskaMux *mux;
-
GstMatroskaPad *collect_pad;
-
const gchar *mimetype;
-
gint samplerate = 0, channels = 0;
-
GstStructure *structure;
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
GstPadTemplate * templ, const gchar * pad_name)
{
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
-
GstMatroskaMux *mux = GST_MATROSKA_MUX (element);
-
GstMatroskaPad *collect_pad;
-
GstPad *newpad = NULL;
-
gchar *name = NULL;
-
GstPadSetCapsFunction setcapsfunc = NULL;
-
GstMatroskaTrackContext *context = NULL;
if (templ == gst_element_class_get_pad_template (klass, "audio_%d")) {
gst_matroska_mux_release_pad (GstElement * element, GstPad * pad)
{
GstMatroskaMux *mux;
-
GSList *walk;
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
GstCollectData *cdata = (GstCollectData *) walk->data;
-
GstMatroskaPad *collect_pad = (GstMatroskaPad *) cdata;
if (cdata->pad == pad) {
GstMatroskaTrackContext * context)
{
GstEbmlWrite *ebml = mux->ebml_write;
-
guint64 master;
/* TODO: check if everything necessary is written and check default values */
for (collected = mux->collect->data; collected;
collected = g_slist_next (collected)) {
GstMatroskaPad *collect_pad;
-
GstFormat format = GST_FORMAT_TIME;
-
GstPad *thepad;
-
gint64 trackduration;
collect_pad = (GstMatroskaPad *) collected->data;
for (collected = mux->collect->data; collected;
collected = g_slist_next (collected)) {
-
GstMatroskaPad *collect_pad;
-
GstPad *thepad;
collect_pad = (GstMatroskaPad *) collected->data;
GST_MATROSKA_TAG_ID_LEAD_PERFORMER, GST_TAG_PERFORMER}, {
GST_MATROSKA_TAG_ID_GENRE, GST_TAG_GENRE}
};
-
GstEbmlWrite *ebml = (GstEbmlWrite *) data;
-
guint i;
-
guint64 simpletag_master;
for (i = 0; i < G_N_ELEMENTS (tag_conv); i++) {
const gchar *tagname_gst = tag_conv[i].gstreamer_tagname;
-
const gchar *tagname_mkv = tag_conv[i].matroska_tagname;
if (strcmp (tagname_gst, tag) == 0) {
gst_matroska_mux_finish (GstMatroskaMux * mux)
{
GstEbmlWrite *ebml = mux->ebml_write;
-
guint64 pos;
-
guint64 duration = 0;
-
GSList *collected;
-
GstTagList *tags;
/* finish last cluster */
/* cues */
if (mux->index != NULL) {
guint n;
-
guint64 master, pointentry_master, trackpos_master;
mux->cues_pos = ebml->pos;
for (collected = mux->collect->data; collected;
collected = g_slist_next (collected)) {
GstMatroskaPad *collect_pad;
-
GstClockTime min_duration; /* observed minimum duration */
collect_pad = (GstMatroskaPad *) collected->data;
gst_matroska_mux_best_pad (GstMatroskaMux * mux, gboolean * popped)
{
GSList *collected;
-
GstMatroskaPad *best = NULL;
*popped = FALSE;
gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad)
{
GstEbmlWrite *ebml = mux->ebml_write;
-
GstBuffer *buf, *hdr;
-
guint64 cluster, blockgroup;
-
gboolean write_duration;
-
gint16 relative_timestamp;
-
gint64 relative_timestamp64;
-
guint64 block_duration;
-
gboolean is_video_keyframe = FALSE;
/* write data */
gst_matroska_mux_collected (GstCollectPads * pads, gpointer user_data)
{
GstMatroskaMux *mux = GST_MATROSKA_MUX (user_data);
-
GstMatroskaPad *best;
-
gboolean popped;
-
GstFlowReturn ret;
GST_DEBUG_OBJECT (mux, "Collected pads");
* the actual duration later when we send an updated header on eos */
if (GST_BUFFER_TIMESTAMP_IS_VALID (best->buffer)) {
GstClockTime start_ts = GST_BUFFER_TIMESTAMP (best->buffer);
-
GstClockTime end_ts = start_ts;
if (GST_BUFFER_DURATION_IS_VALID (best->buffer))
gst_matroska_mux_change_state (GstElement * element, GstStateChange transition)
{
GstStateChangeReturn ret;
-
GstMatroskaMux *mux = GST_MATROSKA_MUX (element);
switch (transition) {