2002-01-19 14:57:47 +00:00
|
|
|
|
/* GStreamer
|
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@temple-baptist.com>
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
* Copyright (C) <2006> Nokia Corporation (contact <stefan.kost@nokia.com>)
|
2009-12-04 14:13:12 +00:00
|
|
|
|
* Copyright (C) <2009-2010> STEricsson <benjamin.gaignard@stericsson.com>
|
2001-12-22 23:22:30 +00:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
2004-01-27 09:00:01 +00:00
|
|
|
|
/* Element-Checklist-Version: 5 */
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2006-04-27 16:05:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:element-avidemux
|
|
|
|
|
*
|
|
|
|
|
* Demuxes an .avi file into raw or compressed audio and/or video streams.
|
2009-01-28 10:29:42 +00:00
|
|
|
|
*
|
2007-01-09 12:25:26 +00:00
|
|
|
|
* This element supports both push and pull-based scheduling, depending on the
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
* capabilities of the upstream elements.
|
2009-01-28 10:29:42 +00:00
|
|
|
|
*
|
|
|
|
|
* <refsect2>
|
2006-04-27 16:05:54 +00:00
|
|
|
|
* <title>Example launch line</title>
|
2009-01-28 10:29:42 +00:00
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
|
* gst-launch-1.0 filesrc location=test.avi ! avidemux name=demux demux.audio_00 ! decodebin ! audioconvert ! audioresample ! autoaudiosink demux.video_00 ! queue ! decodebin ! videoconvert ! videoscale ! autovideosink
|
2009-01-28 10:29:42 +00:00
|
|
|
|
* ]| Play (parse and decode) an .avi file and try to output it to
|
2006-04-27 16:05:54 +00:00
|
|
|
|
* an automatically detected soundcard and videosink. If the AVI file contains
|
|
|
|
|
* compressed audio or video data, this will only work if you have the
|
|
|
|
|
* right decoder elements/plugins installed.
|
|
|
|
|
* </refsect2>
|
|
|
|
|
*
|
2007-01-09 12:25:26 +00:00
|
|
|
|
* Last reviewed on 2006-12-29 (0.10.6)
|
2006-04-27 16:05:54 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#endif
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2001-12-22 23:22:30 +00:00
|
|
|
|
#include <string.h>
|
2010-01-13 14:44:58 +00:00
|
|
|
|
#include <stdio.h>
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
#include "gst/riff/riff-media.h"
|
2001-12-22 23:22:30 +00:00
|
|
|
|
#include "gstavidemux.h"
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
#include "avi-ids.h"
|
2005-11-11 16:48:58 +00:00
|
|
|
|
#include <gst/gst-i18n-plugin.h>
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
#include <gst/base/gstadapter.h>
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2009-09-22 10:35:30 +00:00
|
|
|
|
|
2009-09-23 11:57:02 +00:00
|
|
|
|
#define DIV_ROUND_UP(s,v) (((s) + ((v)-1)) / (v))
|
2009-09-22 10:35:30 +00:00
|
|
|
|
|
2010-04-08 09:14:07 +00:00
|
|
|
|
#define GST_AVI_KEYFRAME 1
|
|
|
|
|
#define ENTRY_IS_KEYFRAME(e) ((e)->flags == GST_AVI_KEYFRAME)
|
|
|
|
|
#define ENTRY_SET_KEYFRAME(e) ((e)->flags = GST_AVI_KEYFRAME)
|
|
|
|
|
#define ENTRY_UNSET_KEYFRAME(e) ((e)->flags = 0)
|
|
|
|
|
|
|
|
|
|
|
2003-11-24 23:11:42 +00:00
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (avidemux_debug);
|
|
|
|
|
#define GST_CAT_DEFAULT avidemux_debug
|
2005-01-13 17:11:08 +00:00
|
|
|
|
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
|
2004-03-14 22:34:33 +00:00
|
|
|
|
GST_PAD_SINK,
|
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
|
GST_STATIC_CAPS ("video/x-msvideo")
|
|
|
|
|
);
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
2012-04-26 11:46:11 +00:00
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
|
static const char *const snap_types[2][2] = {
|
|
|
|
|
{"any", "before"},
|
|
|
|
|
{"after", "nearest"},
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
static void gst_avi_demux_finalize (GObject * object);
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static void gst_avi_demux_reset (GstAviDemux * avi);
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#if 0
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static const GstEventMask *gst_avi_demux_get_event_mask (GstPad * pad);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#endif
|
2011-11-17 14:02:55 +00:00
|
|
|
|
static gboolean gst_avi_demux_handle_src_event (GstPad * pad,
|
|
|
|
|
GstObject * parent, GstEvent * event);
|
2009-07-09 05:14:23 +00:00
|
|
|
|
static gboolean gst_avi_demux_handle_sink_event (GstPad * pad,
|
2011-11-17 14:02:55 +00:00
|
|
|
|
GstObject * parent, GstEvent * event);
|
2009-08-04 11:36:36 +00:00
|
|
|
|
static gboolean gst_avi_demux_push_event (GstAviDemux * avi, GstEvent * event);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
|
|
|
|
#if 0
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static const GstFormat *gst_avi_demux_get_src_formats (GstPad * pad);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#endif
|
2011-11-16 16:27:13 +00:00
|
|
|
|
static gboolean gst_avi_demux_handle_src_query (GstPad * pad,
|
|
|
|
|
GstObject * parent, GstQuery * query);
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static gboolean gst_avi_demux_src_convert (GstPad * pad, GstFormat src_format,
|
|
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
static gboolean gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment);
|
|
|
|
|
static gboolean gst_avi_demux_handle_seek (GstAviDemux * avi, GstPad * pad,
|
|
|
|
|
GstEvent * event);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
static gboolean gst_avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad,
|
|
|
|
|
GstEvent * event);
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static void gst_avi_demux_loop (GstPad * pad);
|
2011-11-18 12:57:20 +00:00
|
|
|
|
static gboolean gst_avi_demux_sink_activate (GstPad * sinkpad,
|
|
|
|
|
GstObject * parent);
|
2011-11-21 12:37:01 +00:00
|
|
|
|
static gboolean gst_avi_demux_sink_activate_mode (GstPad * sinkpad,
|
|
|
|
|
GstObject * parent, GstPadMode mode, gboolean active);
|
2011-11-17 14:02:55 +00:00
|
|
|
|
static GstFlowReturn gst_avi_demux_chain (GstPad * pad, GstObject * parent,
|
|
|
|
|
GstBuffer * buf);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
static void gst_avi_demux_set_index (GstElement * element, GstIndex * index);
|
|
|
|
|
static GstIndex *gst_avi_demux_get_index (GstElement * element);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2006-07-25 13:14:05 +00:00
|
|
|
|
static GstStateChangeReturn gst_avi_demux_change_state (GstElement * element,
|
|
|
|
|
GstStateChange transition);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
static void gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi);
|
|
|
|
|
static void gst_avi_demux_get_buffer_info (GstAviDemux * avi,
|
|
|
|
|
GstAviStream * stream, guint entry_n, GstClockTime * timestamp,
|
|
|
|
|
GstClockTime * ts_end, guint64 * offset, guint64 * offset_end);
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2010-01-08 12:17:22 +00:00
|
|
|
|
static void gst_avi_demux_parse_idit (GstAviDemux * avi, GstBuffer * buf);
|
|
|
|
|
|
2006-09-06 09:05:33 +00:00
|
|
|
|
/* GObject methods */
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2011-04-19 15:20:19 +00:00
|
|
|
|
#define gst_avi_demux_parent_class parent_class
|
|
|
|
|
G_DEFINE_TYPE (GstAviDemux, gst_avi_demux, GST_TYPE_ELEMENT);
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2003-11-01 02:07:52 +00:00
|
|
|
|
static void
|
2011-04-19 15:20:19 +00:00
|
|
|
|
gst_avi_demux_class_init (GstAviDemuxClass * klass)
|
2003-11-01 02:07:52 +00:00
|
|
|
|
{
|
2011-04-19 15:20:19 +00:00
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
2007-05-30 14:38:59 +00:00
|
|
|
|
GstPadTemplate *videosrctempl, *audiosrctempl, *subsrctempl;
|
|
|
|
|
GstCaps *audcaps, *vidcaps, *subcaps;
|
2003-11-01 02:07:52 +00:00
|
|
|
|
|
2011-04-19 15:20:19 +00:00
|
|
|
|
GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux",
|
|
|
|
|
0, "Demuxer for AVI streams");
|
|
|
|
|
|
|
|
|
|
gobject_class->finalize = gst_avi_demux_finalize;
|
|
|
|
|
|
|
|
|
|
gstelement_class->change_state =
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_change_state);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2011-04-19 15:20:19 +00:00
|
|
|
|
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_avi_demux_set_index);
|
|
|
|
|
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_avi_demux_get_index);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2011-04-19 15:20:19 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
audcaps = gst_riff_create_audio_template_caps ();
|
2011-10-27 17:00:52 +00:00
|
|
|
|
gst_caps_append (audcaps, gst_caps_new_empty_simple ("audio/x-avi-unknown"));
|
2011-11-04 12:12:37 +00:00
|
|
|
|
audiosrctempl = gst_pad_template_new ("audio_%u",
|
2004-03-14 22:34:33 +00:00
|
|
|
|
GST_PAD_SRC, GST_PAD_SOMETIMES, audcaps);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
|
vidcaps = gst_riff_create_video_template_caps ();
|
|
|
|
|
gst_caps_append (vidcaps, gst_riff_create_iavs_template_caps ());
|
2011-10-27 17:00:52 +00:00
|
|
|
|
gst_caps_append (vidcaps, gst_caps_new_empty_simple ("video/x-avi-unknown"));
|
2011-11-04 12:12:37 +00:00
|
|
|
|
videosrctempl = gst_pad_template_new ("video_%u",
|
2004-03-14 22:34:33 +00:00
|
|
|
|
GST_PAD_SRC, GST_PAD_SOMETIMES, vidcaps);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2011-10-27 17:00:52 +00:00
|
|
|
|
subcaps = gst_caps_new_empty_simple ("application/x-subtitle-avi");
|
2011-11-04 12:12:37 +00:00
|
|
|
|
subsrctempl = gst_pad_template_new ("subtitle_%u",
|
2007-05-30 14:38:59 +00:00
|
|
|
|
GST_PAD_SRC, GST_PAD_SOMETIMES, subcaps);
|
2011-04-19 15:20:19 +00:00
|
|
|
|
gst_element_class_add_pad_template (gstelement_class, audiosrctempl);
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class, videosrctempl);
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class, subsrctempl);
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
2003-12-22 01:47:09 +00:00
|
|
|
|
gst_static_pad_template_get (&sink_templ));
|
2011-04-19 15:20:19 +00:00
|
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Avi demuxer",
|
2010-03-18 13:31:35 +00:00
|
|
|
|
"Codec/Demuxer",
|
|
|
|
|
"Demultiplex an avi file into audio and video",
|
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
|
|
|
|
"Wim Taymans <wim.taymans@chello.be>, "
|
|
|
|
|
"Thijs Vermeir <thijsvermeir@gmail.com>");
|
2003-11-01 02:07:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_init (GstAviDemux * avi)
|
2003-01-15 00:41:40 +00:00
|
|
|
|
{
|
2006-03-15 16:17:12 +00:00
|
|
|
|
avi->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
|
2009-08-04 11:38:09 +00:00
|
|
|
|
gst_pad_set_activate_function (avi->sinkpad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_sink_activate));
|
2011-11-21 12:37:01 +00:00
|
|
|
|
gst_pad_set_activatemode_function (avi->sinkpad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_sink_activate_mode));
|
2009-08-04 11:38:09 +00:00
|
|
|
|
gst_pad_set_chain_function (avi->sinkpad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_chain));
|
|
|
|
|
gst_pad_set_event_function (avi->sinkpad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_handle_sink_event));
|
2010-01-15 17:13:24 +00:00
|
|
|
|
gst_element_add_pad (GST_ELEMENT_CAST (avi), avi->sinkpad);
|
2003-01-21 22:23:32 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
avi->adapter = gst_adapter_new ();
|
2003-01-21 22:23:32 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
gst_avi_demux_reset (avi);
|
2011-11-28 17:25:52 +00:00
|
|
|
|
|
|
|
|
|
GST_OBJECT_FLAG_SET (avi, GST_ELEMENT_FLAG_INDEXABLE);
|
2003-01-21 22:23:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
static void
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
gst_avi_demux_finalize (GObject * object)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
{
|
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (object);
|
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
GST_DEBUG ("AVI: finalize");
|
|
|
|
|
|
|
|
|
|
g_object_unref (avi->adapter);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_reset_stream (GstAviDemux * avi, GstAviStream * stream)
|
|
|
|
|
{
|
|
|
|
|
g_free (stream->strh);
|
|
|
|
|
g_free (stream->strf.data);
|
|
|
|
|
g_free (stream->name);
|
|
|
|
|
g_free (stream->index);
|
|
|
|
|
g_free (stream->indexes);
|
|
|
|
|
if (stream->initdata)
|
|
|
|
|
gst_buffer_unref (stream->initdata);
|
|
|
|
|
if (stream->extradata)
|
|
|
|
|
gst_buffer_unref (stream->extradata);
|
2012-10-16 00:02:11 +00:00
|
|
|
|
if (stream->rgb8_palette)
|
|
|
|
|
gst_buffer_unref (stream->rgb8_palette);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
if (stream->pad) {
|
2009-10-18 13:46:48 +00:00
|
|
|
|
if (stream->exposed) {
|
|
|
|
|
gst_pad_set_active (stream->pad, FALSE);
|
2010-01-15 17:13:24 +00:00
|
|
|
|
gst_element_remove_pad (GST_ELEMENT_CAST (avi), stream->pad);
|
2009-10-18 13:46:48 +00:00
|
|
|
|
} else
|
|
|
|
|
gst_object_unref (stream->pad);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
}
|
|
|
|
|
if (stream->taglist) {
|
2012-08-04 15:10:16 +00:00
|
|
|
|
gst_tag_list_unref (stream->taglist);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
stream->taglist = NULL;
|
|
|
|
|
}
|
|
|
|
|
memset (stream, 0, sizeof (GstAviStream));
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-31 19:37:26 +00:00
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
|
gst_avi_demux_reset (GstAviDemux * avi)
|
2003-01-31 19:37:26 +00:00
|
|
|
|
{
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gint i;
|
2003-02-02 23:48:30 +00:00
|
|
|
|
|
2007-09-10 06:49:32 +00:00
|
|
|
|
GST_DEBUG ("AVI: reset");
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
for (i = 0; i < avi->num_streams; i++)
|
|
|
|
|
gst_avi_demux_reset_stream (avi, &avi->stream[i]);
|
2003-01-31 19:37:26 +00:00
|
|
|
|
|
2008-10-08 14:47:14 +00:00
|
|
|
|
avi->header_state = GST_AVI_DEMUX_HEADER_TAG_LIST;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->num_streams = 0;
|
|
|
|
|
avi->num_v_streams = 0;
|
|
|
|
|
avi->num_a_streams = 0;
|
2007-05-30 14:38:59 +00:00
|
|
|
|
avi->num_t_streams = 0;
|
2009-10-18 13:48:06 +00:00
|
|
|
|
avi->main_stream = -1;
|
2003-01-31 19:37:26 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->state = GST_AVI_DEMUX_START;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
avi->offset = 0;
|
2010-01-18 16:13:06 +00:00
|
|
|
|
avi->building_index = FALSE;
|
2003-01-31 19:37:26 +00:00
|
|
|
|
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
avi->index_offset = 0;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
g_free (avi->avih);
|
|
|
|
|
avi->avih = NULL;
|
2003-01-31 19:37:26 +00:00
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
if (avi->element_index)
|
|
|
|
|
gst_object_unref (avi->element_index);
|
|
|
|
|
avi->element_index = NULL;
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:08:47 +00:00
|
|
|
|
|
2010-01-20 10:22:04 +00:00
|
|
|
|
if (avi->seg_event) {
|
|
|
|
|
gst_event_unref (avi->seg_event);
|
|
|
|
|
avi->seg_event = NULL;
|
2007-09-10 06:49:32 +00:00
|
|
|
|
}
|
2010-01-18 16:13:06 +00:00
|
|
|
|
if (avi->seek_event) {
|
|
|
|
|
gst_event_unref (avi->seek_event);
|
|
|
|
|
avi->seek_event = NULL;
|
|
|
|
|
}
|
2005-11-11 16:48:58 +00:00
|
|
|
|
|
2006-07-10 20:11:34 +00:00
|
|
|
|
if (avi->globaltags)
|
2012-08-04 15:10:16 +00:00
|
|
|
|
gst_tag_list_unref (avi->globaltags);
|
2006-07-10 20:11:34 +00:00
|
|
|
|
avi->globaltags = NULL;
|
|
|
|
|
|
2009-06-18 22:36:28 +00:00
|
|
|
|
avi->got_tags = TRUE; /* we always want to push global tags */
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
avi->have_eos = FALSE;
|
2009-10-14 11:08:47 +00:00
|
|
|
|
avi->seekable = TRUE;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
gst_adapter_clear (avi->adapter);
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
gst_segment_init (&avi->segment, GST_FORMAT_TIME);
|
2003-01-31 19:37:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* GstElement methods */
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#if 0
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
static const GstFormat *
|
2004-03-14 22:34:33 +00:00
|
|
|
|
gst_avi_demux_get_src_formats (GstPad * pad)
|
2001-12-22 23:22:30 +00:00
|
|
|
|
{
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream = gst_pad_get_element_private (pad);
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
static const GstFormat src_a_formats[] = {
|
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
|
GST_FORMAT_BYTES,
|
|
|
|
|
GST_FORMAT_DEFAULT,
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
static const GstFormat src_v_formats[] = {
|
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
|
GST_FORMAT_DEFAULT,
|
|
|
|
|
0
|
|
|
|
|
};
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
return (stream->strh->type == GST_RIFF_FCC_auds ?
|
2004-03-14 22:34:33 +00:00
|
|
|
|
src_a_formats : src_v_formats);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#endif
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
2009-06-08 13:46:48 +00:00
|
|
|
|
/* assumes stream->strf.auds->av_bps != 0 */
|
|
|
|
|
static inline GstClockTime
|
2009-09-21 16:04:25 +00:00
|
|
|
|
avi_stream_convert_bytes_to_time_unchecked (GstAviStream * stream,
|
2009-06-08 13:46:48 +00:00
|
|
|
|
guint64 bytes)
|
|
|
|
|
{
|
2009-09-22 20:12:58 +00:00
|
|
|
|
return gst_util_uint64_scale_int (bytes, GST_SECOND,
|
|
|
|
|
stream->strf.auds->av_bps);
|
2009-06-08 13:46:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
static inline guint64
|
|
|
|
|
avi_stream_convert_time_to_bytes_unchecked (GstAviStream * stream,
|
|
|
|
|
GstClockTime time)
|
|
|
|
|
{
|
2009-09-22 20:12:58 +00:00
|
|
|
|
return gst_util_uint64_scale_int (time, stream->strf.auds->av_bps,
|
|
|
|
|
GST_SECOND);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-08 13:46:48 +00:00
|
|
|
|
/* assumes stream->strh->rate != 0 */
|
|
|
|
|
static inline GstClockTime
|
2009-09-21 16:04:25 +00:00
|
|
|
|
avi_stream_convert_frames_to_time_unchecked (GstAviStream * stream,
|
2009-06-08 13:46:48 +00:00
|
|
|
|
guint64 frames)
|
|
|
|
|
{
|
|
|
|
|
return gst_util_uint64_scale (frames, stream->strh->scale * GST_SECOND,
|
|
|
|
|
stream->strh->rate);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
static inline guint64
|
|
|
|
|
avi_stream_convert_time_to_frames_unchecked (GstAviStream * stream,
|
|
|
|
|
GstClockTime time)
|
|
|
|
|
{
|
|
|
|
|
return gst_util_uint64_scale (time, stream->strh->rate,
|
|
|
|
|
stream->strh->scale * GST_SECOND);
|
|
|
|
|
}
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
|
gst_avi_demux_src_convert (GstPad * pad,
|
|
|
|
|
GstFormat src_format,
|
|
|
|
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream = gst_pad_get_element_private (pad);
|
2008-08-30 14:15:03 +00:00
|
|
|
|
gboolean res = TRUE;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
2008-08-30 14:15:03 +00:00
|
|
|
|
GST_LOG_OBJECT (pad,
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
"Received src_format:%s, src_value:%" G_GUINT64_FORMAT
|
|
|
|
|
", dest_format:%s", gst_format_get_name (src_format), src_value,
|
|
|
|
|
gst_format_get_name (*dest_format));
|
2005-11-11 16:48:58 +00:00
|
|
|
|
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (src_format == *dest_format)) {
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
*dest_value = src_value;
|
2005-11-11 16:48:58 +00:00
|
|
|
|
goto done;
|
|
|
|
|
}
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (!stream->strh || !stream->strf.data)) {
|
2005-11-11 16:48:58 +00:00
|
|
|
|
res = FALSE;
|
|
|
|
|
goto done;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (stream->strh->type == GST_RIFF_FCC_vids &&
|
|
|
|
|
(src_format == GST_FORMAT_BYTES
|
|
|
|
|
|| *dest_format == GST_FORMAT_BYTES))) {
|
2005-11-11 16:48:58 +00:00
|
|
|
|
res = FALSE;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
2003-07-06 20:49:52 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
switch (src_format) {
|
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case GST_FORMAT_BYTES:
|
2009-09-22 20:12:58 +00:00
|
|
|
|
*dest_value = gst_util_uint64_scale_int (src_value,
|
|
|
|
|
stream->strf.auds->av_bps, GST_SECOND);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case GST_FORMAT_DEFAULT:
|
2009-09-21 16:04:25 +00:00
|
|
|
|
*dest_value =
|
|
|
|
|
gst_util_uint64_scale_round (src_value, stream->strh->rate,
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
stream->strh->scale * GST_SECOND);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
res = FALSE;
|
|
|
|
|
break;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
}
|
2002-01-31 22:22:42 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case GST_FORMAT_TIME:
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
if (stream->strf.auds->av_bps != 0) {
|
2009-06-08 13:46:48 +00:00
|
|
|
|
*dest_value = avi_stream_convert_bytes_to_time_unchecked (stream,
|
|
|
|
|
src_value);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
} else
|
|
|
|
|
res = FALSE;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
res = FALSE;
|
|
|
|
|
break;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
|
switch (*dest_format) {
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case GST_FORMAT_TIME:
|
2009-06-08 13:46:48 +00:00
|
|
|
|
*dest_value =
|
|
|
|
|
avi_stream_convert_frames_to_time_unchecked (stream, src_value);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
res = FALSE;
|
|
|
|
|
break;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
}
|
2003-01-18 16:13:29 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
res = FALSE;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
}
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2005-11-11 16:48:58 +00:00
|
|
|
|
done:
|
2008-08-30 14:15:03 +00:00
|
|
|
|
GST_LOG_OBJECT (pad,
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
"Returning res:%d dest_format:%s dest_value:%" G_GUINT64_FORMAT, res,
|
|
|
|
|
gst_format_get_name (*dest_format), *dest_value);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
return res;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
static gboolean
|
2011-11-16 16:27:13 +00:00
|
|
|
|
gst_avi_demux_handle_src_query (GstPad * pad, GstObject * parent,
|
|
|
|
|
GstQuery * query)
|
2001-12-22 23:22:30 +00:00
|
|
|
|
{
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gboolean res = TRUE;
|
2011-11-16 16:27:13 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream = gst_pad_get_element_private (pad);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
if (!stream->strh || !stream->strf.data)
|
2011-11-16 16:27:13 +00:00
|
|
|
|
return gst_pad_query_default (pad, parent, query);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
|
case GST_QUERY_POSITION:{
|
2005-10-19 15:57:04 +00:00
|
|
|
|
gint64 pos = 0;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
2009-10-03 15:18:28 +00:00
|
|
|
|
GST_DEBUG ("pos query for stream %u: frames %u, bytes %u",
|
2009-09-22 12:44:42 +00:00
|
|
|
|
stream->num, stream->current_entry, stream->current_total);
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
2009-09-23 12:25:08 +00:00
|
|
|
|
/* FIXME, this looks clumsy */
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
2006-10-28 16:37:20 +00:00
|
|
|
|
if (stream->is_vbr) {
|
|
|
|
|
/* VBR */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
pos = gst_util_uint64_scale ((gint64) stream->current_entry *
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
stream->strh->scale, GST_SECOND, (guint64) stream->strh->rate);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "VBR convert frame %u, time %"
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_TIME_FORMAT, stream->current_entry, GST_TIME_ARGS (pos));
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
} else if (stream->strf.auds->av_bps != 0) {
|
2006-10-28 16:37:20 +00:00
|
|
|
|
/* CBR */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
pos = gst_util_uint64_scale (stream->current_total, GST_SECOND,
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
(guint64) stream->strf.auds->av_bps);
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
2009-10-03 15:18:28 +00:00
|
|
|
|
"CBR convert bytes %u, time %" GST_TIME_FORMAT,
|
2009-09-22 12:44:42 +00:00
|
|
|
|
stream->current_total, GST_TIME_ARGS (pos));
|
2009-09-21 16:04:25 +00:00
|
|
|
|
} else if (stream->idx_n != 0 && stream->total_bytes != 0) {
|
gst/avi/gstavidemux.*: Some cleanups, prepare to use GstSegment.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_next), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_subindex),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Some cleanups, prepare to use GstSegment.
Fix error in entry walking code.
Fix VBR detection.
Smarter timestamp calculation code.
Uniform error/eos handling.
2006-05-12 18:04:22 +00:00
|
|
|
|
/* calculate timestamps based on percentage of length */
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
guint64 xlen = avi->avih->us_frame *
|
|
|
|
|
avi->avih->tot_frames * GST_USECOND;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
2006-10-28 16:37:20 +00:00
|
|
|
|
if (stream->is_vbr) {
|
2009-09-22 12:44:42 +00:00
|
|
|
|
pos = gst_util_uint64_scale (xlen, stream->current_entry,
|
2009-09-21 16:04:25 +00:00
|
|
|
|
stream->idx_n);
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "VBR perc convert frame %u, time %"
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_TIME_FORMAT, stream->current_entry, GST_TIME_ARGS (pos));
|
2006-10-28 16:37:20 +00:00
|
|
|
|
} else {
|
2009-09-22 12:44:42 +00:00
|
|
|
|
pos = gst_util_uint64_scale (xlen, stream->current_total,
|
2006-10-28 16:37:20 +00:00
|
|
|
|
stream->total_bytes);
|
2009-10-03 15:18:28 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"CBR perc convert bytes %u, time %" GST_TIME_FORMAT,
|
|
|
|
|
stream->current_total, GST_TIME_ARGS (pos));
|
2006-10-28 16:37:20 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
} else {
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* we don't know */
|
2004-03-15 19:32:27 +00:00
|
|
|
|
res = FALSE;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (stream->strh->rate != 0) {
|
2009-09-22 12:44:42 +00:00
|
|
|
|
pos = gst_util_uint64_scale ((guint64) stream->current_entry *
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
stream->strh->scale, GST_SECOND, (guint64) stream->strh->rate);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
} else {
|
2009-09-22 12:44:42 +00:00
|
|
|
|
pos = stream->current_entry * avi->avih->us_frame * GST_USECOND;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
if (res) {
|
|
|
|
|
GST_DEBUG ("pos query : %" GST_TIME_FORMAT, GST_TIME_ARGS (pos));
|
2005-10-19 15:57:04 +00:00
|
|
|
|
gst_query_set_position (query, GST_FORMAT_TIME, pos);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
} else
|
|
|
|
|
GST_WARNING ("pos query failed");
|
2005-10-19 15:57:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GST_QUERY_DURATION:
|
|
|
|
|
{
|
2009-04-09 22:26:44 +00:00
|
|
|
|
GstFormat fmt;
|
2010-01-15 17:09:15 +00:00
|
|
|
|
GstClockTime duration;
|
2009-04-09 22:26:44 +00:00
|
|
|
|
|
2010-01-15 17:09:15 +00:00
|
|
|
|
/* only act on audio or video streams */
|
2006-03-03 17:51:16 +00:00
|
|
|
|
if (stream->strh->type != GST_RIFF_FCC_auds &&
|
|
|
|
|
stream->strh->type != GST_RIFF_FCC_vids) {
|
|
|
|
|
res = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-04-09 22:26:44 +00:00
|
|
|
|
|
2010-01-15 17:09:15 +00:00
|
|
|
|
/* take stream duration, fall back to avih duration */
|
|
|
|
|
if ((duration = stream->duration) == -1)
|
|
|
|
|
duration = avi->duration;
|
|
|
|
|
|
2009-04-09 22:26:44 +00:00
|
|
|
|
gst_query_parse_duration (query, &fmt, NULL);
|
|
|
|
|
|
|
|
|
|
switch (fmt) {
|
|
|
|
|
case GST_FORMAT_TIME:
|
2010-01-15 17:09:15 +00:00
|
|
|
|
gst_query_set_duration (query, fmt, duration);
|
2009-04-09 22:26:44 +00:00
|
|
|
|
break;
|
|
|
|
|
case GST_FORMAT_DEFAULT:
|
2009-07-24 15:04:31 +00:00
|
|
|
|
{
|
|
|
|
|
gint64 dur;
|
2009-04-09 22:26:44 +00:00
|
|
|
|
GST_DEBUG_OBJECT (query, "total frames is %" G_GUINT32_FORMAT,
|
2009-09-21 16:04:25 +00:00
|
|
|
|
stream->idx_n);
|
2009-07-24 15:04:31 +00:00
|
|
|
|
|
2012-01-20 15:54:06 +00:00
|
|
|
|
if (stream->idx_n > 0)
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_query_set_duration (query, fmt, stream->idx_n);
|
2009-07-29 12:31:48 +00:00
|
|
|
|
else if (gst_pad_query_convert (pad, GST_FORMAT_TIME,
|
2011-07-28 09:54:38 +00:00
|
|
|
|
duration, fmt, &dur))
|
2009-07-24 15:04:31 +00:00
|
|
|
|
gst_query_set_duration (query, fmt, dur);
|
2009-04-09 22:26:44 +00:00
|
|
|
|
break;
|
2009-07-24 15:04:31 +00:00
|
|
|
|
}
|
2009-04-09 22:26:44 +00:00
|
|
|
|
default:
|
|
|
|
|
res = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
|
break;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
2007-09-03 07:44:34 +00:00
|
|
|
|
case GST_QUERY_SEEKING:{
|
|
|
|
|
GstFormat fmt;
|
|
|
|
|
|
|
|
|
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
|
|
|
|
if (fmt == GST_FORMAT_TIME) {
|
|
|
|
|
gboolean seekable = TRUE;
|
|
|
|
|
|
|
|
|
|
if (avi->streaming) {
|
2009-10-14 11:09:03 +00:00
|
|
|
|
seekable = avi->seekable;
|
2007-09-03 07:44:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable,
|
|
|
|
|
0, stream->duration);
|
|
|
|
|
res = TRUE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-04-09 22:26:44 +00:00
|
|
|
|
case GST_QUERY_CONVERT:{
|
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
|
|
|
|
if ((res = gst_avi_demux_src_convert (pad, src_fmt, src_val, &dest_fmt,
|
|
|
|
|
&dest_val)))
|
|
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
|
|
|
|
else
|
2011-11-16 16:27:13 +00:00
|
|
|
|
res = gst_pad_query_default (pad, parent, query);
|
2009-04-09 22:26:44 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2002-05-26 21:59:22 +00:00
|
|
|
|
default:
|
2011-11-16 16:27:13 +00:00
|
|
|
|
res = gst_pad_query_default (pad, parent, query);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#if 0
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
static const GstEventMask *
|
2004-03-14 22:34:33 +00:00
|
|
|
|
gst_avi_demux_get_event_mask (GstPad * pad)
|
2002-07-24 21:41:38 +00:00
|
|
|
|
{
|
|
|
|
|
static const GstEventMask masks[] = {
|
2004-03-14 22:34:33 +00:00
|
|
|
|
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_KEY_UNIT},
|
|
|
|
|
{0,}
|
2002-07-24 21:41:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return masks;
|
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#endif
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:09:03 +00:00
|
|
|
|
static guint64
|
|
|
|
|
gst_avi_demux_seek_streams (GstAviDemux * avi, guint64 offset, gboolean before)
|
|
|
|
|
{
|
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
GstIndexEntry *entry;
|
|
|
|
|
gint i;
|
|
|
|
|
gint64 val, min = offset;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
stream = &avi->stream[i];
|
|
|
|
|
|
|
|
|
|
entry = gst_index_get_assoc_entry (avi->element_index, stream->index_id,
|
|
|
|
|
before ? GST_INDEX_LOOKUP_BEFORE : GST_INDEX_LOOKUP_AFTER,
|
|
|
|
|
GST_ASSOCIATION_FLAG_NONE, GST_FORMAT_BYTES, offset);
|
|
|
|
|
|
|
|
|
|
if (before) {
|
|
|
|
|
if (entry) {
|
2010-06-15 18:04:35 +00:00
|
|
|
|
gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, &val);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "stream %d, previous entry at %"
|
|
|
|
|
G_GUINT64_FORMAT, i, val);
|
|
|
|
|
if (val < min)
|
|
|
|
|
min = val;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!entry) {
|
2009-10-15 09:24:45 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "no position for stream %d, assuming at start", i);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
stream->current_entry = 0;
|
|
|
|
|
stream->current_total = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, &val);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "stream %d, next entry at %" G_GUINT64_FORMAT,
|
|
|
|
|
i, val);
|
|
|
|
|
|
|
|
|
|
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &val);
|
|
|
|
|
stream->current_total = val;
|
|
|
|
|
gst_index_entry_assoc_map (entry, GST_FORMAT_DEFAULT, &val);
|
|
|
|
|
stream->current_entry = val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return min;
|
|
|
|
|
}
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
static guint
|
|
|
|
|
gst_avi_demux_index_entry_offset_search (GstAviIndexEntry * entry,
|
|
|
|
|
guint64 * offset)
|
|
|
|
|
{
|
|
|
|
|
if (entry->offset < *offset)
|
|
|
|
|
return -1;
|
|
|
|
|
else if (entry->offset > *offset)
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static guint64
|
|
|
|
|
gst_avi_demux_seek_streams_index (GstAviDemux * avi, guint64 offset,
|
|
|
|
|
gboolean before)
|
|
|
|
|
{
|
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
GstAviIndexEntry *entry;
|
|
|
|
|
gint i;
|
|
|
|
|
gint64 val, min = offset;
|
2011-01-27 15:02:46 +00:00
|
|
|
|
guint index = 0;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
stream = &avi->stream[i];
|
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
/* compensate for chunk header */
|
|
|
|
|
offset += 8;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
entry =
|
|
|
|
|
gst_util_array_binary_search (stream->index, stream->idx_n,
|
|
|
|
|
sizeof (GstAviIndexEntry),
|
|
|
|
|
(GCompareDataFunc) gst_avi_demux_index_entry_offset_search,
|
|
|
|
|
before ? GST_SEARCH_MODE_BEFORE : GST_SEARCH_MODE_AFTER, &offset, NULL);
|
2010-03-09 17:05:29 +00:00
|
|
|
|
offset -= 8;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
if (entry)
|
|
|
|
|
index = entry - stream->index;
|
|
|
|
|
|
|
|
|
|
if (before) {
|
|
|
|
|
if (entry) {
|
2010-06-15 18:04:35 +00:00
|
|
|
|
val = stream->index[index].offset;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"stream %d, previous entry at %" G_GUINT64_FORMAT, i, val);
|
|
|
|
|
if (val < min)
|
|
|
|
|
min = val;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!entry) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "no position for stream %d, assuming at start", i);
|
|
|
|
|
stream->current_entry = 0;
|
|
|
|
|
stream->current_total = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
val = stream->index[index].offset - 8;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "stream %d, next entry at %" G_GUINT64_FORMAT, i,
|
|
|
|
|
val);
|
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
stream->current_total = stream->index[index].total;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
stream->current_entry = index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return min;
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-14 11:09:03 +00:00
|
|
|
|
#define GST_AVI_SEEK_PUSH_DISPLACE (4 * GST_SECOND)
|
|
|
|
|
|
2009-07-09 05:14:23 +00:00
|
|
|
|
static gboolean
|
2011-11-17 14:02:55 +00:00
|
|
|
|
gst_avi_demux_handle_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
|
GstEvent * event)
|
2009-07-09 05:14:23 +00:00
|
|
|
|
{
|
|
|
|
|
gboolean res = TRUE;
|
2011-11-17 14:02:55 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
2009-07-09 05:14:23 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"have event type %s: %p on sink pad", GST_EVENT_TYPE_NAME (event), event);
|
|
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-06-02 16:47:36 +00:00
|
|
|
|
case GST_EVENT_SEGMENT:
|
2009-10-14 11:09:03 +00:00
|
|
|
|
{
|
2011-06-02 16:47:36 +00:00
|
|
|
|
gint64 boffset, offset = 0;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
GstSegment segment;
|
|
|
|
|
|
|
|
|
|
/* some debug output */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
gst_event_copy_segment (event, &segment);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "received newsegment %" GST_SEGMENT_FORMAT,
|
2009-10-14 11:09:03 +00:00
|
|
|
|
&segment);
|
|
|
|
|
|
|
|
|
|
/* chain will send initial newsegment after pads have been added */
|
|
|
|
|
if (avi->state != GST_AVI_DEMUX_MOVI) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "still starting, eating event");
|
|
|
|
|
goto exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* we only expect a BYTE segment, e.g. following a seek */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
if (segment.format != GST_FORMAT_BYTES) {
|
2009-10-14 11:09:03 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "unsupported segment format, ignoring");
|
|
|
|
|
goto exit;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (avi->have_index) {
|
|
|
|
|
GstAviIndexEntry *entry;
|
2010-03-09 17:05:29 +00:00
|
|
|
|
guint i = 0, index = 0, k = 0;
|
2010-01-19 09:51:08 +00:00
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
/* compensate chunk header, stored index offset points after header */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
boffset = segment.start + 8;
|
2010-01-19 09:51:08 +00:00
|
|
|
|
/* find which stream we're on */
|
|
|
|
|
do {
|
|
|
|
|
stream = &avi->stream[i];
|
|
|
|
|
|
|
|
|
|
/* find the index for start bytes offset */
|
|
|
|
|
entry = gst_util_array_binary_search (stream->index,
|
|
|
|
|
stream->idx_n, sizeof (GstAviIndexEntry),
|
|
|
|
|
(GCompareDataFunc) gst_avi_demux_index_entry_offset_search,
|
2011-06-02 16:47:36 +00:00
|
|
|
|
GST_SEARCH_MODE_AFTER, &boffset, NULL);
|
2010-01-19 09:51:08 +00:00
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
if (entry == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
index = entry - stream->index;
|
2010-01-19 09:51:08 +00:00
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
/* we are on the stream with a chunk start offset closest to start */
|
|
|
|
|
if (!offset || stream->index[index].offset < offset) {
|
|
|
|
|
offset = stream->index[index].offset;
|
|
|
|
|
k = i;
|
|
|
|
|
}
|
|
|
|
|
/* exact match needs no further searching */
|
2012-09-28 14:50:25 +00:00
|
|
|
|
if (stream->index[index].offset == boffset)
|
2010-01-19 09:51:08 +00:00
|
|
|
|
break;
|
|
|
|
|
} while (++i < avi->num_streams);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
boffset -= 8;
|
2010-03-09 17:05:29 +00:00
|
|
|
|
offset -= 8;
|
|
|
|
|
stream = &avi->stream[k];
|
|
|
|
|
|
|
|
|
|
/* so we have no idea what is to come, or where we are */
|
|
|
|
|
if (!offset) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "insufficient index data, forcing EOS");
|
|
|
|
|
goto eos;
|
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-01-19 09:51:08 +00:00
|
|
|
|
/* get the ts corresponding to start offset bytes for the stream */
|
2009-12-04 14:13:12 +00:00
|
|
|
|
gst_avi_demux_get_buffer_info (avi, stream, index,
|
2011-06-02 16:47:36 +00:00
|
|
|
|
(GstClockTime *) & segment.time, NULL, NULL, NULL);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-12-04 14:13:12 +00:00
|
|
|
|
} else if (avi->element_index) {
|
|
|
|
|
GstIndexEntry *entry;
|
|
|
|
|
|
|
|
|
|
/* Let's check if we have an index entry for this position */
|
|
|
|
|
entry = gst_index_get_assoc_entry (avi->element_index, avi->index_id,
|
|
|
|
|
GST_INDEX_LOOKUP_AFTER, GST_ASSOCIATION_FLAG_NONE,
|
2011-06-02 16:47:36 +00:00
|
|
|
|
GST_FORMAT_BYTES, segment.start);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
/* we can not go where we have not yet been before ... */
|
|
|
|
|
if (!entry) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "insufficient index data, forcing EOS");
|
|
|
|
|
goto eos;
|
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2011-06-02 16:47:36 +00:00
|
|
|
|
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME,
|
|
|
|
|
(gint64 *) & segment.time);
|
2010-03-09 17:05:29 +00:00
|
|
|
|
gst_index_entry_assoc_map (entry, GST_FORMAT_BYTES, &offset);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-12-04 14:13:12 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "no index data, forcing EOS");
|
2009-10-14 11:09:03 +00:00
|
|
|
|
goto eos;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-02 16:47:36 +00:00
|
|
|
|
segment.format = GST_FORMAT_TIME;
|
|
|
|
|
segment.start = segment.time;
|
|
|
|
|
segment.stop = GST_CLOCK_TIME_NONE;
|
2011-06-28 10:55:45 +00:00
|
|
|
|
segment.position = segment.start;
|
|
|
|
|
|
|
|
|
|
/* rescue duration */
|
|
|
|
|
segment.duration = avi->segment.duration;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
|
|
|
|
/* set up segment and send downstream */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
gst_segment_copy_into (&segment, &avi->segment);
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Pushing newseg %" GST_SEGMENT_FORMAT, &segment);
|
|
|
|
|
gst_avi_demux_push_event (avi, gst_event_new_segment (&segment));
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "next chunk expected at %" G_GINT64_FORMAT,
|
|
|
|
|
boffset);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
|
|
|
|
/* adjust state for streaming thread accordingly */
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (avi->have_index)
|
|
|
|
|
gst_avi_demux_seek_streams_index (avi, offset, FALSE);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-12-04 14:13:12 +00:00
|
|
|
|
else
|
|
|
|
|
gst_avi_demux_seek_streams (avi, offset, FALSE);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
|
|
|
|
/* set up streaming thread */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
g_assert (offset >= boffset);
|
|
|
|
|
avi->offset = boffset;
|
|
|
|
|
avi->todrop = offset - boffset;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
|
|
|
|
exit:
|
2009-07-09 05:14:23 +00:00
|
|
|
|
gst_event_unref (event);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
res = TRUE;
|
2009-07-09 05:14:23 +00:00
|
|
|
|
break;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
eos:
|
|
|
|
|
/* set up for EOS */
|
|
|
|
|
avi->have_eos = TRUE;
|
|
|
|
|
goto exit;
|
|
|
|
|
}
|
2009-08-04 11:36:36 +00:00
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
|
{
|
|
|
|
|
if (avi->state != GST_AVI_DEMUX_MOVI) {
|
|
|
|
|
gst_event_unref (event);
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX,
|
|
|
|
|
(NULL), ("got eos and didn't receive a complete header object"));
|
|
|
|
|
} else if (!gst_avi_demux_push_event (avi, event)) {
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX,
|
|
|
|
|
(NULL), ("got eos but no streams (yet)"));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2010-01-20 10:26:34 +00:00
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
gst_adapter_clear (avi->adapter);
|
|
|
|
|
avi->have_eos = FALSE;
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
avi->stream[i].last_flow = GST_FLOW_OK;
|
|
|
|
|
avi->stream[i].discont = TRUE;
|
|
|
|
|
}
|
|
|
|
|
/* fall through to default case so that the event gets passed downstream */
|
|
|
|
|
}
|
2009-07-09 05:14:23 +00:00
|
|
|
|
default:
|
2011-11-17 14:02:55 +00:00
|
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
2009-07-09 05:14:23 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
|
static gboolean
|
2011-11-17 14:02:55 +00:00
|
|
|
|
gst_avi_demux_handle_src_event (GstPad * pad, GstObject * parent,
|
|
|
|
|
GstEvent * event)
|
2002-05-26 21:59:22 +00:00
|
|
|
|
{
|
|
|
|
|
gboolean res = TRUE;
|
2011-11-17 14:02:55 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
"have event type %s: %p on src pad", GST_EVENT_TYPE_NAME (event), event);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
|
case GST_EVENT_SEEK:
|
2009-02-26 18:07:35 +00:00
|
|
|
|
if (!avi->streaming) {
|
|
|
|
|
res = gst_avi_demux_handle_seek (avi, pad, event);
|
|
|
|
|
} else {
|
2009-10-14 11:09:03 +00:00
|
|
|
|
res = gst_avi_demux_handle_seek_push (avi, pad, event);
|
2009-02-26 18:07:35 +00:00
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
gst_event_unref (event);
|
2007-11-12 17:21:59 +00:00
|
|
|
|
break;
|
|
|
|
|
case GST_EVENT_QOS:
|
|
|
|
|
case GST_EVENT_NAVIGATION:
|
|
|
|
|
res = FALSE;
|
|
|
|
|
gst_event_unref (event);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2011-11-17 14:02:55 +00:00
|
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
2002-05-26 21:59:22 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2007-11-12 17:06:32 +00:00
|
|
|
|
|
2002-05-26 21:59:22 +00:00
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* streaming helper (push) */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* gst_avi_demux_peek_chunk_info:
|
|
|
|
|
* @avi: Avi object
|
|
|
|
|
* @tag: holder for tag
|
|
|
|
|
* @size: holder for tag size
|
|
|
|
|
*
|
|
|
|
|
* Peek next chunk info (tag and size)
|
|
|
|
|
*
|
|
|
|
|
* Returns: TRUE when one chunk info has been got
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
gst_avi_demux_peek_chunk_info (GstAviDemux * avi, guint32 * tag, guint32 * size)
|
|
|
|
|
{
|
|
|
|
|
const guint8 *data = NULL;
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
if (gst_adapter_available (avi->adapter) < 8)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
data = gst_adapter_map (avi->adapter, 8);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
*tag = GST_READ_UINT32_LE (data);
|
|
|
|
|
*size = GST_READ_UINT32_LE (data + 4);
|
2011-11-10 17:32:58 +00:00
|
|
|
|
gst_adapter_unmap (avi->adapter);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* gst_avi_demux_peek_chunk:
|
|
|
|
|
* @avi: Avi object
|
|
|
|
|
* @tag: holder for tag
|
|
|
|
|
* @size: holder for tag size
|
|
|
|
|
*
|
|
|
|
|
* Peek enough data for one full chunk
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE when one chunk has been got
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
gst_avi_demux_peek_chunk (GstAviDemux * avi, guint32 * tag, guint32 * size)
|
|
|
|
|
{
|
|
|
|
|
guint32 peek_size = 0;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
gint available;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
if (!gst_avi_demux_peek_chunk_info (avi, tag, size))
|
|
|
|
|
goto peek_failed;
|
2009-08-08 19:54:00 +00:00
|
|
|
|
|
|
|
|
|
/* size 0 -> empty data buffer would surprise most callers,
|
|
|
|
|
* large size -> do not bother trying to squeeze that into adapter,
|
|
|
|
|
* so we throw poor man's exception, which can be caught if caller really
|
|
|
|
|
* wants to handle 0 size chunk */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
if (!(*size) || (*size) >= (1 << 30))
|
|
|
|
|
goto strange_size;
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
peek_size = (*size + 1) & ~1;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
available = gst_adapter_available (avi->adapter);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Need to peek chunk of %d bytes to read chunk %" GST_FOURCC_FORMAT
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
", %d bytes available", *size, GST_FOURCC_ARGS (*tag), available);
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
if (available < (8 + peek_size))
|
|
|
|
|
goto need_more;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
peek_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_INFO_OBJECT (avi, "Failed to peek");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
strange_size:
|
|
|
|
|
{
|
|
|
|
|
GST_INFO_OBJECT (avi,
|
|
|
|
|
"Invalid/unexpected chunk size %d for tag %" GST_FOURCC_FORMAT, *size,
|
|
|
|
|
GST_FOURCC_ARGS (*tag));
|
|
|
|
|
/* chain should give up */
|
|
|
|
|
avi->abort_buffering = TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
need_more:
|
|
|
|
|
{
|
|
|
|
|
GST_INFO_OBJECT (avi, "need more %d < %" G_GUINT32_FORMAT,
|
|
|
|
|
available, 8 + peek_size);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* AVI init */
|
|
|
|
|
|
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_parse_file_header:
|
|
|
|
|
* @element: caller element (used for errors/debug).
|
|
|
|
|
* @buf: input data to be used for parsing.
|
|
|
|
|
*
|
|
|
|
|
* "Open" a RIFF/AVI file. The buffer should be at least 12
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
* bytes long. Takes ownership of @buf.
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: TRUE if the file is a RIFF/AVI file, FALSE otherwise.
|
|
|
|
|
* Throws an error, caller should error out (fatal).
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
*/
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
static gboolean
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_avi_demux_parse_file_header (GstElement * element, GstBuffer * buf)
|
2001-12-22 23:22:30 +00:00
|
|
|
|
{
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
guint32 doctype;
|
2009-09-21 10:32:51 +00:00
|
|
|
|
GstClockTime stamp;
|
|
|
|
|
|
|
|
|
|
stamp = gst_util_get_timestamp ();
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2006-10-28 16:37:20 +00:00
|
|
|
|
/* riff_parse posts an error */
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
if (!gst_riff_parse_file_header (element, buf, &doctype))
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
return FALSE;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
if (doctype != GST_RIFF_RIFF_AVI)
|
|
|
|
|
goto not_avi;
|
|
|
|
|
|
2009-09-21 10:32:51 +00:00
|
|
|
|
stamp = gst_util_get_timestamp () - stamp;
|
2009-12-07 20:54:07 +00:00
|
|
|
|
GST_DEBUG_OBJECT (element, "header parsing took %" GST_TIME_FORMAT,
|
2009-09-21 10:32:51 +00:00
|
|
|
|
GST_TIME_ARGS (stamp));
|
|
|
|
|
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
not_avi:
|
|
|
|
|
{
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
|
2005-11-21 13:38:24 +00:00
|
|
|
|
("File is not an AVI file: %" GST_FOURCC_FORMAT,
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GST_FOURCC_ARGS (doctype)));
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
|
|
|
|
* Read AVI file tag when streaming
|
|
|
|
|
*/
|
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_stream_init_push (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
if (gst_adapter_available (avi->adapter) >= 12) {
|
2006-10-28 16:37:20 +00:00
|
|
|
|
GstBuffer *tmp;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2006-10-28 16:37:20 +00:00
|
|
|
|
tmp = gst_adapter_take_buffer (avi->adapter, 12);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG ("Parsing avi header");
|
2010-01-15 17:13:24 +00:00
|
|
|
|
if (!gst_avi_demux_parse_file_header (GST_ELEMENT_CAST (avi), tmp)) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
GST_DEBUG ("header ok");
|
|
|
|
|
avi->offset += 12;
|
2006-10-28 16:37:20 +00:00
|
|
|
|
|
|
|
|
|
avi->state = GST_AVI_DEMUX_HEADER;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Read AVI file tag
|
|
|
|
|
*/
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
static GstFlowReturn
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
gst_avi_demux_stream_init_pull (GstAviDemux * avi)
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
{
|
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
GstBuffer *buf = NULL;
|
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
res = gst_pad_pull_range (avi->sinkpad, avi->offset, 12, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK)
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
return res;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
else if (!gst_avi_demux_parse_file_header (GST_ELEMENT_CAST (avi), buf))
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto wrong_header;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
|
|
|
|
avi->offset += 12;
|
|
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
wrong_header:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "error parsing file header");
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* AVI header handling */
|
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_parse_avih:
|
2010-01-15 17:15:14 +00:00
|
|
|
|
* @avi: caller element (used for errors/debug).
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* @buf: input data to be used for parsing.
|
|
|
|
|
* @avih: pointer to structure (filled in by function) containing
|
|
|
|
|
* stream information (such as flags, number of streams, etc.).
|
|
|
|
|
*
|
|
|
|
|
* Read 'avih' header. Discards buffer after use.
|
|
|
|
|
*
|
|
|
|
|
* Returns: TRUE on success, FALSE otherwise. Throws an error if
|
|
|
|
|
* the header is invalid. The caller should error out
|
|
|
|
|
* (fatal).
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
*/
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
static gboolean
|
2010-01-15 17:15:14 +00:00
|
|
|
|
gst_avi_demux_parse_avih (GstAviDemux * avi,
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GstBuffer * buf, gst_riff_avih ** _avih)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_riff_avih *avih;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gsize size;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
if (buf == NULL)
|
|
|
|
|
goto no_buffer;
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
size = gst_buffer_get_size (buf);
|
|
|
|
|
if (size < sizeof (gst_riff_avih))
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto avih_too_small;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
avih = g_malloc (size);
|
|
|
|
|
gst_buffer_extract (buf, 0, avih, size);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
|
|
|
|
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
|
|
|
|
avih->us_frame = GUINT32_FROM_LE (avih->us_frame);
|
|
|
|
|
avih->max_bps = GUINT32_FROM_LE (avih->max_bps);
|
|
|
|
|
avih->pad_gran = GUINT32_FROM_LE (avih->pad_gran);
|
|
|
|
|
avih->flags = GUINT32_FROM_LE (avih->flags);
|
|
|
|
|
avih->tot_frames = GUINT32_FROM_LE (avih->tot_frames);
|
|
|
|
|
avih->init_frames = GUINT32_FROM_LE (avih->init_frames);
|
|
|
|
|
avih->streams = GUINT32_FROM_LE (avih->streams);
|
|
|
|
|
avih->bufsize = GUINT32_FROM_LE (avih->bufsize);
|
|
|
|
|
avih->width = GUINT32_FROM_LE (avih->width);
|
|
|
|
|
avih->height = GUINT32_FROM_LE (avih->height);
|
|
|
|
|
avih->scale = GUINT32_FROM_LE (avih->scale);
|
|
|
|
|
avih->rate = GUINT32_FROM_LE (avih->rate);
|
|
|
|
|
avih->start = GUINT32_FROM_LE (avih->start);
|
|
|
|
|
avih->length = GUINT32_FROM_LE (avih->length);
|
|
|
|
|
#endif
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
|
|
/* debug stuff */
|
2010-01-15 17:15:14 +00:00
|
|
|
|
GST_INFO_OBJECT (avi, "avih tag found:");
|
|
|
|
|
GST_INFO_OBJECT (avi, " us_frame %u", avih->us_frame);
|
|
|
|
|
GST_INFO_OBJECT (avi, " max_bps %u", avih->max_bps);
|
|
|
|
|
GST_INFO_OBJECT (avi, " pad_gran %u", avih->pad_gran);
|
|
|
|
|
GST_INFO_OBJECT (avi, " flags 0x%08x", avih->flags);
|
|
|
|
|
GST_INFO_OBJECT (avi, " tot_frames %u", avih->tot_frames);
|
|
|
|
|
GST_INFO_OBJECT (avi, " init_frames %u", avih->init_frames);
|
|
|
|
|
GST_INFO_OBJECT (avi, " streams %u", avih->streams);
|
|
|
|
|
GST_INFO_OBJECT (avi, " bufsize %u", avih->bufsize);
|
|
|
|
|
GST_INFO_OBJECT (avi, " width %u", avih->width);
|
|
|
|
|
GST_INFO_OBJECT (avi, " height %u", avih->height);
|
|
|
|
|
GST_INFO_OBJECT (avi, " scale %u", avih->scale);
|
|
|
|
|
GST_INFO_OBJECT (avi, " rate %u", avih->rate);
|
|
|
|
|
GST_INFO_OBJECT (avi, " start %u", avih->start);
|
|
|
|
|
GST_INFO_OBJECT (avi, " length %u", avih->length);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
|
|
|
|
*_avih = avih;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
2010-01-15 17:09:15 +00:00
|
|
|
|
if (avih->us_frame != 0 && avih->tot_frames != 0)
|
|
|
|
|
avi->duration =
|
|
|
|
|
(guint64) avih->us_frame * (guint64) avih->tot_frames * 1000;
|
|
|
|
|
else
|
|
|
|
|
avi->duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
2010-01-15 17:15:14 +00:00
|
|
|
|
GST_INFO_OBJECT (avi, " header duration %" GST_TIME_FORMAT,
|
2010-01-15 17:09:15 +00:00
|
|
|
|
GST_TIME_ARGS (avi->duration));
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
return TRUE;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
no_buffer:
|
|
|
|
|
{
|
2010-01-15 17:15:14 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("No buffer"));
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
avih_too_small:
|
|
|
|
|
{
|
2010-01-15 17:15:14 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
2011-11-21 19:31:31 +00:00
|
|
|
|
("Too small avih (%" G_GSIZE_FORMAT " available, %d needed)",
|
2011-04-04 17:17:43 +00:00
|
|
|
|
size, (int) sizeof (gst_riff_avih)));
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_parse_superindex:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
* @avi: caller element (used for debugging/errors).
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* @buf: input data to use for parsing.
|
|
|
|
|
* @locations: locations in the file (byte-offsets) that contain
|
|
|
|
|
* the actual indexes (see get_avi_demux_parse_subindex()).
|
|
|
|
|
* The array ends with GST_BUFFER_OFFSET_NONE.
|
|
|
|
|
*
|
|
|
|
|
* Reads superindex (openDML-2 spec stuff) from the provided data.
|
|
|
|
|
*
|
|
|
|
|
* Returns: TRUE on success, FALSE otherwise. Indexes should be skipped
|
|
|
|
|
* on error, but they are not fatal.
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_avi_demux_parse_superindex (GstAviDemux * avi,
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GstBuffer * buf, guint64 ** _indexes)
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
{
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2006-04-10 10:10:55 +00:00
|
|
|
|
guint8 *data;
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
guint16 bpe = 16;
|
|
|
|
|
guint32 num, i;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
guint64 *indexes;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gsize size;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
*_indexes = NULL;
|
|
|
|
|
|
2011-07-27 23:37:13 +00:00
|
|
|
|
if (buf) {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
data = map.data;
|
|
|
|
|
size = map.size;
|
2011-07-27 23:37:13 +00:00
|
|
|
|
} else {
|
|
|
|
|
data = NULL;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
size = 0;
|
2011-07-27 23:37:13 +00:00
|
|
|
|
}
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2006-08-24 11:21:06 +00:00
|
|
|
|
if (size < 24)
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto too_small;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
|
|
|
|
/* check type of index. The opendml2 specs state that
|
|
|
|
|
* there should be 4 dwords per array entry. Type can be
|
|
|
|
|
* either frame or field (and we don't care). */
|
|
|
|
|
if (GST_READ_UINT16_LE (data) != 4 ||
|
|
|
|
|
(data[2] & 0xfe) != 0x0 || data[3] != 0x0) {
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
2006-10-05 16:37:33 +00:00
|
|
|
|
"Superindex for stream has unexpected "
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
"size_entry %d (bytes) or flags 0x%02x/0x%02x",
|
|
|
|
|
GST_READ_UINT16_LE (data), data[2], data[3]);
|
|
|
|
|
bpe = GST_READ_UINT16_LE (data) * 4;
|
|
|
|
|
}
|
|
|
|
|
num = GST_READ_UINT32_LE (&data[4]);
|
|
|
|
|
|
2009-10-13 16:19:32 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "got %d indexes", num);
|
2009-10-13 15:41:13 +00:00
|
|
|
|
|
2011-02-22 13:01:27 +00:00
|
|
|
|
/* this can't work out well ... */
|
|
|
|
|
if (num > G_MAXUINT32 >> 1 || bpe < 8) {
|
|
|
|
|
goto invalid_params;
|
|
|
|
|
}
|
|
|
|
|
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
indexes = g_new (guint64, num + 1);
|
|
|
|
|
for (i = 0; i < num; i++) {
|
2006-08-24 11:21:06 +00:00
|
|
|
|
if (size < 24 + bpe * (i + 1))
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
break;
|
|
|
|
|
indexes[i] = GST_READ_UINT64_LE (&data[24 + bpe * i]);
|
2009-10-13 16:19:32 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "index %d at %" G_GUINT64_FORMAT, i, indexes[i]);
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
indexes[i] = GST_BUFFER_OFFSET_NONE;
|
|
|
|
|
*_indexes = indexes;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
too_small:
|
|
|
|
|
{
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_ERROR_OBJECT (avi,
|
2011-11-21 19:31:31 +00:00
|
|
|
|
"Not enough data to parse superindex (%" G_GSIZE_FORMAT
|
|
|
|
|
" available, 24 needed)", size);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (buf) {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2011-02-22 13:01:27 +00:00
|
|
|
|
invalid_params:
|
|
|
|
|
{
|
|
|
|
|
GST_ERROR_OBJECT (avi, "invalid index parameters (num = %d, bpe = %d)",
|
|
|
|
|
num, bpe);
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2011-02-22 13:01:27 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* add an entry to the index of a stream. @num should be an estimate of the
|
|
|
|
|
* total amount of index entries for all streams and is used to dynamically
|
|
|
|
|
* allocate memory for the index entries. */
|
|
|
|
|
static inline gboolean
|
|
|
|
|
gst_avi_demux_add_index (GstAviDemux * avi, GstAviStream * stream,
|
|
|
|
|
guint num, GstAviIndexEntry * entry)
|
|
|
|
|
{
|
|
|
|
|
/* ensure index memory */
|
|
|
|
|
if (G_UNLIKELY (stream->idx_n >= stream->idx_max)) {
|
2009-09-23 11:57:02 +00:00
|
|
|
|
guint idx_max = stream->idx_max;
|
|
|
|
|
GstAviIndexEntry *new_idx;
|
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* we need to make some more room */
|
2009-09-23 11:57:02 +00:00
|
|
|
|
if (idx_max == 0) {
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* initial size guess, assume each stream has an equal amount of entries,
|
|
|
|
|
* overshoot with at least 8K */
|
2009-09-23 11:57:02 +00:00
|
|
|
|
idx_max = (num / avi->num_streams) + (8192 / sizeof (GstAviIndexEntry));
|
2009-09-23 10:56:07 +00:00
|
|
|
|
} else {
|
2009-09-23 11:57:02 +00:00
|
|
|
|
idx_max += 8192 / sizeof (GstAviIndexEntry);
|
2009-10-01 07:54:55 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "expanded index from %u to %u",
|
2009-09-23 11:57:02 +00:00
|
|
|
|
stream->idx_max, idx_max);
|
2009-09-23 10:56:07 +00:00
|
|
|
|
}
|
2009-09-23 11:57:02 +00:00
|
|
|
|
new_idx = g_try_renew (GstAviIndexEntry, stream->index, idx_max);
|
|
|
|
|
/* out of memory, if this fails stream->index is untouched. */
|
|
|
|
|
if (G_UNLIKELY (!new_idx))
|
2009-09-23 10:56:07 +00:00
|
|
|
|
return FALSE;
|
2009-09-23 11:57:02 +00:00
|
|
|
|
/* use new index */
|
|
|
|
|
stream->index = new_idx;
|
|
|
|
|
stream->idx_max = idx_max;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-23 11:57:02 +00:00
|
|
|
|
/* update entry total and stream stats. The entry total can be converted to
|
|
|
|
|
* the timestamp of the entry easily. */
|
2009-09-23 10:56:07 +00:00
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
2009-09-23 11:57:02 +00:00
|
|
|
|
gint blockalign;
|
|
|
|
|
|
|
|
|
|
if (stream->is_vbr) {
|
|
|
|
|
entry->total = stream->total_blocks;
|
|
|
|
|
} else {
|
|
|
|
|
entry->total = stream->total_bytes;
|
|
|
|
|
}
|
|
|
|
|
blockalign = stream->strf.auds->blockalign;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
if (blockalign > 0)
|
|
|
|
|
stream->total_blocks += DIV_ROUND_UP (entry->size, blockalign);
|
|
|
|
|
else
|
|
|
|
|
stream->total_blocks++;
|
2009-09-23 11:57:02 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (stream->is_vbr) {
|
|
|
|
|
entry->total = stream->idx_n;
|
|
|
|
|
} else {
|
|
|
|
|
entry->total = stream->total_bytes;
|
|
|
|
|
}
|
2009-09-23 10:56:07 +00:00
|
|
|
|
}
|
2009-09-23 11:57:02 +00:00
|
|
|
|
stream->total_bytes += entry->size;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
if (ENTRY_IS_KEYFRAME (entry))
|
|
|
|
|
stream->n_keyframes++;
|
|
|
|
|
|
|
|
|
|
/* and add */
|
|
|
|
|
GST_LOG_OBJECT (avi,
|
|
|
|
|
"Adding stream %u, index entry %d, kf %d, size %u "
|
|
|
|
|
", offset %" G_GUINT64_FORMAT ", total %" G_GUINT64_FORMAT, stream->num,
|
|
|
|
|
stream->idx_n, ENTRY_IS_KEYFRAME (entry), entry->size, entry->offset,
|
|
|
|
|
entry->total);
|
|
|
|
|
stream->index[stream->idx_n++] = *entry;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-23 11:57:02 +00:00
|
|
|
|
/* given @entry_n in @stream, calculate info such as timestamps and
|
|
|
|
|
* offsets for the entry. */
|
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_get_buffer_info (GstAviDemux * avi, GstAviStream * stream,
|
|
|
|
|
guint entry_n, GstClockTime * timestamp, GstClockTime * ts_end,
|
|
|
|
|
guint64 * offset, guint64 * offset_end)
|
|
|
|
|
{
|
|
|
|
|
GstAviIndexEntry *entry;
|
|
|
|
|
|
|
|
|
|
entry = &stream->index[entry_n];
|
|
|
|
|
|
|
|
|
|
if (stream->is_vbr) {
|
|
|
|
|
/* VBR stream next timestamp */
|
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
|
|
|
|
if (timestamp)
|
|
|
|
|
*timestamp =
|
|
|
|
|
avi_stream_convert_frames_to_time_unchecked (stream, entry->total);
|
|
|
|
|
if (ts_end)
|
|
|
|
|
*ts_end = avi_stream_convert_frames_to_time_unchecked (stream,
|
|
|
|
|
entry->total + 1);
|
|
|
|
|
} else {
|
|
|
|
|
if (timestamp)
|
|
|
|
|
*timestamp =
|
|
|
|
|
avi_stream_convert_frames_to_time_unchecked (stream, entry_n);
|
|
|
|
|
if (ts_end)
|
|
|
|
|
*ts_end = avi_stream_convert_frames_to_time_unchecked (stream,
|
|
|
|
|
entry_n + 1);
|
|
|
|
|
}
|
2009-10-18 13:49:29 +00:00
|
|
|
|
} else if (stream->strh->type == GST_RIFF_FCC_auds) {
|
2009-09-23 11:57:02 +00:00
|
|
|
|
/* constant rate stream */
|
|
|
|
|
if (timestamp)
|
|
|
|
|
*timestamp =
|
|
|
|
|
avi_stream_convert_bytes_to_time_unchecked (stream, entry->total);
|
|
|
|
|
if (ts_end)
|
|
|
|
|
*ts_end = avi_stream_convert_bytes_to_time_unchecked (stream,
|
|
|
|
|
entry->total + entry->size);
|
|
|
|
|
}
|
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_vids) {
|
|
|
|
|
/* video offsets are the frame number */
|
|
|
|
|
if (offset)
|
|
|
|
|
*offset = entry_n;
|
|
|
|
|
if (offset_end)
|
|
|
|
|
*offset_end = entry_n + 1;
|
|
|
|
|
} else {
|
|
|
|
|
/* no offsets for audio */
|
|
|
|
|
if (offset)
|
|
|
|
|
*offset = -1;
|
|
|
|
|
if (offset_end)
|
|
|
|
|
*offset_end = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* collect and debug stats about the indexes for all streams.
|
|
|
|
|
* This method is also responsible for filling in the stream duration
|
2009-10-18 13:40:37 +00:00
|
|
|
|
* as measured by the amount of index entries.
|
|
|
|
|
*
|
|
|
|
|
* Returns TRUE if the index is not empty, else FALSE */
|
|
|
|
|
static gboolean
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_avi_demux_do_index_stats (GstAviDemux * avi)
|
|
|
|
|
{
|
2009-10-22 01:09:08 +00:00
|
|
|
|
guint total_idx = 0;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
guint i;
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2009-10-22 01:09:08 +00:00
|
|
|
|
guint total_max = 0;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* get stream stats now */
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!(stream = &avi->stream[i])))
|
|
|
|
|
continue;
|
|
|
|
|
if (G_UNLIKELY (!stream->strh))
|
|
|
|
|
continue;
|
|
|
|
|
if (G_UNLIKELY (!stream->index || stream->idx_n == 0))
|
|
|
|
|
continue;
|
|
|
|
|
|
2009-09-23 11:57:02 +00:00
|
|
|
|
/* we interested in the end_ts of the last entry, which is the total
|
|
|
|
|
* duration of this stream */
|
|
|
|
|
gst_avi_demux_get_buffer_info (avi, stream, stream->idx_n - 1,
|
|
|
|
|
NULL, &stream->idx_duration, NULL, NULL);
|
2009-09-23 10:56:07 +00:00
|
|
|
|
|
|
|
|
|
total_idx += stream->idx_n;
|
2009-10-22 01:09:08 +00:00
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2009-09-23 10:56:07 +00:00
|
|
|
|
total_max += stream->idx_max;
|
|
|
|
|
#endif
|
|
|
|
|
GST_INFO_OBJECT (avi, "Stream %d, dur %" GST_TIME_FORMAT ", %6u entries, "
|
|
|
|
|
"%5u keyframes, entry size = %2u, total size = %10u, allocated %10u",
|
|
|
|
|
i, GST_TIME_ARGS (stream->idx_duration), stream->idx_n,
|
|
|
|
|
stream->n_keyframes, (guint) sizeof (GstAviIndexEntry),
|
|
|
|
|
(guint) (stream->idx_n * sizeof (GstAviIndexEntry)),
|
|
|
|
|
(guint) (stream->idx_max * sizeof (GstAviIndexEntry)));
|
|
|
|
|
}
|
|
|
|
|
total_idx *= sizeof (GstAviIndexEntry);
|
2009-10-22 01:09:08 +00:00
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2009-09-23 10:56:07 +00:00
|
|
|
|
total_max *= sizeof (GstAviIndexEntry);
|
|
|
|
|
#endif
|
|
|
|
|
GST_INFO_OBJECT (avi, "%u bytes for index vs %u ideally, %u wasted",
|
|
|
|
|
total_max, total_idx, total_max - total_idx);
|
2009-10-18 13:40:37 +00:00
|
|
|
|
|
|
|
|
|
if (total_idx == 0) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Index is empty !");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_parse_subindex:
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
* @avi: Avi object
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* @buf: input data to use for parsing.
|
|
|
|
|
* @stream: stream context.
|
|
|
|
|
* @entries_list: a list (returned by the function) containing all the
|
|
|
|
|
* indexes parsed in this specific subindex. The first
|
|
|
|
|
* entry is also a pointer to allocated memory that needs
|
|
|
|
|
* to be free´ed. May be NULL if no supported indexes were
|
|
|
|
|
* found.
|
|
|
|
|
*
|
|
|
|
|
* Reads superindex (openDML-2 spec stuff) from the provided data.
|
2009-09-18 11:22:02 +00:00
|
|
|
|
* The buffer should contain a GST_RIFF_TAG_ix?? chunk.
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: TRUE on success, FALSE otherwise. Errors are fatal, we
|
|
|
|
|
* throw an error, caller should bail out asap.
|
|
|
|
|
*/
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
static gboolean
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_avi_demux_parse_subindex (GstAviDemux * avi, GstAviStream * stream,
|
|
|
|
|
GstBuffer * buf)
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
{
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
guint8 *data;
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
guint16 bpe;
|
|
|
|
|
guint32 num, i;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
guint64 baseoff;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (buf == NULL)
|
2009-09-23 10:56:07 +00:00
|
|
|
|
return TRUE;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
data = map.data;
|
|
|
|
|
|
2006-08-24 11:21:06 +00:00
|
|
|
|
/* check size */
|
2012-01-23 16:25:37 +00:00
|
|
|
|
if (map.size < 24)
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto too_small;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
/* We don't support index-data yet */
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
if (data[3] & 0x80)
|
|
|
|
|
goto not_implemented;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
/* check type of index. The opendml2 specs state that
|
|
|
|
|
* there should be 4 dwords per array entry. Type can be
|
|
|
|
|
* either frame or field (and we don't care). */
|
|
|
|
|
bpe = (data[2] & 0x01) ? 12 : 8;
|
|
|
|
|
if (GST_READ_UINT16_LE (data) != bpe / 4 ||
|
|
|
|
|
(data[2] & 0xfe) != 0x0 || data[3] != 0x1) {
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
"Superindex for stream %d has unexpected "
|
|
|
|
|
"size_entry %d (bytes) or flags 0x%02x/0x%02x",
|
2006-10-05 16:37:33 +00:00
|
|
|
|
stream->num, GST_READ_UINT16_LE (data), data[2], data[3]);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
bpe = GST_READ_UINT16_LE (data) * 4;
|
|
|
|
|
}
|
|
|
|
|
num = GST_READ_UINT32_LE (&data[4]);
|
|
|
|
|
baseoff = GST_READ_UINT64_LE (&data[12]);
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2008-02-04 12:07:14 +00:00
|
|
|
|
/* If there's nothing, just return ! */
|
|
|
|
|
if (num == 0)
|
2009-09-23 10:56:07 +00:00
|
|
|
|
goto empty_index;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
2009-09-18 11:22:02 +00:00
|
|
|
|
GST_INFO_OBJECT (avi, "Parsing subindex, nr_entries = %6d", num);
|
|
|
|
|
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
for (i = 0; i < num; i++) {
|
2009-09-23 10:56:07 +00:00
|
|
|
|
GstAviIndexEntry entry;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
if (map.size < 24 + bpe * (i + 1))
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
break;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* fill in offset and size. offset contains the keyframe flag in the
|
|
|
|
|
* upper bit*/
|
|
|
|
|
entry.offset = baseoff + GST_READ_UINT32_LE (&data[24 + bpe * i]);
|
|
|
|
|
entry.size = GST_READ_UINT32_LE (&data[24 + bpe * i + 4]);
|
|
|
|
|
/* handle flags */
|
2009-09-18 11:22:02 +00:00
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
|
|
|
|
/* all audio frames are keyframes */
|
2009-09-23 10:56:07 +00:00
|
|
|
|
ENTRY_SET_KEYFRAME (&entry);
|
gst/avi/gstavidemux.*: Some cleanups, prepare to use GstSegment.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_next), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_subindex),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Some cleanups, prepare to use GstSegment.
Fix error in entry walking code.
Fix VBR detection.
Smarter timestamp calculation code.
Uniform error/eos handling.
2006-05-12 18:04:22 +00:00
|
|
|
|
} else {
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* else read flags */
|
|
|
|
|
entry.flags = (entry.size & 0x80000000) ? 0 : GST_AVI_KEYFRAME;
|
2008-10-08 13:31:44 +00:00
|
|
|
|
}
|
2009-09-23 10:56:07 +00:00
|
|
|
|
entry.size &= ~0x80000000;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* and add */
|
|
|
|
|
if (G_UNLIKELY (!gst_avi_demux_add_index (avi, stream, num, &entry)))
|
|
|
|
|
goto out_of_mem;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
2011-04-04 17:17:43 +00:00
|
|
|
|
done:
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
too_small:
|
|
|
|
|
{
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_ERROR_OBJECT (avi,
|
2011-11-21 19:31:31 +00:00
|
|
|
|
"Not enough data to parse subindex (%" G_GSIZE_FORMAT
|
2012-01-23 16:25:37 +00:00
|
|
|
|
" available, 24 needed)", map.size);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
goto done; /* continue */
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
}
|
|
|
|
|
not_implemented:
|
|
|
|
|
{
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, NOT_IMPLEMENTED, (NULL),
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
("Subindex-is-data is not implemented"));
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2009-09-23 10:56:07 +00:00
|
|
|
|
empty_index:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "the index is empty");
|
2011-04-04 17:17:43 +00:00
|
|
|
|
goto done; /* continue */
|
2009-09-23 10:56:07 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
out_of_mem:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, RESOURCE, NO_SPACE_LEFT, (NULL),
|
2007-03-10 12:30:48 +00:00
|
|
|
|
("Cannot allocate memory for %u*%u=%u bytes",
|
2009-09-23 10:56:07 +00:00
|
|
|
|
(guint) sizeof (GstAviIndexEntry), num,
|
|
|
|
|
(guint) sizeof (GstAviIndexEntry) * num));
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/*
|
|
|
|
|
* Create and push a flushing seek event upstream
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
2010-01-18 16:13:06 +00:00
|
|
|
|
perform_seek_to_offset (GstAviDemux * demux, guint64 offset)
|
2009-12-04 14:13:12 +00:00
|
|
|
|
{
|
|
|
|
|
GstEvent *event;
|
|
|
|
|
gboolean res = 0;
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "Seeking to %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
|
|
|
|
event =
|
|
|
|
|
gst_event_new_seek (1.0, GST_FORMAT_BYTES,
|
|
|
|
|
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, GST_SEEK_TYPE_SET, offset,
|
|
|
|
|
GST_SEEK_TYPE_NONE, -1);
|
|
|
|
|
|
|
|
|
|
res = gst_pad_push_event (demux->sinkpad, event);
|
|
|
|
|
|
|
|
|
|
if (res)
|
|
|
|
|
demux->offset = offset;
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
|
|
|
|
* Read AVI index when streaming
|
|
|
|
|
*/
|
2009-12-04 14:13:12 +00:00
|
|
|
|
static gboolean
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_avi_demux_read_subindexes_push (GstAviDemux * avi)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
{
|
|
|
|
|
guint32 tag = 0, size;
|
|
|
|
|
GstBuffer *buf = NULL;
|
2010-01-18 16:13:06 +00:00
|
|
|
|
guint odml_stream;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "read subindexes for %d streams", avi->num_streams);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (avi->odml_subidxs[avi->odml_subidx] != avi->offset)
|
|
|
|
|
return FALSE;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (!gst_avi_demux_peek_chunk (avi, &tag, &size))
|
|
|
|
|
return TRUE;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
/* this is the ODML chunk we expect */
|
|
|
|
|
odml_stream = avi->odml_stream;
|
|
|
|
|
|
|
|
|
|
if ((tag != GST_MAKE_FOURCC ('i', 'x', '0' + odml_stream / 10,
|
|
|
|
|
'0' + odml_stream % 10)) &&
|
|
|
|
|
(tag != GST_MAKE_FOURCC ('0' + odml_stream / 10,
|
|
|
|
|
'0' + odml_stream % 10, 'i', 'x'))) {
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi, "Not an ix## chunk (%" GST_FOURCC_FORMAT ")",
|
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
|
|
|
|
/* flush chunk header so we get just the 'size' payload data */
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8);
|
|
|
|
|
buf = gst_adapter_take_buffer (avi->adapter, size);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
if (!gst_avi_demux_parse_subindex (avi, &avi->stream[odml_stream], buf))
|
2009-12-04 14:13:12 +00:00
|
|
|
|
return FALSE;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
/* we parsed the index, go to next subindex */
|
|
|
|
|
avi->odml_subidx++;
|
|
|
|
|
|
|
|
|
|
if (avi->odml_subidxs[avi->odml_subidx] == GST_BUFFER_OFFSET_NONE) {
|
|
|
|
|
/* we reached the end of the indexes for this stream, move to the next
|
|
|
|
|
* stream to handle the first index */
|
|
|
|
|
avi->odml_stream++;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi->odml_subidx = 0;
|
2010-01-18 16:13:06 +00:00
|
|
|
|
|
|
|
|
|
if (avi->odml_stream < avi->num_streams) {
|
|
|
|
|
/* there are more indexes */
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi->odml_subidxs = avi->stream[avi->odml_stream].indexes;
|
|
|
|
|
} else {
|
2010-01-18 16:13:06 +00:00
|
|
|
|
/* we're done, get stream stats now */
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi->have_index = gst_avi_demux_do_index_stats (avi);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
/* seek to next index */
|
|
|
|
|
return perform_seek_to_offset (avi, avi->odml_subidxs[avi->odml_subidx]);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Read AVI index
|
|
|
|
|
*/
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
static void
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_avi_demux_read_subindexes_pull (GstAviDemux * avi)
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
{
|
|
|
|
|
guint32 tag;
|
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
gint i, n;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "read subindexes for %d streams", avi->num_streams);
|
2006-07-25 13:14:05 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
for (n = 0; n < avi->num_streams; n++) {
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream = &avi->stream[n];
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2010-01-21 16:57:36 +00:00
|
|
|
|
if (stream->indexes == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
for (i = 0; stream->indexes[i] != GST_BUFFER_OFFSET_NONE; i++) {
|
2009-09-23 10:56:07 +00:00
|
|
|
|
if (gst_riff_read_chunk (GST_ELEMENT_CAST (avi), avi->sinkpad,
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
&stream->indexes[i], &tag, &buf) != GST_FLOW_OK)
|
|
|
|
|
continue;
|
2008-08-16 14:54:56 +00:00
|
|
|
|
else if ((tag != GST_MAKE_FOURCC ('i', 'x', '0' + stream->num / 10,
|
|
|
|
|
'0' + stream->num % 10)) &&
|
|
|
|
|
(tag != GST_MAKE_FOURCC ('0' + stream->num / 10,
|
|
|
|
|
'0' + stream->num % 10, 'i', 'x'))) {
|
|
|
|
|
/* Some ODML files (created by god knows what muxer) have a ##ix format
|
|
|
|
|
* instead of the 'official' ix##. They are still valid though. */
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi, "Not an ix## chunk (%" GST_FOURCC_FORMAT ")",
|
2005-11-21 13:38:24 +00:00
|
|
|
|
GST_FOURCC_ARGS (tag));
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-23 10:56:07 +00:00
|
|
|
|
if (!gst_avi_demux_parse_subindex (avi, stream, buf))
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
continue;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (stream->indexes);
|
|
|
|
|
stream->indexes = NULL;
|
|
|
|
|
}
|
2009-09-23 10:56:07 +00:00
|
|
|
|
/* get stream stats now */
|
2009-10-18 13:40:37 +00:00
|
|
|
|
avi->have_index = gst_avi_demux_do_index_stats (avi);
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-29 19:52:51 +00:00
|
|
|
|
/*
|
|
|
|
|
* gst_avi_demux_riff_parse_vprp:
|
|
|
|
|
* @element: caller element (used for debugging/error).
|
|
|
|
|
* @buf: input data to be used for parsing, stripped from header.
|
|
|
|
|
* @vprp: a pointer (returned by this function) to a filled-in vprp
|
|
|
|
|
* structure. Caller should free it.
|
|
|
|
|
*
|
|
|
|
|
* Parses a video stream´s vprp. This function takes ownership of @buf.
|
|
|
|
|
*
|
|
|
|
|
* Returns: TRUE if parsing succeeded, otherwise FALSE. The stream
|
|
|
|
|
* should be skipped on error, but it is not fatal.
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
gst_avi_demux_riff_parse_vprp (GstElement * element,
|
|
|
|
|
GstBuffer * buf, gst_riff_vprp ** _vprp)
|
|
|
|
|
{
|
|
|
|
|
gst_riff_vprp *vprp;
|
|
|
|
|
gint k;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gsize size;
|
2008-06-29 19:52:51 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (buf != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (_vprp != NULL, FALSE);
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
size = gst_buffer_get_size (buf);
|
|
|
|
|
|
|
|
|
|
if (size < G_STRUCT_OFFSET (gst_riff_vprp, field_info))
|
2008-06-29 19:52:51 +00:00
|
|
|
|
goto too_small;
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
vprp = g_malloc (size);
|
|
|
|
|
gst_buffer_extract (buf, 0, vprp, size);
|
2008-06-29 19:52:51 +00:00
|
|
|
|
|
|
|
|
|
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
|
|
|
|
vprp->format_token = GUINT32_FROM_LE (vprp->format_token);
|
|
|
|
|
vprp->standard = GUINT32_FROM_LE (vprp->standard);
|
|
|
|
|
vprp->vert_rate = GUINT32_FROM_LE (vprp->vert_rate);
|
|
|
|
|
vprp->hor_t_total = GUINT32_FROM_LE (vprp->hor_t_total);
|
|
|
|
|
vprp->vert_lines = GUINT32_FROM_LE (vprp->vert_lines);
|
|
|
|
|
vprp->aspect = GUINT32_FROM_LE (vprp->aspect);
|
|
|
|
|
vprp->width = GUINT32_FROM_LE (vprp->width);
|
|
|
|
|
vprp->height = GUINT32_FROM_LE (vprp->height);
|
|
|
|
|
vprp->fields = GUINT32_FROM_LE (vprp->fields);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* size checking */
|
|
|
|
|
/* calculate fields based on size */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
k = (size - G_STRUCT_OFFSET (gst_riff_vprp, field_info)) / vprp->fields;
|
2008-06-29 19:52:51 +00:00
|
|
|
|
if (vprp->fields > k) {
|
|
|
|
|
GST_WARNING_OBJECT (element,
|
|
|
|
|
"vprp header indicated %d fields, only %d available", vprp->fields, k);
|
|
|
|
|
vprp->fields = k;
|
|
|
|
|
}
|
|
|
|
|
if (vprp->fields > GST_RIFF_VPRP_VIDEO_FIELDS) {
|
|
|
|
|
GST_WARNING_OBJECT (element,
|
|
|
|
|
"vprp header indicated %d fields, at most %d supported", vprp->fields,
|
|
|
|
|
GST_RIFF_VPRP_VIDEO_FIELDS);
|
|
|
|
|
vprp->fields = GST_RIFF_VPRP_VIDEO_FIELDS;
|
|
|
|
|
}
|
|
|
|
|
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
|
|
|
|
for (k = 0; k < vprp->fields; k++) {
|
|
|
|
|
gst_riff_vprp_video_field_desc *fd;
|
|
|
|
|
|
2008-07-14 13:02:48 +00:00
|
|
|
|
fd = &vprp->field_info[k];
|
2008-06-29 19:52:51 +00:00
|
|
|
|
fd->compressed_bm_height = GUINT32_FROM_LE (fd->compressed_bm_height);
|
|
|
|
|
fd->compressed_bm_width = GUINT32_FROM_LE (fd->compressed_bm_width);
|
|
|
|
|
fd->valid_bm_height = GUINT32_FROM_LE (fd->valid_bm_height);
|
|
|
|
|
fd->valid_bm_width = GUINT16_FROM_LE (fd->valid_bm_width);
|
|
|
|
|
fd->valid_bm_x_offset = GUINT16_FROM_LE (fd->valid_bm_x_offset);
|
|
|
|
|
fd->valid_bm_y_offset = GUINT32_FROM_LE (fd->valid_bm_y_offset);
|
|
|
|
|
fd->video_x_t_offset = GUINT32_FROM_LE (fd->video_x_t_offset);
|
|
|
|
|
fd->video_y_start = GUINT32_FROM_LE (fd->video_y_start);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* debug */
|
|
|
|
|
GST_INFO_OBJECT (element, "vprp tag found in context vids:");
|
|
|
|
|
GST_INFO_OBJECT (element, " format_token %d", vprp->format_token);
|
|
|
|
|
GST_INFO_OBJECT (element, " standard %d", vprp->standard);
|
|
|
|
|
GST_INFO_OBJECT (element, " vert_rate %d", vprp->vert_rate);
|
|
|
|
|
GST_INFO_OBJECT (element, " hor_t_total %d", vprp->hor_t_total);
|
|
|
|
|
GST_INFO_OBJECT (element, " vert_lines %d", vprp->vert_lines);
|
|
|
|
|
GST_INFO_OBJECT (element, " aspect %d:%d", vprp->aspect >> 16,
|
|
|
|
|
vprp->aspect & 0xffff);
|
|
|
|
|
GST_INFO_OBJECT (element, " width %d", vprp->width);
|
|
|
|
|
GST_INFO_OBJECT (element, " height %d", vprp->height);
|
|
|
|
|
GST_INFO_OBJECT (element, " fields %d", vprp->fields);
|
|
|
|
|
for (k = 0; k < vprp->fields; k++) {
|
|
|
|
|
gst_riff_vprp_video_field_desc *fd;
|
|
|
|
|
|
|
|
|
|
fd = &(vprp->field_info[k]);
|
|
|
|
|
GST_INFO_OBJECT (element, " field %u description:", k);
|
|
|
|
|
GST_INFO_OBJECT (element, " compressed_bm_height %d",
|
|
|
|
|
fd->compressed_bm_height);
|
|
|
|
|
GST_INFO_OBJECT (element, " compressed_bm_width %d",
|
|
|
|
|
fd->compressed_bm_width);
|
|
|
|
|
GST_INFO_OBJECT (element, " valid_bm_height %d",
|
|
|
|
|
fd->valid_bm_height);
|
|
|
|
|
GST_INFO_OBJECT (element, " valid_bm_width %d", fd->valid_bm_width);
|
|
|
|
|
GST_INFO_OBJECT (element, " valid_bm_x_offset %d",
|
|
|
|
|
fd->valid_bm_x_offset);
|
|
|
|
|
GST_INFO_OBJECT (element, " valid_bm_y_offset %d",
|
|
|
|
|
fd->valid_bm_y_offset);
|
|
|
|
|
GST_INFO_OBJECT (element, " video_x_t_offset %d",
|
|
|
|
|
fd->video_x_t_offset);
|
|
|
|
|
GST_INFO_OBJECT (element, " video_y_start %d", fd->video_y_start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
|
|
*_vprp = vprp;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
too_small:
|
|
|
|
|
{
|
|
|
|
|
GST_ERROR_OBJECT (element,
|
2011-11-21 19:31:31 +00:00
|
|
|
|
"Too small vprp (%" G_GSIZE_FORMAT " available, at least %d needed)",
|
2011-04-04 17:17:43 +00:00
|
|
|
|
size, (int) G_STRUCT_OFFSET (gst_riff_vprp, field_info));
|
2008-06-29 19:52:51 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-18 13:46:48 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_expose_streams (GstAviDemux * avi, gboolean force)
|
|
|
|
|
{
|
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "force : %d", force);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
GstAviStream *stream = &avi->stream[i];
|
|
|
|
|
|
|
|
|
|
if (force || stream->idx_n != 0) {
|
2012-10-22 09:55:22 +00:00
|
|
|
|
GST_LOG_OBJECT (avi, "Adding pad %s", GST_PAD_NAME (stream->pad));
|
2009-10-18 13:46:48 +00:00
|
|
|
|
gst_element_add_pad ((GstElement *) avi, stream->pad);
|
2011-02-17 15:56:29 +00:00
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2011-02-17 15:56:29 +00:00
|
|
|
|
if (avi->element_index)
|
|
|
|
|
gst_index_get_writer_id (avi->element_index,
|
|
|
|
|
GST_OBJECT_CAST (stream->pad), &stream->index_id);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2011-02-17 15:56:29 +00:00
|
|
|
|
|
2009-10-18 13:46:48 +00:00
|
|
|
|
stream->exposed = TRUE;
|
2009-10-18 13:48:06 +00:00
|
|
|
|
if (avi->main_stream == -1)
|
|
|
|
|
avi->main_stream = i;
|
2009-10-18 13:46:48 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Stream #%d doesn't have any entry, removing it",
|
|
|
|
|
i);
|
|
|
|
|
gst_avi_demux_reset_stream (avi, stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-26 09:15:49 +00:00
|
|
|
|
/* buf contains LIST chunk data, and will be padded to even size,
|
|
|
|
|
* since some buggy files do not account for the padding of chunks
|
|
|
|
|
* within a LIST in the size of the LIST */
|
|
|
|
|
static inline void
|
|
|
|
|
gst_avi_demux_roundup_list (GstAviDemux * avi, GstBuffer ** buf)
|
|
|
|
|
{
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gsize size;
|
|
|
|
|
|
|
|
|
|
size = gst_buffer_get_size (*buf);
|
|
|
|
|
|
|
|
|
|
if (G_UNLIKELY (size & 1)) {
|
2010-10-26 09:15:49 +00:00
|
|
|
|
GstBuffer *obuf;
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2010-10-26 09:15:49 +00:00
|
|
|
|
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "rounding up dubious list size %" G_GSIZE_FORMAT,
|
|
|
|
|
size);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
obuf = gst_buffer_new_and_alloc (size + 1);
|
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (obuf, &map, GST_MAP_WRITE);
|
|
|
|
|
gst_buffer_extract (*buf, 0, map.data, size);
|
2011-05-18 10:52:31 +00:00
|
|
|
|
/* assume 0 padding, at least makes outcome deterministic */
|
2012-01-23 16:25:37 +00:00
|
|
|
|
map.data[size] = 0;
|
|
|
|
|
gst_buffer_unmap (obuf, &map);
|
2010-10-26 09:15:49 +00:00
|
|
|
|
gst_buffer_replace (buf, obuf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-28 16:56:19 +00:00
|
|
|
|
static GstCaps *
|
2012-10-16 00:02:11 +00:00
|
|
|
|
gst_avi_demux_check_caps (GstAviDemux * avi, GstCaps * caps,
|
|
|
|
|
GstBuffer ** rgb8_palette)
|
2012-08-28 16:56:19 +00:00
|
|
|
|
{
|
|
|
|
|
GstStructure *s;
|
|
|
|
|
const GValue *val;
|
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
2012-10-16 00:02:11 +00:00
|
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
|
|
2012-08-28 16:56:19 +00:00
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
2012-10-16 00:02:11 +00:00
|
|
|
|
if (gst_structure_has_name (s, "video/x-raw") &&
|
|
|
|
|
gst_structure_has_field_typed (s, "palette_data", GST_TYPE_BUFFER)) {
|
|
|
|
|
gst_structure_get (s, "palette_data", GST_TYPE_BUFFER, rgb8_palette, NULL);
|
|
|
|
|
gst_structure_remove_field (s, "palette_data");
|
|
|
|
|
return caps;
|
|
|
|
|
} else if (!gst_structure_has_name (s, "video/x-h264")) {
|
2012-08-28 16:56:19 +00:00
|
|
|
|
return caps;
|
2012-10-16 00:02:11 +00:00
|
|
|
|
}
|
2012-08-28 16:56:19 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "checking caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
|
|
|
|
/* some muxers put invalid bytestream stuff in h264 extra data */
|
|
|
|
|
val = gst_structure_get_value (s, "codec_data");
|
|
|
|
|
if (val && (buf = gst_value_get_buffer (val))) {
|
|
|
|
|
guint8 *data;
|
|
|
|
|
gint size;
|
|
|
|
|
GstMapInfo map;
|
|
|
|
|
|
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
data = map.data;
|
|
|
|
|
size = map.size;
|
|
|
|
|
if (size >= 4) {
|
|
|
|
|
guint32 h = GST_READ_UINT32_BE (data);
|
|
|
|
|
gst_buffer_unmap (buf, &map);
|
|
|
|
|
if (h == 0x01) {
|
|
|
|
|
/* can hardly be valid AVC codec data */
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"discarding invalid codec_data containing byte-stream");
|
|
|
|
|
/* so do not pretend to downstream that it is packetized avc */
|
|
|
|
|
gst_structure_remove_field (s, "codec_data");
|
|
|
|
|
/* ... but rather properly parsed bytestream */
|
|
|
|
|
gst_structure_set (s, "stream-format", G_TYPE_STRING, "byte-stream",
|
|
|
|
|
"alignment", G_TYPE_STRING, "au", NULL);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
gst_buffer_unmap (buf, &map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_parse_stream:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
* @avi: calling element (used for debugging/errors).
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* @buf: input buffer used to parse the stream.
|
|
|
|
|
*
|
|
|
|
|
* Parses all subchunks in a strl chunk (which defines a single
|
|
|
|
|
* stream). Discards the buffer after use. This function will
|
|
|
|
|
* increment the stream counter internally.
|
|
|
|
|
*
|
|
|
|
|
* Returns: whether the stream was identified successfully.
|
|
|
|
|
* Errors are not fatal. It does indicate the stream
|
|
|
|
|
* was skipped.
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GstElementClass *klass;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GstPadTemplate *templ;
|
|
|
|
|
GstBuffer *sub = NULL;
|
|
|
|
|
guint offset = 4;
|
|
|
|
|
guint32 tag = 0;
|
|
|
|
|
gchar *codec_name = NULL, *padname = NULL;
|
|
|
|
|
const gchar *tag_name;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
GstCaps *caps = NULL;
|
|
|
|
|
GstPad *pad;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GstElement *element;
|
2008-06-29 19:52:51 +00:00
|
|
|
|
gboolean got_strh = FALSE, got_strf = FALSE, got_vprp = FALSE;
|
|
|
|
|
gst_riff_vprp *vprp = NULL;
|
2012-08-04 10:47:44 +00:00
|
|
|
|
gchar *stream_id;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
|
|
|
|
|
element = GST_ELEMENT_CAST (avi);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Parsing stream");
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
2010-10-26 09:15:49 +00:00
|
|
|
|
gst_avi_demux_roundup_list (avi, &buf);
|
|
|
|
|
|
2009-08-04 09:37:16 +00:00
|
|
|
|
if (avi->num_streams >= GST_AVI_DEMUX_MAX_STREAMS) {
|
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"maximum no of streams (%d) exceeded, ignoring stream",
|
|
|
|
|
GST_AVI_DEMUX_MAX_STREAMS);
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
/* not a fatal error, let's say */
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stream = &avi->stream[avi->num_streams];
|
|
|
|
|
|
2009-08-04 10:16:13 +00:00
|
|
|
|
/* initial settings */
|
|
|
|
|
stream->idx_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
stream->hdr_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
stream->duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
while (gst_riff_parse_chunk (element, buf, &offset, &tag, &sub)) {
|
2006-04-10 10:10:55 +00:00
|
|
|
|
/* sub can be NULL if the chunk is empty */
|
2009-08-04 09:39:39 +00:00
|
|
|
|
if (sub == NULL) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "ignoring empty chunk %" GST_FOURCC_FORMAT,
|
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
switch (tag) {
|
2007-03-08 16:01:42 +00:00
|
|
|
|
case GST_RIFF_TAG_strh:
|
2009-08-04 10:16:13 +00:00
|
|
|
|
{
|
|
|
|
|
gst_riff_strh *strh;
|
|
|
|
|
|
2007-03-08 16:01:42 +00:00
|
|
|
|
if (got_strh) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Ignoring additional strh chunk");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!gst_riff_parse_strh (element, sub, &stream->strh)) {
|
2009-08-04 09:39:39 +00:00
|
|
|
|
/* ownership given away */
|
|
|
|
|
sub = NULL;
|
2007-03-08 16:01:42 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi, "Failed to parse strh chunk");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2009-08-04 10:16:13 +00:00
|
|
|
|
strh = stream->strh;
|
2009-07-29 13:25:38 +00:00
|
|
|
|
/* sanity check; stream header frame rate matches global header
|
|
|
|
|
* frame duration */
|
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_vids) {
|
|
|
|
|
GstClockTime s_dur;
|
|
|
|
|
GstClockTime h_dur = avi->avih->us_frame * GST_USECOND;
|
|
|
|
|
|
|
|
|
|
s_dur = gst_util_uint64_scale (GST_SECOND, strh->scale, strh->rate);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "verifying stream framerate %d/%d, "
|
|
|
|
|
"frame duration = %d ms", strh->rate, strh->scale,
|
2009-09-22 13:03:20 +00:00
|
|
|
|
(gint) (s_dur / GST_MSECOND));
|
2009-07-29 13:25:38 +00:00
|
|
|
|
if (h_dur > (10 * GST_MSECOND) && (s_dur > 10 * h_dur)) {
|
|
|
|
|
strh->rate = GST_SECOND / GST_USECOND;
|
|
|
|
|
strh->scale = h_dur / GST_USECOND;
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "correcting stream framerate to %d/%d",
|
|
|
|
|
strh->rate, strh->scale);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* determine duration as indicated by header */
|
2009-08-04 10:16:13 +00:00
|
|
|
|
stream->hdr_duration = gst_util_uint64_scale ((guint64) strh->length *
|
|
|
|
|
strh->scale, GST_SECOND, (guint64) strh->rate);
|
|
|
|
|
GST_INFO ("Stream duration according to header: %" GST_TIME_FORMAT,
|
|
|
|
|
GST_TIME_ARGS (stream->hdr_duration));
|
|
|
|
|
if (stream->hdr_duration == 0)
|
|
|
|
|
stream->hdr_duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
2007-03-08 16:01:42 +00:00
|
|
|
|
got_strh = TRUE;
|
|
|
|
|
break;
|
2009-08-04 10:16:13 +00:00
|
|
|
|
}
|
2007-03-08 16:01:42 +00:00
|
|
|
|
case GST_RIFF_TAG_strf:
|
|
|
|
|
{
|
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
|
|
|
|
|
if (got_strf) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Ignoring additional strf chunk");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!got_strh) {
|
|
|
|
|
GST_ERROR_OBJECT (avi, "Found strf chunk before strh chunk");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
switch (stream->strh->type) {
|
|
|
|
|
case GST_RIFF_FCC_vids:
|
|
|
|
|
stream->is_vbr = TRUE;
|
|
|
|
|
res = gst_riff_parse_strf_vids (element, sub,
|
|
|
|
|
&stream->strf.vids, &stream->extradata);
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2007-03-08 16:01:42 +00:00
|
|
|
|
GST_DEBUG_OBJECT (element, "marking video as VBR, res %d", res);
|
|
|
|
|
break;
|
|
|
|
|
case GST_RIFF_FCC_auds:
|
|
|
|
|
res =
|
|
|
|
|
gst_riff_parse_strf_auds (element, sub, &stream->strf.auds,
|
|
|
|
|
&stream->extradata);
|
2011-02-22 13:00:11 +00:00
|
|
|
|
sub = NULL;
|
|
|
|
|
if (!res)
|
|
|
|
|
break;
|
2010-06-16 13:40:34 +00:00
|
|
|
|
stream->is_vbr = (stream->strh->samplesize == 0)
|
|
|
|
|
&& stream->strh->scale > 1
|
|
|
|
|
&& stream->strf.auds->blockalign != 1;
|
2007-03-08 16:01:42 +00:00
|
|
|
|
GST_DEBUG_OBJECT (element, "marking audio as VBR:%d, res %d",
|
|
|
|
|
stream->is_vbr, res);
|
2010-03-11 14:02:48 +00:00
|
|
|
|
/* we need these or we have no way to come up with timestamps */
|
2010-03-24 15:19:53 +00:00
|
|
|
|
if ((!stream->is_vbr && !stream->strf.auds->av_bps) ||
|
|
|
|
|
(stream->is_vbr && (!stream->strh->scale ||
|
2010-03-18 10:33:59 +00:00
|
|
|
|
!stream->strh->rate))) {
|
2010-03-11 14:02:48 +00:00
|
|
|
|
GST_WARNING_OBJECT (element,
|
|
|
|
|
"invalid audio header, ignoring stream");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2010-07-07 12:16:59 +00:00
|
|
|
|
/* some more sanity checks */
|
|
|
|
|
if (stream->is_vbr) {
|
|
|
|
|
if (stream->strf.auds->blockalign <= 4) {
|
|
|
|
|
/* that would mean (too) many frames per chunk,
|
|
|
|
|
* so not likely set as expected */
|
|
|
|
|
GST_DEBUG_OBJECT (element,
|
|
|
|
|
"suspicious blockalign %d for VBR audio; "
|
|
|
|
|
"overriding to 1 frame per chunk",
|
|
|
|
|
stream->strf.auds->blockalign);
|
|
|
|
|
/* this should top any likely value */
|
|
|
|
|
stream->strf.auds->blockalign = (1 << 12);
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-08 16:01:42 +00:00
|
|
|
|
break;
|
|
|
|
|
case GST_RIFF_FCC_iavs:
|
|
|
|
|
stream->is_vbr = TRUE;
|
|
|
|
|
res = gst_riff_parse_strf_iavs (element, sub,
|
|
|
|
|
&stream->strf.iavs, &stream->extradata);
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2007-03-08 16:01:42 +00:00
|
|
|
|
GST_DEBUG_OBJECT (element, "marking iavs as VBR, res %d", res);
|
|
|
|
|
break;
|
2007-05-30 14:38:59 +00:00
|
|
|
|
case GST_RIFF_FCC_txts:
|
|
|
|
|
/* nothing to parse here */
|
|
|
|
|
stream->is_vbr = (stream->strh->samplesize == 0)
|
|
|
|
|
&& (stream->strh->scale > 1);
|
|
|
|
|
res = TRUE;
|
|
|
|
|
break;
|
2007-03-08 16:01:42 +00:00
|
|
|
|
default:
|
|
|
|
|
GST_ERROR_OBJECT (avi,
|
|
|
|
|
"Don´t know how to handle stream type %" GST_FOURCC_FORMAT,
|
|
|
|
|
GST_FOURCC_ARGS (stream->strh->type));
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-08-04 09:39:39 +00:00
|
|
|
|
if (sub) {
|
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
sub = NULL;
|
|
|
|
|
}
|
2007-03-08 16:01:42 +00:00
|
|
|
|
if (!res)
|
|
|
|
|
goto fail;
|
|
|
|
|
got_strf = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2008-06-29 19:52:51 +00:00
|
|
|
|
case GST_RIFF_TAG_vprp:
|
|
|
|
|
{
|
|
|
|
|
if (got_vprp) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Ignoring additional vprp chunk");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!got_strh) {
|
|
|
|
|
GST_ERROR_OBJECT (avi, "Found vprp chunk before strh chunk");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
if (!got_strf) {
|
|
|
|
|
GST_ERROR_OBJECT (avi, "Found vprp chunk before strf chunk");
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!gst_avi_demux_riff_parse_vprp (element, sub, &vprp)) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Failed to parse vprp chunk");
|
|
|
|
|
/* not considered fatal */
|
|
|
|
|
g_free (vprp);
|
|
|
|
|
vprp = NULL;
|
|
|
|
|
} else
|
|
|
|
|
got_vprp = TRUE;
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2008-06-29 19:52:51 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
gst/: Add MS RLE support. I added some functions to read out strf chunks into strf chunks and the data behind it. Thi...
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* gst-libs/gst/riff/riff-media.c:
(gst_riff_create_video_caps_with_data),
(gst_riff_create_video_caps), (gst_riff_create_audio_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst-libs/gst/riff/riff-read.c:
(gst_riff_read_strf_vids_with_data), (gst_riff_read_strf_vids):
* gst-libs/gst/riff/riff-read.h:
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
Add MS RLE support. I added some functions to read out strf chunks
into strf chunks and the data behind it. This is usually color
palettes (as in RLE, but also in 8-bit RGB). Also use those during
caps creation. Lastly, add ADPCM (similar to wavparse - which
should eventually be rifflib based).
* gst/matroska/matroska-demux.c: (gst_matroska_demux_class_init),
(gst_matroska_demux_init), (gst_matroska_demux_reset):
* gst/matroska/matroska-demux.h:
Remove placeholders for some prehistoric tagging system. Didn't add
support for any tag system really anyway.
* gst/qtdemux/qtdemux.c:
Add support for audio/x-m4a (MPEG-4) through spider.
* gst/wavparse/gstwavparse.c: (gst_wavparse_parse_fmt),
(gst_wavparse_loop):
ADPCM support (#135862). Increase max. buffer size because we
cannot split buffers for ADPCM (screws references) and I've seen
files with 2048 byte chunks. 4096 seems safe for now.
2004-04-16 01:20:44 +00:00
|
|
|
|
case GST_RIFF_TAG_strd:
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
if (stream->initdata)
|
|
|
|
|
gst_buffer_unref (stream->initdata);
|
|
|
|
|
stream->initdata = sub;
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
gst/: Add MS RLE support. I added some functions to read out strf chunks into strf chunks and the data behind it. Thi...
Original commit message from CVS:
reviewed by: <delete if not using a buddy>
* gst-libs/gst/riff/riff-media.c:
(gst_riff_create_video_caps_with_data),
(gst_riff_create_video_caps), (gst_riff_create_audio_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst-libs/gst/riff/riff-read.c:
(gst_riff_read_strf_vids_with_data), (gst_riff_read_strf_vids):
* gst-libs/gst/riff/riff-read.h:
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
Add MS RLE support. I added some functions to read out strf chunks
into strf chunks and the data behind it. This is usually color
palettes (as in RLE, but also in 8-bit RGB). Also use those during
caps creation. Lastly, add ADPCM (similar to wavparse - which
should eventually be rifflib based).
* gst/matroska/matroska-demux.c: (gst_matroska_demux_class_init),
(gst_matroska_demux_init), (gst_matroska_demux_reset):
* gst/matroska/matroska-demux.h:
Remove placeholders for some prehistoric tagging system. Didn't add
support for any tag system really anyway.
* gst/qtdemux/qtdemux.c:
Add support for audio/x-m4a (MPEG-4) through spider.
* gst/wavparse/gstwavparse.c: (gst_wavparse_parse_fmt),
(gst_wavparse_loop):
ADPCM support (#135862). Increase max. buffer size because we
cannot split buffers for ADPCM (screws references) and I've seen
files with 2048 byte chunks. 4096 seems safe for now.
2004-04-16 01:20:44 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_RIFF_TAG_strn:
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
g_free (stream->name);
|
2006-04-10 10:10:55 +00:00
|
|
|
|
if (sub != NULL) {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (sub, &map, GST_MAP_READ);
|
|
|
|
|
stream->name = g_strndup ((gchar *) map.data, map.size);
|
|
|
|
|
gst_buffer_unmap (sub, &map);
|
2006-04-10 10:10:55 +00:00
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
sub = NULL;
|
|
|
|
|
} else {
|
|
|
|
|
stream->name = g_strdup ("");
|
|
|
|
|
}
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "stream name: %s", stream->name);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
2010-11-30 18:22:11 +00:00
|
|
|
|
case GST_RIFF_IDIT:
|
|
|
|
|
gst_avi_demux_parse_idit (avi, sub);
|
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
default:
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
if (tag == GST_MAKE_FOURCC ('i', 'n', 'd', 'x') ||
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
tag == GST_MAKE_FOURCC ('i', 'x', '0' + avi->num_streams / 10,
|
|
|
|
|
'0' + avi->num_streams % 10)) {
|
|
|
|
|
g_free (stream->indexes);
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_avi_demux_parse_superindex (avi, sub, &stream->indexes);
|
|
|
|
|
stream->superindex = TRUE;
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
2005-11-21 13:38:24 +00:00
|
|
|
|
"Unknown stream header tag %" GST_FOURCC_FORMAT ", ignoring",
|
2004-03-15 19:32:27 +00:00
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
/* fall-through */
|
2010-02-01 12:43:04 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNQ:
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNK:
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
2009-08-04 09:39:39 +00:00
|
|
|
|
if (sub != NULL) {
|
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
sub = NULL;
|
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-03-08 16:01:42 +00:00
|
|
|
|
if (!got_strh) {
|
2008-06-10 11:05:30 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi, "Failed to find strh chunk");
|
2007-03-08 16:01:42 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!got_strf) {
|
2008-06-10 11:05:30 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi, "Failed to find strf chunk");
|
2007-03-08 16:01:42 +00:00
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
|
2006-08-24 11:21:06 +00:00
|
|
|
|
/* get class to figure out the template */
|
|
|
|
|
klass = GST_ELEMENT_GET_CLASS (avi);
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
/* we now have all info, let´s set up a pad and a caps and be done */
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/* create stream name + pad */
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
switch (stream->strh->type) {
|
2005-09-26 13:06:27 +00:00
|
|
|
|
case GST_RIFF_FCC_vids:{
|
|
|
|
|
guint32 fourcc;
|
|
|
|
|
|
|
|
|
|
fourcc = (stream->strf.vids->compression) ?
|
|
|
|
|
stream->strf.vids->compression : stream->strh->fcc_handler;
|
2011-11-04 12:12:37 +00:00
|
|
|
|
padname = g_strdup_printf ("video_%u", avi->num_v_streams);
|
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "video_%u");
|
2005-09-26 13:06:27 +00:00
|
|
|
|
caps = gst_riff_create_video_caps (fourcc, stream->strh,
|
|
|
|
|
stream->strf.vids, stream->extradata, stream->initdata, &codec_name);
|
|
|
|
|
if (!caps) {
|
|
|
|
|
caps = gst_caps_new_simple ("video/x-avi-unknown", "fourcc",
|
2011-08-22 10:24:15 +00:00
|
|
|
|
G_TYPE_INT, fourcc, NULL);
|
2008-06-29 19:52:51 +00:00
|
|
|
|
} else if (got_vprp && vprp) {
|
|
|
|
|
guint32 aspect_n, aspect_d;
|
|
|
|
|
gint n, d;
|
|
|
|
|
|
|
|
|
|
aspect_n = vprp->aspect >> 16;
|
|
|
|
|
aspect_d = vprp->aspect & 0xffff;
|
|
|
|
|
/* calculate the pixel aspect ratio using w/h and aspect ratio */
|
|
|
|
|
n = aspect_n * stream->strf.vids->height;
|
|
|
|
|
d = aspect_d * stream->strf.vids->width;
|
|
|
|
|
if (n && d)
|
|
|
|
|
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
|
|
|
|
|
n, d, NULL);
|
|
|
|
|
/* very local, not needed elsewhere */
|
|
|
|
|
g_free (vprp);
|
|
|
|
|
vprp = NULL;
|
2005-09-26 13:06:27 +00:00
|
|
|
|
}
|
2012-10-16 00:02:11 +00:00
|
|
|
|
caps = gst_avi_demux_check_caps (avi, caps, &stream->rgb8_palette);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
tag_name = GST_TAG_VIDEO_CODEC;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->num_v_streams++;
|
|
|
|
|
break;
|
2005-09-26 13:06:27 +00:00
|
|
|
|
}
|
|
|
|
|
case GST_RIFF_FCC_auds:{
|
2012-01-04 10:07:29 +00:00
|
|
|
|
/* FIXME: Do something with the channel reorder map */
|
2011-11-04 12:12:37 +00:00
|
|
|
|
padname = g_strdup_printf ("audio_%u", avi->num_a_streams);
|
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "audio_%u");
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
caps = gst_riff_create_audio_caps (stream->strf.auds->format,
|
2005-09-26 13:06:27 +00:00
|
|
|
|
stream->strh, stream->strf.auds, stream->extradata,
|
2012-01-04 10:07:29 +00:00
|
|
|
|
stream->initdata, &codec_name, NULL);
|
2005-09-26 13:06:27 +00:00
|
|
|
|
if (!caps) {
|
|
|
|
|
caps = gst_caps_new_simple ("audio/x-avi-unknown", "codec_id",
|
|
|
|
|
G_TYPE_INT, stream->strf.auds->format, NULL);
|
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
tag_name = GST_TAG_AUDIO_CODEC;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->num_a_streams++;
|
|
|
|
|
break;
|
2005-09-26 13:06:27 +00:00
|
|
|
|
}
|
|
|
|
|
case GST_RIFF_FCC_iavs:{
|
|
|
|
|
guint32 fourcc = stream->strh->fcc_handler;
|
|
|
|
|
|
2011-11-04 12:12:37 +00:00
|
|
|
|
padname = g_strdup_printf ("video_%u", avi->num_v_streams);
|
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "video_%u");
|
2005-09-26 13:06:27 +00:00
|
|
|
|
caps = gst_riff_create_iavs_caps (fourcc, stream->strh,
|
|
|
|
|
stream->strf.iavs, stream->extradata, stream->initdata, &codec_name);
|
|
|
|
|
if (!caps) {
|
|
|
|
|
caps = gst_caps_new_simple ("video/x-avi-unknown", "fourcc",
|
2011-08-22 10:24:15 +00:00
|
|
|
|
G_TYPE_INT, fourcc, NULL);
|
2005-09-26 13:06:27 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
tag_name = GST_TAG_VIDEO_CODEC;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->num_v_streams++;
|
|
|
|
|
break;
|
2005-09-26 13:06:27 +00:00
|
|
|
|
}
|
2007-05-30 14:38:59 +00:00
|
|
|
|
case GST_RIFF_FCC_txts:{
|
2011-11-04 12:12:37 +00:00
|
|
|
|
padname = g_strdup_printf ("subtitle_%u", avi->num_t_streams);
|
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "subtitle_%u");
|
2011-10-27 17:00:52 +00:00
|
|
|
|
caps = gst_caps_new_empty_simple ("application/x-subtitle-avi");
|
2007-05-30 14:38:59 +00:00
|
|
|
|
tag_name = NULL;
|
|
|
|
|
avi->num_t_streams++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-12-22 23:22:30 +00:00
|
|
|
|
default:
|
2011-04-17 00:29:01 +00:00
|
|
|
|
g_return_val_if_reached (FALSE);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* no caps means no stream */
|
|
|
|
|
if (!caps) {
|
|
|
|
|
GST_ERROR_OBJECT (element, "Did not find caps for stream %s", padname);
|
|
|
|
|
goto fail;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-16 00:02:11 +00:00
|
|
|
|
GST_DEBUG_OBJECT (element, "codec-name=%s", codec_name ? codec_name : "NULL");
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_DEBUG_OBJECT (element, "caps=%" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/* set proper settings and add it */
|
2005-12-07 11:40:46 +00:00
|
|
|
|
if (stream->pad)
|
|
|
|
|
gst_object_unref (stream->pad);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
pad = stream->pad = gst_pad_new_from_template (templ, padname);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
g_free (padname);
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_pad_use_fixed_caps (pad);
|
|
|
|
|
#if 0
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
gst_pad_set_formats_function (pad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_get_src_formats));
|
|
|
|
|
gst_pad_set_event_mask_function (pad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_get_event_mask));
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
#endif
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
gst_pad_set_event_function (pad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_handle_src_event));
|
|
|
|
|
gst_pad_set_query_function (pad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_handle_src_query));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
#if 0
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
gst_pad_set_convert_function (pad,
|
|
|
|
|
GST_DEBUG_FUNCPTR (gst_avi_demux_src_convert));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
#endif
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
|
|
stream->num = avi->num_streams;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
|
|
|
|
|
stream->start_entry = 0;
|
|
|
|
|
stream->step_entry = 0;
|
|
|
|
|
stream->stop_entry = 0;
|
|
|
|
|
|
|
|
|
|
stream->current_entry = -1;
|
|
|
|
|
stream->current_total = 0;
|
|
|
|
|
|
|
|
|
|
stream->last_flow = GST_FLOW_OK;
|
|
|
|
|
stream->discont = TRUE;
|
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
stream->total_bytes = 0;
|
2008-10-08 13:31:44 +00:00
|
|
|
|
stream->total_blocks = 0;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
stream->n_keyframes = 0;
|
|
|
|
|
|
|
|
|
|
stream->idx_n = 0;
|
|
|
|
|
stream->idx_max = 0;
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst_pad_set_element_private (pad, stream);
|
|
|
|
|
avi->num_streams++;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
|
2005-11-07 10:31:32 +00:00
|
|
|
|
gst_pad_set_active (pad, TRUE);
|
2012-08-04 10:47:44 +00:00
|
|
|
|
stream_id =
|
|
|
|
|
gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (avi), "%u",
|
|
|
|
|
avi->num_streams);
|
|
|
|
|
gst_pad_push_event (pad, gst_event_new_stream_start (stream_id));
|
|
|
|
|
g_free (stream_id);
|
2012-06-08 13:54:42 +00:00
|
|
|
|
gst_pad_set_caps (pad, caps);
|
2006-07-21 10:57:00 +00:00
|
|
|
|
gst_caps_unref (caps);
|
2005-01-10 16:09:25 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
/* make tags */
|
2005-08-16 16:30:23 +00:00
|
|
|
|
if (codec_name) {
|
2006-07-03 15:28:48 +00:00
|
|
|
|
if (!stream->taglist)
|
2011-10-30 11:44:53 +00:00
|
|
|
|
stream->taglist = gst_tag_list_new_empty ();
|
2006-07-03 15:28:48 +00:00
|
|
|
|
|
|
|
|
|
avi->got_tags = TRUE;
|
2005-08-16 16:30:23 +00:00
|
|
|
|
|
2006-07-03 15:28:48 +00:00
|
|
|
|
gst_tag_list_add (stream->taglist, GST_TAG_MERGE_APPEND, tag_name,
|
|
|
|
|
codec_name, NULL);
|
2006-07-21 10:57:00 +00:00
|
|
|
|
g_free (codec_name);
|
2005-08-16 16:30:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-04 09:39:39 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
/* ERRORS */
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
fail:
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
{
|
|
|
|
|
/* unref any mem that may be in use */
|
|
|
|
|
if (buf)
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
if (sub)
|
|
|
|
|
gst_buffer_unref (sub);
|
2008-06-29 19:52:51 +00:00
|
|
|
|
g_free (vprp);
|
2006-07-21 10:57:00 +00:00
|
|
|
|
g_free (codec_name);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
gst_avi_demux_reset_stream (avi, stream);
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
avi->num_streams++;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_parse_odml:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
* @avi: calling element (used for debug/error).
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* @buf: input buffer to be used for parsing.
|
|
|
|
|
*
|
|
|
|
|
* Read an openDML-2.0 extension header. Fills in the frame number
|
|
|
|
|
* in the avi demuxer object when reading succeeds.
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
*/
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
static void
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_avi_demux_parse_odml (GstAviDemux * avi, GstBuffer * buf)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
guint32 tag = 0;
|
|
|
|
|
guint offset = 4;
|
|
|
|
|
GstBuffer *sub = NULL;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2006-08-24 11:21:06 +00:00
|
|
|
|
while (gst_riff_parse_chunk (GST_ELEMENT_CAST (avi), buf, &offset, &tag,
|
|
|
|
|
&sub)) {
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
switch (tag) {
|
2004-03-14 22:34:33 +00:00
|
|
|
|
case GST_RIFF_TAG_dmlh:{
|
2004-03-15 19:32:27 +00:00
|
|
|
|
gst_riff_dmlh dmlh, *_dmlh;
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
|
2006-08-24 11:21:06 +00:00
|
|
|
|
/* sub == NULL is possible and means an empty buffer */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (sub == NULL)
|
|
|
|
|
goto next;
|
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (sub, &map, GST_MAP_READ);
|
2006-08-24 11:21:06 +00:00
|
|
|
|
|
|
|
|
|
/* check size */
|
2012-01-23 16:25:37 +00:00
|
|
|
|
if (map.size < sizeof (gst_riff_dmlh)) {
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_ERROR_OBJECT (avi,
|
2011-11-21 19:31:31 +00:00
|
|
|
|
"DMLH entry is too small (%" G_GSIZE_FORMAT " bytes, %d needed)",
|
2012-01-23 16:25:37 +00:00
|
|
|
|
map.size, (int) sizeof (gst_riff_dmlh));
|
|
|
|
|
gst_buffer_unmap (sub, &map);
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
2012-01-23 16:25:37 +00:00
|
|
|
|
_dmlh = (gst_riff_dmlh *) map.data;
|
2009-02-22 17:32:02 +00:00
|
|
|
|
dmlh.totalframes = GST_READ_UINT32_LE (&_dmlh->totalframes);
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (sub, &map);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
|
2009-09-18 11:22:02 +00:00
|
|
|
|
GST_INFO_OBJECT (avi, "dmlh tag found: totalframes: %u",
|
|
|
|
|
dmlh.totalframes);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
avi->avih->tot_frames = dmlh.totalframes;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
2005-11-21 13:38:24 +00:00
|
|
|
|
"Unknown tag %" GST_FOURCC_FORMAT " in ODML header",
|
2004-03-15 19:32:27 +00:00
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
/* fall-through */
|
2010-02-01 12:43:04 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNQ:
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNK:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
next:
|
|
|
|
|
/* skip and move to next chunk */
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
if (sub) {
|
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
sub = NULL;
|
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
if (buf)
|
|
|
|
|
gst_buffer_unref (buf);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
/* Index helper */
|
|
|
|
|
static guint
|
|
|
|
|
gst_avi_demux_index_last (GstAviDemux * avi, GstAviStream * stream)
|
|
|
|
|
{
|
2010-09-29 08:34:36 +00:00
|
|
|
|
return stream->idx_n;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* find a previous entry in the index with the given flags */
|
|
|
|
|
static guint
|
|
|
|
|
gst_avi_demux_index_prev (GstAviDemux * avi, GstAviStream * stream,
|
2009-09-22 10:35:30 +00:00
|
|
|
|
guint last, gboolean keyframe)
|
2009-09-21 16:04:25 +00:00
|
|
|
|
{
|
|
|
|
|
GstAviIndexEntry *entry;
|
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
for (i = last; i > 0; i--) {
|
|
|
|
|
entry = &stream->index[i - 1];
|
2009-09-22 10:35:30 +00:00
|
|
|
|
if (!keyframe || ENTRY_IS_KEYFRAME (entry)) {
|
2009-09-22 15:42:48 +00:00
|
|
|
|
return i - 1;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
|
gst_avi_demux_index_next (GstAviDemux * avi, GstAviStream * stream,
|
2009-09-22 10:35:30 +00:00
|
|
|
|
guint last, gboolean keyframe)
|
2009-09-21 16:04:25 +00:00
|
|
|
|
{
|
|
|
|
|
GstAviIndexEntry *entry;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
for (i = last + 1; i < stream->idx_n; i++) {
|
|
|
|
|
entry = &stream->index[i];
|
2009-09-22 10:35:30 +00:00
|
|
|
|
if (!keyframe || ENTRY_IS_KEYFRAME (entry)) {
|
2009-09-21 16:04:25 +00:00
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return stream->idx_n - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static guint
|
|
|
|
|
gst_avi_demux_index_entry_search (GstAviIndexEntry * entry, guint64 * total)
|
|
|
|
|
{
|
|
|
|
|
if (entry->total < *total)
|
|
|
|
|
return -1;
|
|
|
|
|
else if (entry->total > *total)
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
2009-09-22 20:12:58 +00:00
|
|
|
|
* gst_avi_demux_index_for_time:
|
2009-09-21 16:04:25 +00:00
|
|
|
|
* @avi: Avi object
|
|
|
|
|
* @stream: the stream
|
2009-09-22 20:12:58 +00:00
|
|
|
|
* @time: a time position
|
2009-09-21 16:04:25 +00:00
|
|
|
|
*
|
|
|
|
|
* Finds the index entry which time is less or equal than the requested time.
|
2009-09-22 20:12:58 +00:00
|
|
|
|
* Try to avoid binary search when we can convert the time to an index
|
|
|
|
|
* position directly (for example for video frames with a fixed duration).
|
2009-09-21 16:04:25 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the found position in the index.
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
*/
|
2009-09-21 16:04:25 +00:00
|
|
|
|
static guint
|
|
|
|
|
gst_avi_demux_index_for_time (GstAviDemux * avi,
|
|
|
|
|
GstAviStream * stream, guint64 time)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
{
|
2009-09-21 16:04:25 +00:00
|
|
|
|
guint index = -1;
|
|
|
|
|
guint64 total;
|
|
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (avi, "search time:%" GST_TIME_FORMAT, GST_TIME_ARGS (time));
|
|
|
|
|
|
|
|
|
|
/* easy (and common) cases */
|
|
|
|
|
if (time == 0 || stream->idx_n == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
if (time >= stream->idx_duration)
|
|
|
|
|
return stream->idx_n - 1;
|
|
|
|
|
|
|
|
|
|
/* figure out where we need to go. For that we convert the time to an
|
|
|
|
|
* index entry or we convert it to a total and then do a binary search. */
|
|
|
|
|
if (stream->is_vbr) {
|
|
|
|
|
/* VBR stream next timestamp */
|
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
|
|
|
|
total = avi_stream_convert_time_to_frames_unchecked (stream, time);
|
|
|
|
|
} else {
|
|
|
|
|
index = avi_stream_convert_time_to_frames_unchecked (stream, time);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* constant rate stream */
|
|
|
|
|
total = avi_stream_convert_time_to_bytes_unchecked (stream, time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
GstAviIndexEntry *entry;
|
|
|
|
|
|
|
|
|
|
/* no index, find index with binary search on total */
|
|
|
|
|
GST_LOG_OBJECT (avi, "binary search for entry with total %"
|
|
|
|
|
G_GUINT64_FORMAT, total);
|
|
|
|
|
|
|
|
|
|
entry = gst_util_array_binary_search (stream->index,
|
|
|
|
|
stream->idx_n, sizeof (GstAviIndexEntry),
|
|
|
|
|
(GCompareDataFunc) gst_avi_demux_index_entry_search,
|
|
|
|
|
GST_SEARCH_MODE_BEFORE, &total, NULL);
|
|
|
|
|
|
|
|
|
|
if (entry == NULL) {
|
|
|
|
|
GST_LOG_OBJECT (avi, "not found, assume index 0");
|
|
|
|
|
index = 0;
|
|
|
|
|
} else {
|
|
|
|
|
index = entry - stream->index;
|
|
|
|
|
GST_LOG_OBJECT (avi, "found at %u", index);
|
|
|
|
|
}
|
2009-09-22 12:44:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_LOG_OBJECT (avi, "converted time to index %u", index);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return index;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
static inline GstAviStream *
|
|
|
|
|
gst_avi_demux_stream_for_id (GstAviDemux * avi, guint32 id)
|
|
|
|
|
{
|
|
|
|
|
guint stream_nr;
|
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
|
|
|
|
|
/* get the stream for this entry */
|
|
|
|
|
stream_nr = CHUNKID_TO_STREAMNR (id);
|
|
|
|
|
if (G_UNLIKELY (stream_nr >= avi->num_streams)) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "invalid stream nr %d", stream_nr);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
stream = &avi->stream[stream_nr];
|
|
|
|
|
if (G_UNLIKELY (!stream->strh)) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Unhandled stream %d, skipping", stream_nr);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
return stream;
|
|
|
|
|
}
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
2009-09-21 13:35:55 +00:00
|
|
|
|
/*
|
2009-09-21 16:04:25 +00:00
|
|
|
|
* gst_avi_demux_parse_index:
|
2009-09-21 13:35:55 +00:00
|
|
|
|
* @avi: calling element (used for debugging/errors).
|
|
|
|
|
* @buf: buffer containing the full index.
|
|
|
|
|
*
|
|
|
|
|
* Read index entries from the provided buffer.
|
|
|
|
|
* The buffer should contain a GST_RIFF_TAG_idx1 chunk.
|
|
|
|
|
*/
|
2009-09-22 20:12:58 +00:00
|
|
|
|
static gboolean
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_parse_index (GstAviDemux * avi, GstBuffer * buf)
|
2009-09-21 13:35:55 +00:00
|
|
|
|
{
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
guint i, num, n;
|
|
|
|
|
gst_riff_index_entry *index;
|
|
|
|
|
GstClockTime stamp;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
GstAviIndexEntry entry;
|
|
|
|
|
guint32 id;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
|
|
|
|
if (!buf)
|
2009-09-23 10:56:07 +00:00
|
|
|
|
return FALSE;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
|
|
|
|
stamp = gst_util_get_timestamp ();
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* see how many items in the index */
|
2012-01-23 16:25:37 +00:00
|
|
|
|
num = map.size / sizeof (gst_riff_index_entry);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
if (num == 0)
|
|
|
|
|
goto empty_list;
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
GST_INFO_OBJECT (avi, "Parsing index, nr_entries = %6d", num);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
index = (gst_riff_index_entry *) map.data;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* figure out if the index is 0 based or relative to the MOVI start */
|
|
|
|
|
entry.offset = GST_READ_UINT32_LE (&index[0].offset);
|
|
|
|
|
if (entry.offset < avi->offset) {
|
|
|
|
|
avi->index_offset = avi->offset + 8;
|
|
|
|
|
GST_DEBUG ("index_offset = %" G_GUINT64_FORMAT, avi->index_offset);
|
|
|
|
|
} else {
|
|
|
|
|
avi->index_offset = 0;
|
|
|
|
|
GST_DEBUG ("index is 0 based");
|
|
|
|
|
}
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
for (i = 0, n = 0; i < num; i++) {
|
2009-09-21 13:35:55 +00:00
|
|
|
|
id = GST_READ_UINT32_LE (&index[i].id);
|
|
|
|
|
entry.offset = GST_READ_UINT32_LE (&index[i].offset);
|
|
|
|
|
|
|
|
|
|
/* some sanity checks */
|
|
|
|
|
if (G_UNLIKELY (id == GST_RIFF_rec || id == 0 ||
|
|
|
|
|
(entry.offset == 0 && n > 0)))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* get the stream for this entry */
|
2009-09-22 20:12:58 +00:00
|
|
|
|
stream = gst_avi_demux_stream_for_id (avi, id);
|
|
|
|
|
if (G_UNLIKELY (!stream))
|
2009-09-21 13:35:55 +00:00
|
|
|
|
continue;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
|
|
|
|
|
/* handle offset and size */
|
|
|
|
|
entry.offset += avi->index_offset + 8;
|
|
|
|
|
entry.size = GST_READ_UINT32_LE (&index[i].size);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
|
|
|
|
/* handle flags */
|
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_auds) {
|
|
|
|
|
/* all audio frames are keyframes */
|
2009-09-22 10:35:30 +00:00
|
|
|
|
ENTRY_SET_KEYFRAME (&entry);
|
2012-09-28 14:51:01 +00:00
|
|
|
|
} else if (stream->strf.vids->compression == GST_RIFF_DXSB) {
|
|
|
|
|
/* all xsub frames are keyframes */
|
|
|
|
|
ENTRY_SET_KEYFRAME (&entry);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
} else {
|
2009-09-22 10:35:30 +00:00
|
|
|
|
guint32 flags;
|
|
|
|
|
/* else read flags */
|
|
|
|
|
flags = GST_READ_UINT32_LE (&index[i].flags);
|
|
|
|
|
if (flags & GST_RIFF_IF_KEYFRAME) {
|
|
|
|
|
ENTRY_SET_KEYFRAME (&entry);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
} else {
|
2009-09-22 10:35:30 +00:00
|
|
|
|
ENTRY_UNSET_KEYFRAME (&entry);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* and add */
|
|
|
|
|
if (G_UNLIKELY (!gst_avi_demux_add_index (avi, stream, num, &entry)))
|
|
|
|
|
goto out_of_mem;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
|
|
|
|
n++;
|
|
|
|
|
}
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
2009-09-21 13:35:55 +00:00
|
|
|
|
/* get stream stats now */
|
2009-10-18 13:40:37 +00:00
|
|
|
|
avi->have_index = gst_avi_demux_do_index_stats (avi);
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
|
|
|
|
stamp = gst_util_get_timestamp () - stamp;
|
2009-12-07 20:54:07 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "index parsing took %" GST_TIME_FORMAT,
|
2009-09-21 13:35:55 +00:00
|
|
|
|
GST_TIME_ARGS (stamp));
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
return TRUE;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
empty_list:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "empty index");
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
return FALSE;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
}
|
|
|
|
|
out_of_mem:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, RESOURCE, NO_SPACE_LEFT, (NULL),
|
|
|
|
|
("Cannot allocate memory for %u*%u=%u bytes",
|
|
|
|
|
(guint) sizeof (GstAviIndexEntry), num,
|
|
|
|
|
(guint) sizeof (GstAviIndexEntry) * num));
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
return FALSE;
|
2009-09-21 13:35:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
* gst_avi_demux_stream_index:
|
|
|
|
|
* @avi: avi demuxer object.
|
|
|
|
|
*
|
|
|
|
|
* Seeks to index and reads it.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_stream_index (GstAviDemux * avi)
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
{
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GstFlowReturn res;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
guint64 offset = avi->offset;
|
2012-03-16 20:47:21 +00:00
|
|
|
|
GstBuffer *buf = NULL;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
guint32 tag;
|
2008-03-15 22:10:38 +00:00
|
|
|
|
guint32 size;
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_DEBUG ("demux stream index at offset %" G_GUINT64_FORMAT, offset);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2006-09-13 13:26:15 +00:00
|
|
|
|
/* get chunk information */
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
res = gst_pad_pull_range (avi->sinkpad, offset, 8, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
|
goto pull_failed;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
if (map.size < 8)
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto too_small;
|
|
|
|
|
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
/* check tag first before blindy trying to read 'size' bytes */
|
2012-01-23 16:25:37 +00:00
|
|
|
|
tag = GST_READ_UINT32_LE (map.data);
|
|
|
|
|
size = GST_READ_UINT32_LE (map.data + 4);
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
if (tag == GST_RIFF_TAG_LIST) {
|
2008-03-16 14:04:16 +00:00
|
|
|
|
/* this is the movi tag */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "skip LIST chunk, size %" G_GUINT32_FORMAT,
|
2009-09-21 23:28:54 +00:00
|
|
|
|
(8 + GST_ROUND_UP_2 (size)));
|
|
|
|
|
offset += 8 + GST_ROUND_UP_2 (size);
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2007-09-10 06:49:32 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-03-16 20:47:21 +00:00
|
|
|
|
buf = NULL;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
res = gst_pad_pull_range (avi->sinkpad, offset, 8, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
|
goto pull_failed;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
if (map.size < 8)
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
goto too_small;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
tag = GST_READ_UINT32_LE (map.data);
|
|
|
|
|
size = GST_READ_UINT32_LE (map.data + 4);
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
}
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
|
|
|
|
if (tag != GST_RIFF_TAG_idx1)
|
|
|
|
|
goto no_index;
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
if (!size)
|
|
|
|
|
goto zero_index;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG ("index found at offset %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
2006-09-13 13:26:15 +00:00
|
|
|
|
/* read chunk, advance offset */
|
2006-08-24 11:21:06 +00:00
|
|
|
|
if (gst_riff_read_chunk (GST_ELEMENT_CAST (avi),
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
avi->sinkpad, &offset, &tag, &buf) != GST_FLOW_OK)
|
|
|
|
|
return;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG ("will parse index chunk size %" G_GSIZE_FORMAT " for tag %"
|
2011-04-04 17:17:43 +00:00
|
|
|
|
GST_FOURCC_FORMAT, gst_buffer_get_size (buf), GST_FOURCC_ARGS (tag));
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_parse_index (avi, buf);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
2009-09-18 11:22:02 +00:00
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/* debug our indexes */
|
2009-09-18 11:22:02 +00:00
|
|
|
|
{
|
|
|
|
|
gint i;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2009-09-18 11:22:02 +00:00
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
stream = &avi->stream[i];
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "stream %u: %u frames, %" G_GINT64_FORMAT " bytes",
|
2009-09-21 16:04:25 +00:00
|
|
|
|
i, stream->idx_n, stream->total_bytes);
|
2009-09-18 11:22:02 +00:00
|
|
|
|
}
|
2001-12-22 23:22:30 +00:00
|
|
|
|
}
|
2009-09-18 11:22:02 +00:00
|
|
|
|
#endif
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
return;
|
2006-03-24 18:56:16 +00:00
|
|
|
|
|
2006-07-28 08:21:27 +00:00
|
|
|
|
/* ERRORS */
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
pull_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"pull range failed: pos=%" G_GUINT64_FORMAT " size=8", offset);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2006-08-24 11:21:06 +00:00
|
|
|
|
too_small:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Buffer is too small");
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2006-03-24 18:56:16 +00:00
|
|
|
|
no_index:
|
|
|
|
|
{
|
2006-09-13 13:26:15 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
"No index data (idx1) after movi chunk, but %" GST_FOURCC_FORMAT,
|
2006-03-24 18:56:16 +00:00
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
return;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
zero_index:
|
|
|
|
|
{
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Empty index data (idx1) after movi chunk");
|
|
|
|
|
return;
|
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
2002-02-03 20:10:04 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/*
|
|
|
|
|
* gst_avi_demux_stream_index_push:
|
|
|
|
|
* @avi: avi demuxer object.
|
|
|
|
|
*
|
|
|
|
|
* Read index.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_stream_index_push (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
guint64 offset = avi->idx1_offset;
|
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
guint32 tag;
|
|
|
|
|
guint32 size;
|
|
|
|
|
|
|
|
|
|
GST_DEBUG ("demux stream index at offset %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
|
|
|
|
/* get chunk information */
|
|
|
|
|
if (!gst_avi_demux_peek_chunk (avi, &tag, &size))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* check tag first before blindly trying to read 'size' bytes */
|
|
|
|
|
if (tag == GST_RIFF_TAG_LIST) {
|
|
|
|
|
/* this is the movi tag */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "skip LIST chunk, size %" G_GUINT32_FORMAT,
|
|
|
|
|
(8 + GST_ROUND_UP_2 (size)));
|
|
|
|
|
avi->idx1_offset = offset + 8 + GST_ROUND_UP_2 (size);
|
|
|
|
|
/* issue seek to allow chain function to handle it and return! */
|
2010-01-18 16:13:06 +00:00
|
|
|
|
perform_seek_to_offset (avi, avi->idx1_offset);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tag != GST_RIFF_TAG_idx1)
|
|
|
|
|
goto no_index;
|
|
|
|
|
|
|
|
|
|
GST_DEBUG ("index found at offset %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
|
|
|
|
/* flush chunk header */
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8);
|
|
|
|
|
/* read chunk payload */
|
|
|
|
|
buf = gst_adapter_take_buffer (avi->adapter, size);
|
|
|
|
|
if (!buf)
|
|
|
|
|
goto pull_failed;
|
|
|
|
|
/* advance offset */
|
|
|
|
|
offset += 8 + GST_ROUND_UP_2 (size);
|
|
|
|
|
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG ("will parse index chunk size %" G_GSIZE_FORMAT " for tag %"
|
2011-04-04 17:17:43 +00:00
|
|
|
|
GST_FOURCC_FORMAT, gst_buffer_get_size (buf), GST_FOURCC_ARGS (tag));
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
2010-07-29 15:18:11 +00:00
|
|
|
|
avi->offset = avi->first_movi_offset;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
gst_avi_demux_parse_index (avi, buf);
|
|
|
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
|
/* debug our indexes */
|
|
|
|
|
{
|
|
|
|
|
gint i;
|
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
stream = &avi->stream[i];
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "stream %u: %u frames, %" G_GINT64_FORMAT " bytes",
|
|
|
|
|
i, stream->idx_n, stream->total_bytes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
pull_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"taking data from adapter failed: pos=%" G_GUINT64_FORMAT " size=%u",
|
|
|
|
|
offset, size);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
no_index:
|
|
|
|
|
{
|
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"No index data (idx1) after movi chunk, but %" GST_FOURCC_FORMAT,
|
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
* gst_avi_demux_peek_tag:
|
2006-07-28 08:21:27 +00:00
|
|
|
|
*
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
* Returns the tag and size of the next chunk
|
|
|
|
|
*/
|
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_peek_tag (GstAviDemux * avi, guint64 offset, guint32 * tag,
|
|
|
|
|
guint * size)
|
|
|
|
|
{
|
|
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
|
|
|
|
GstBuffer *buf = NULL;
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
res = gst_pad_pull_range (avi->sinkpad, offset, 8, &buf);
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
if (res != GST_FLOW_OK)
|
|
|
|
|
goto pull_failed;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
if (map.size != 8)
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
goto wrong_size;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
*tag = GST_READ_UINT32_LE (map.data);
|
|
|
|
|
*size = GST_READ_UINT32_LE (map.data + 4);
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
2006-04-20 16:33:55 +00:00
|
|
|
|
GST_LOG_OBJECT (avi, "Tag[%" GST_FOURCC_FORMAT "] (size:%d) %"
|
|
|
|
|
G_GINT64_FORMAT " -- %" G_GINT64_FORMAT, GST_FOURCC_ARGS (*tag),
|
|
|
|
|
*size, offset + 8, offset + 8 + (gint64) * size);
|
2009-09-22 20:12:58 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
done:
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2006-04-20 16:33:55 +00:00
|
|
|
|
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
return res;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
pull_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "pull_ranged returned %s", gst_flow_get_name (res));
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
wrong_size:
|
|
|
|
|
{
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "got %" G_GSIZE_FORMAT " bytes which is <> 8 bytes",
|
2012-01-23 16:25:37 +00:00
|
|
|
|
map.size);
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
res = GST_FLOW_ERROR;
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
* gst_avi_demux_next_data_buffer:
|
2006-07-28 08:21:27 +00:00
|
|
|
|
*
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
* Returns the offset and size of the next buffer
|
|
|
|
|
* Position is the position of the buffer (after tag and size)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
*/
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_next_data_buffer (GstAviDemux * avi, guint64 * offset,
|
|
|
|
|
guint32 * tag, guint * size)
|
|
|
|
|
{
|
|
|
|
|
guint64 off = *offset;
|
2006-08-27 13:12:52 +00:00
|
|
|
|
guint _size = 0;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
GstFlowReturn res;
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
do {
|
2006-08-27 13:12:52 +00:00
|
|
|
|
res = gst_avi_demux_peek_tag (avi, off, tag, &_size);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
if (res != GST_FLOW_OK)
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
break;
|
2009-08-04 10:16:13 +00:00
|
|
|
|
if (*tag == GST_RIFF_TAG_LIST || *tag == GST_RIFF_TAG_RIFF)
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
off += 8 + 4; /* skip tag + size + subtag */
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
else {
|
|
|
|
|
*offset = off + 8;
|
2006-08-27 13:12:52 +00:00
|
|
|
|
*size = _size;
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
} while (TRUE);
|
|
|
|
|
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
return res;
|
|
|
|
|
}
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/*
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
* gst_avi_demux_stream_scan:
|
|
|
|
|
* @avi: calling element (used for debugging/errors).
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
*
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
* Scan the file for all chunks to "create" a new index.
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
* pull-range based
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
*/
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
static gboolean
|
2009-09-22 20:12:58 +00:00
|
|
|
|
gst_avi_demux_stream_scan (GstAviDemux * avi)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
GstFlowReturn res;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream;
|
2009-09-23 10:56:07 +00:00
|
|
|
|
guint64 pos = 0;
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
guint64 length;
|
2005-12-19 15:43:30 +00:00
|
|
|
|
gint64 tmplength;
|
2006-08-27 13:12:52 +00:00
|
|
|
|
guint32 tag = 0;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
guint num;
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
|
|
|
|
|
/* FIXME:
|
|
|
|
|
* - implement non-seekable source support.
|
|
|
|
|
*/
|
2009-09-23 10:56:07 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Creating index");
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* get the size of the file */
|
2011-11-15 17:01:16 +00:00
|
|
|
|
if (!gst_pad_peer_query_duration (avi->sinkpad, GST_FORMAT_BYTES, &tmplength))
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
return FALSE;
|
2005-12-19 15:43:30 +00:00
|
|
|
|
length = tmplength;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* guess the total amount of entries we expect */
|
|
|
|
|
num = 16000;
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
while (TRUE) {
|
2009-09-22 20:12:58 +00:00
|
|
|
|
GstAviIndexEntry entry;
|
2006-11-16 15:04:55 +00:00
|
|
|
|
guint size = 0;
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* start reading data buffers to find the id and offset */
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
res = gst_avi_demux_next_data_buffer (avi, &pos, &tag, &size);
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK))
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
break;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* get stream */
|
|
|
|
|
stream = gst_avi_demux_stream_for_id (avi, tag);
|
|
|
|
|
if (G_UNLIKELY (!stream))
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
goto next;
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* we can't figure out the keyframes, assume they all are */
|
|
|
|
|
entry.flags = GST_AVI_KEYFRAME;
|
|
|
|
|
entry.offset = pos;
|
|
|
|
|
entry.size = size;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* and add to the index of this stream */
|
|
|
|
|
if (G_UNLIKELY (!gst_avi_demux_add_index (avi, stream, num, &entry)))
|
|
|
|
|
goto out_of_mem;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
|
|
|
|
next:
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
/* update position */
|
2006-04-20 16:33:55 +00:00
|
|
|
|
pos += GST_ROUND_UP_2 (size);
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (pos > length)) {
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"Stopping index lookup since we are further than EOF");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-18 13:40:37 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* collect stats */
|
2009-10-18 13:40:37 +00:00
|
|
|
|
avi->have_index = gst_avi_demux_do_index_stats (avi);
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
out_of_mem:
|
2009-09-21 10:32:51 +00:00
|
|
|
|
{
|
2009-09-22 20:12:58 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, RESOURCE, NO_SPACE_LEFT, (NULL),
|
|
|
|
|
("Cannot allocate memory for %u*%u=%u bytes",
|
|
|
|
|
(guint) sizeof (GstAviIndexEntry), num,
|
|
|
|
|
(guint) sizeof (GstAviIndexEntry) * num));
|
2009-09-21 10:32:51 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 17:51:16 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi)
|
|
|
|
|
{
|
2009-09-22 20:12:58 +00:00
|
|
|
|
guint i;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
GstClockTime total;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
GstAviStream *stream;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
total = GST_CLOCK_TIME_NONE;
|
2006-03-03 17:51:16 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* all streams start at a timestamp 0 */
|
2009-09-22 20:12:58 +00:00
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
GstClockTime duration, hduration;
|
2009-09-22 20:12:58 +00:00
|
|
|
|
gst_riff_strh *strh;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
stream = &avi->stream[i];
|
2009-10-18 13:50:39 +00:00
|
|
|
|
if (G_UNLIKELY (!stream || !stream->idx_n || !(strh = stream->strh)))
|
2008-06-10 11:05:30 +00:00
|
|
|
|
continue;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
|
2009-08-04 10:16:13 +00:00
|
|
|
|
/* get header duration for the stream */
|
2009-09-22 20:12:58 +00:00
|
|
|
|
hduration = stream->hdr_duration;
|
|
|
|
|
/* index duration calculated during parsing */
|
|
|
|
|
duration = stream->idx_duration;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
|
|
|
|
|
/* now pick a good duration */
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (duration)) {
|
|
|
|
|
/* index gave valid duration, use that */
|
2009-10-03 15:18:28 +00:00
|
|
|
|
GST_INFO ("Stream %p duration according to index: %" GST_TIME_FORMAT,
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
stream, GST_TIME_ARGS (duration));
|
|
|
|
|
} else {
|
|
|
|
|
/* fall back to header info to calculate a duration */
|
|
|
|
|
duration = hduration;
|
2006-03-03 17:51:16 +00:00
|
|
|
|
}
|
2009-10-18 13:50:39 +00:00
|
|
|
|
GST_INFO ("Setting duration of stream #%d to %" GST_TIME_FORMAT,
|
|
|
|
|
i, GST_TIME_ARGS (duration));
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* set duration for the stream */
|
2009-09-22 20:12:58 +00:00
|
|
|
|
stream->duration = duration;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
/* find total duration */
|
2009-10-18 13:50:39 +00:00
|
|
|
|
if (total == GST_CLOCK_TIME_NONE ||
|
|
|
|
|
(GST_CLOCK_TIME_IS_VALID (duration) && duration > total))
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
total = duration;
|
2006-03-03 17:51:16 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (total) && (total > 0)) {
|
|
|
|
|
/* now update the duration for those streams where we had none */
|
2009-09-22 20:12:58 +00:00
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
stream = &avi->stream[i];
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (stream->duration)
|
|
|
|
|
|| stream->duration == 0) {
|
|
|
|
|
stream->duration = total;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
2009-10-03 15:18:28 +00:00
|
|
|
|
GST_INFO ("Stream %p duration according to total: %" GST_TIME_FORMAT,
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
stream, GST_TIME_ARGS (total));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* and set the total duration in the segment. */
|
|
|
|
|
GST_INFO ("Setting total duration to: %" GST_TIME_FORMAT,
|
|
|
|
|
GST_TIME_ARGS (total));
|
|
|
|
|
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->segment.duration = total;
|
2006-03-03 17:51:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-08-04 11:36:36 +00:00
|
|
|
|
/* returns FALSE if there are no pads to deliver event to,
|
2009-09-22 15:42:48 +00:00
|
|
|
|
* otherwise TRUE (whatever the outcome of event sending),
|
|
|
|
|
* takes ownership of the event. */
|
2005-07-16 16:43:53 +00:00
|
|
|
|
static gboolean
|
gst/avi/gstavidemux.*: Some cleanups, prepare to use GstSegment.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_next), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_subindex),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Some cleanups, prepare to use GstSegment.
Fix error in entry walking code.
Fix VBR detection.
Smarter timestamp calculation code.
Uniform error/eos handling.
2006-05-12 18:04:22 +00:00
|
|
|
|
gst_avi_demux_push_event (GstAviDemux * avi, GstEvent * event)
|
2005-07-16 16:43:53 +00:00
|
|
|
|
{
|
2007-05-30 12:46:32 +00:00
|
|
|
|
gboolean result = FALSE;
|
2005-07-16 16:43:53 +00:00
|
|
|
|
gint i;
|
|
|
|
|
|
2007-05-30 12:46:32 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "sending %s event to %d streams",
|
|
|
|
|
GST_EVENT_TYPE_NAME (event), avi->num_streams);
|
|
|
|
|
|
2009-09-22 15:42:48 +00:00
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
GstAviStream *stream = &avi->stream[i];
|
2005-07-16 16:43:53 +00:00
|
|
|
|
|
2009-09-22 15:42:48 +00:00
|
|
|
|
if (stream->pad) {
|
|
|
|
|
result = TRUE;
|
|
|
|
|
gst_pad_push_event (stream->pad, gst_event_ref (event));
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
}
|
2005-07-16 16:43:53 +00:00
|
|
|
|
}
|
|
|
|
|
gst_event_unref (event);
|
gst/avi/gstavidemux.*: Some cleanups, prepare to use GstSegment.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_next), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_subindex),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Some cleanups, prepare to use GstSegment.
Fix error in entry walking code.
Fix VBR detection.
Smarter timestamp calculation code.
Uniform error/eos handling.
2006-05-12 18:04:22 +00:00
|
|
|
|
return result;
|
2005-07-16 16:43:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-10-14 11:08:47 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_check_seekability (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
GstQuery *query;
|
|
|
|
|
gboolean seekable = FALSE;
|
|
|
|
|
gint64 start = -1, stop = -1;
|
|
|
|
|
|
|
|
|
|
query = gst_query_new_seeking (GST_FORMAT_BYTES);
|
|
|
|
|
if (!gst_pad_peer_query (avi->sinkpad, query)) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "seeking query failed");
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_query_parse_seeking (query, NULL, &seekable, &start, &stop);
|
|
|
|
|
|
|
|
|
|
/* try harder to query upstream size if we didn't get it the first time */
|
|
|
|
|
if (seekable && stop == -1) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "doing duration query to fix up unset stop");
|
2011-11-15 17:01:16 +00:00
|
|
|
|
gst_pad_peer_query_duration (avi->sinkpad, GST_FORMAT_BYTES, &stop);
|
2009-10-14 11:08:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if upstream doesn't know the size, it's likely that it's not seekable in
|
|
|
|
|
* practice even if it technically may be seekable */
|
|
|
|
|
if (seekable && (start != 0 || stop <= start)) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "seekable but unknown start/stop -> disable");
|
|
|
|
|
seekable = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
GST_INFO_OBJECT (avi, "seekable: %d (%" G_GUINT64_FORMAT " - %"
|
|
|
|
|
G_GUINT64_FORMAT ")", seekable, start, stop);
|
|
|
|
|
avi->seekable = seekable;
|
|
|
|
|
|
|
|
|
|
gst_query_unref (query);
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
|
|
|
|
* Read AVI headers when streaming
|
|
|
|
|
*/
|
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_stream_header_push (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
guint32 tag = 0;
|
|
|
|
|
guint32 ltag = 0;
|
|
|
|
|
guint32 size = 0;
|
|
|
|
|
const guint8 *data;
|
|
|
|
|
GstBuffer *buf = NULL, *sub = NULL;
|
|
|
|
|
guint offset = 4;
|
2009-12-04 12:50:59 +00:00
|
|
|
|
gint i;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
GstTagList *tags = NULL;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
guint8 fourcc[4];
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG ("Reading and parsing avi headers: %d", avi->header_state);
|
|
|
|
|
|
|
|
|
|
switch (avi->header_state) {
|
|
|
|
|
case GST_AVI_DEMUX_HEADER_TAG_LIST:
|
2012-10-01 13:44:01 +00:00
|
|
|
|
again:
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size)) {
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
2006-10-28 16:37:20 +00:00
|
|
|
|
if (tag != GST_RIFF_TAG_LIST)
|
|
|
|
|
goto header_no_list;
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
gst_adapter_flush (avi->adapter, 8);
|
|
|
|
|
/* Find the 'hdrl' LIST tag */
|
|
|
|
|
GST_DEBUG ("Reading %d bytes", size);
|
2006-10-28 16:37:20 +00:00
|
|
|
|
buf = gst_adapter_take_buffer (avi->adapter, size);
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_extract (buf, 0, fourcc, 4);
|
|
|
|
|
|
2012-10-01 13:44:01 +00:00
|
|
|
|
if (GST_READ_UINT32_LE (fourcc) != GST_RIFF_LIST_hdrl) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Invalid AVI header (no hdrl at start): %"
|
|
|
|
|
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag));
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
goto again;
|
|
|
|
|
}
|
2006-10-28 16:37:20 +00:00
|
|
|
|
|
2009-08-10 11:30:23 +00:00
|
|
|
|
/* mind padding */
|
|
|
|
|
if (size & 1)
|
|
|
|
|
gst_adapter_flush (avi->adapter, 1);
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_DEBUG ("'hdrl' LIST tag found. Parsing next chunk");
|
|
|
|
|
|
2010-10-26 09:15:49 +00:00
|
|
|
|
gst_avi_demux_roundup_list (avi, &buf);
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* the hdrl starts with a 'avih' header */
|
2010-01-15 17:13:24 +00:00
|
|
|
|
if (!gst_riff_parse_chunk (GST_ELEMENT_CAST (avi), buf, &offset, &tag,
|
|
|
|
|
&sub))
|
2006-10-28 16:37:20 +00:00
|
|
|
|
goto header_no_avih;
|
|
|
|
|
|
|
|
|
|
if (tag != GST_RIFF_TAG_avih)
|
|
|
|
|
goto header_no_avih;
|
|
|
|
|
|
2010-01-15 17:15:14 +00:00
|
|
|
|
if (!gst_avi_demux_parse_avih (avi, sub, &avi->avih))
|
2006-10-28 16:37:20 +00:00
|
|
|
|
goto header_wrong_avih;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "AVI header ok, reading elemnts from header");
|
|
|
|
|
|
|
|
|
|
/* now, read the elements from the header until the end */
|
2010-01-15 17:13:24 +00:00
|
|
|
|
while (gst_riff_parse_chunk (GST_ELEMENT_CAST (avi), buf, &offset, &tag,
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
&sub)) {
|
|
|
|
|
/* sub can be NULL on empty tags */
|
|
|
|
|
if (!sub)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
switch (tag) {
|
|
|
|
|
case GST_RIFF_TAG_LIST:
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (gst_buffer_get_size (sub) < 4)
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_extract (sub, 0, fourcc, 4);
|
|
|
|
|
|
|
|
|
|
switch (GST_READ_UINT32_LE (fourcc)) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
case GST_RIFF_LIST_strl:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
if (!(gst_avi_demux_parse_stream (avi, sub))) {
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2008-06-10 11:05:30 +00:00
|
|
|
|
GST_ELEMENT_WARNING (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("failed to parse stream, ignoring"));
|
|
|
|
|
goto next;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
case GST_RIFF_LIST_odml:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_avi_demux_parse_odml (avi, sub);
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"Unknown list %" GST_FOURCC_FORMAT " in AVI header",
|
2011-04-04 17:17:43 +00:00
|
|
|
|
GST_FOURCC_ARGS (GST_READ_UINT32_LE (fourcc)));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* fall-through */
|
2010-02-01 12:43:04 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNQ:
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNK:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
2012-07-18 22:43:59 +00:00
|
|
|
|
break;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
case GST_RIFF_IDIT:
|
|
|
|
|
gst_avi_demux_parse_idit (avi, sub);
|
|
|
|
|
goto next;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
default:
|
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"Unknown off %d tag %" GST_FOURCC_FORMAT " in AVI header",
|
|
|
|
|
offset, GST_FOURCC_ARGS (tag));
|
|
|
|
|
/* fall-through */
|
2010-02-01 12:43:04 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNQ:
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNK:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
next:
|
|
|
|
|
/* move to next chunk */
|
2009-08-04 09:39:39 +00:00
|
|
|
|
if (sub)
|
|
|
|
|
gst_buffer_unref (sub);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
sub = NULL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
GST_DEBUG ("elements parsed");
|
|
|
|
|
|
|
|
|
|
/* check parsed streams */
|
|
|
|
|
if (avi->num_streams == 0) {
|
|
|
|
|
goto no_streams;
|
|
|
|
|
} else if (avi->num_streams != avi->avih->streams) {
|
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"Stream header mentioned %d streams, but %d available",
|
|
|
|
|
avi->avih->streams, avi->num_streams);
|
|
|
|
|
}
|
|
|
|
|
GST_DEBUG ("Get junk and info next");
|
|
|
|
|
avi->header_state = GST_AVI_DEMUX_HEADER_INFO;
|
|
|
|
|
} else {
|
|
|
|
|
/* Need more data */
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
/* fall-though */
|
|
|
|
|
case GST_AVI_DEMUX_HEADER_INFO:
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "skipping junk between header and data ...");
|
2006-10-28 16:37:20 +00:00
|
|
|
|
while (TRUE) {
|
|
|
|
|
if (gst_adapter_available (avi->adapter) < 12)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
data = gst_adapter_map (avi->adapter, 12);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
tag = GST_READ_UINT32_LE (data);
|
|
|
|
|
size = GST_READ_UINT32_LE (data + 4);
|
|
|
|
|
ltag = GST_READ_UINT32_LE (data + 8);
|
2011-11-10 17:32:58 +00:00
|
|
|
|
gst_adapter_unmap (avi->adapter);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
|
|
|
|
if (tag == GST_RIFF_TAG_LIST) {
|
|
|
|
|
switch (ltag) {
|
|
|
|
|
case GST_RIFF_LIST_movi:
|
|
|
|
|
gst_adapter_flush (avi->adapter, 12);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (!avi->first_movi_offset)
|
|
|
|
|
avi->first_movi_offset = avi->offset;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
avi->offset += 12;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi->idx1_offset = avi->offset + size - 4;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
goto skipping_done;
|
|
|
|
|
case GST_RIFF_LIST_INFO:
|
|
|
|
|
GST_DEBUG ("Found INFO chunk");
|
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size)) {
|
2009-08-04 09:32:27 +00:00
|
|
|
|
GST_DEBUG ("got size %d", size);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
avi->offset += 12;
|
|
|
|
|
gst_adapter_flush (avi->adapter, 12);
|
2009-08-04 09:32:27 +00:00
|
|
|
|
if (size > 4) {
|
|
|
|
|
buf = gst_adapter_take_buffer (avi->adapter, size - 4);
|
2009-08-10 11:30:23 +00:00
|
|
|
|
/* mind padding */
|
|
|
|
|
if (size & 1)
|
|
|
|
|
gst_adapter_flush (avi->adapter, 1);
|
2010-01-15 17:13:24 +00:00
|
|
|
|
gst_riff_parse_info (GST_ELEMENT_CAST (avi), buf, &tags);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
if (tags) {
|
|
|
|
|
if (avi->globaltags) {
|
|
|
|
|
gst_tag_list_insert (avi->globaltags, tags,
|
|
|
|
|
GST_TAG_MERGE_REPLACE);
|
|
|
|
|
} else {
|
|
|
|
|
avi->globaltags = tags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tags = NULL;
|
2009-08-04 09:32:27 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += GST_ROUND_UP_2 (size) - 4;
|
2009-08-04 09:32:27 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG ("skipping INFO LIST prefix");
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* Need more data */
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size)) {
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* Need more data */
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size)) {
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* Need more data */
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-10-28 16:37:20 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
GST_WARNING ("unhandled header state: %d", avi->header_state);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
skipping_done:
|
|
|
|
|
|
gst/avi/gstavidemux.c: unbreak AVI index handling, some more debug, remove an obsolete adapter_flush that caused stre...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_read_subindexes_pull),
(gst_avi_demux_sync), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_chain):
unbreak AVI index handling, some more debug, remove an obsolete
adapter_flush that caused streaming to wander off in the wild
2006-08-24 13:51:15 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "skipping done ... (streams=%u, stream[0].indexes=%p)",
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
avi->num_streams, avi->stream[0].indexes);
|
|
|
|
|
|
|
|
|
|
GST_DEBUG ("Found movi chunk. Starting to stream data");
|
|
|
|
|
avi->state = GST_AVI_DEMUX_MOVI;
|
|
|
|
|
|
2009-10-14 09:55:33 +00:00
|
|
|
|
/* no indexes in push mode, but it still sets some variables */
|
|
|
|
|
gst_avi_demux_calculate_durations_from_index (avi);
|
|
|
|
|
|
2009-10-18 13:46:48 +00:00
|
|
|
|
gst_avi_demux_expose_streams (avi, TRUE);
|
|
|
|
|
|
2009-12-04 12:50:59 +00:00
|
|
|
|
/* prepare all streams for index 0 */
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++)
|
|
|
|
|
avi->stream[i].current_entry = 0;
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* create initial NEWSEGMENT event */
|
2010-01-20 10:22:04 +00:00
|
|
|
|
if (avi->seg_event)
|
|
|
|
|
gst_event_unref (avi->seg_event);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->seg_event = gst_event_new_segment (&avi->segment);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-10-14 11:08:47 +00:00
|
|
|
|
gst_avi_demux_check_seekability (avi);
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* at this point we know all the streams and we can signal the no more
|
|
|
|
|
* pads signal */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "signaling no more pads");
|
2010-01-15 17:13:24 +00:00
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT_CAST (avi));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
no_streams:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("No streams found"));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
2006-10-28 16:37:20 +00:00
|
|
|
|
header_no_list:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("Invalid AVI header (no LIST at start): %"
|
|
|
|
|
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
header_no_avih:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("Invalid AVI header (no avih at start): %"
|
|
|
|
|
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
|
|
|
|
if (sub)
|
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
header_wrong_avih:
|
|
|
|
|
{
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-01-08 12:17:22 +00:00
|
|
|
|
static void
|
2010-11-30 18:21:23 +00:00
|
|
|
|
gst_avi_demux_add_date_tag (GstAviDemux * avi, gint y, gint m, gint d,
|
|
|
|
|
gint h, gint min, gint s)
|
2010-01-08 12:17:22 +00:00
|
|
|
|
{
|
|
|
|
|
GDate *date;
|
2012-01-26 18:25:21 +00:00
|
|
|
|
GstDateTime *dt;
|
2010-11-30 18:21:23 +00:00
|
|
|
|
|
2010-01-08 12:17:22 +00:00
|
|
|
|
date = g_date_new_dmy (d, m, y);
|
|
|
|
|
if (!g_date_valid (date)) {
|
|
|
|
|
/* bogus date */
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Refusing to add invalid date %d-%d-%d", y, m, d);
|
|
|
|
|
g_date_free (date);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-26 18:25:21 +00:00
|
|
|
|
dt = gst_date_time_new_local_time (y, m, d, h, min, s);
|
2010-11-30 18:21:23 +00:00
|
|
|
|
|
2010-01-08 12:17:22 +00:00
|
|
|
|
if (avi->globaltags == NULL)
|
2011-10-30 11:44:53 +00:00
|
|
|
|
avi->globaltags = gst_tag_list_new_empty ();
|
2010-01-08 12:17:22 +00:00
|
|
|
|
|
|
|
|
|
gst_tag_list_add (avi->globaltags, GST_TAG_MERGE_REPLACE, GST_TAG_DATE, date,
|
|
|
|
|
NULL);
|
|
|
|
|
g_date_free (date);
|
2010-11-30 18:21:23 +00:00
|
|
|
|
if (dt) {
|
|
|
|
|
gst_tag_list_add (avi->globaltags, GST_TAG_MERGE_REPLACE, GST_TAG_DATE_TIME,
|
|
|
|
|
dt, NULL);
|
2012-01-26 18:25:21 +00:00
|
|
|
|
gst_date_time_unref (dt);
|
2010-11-30 18:21:23 +00:00
|
|
|
|
}
|
2010-01-08 12:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-01-08 14:33:02 +00:00
|
|
|
|
gst_avi_demux_parse_idit_nums_only (GstAviDemux * avi, gchar * data)
|
2010-01-08 12:17:22 +00:00
|
|
|
|
{
|
|
|
|
|
gint y, m, d;
|
2010-12-03 14:38:00 +00:00
|
|
|
|
gint hr = 0, min = 0, sec = 0;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
gint ret;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
|
2010-12-03 14:38:00 +00:00
|
|
|
|
GST_DEBUG ("data : '%s'", data);
|
|
|
|
|
|
|
|
|
|
ret = sscanf (data, "%d:%d:%d %d:%d:%d", &y, &m, &d, &hr, &min, &sec);
|
|
|
|
|
if (ret < 3) {
|
|
|
|
|
/* Attempt YYYY/MM/DD/ HH:MM variant (found in CASIO cameras) */
|
|
|
|
|
ret = sscanf (data, "%04d/%02d/%02d/ %d:%d", &y, &m, &d, &hr, &min);
|
|
|
|
|
if (ret < 3) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Failed to parse IDIT tag");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-01-08 13:44:44 +00:00
|
|
|
|
}
|
2010-12-03 14:38:00 +00:00
|
|
|
|
gst_avi_demux_add_date_tag (avi, y, m, d, hr, min, sec);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
get_month_num (gchar * data, guint size)
|
|
|
|
|
{
|
2010-01-08 13:44:44 +00:00
|
|
|
|
if (g_ascii_strncasecmp (data, "jan", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 1;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "feb", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 2;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "mar", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 3;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "apr", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 4;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "may", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 5;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "jun", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 6;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "jul", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 7;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "aug", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 8;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "sep", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 9;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "oct", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 10;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "nov", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 11;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
} else if (g_ascii_strncasecmp (data, "dec", 3) == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return 12;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-01-08 14:33:02 +00:00
|
|
|
|
gst_avi_demux_parse_idit_text (GstAviDemux * avi, gchar * data)
|
2010-01-08 12:17:22 +00:00
|
|
|
|
{
|
2010-01-08 13:44:44 +00:00
|
|
|
|
gint year, month, day;
|
|
|
|
|
gint hour, min, sec;
|
|
|
|
|
gint ret;
|
2010-01-08 14:33:02 +00:00
|
|
|
|
gchar weekday[4];
|
|
|
|
|
gchar monthstr[4];
|
2010-01-08 13:44:44 +00:00
|
|
|
|
|
2010-01-08 14:33:02 +00:00
|
|
|
|
ret = sscanf (data, "%3s %3s %d %d:%d:%d %d", weekday, monthstr, &day, &hour,
|
2010-01-08 13:44:44 +00:00
|
|
|
|
&min, &sec, &year);
|
|
|
|
|
if (ret != 7) {
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Failed to parse IDIT tag");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
month = get_month_num (monthstr, strlen (monthstr));
|
2010-11-30 18:21:23 +00:00
|
|
|
|
gst_avi_demux_add_date_tag (avi, year, month, day, hour, min, sec);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_parse_idit (GstAviDemux * avi, GstBuffer * buf)
|
|
|
|
|
{
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
|
|
|
|
gchar *ptr;
|
|
|
|
|
gsize left;
|
2010-01-08 13:44:44 +00:00
|
|
|
|
gchar *safedata = NULL;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
/*
|
|
|
|
|
* According to:
|
|
|
|
|
* http://www.eden-foundation.org/products/code/film_date_stamp/index.html
|
|
|
|
|
*
|
|
|
|
|
* This tag could be in one of the below formats
|
|
|
|
|
* 2005:08:17 11:42:43
|
|
|
|
|
* THU OCT 26 16:46:04 2006
|
|
|
|
|
* Mon Mar 3 09:44:56 2008
|
|
|
|
|
*
|
|
|
|
|
* FIXME: Our date tag doesn't include hours
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* skip eventual initial whitespace */
|
2012-01-23 16:25:37 +00:00
|
|
|
|
ptr = (gchar *) map.data;
|
|
|
|
|
left = map.size;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
|
|
|
|
while (left > 0 && g_ascii_isspace (ptr[0])) {
|
|
|
|
|
ptr++;
|
|
|
|
|
left--;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (left == 0) {
|
2010-01-08 12:17:22 +00:00
|
|
|
|
goto non_parsable;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-08 13:44:44 +00:00
|
|
|
|
/* make a safe copy to add a \0 to the end of the string */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
safedata = g_strndup (ptr, left);
|
2010-01-08 13:44:44 +00:00
|
|
|
|
|
2010-01-08 12:17:22 +00:00
|
|
|
|
/* test if the first char is a alpha or a number */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (g_ascii_isdigit (ptr[0])) {
|
2010-01-08 14:33:02 +00:00
|
|
|
|
gst_avi_demux_parse_idit_nums_only (avi, safedata);
|
2010-01-08 13:44:44 +00:00
|
|
|
|
g_free (safedata);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
} else if (g_ascii_isalpha (ptr[0])) {
|
2010-01-08 14:33:02 +00:00
|
|
|
|
gst_avi_demux_parse_idit_text (avi, safedata);
|
2010-01-08 13:44:44 +00:00
|
|
|
|
g_free (safedata);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-08 13:44:44 +00:00
|
|
|
|
g_free (safedata);
|
|
|
|
|
|
2010-01-08 12:17:22 +00:00
|
|
|
|
non_parsable:
|
|
|
|
|
GST_WARNING_OBJECT (avi, "IDIT tag has no parsable info");
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/*
|
|
|
|
|
* Read full AVI headers.
|
|
|
|
|
*/
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
static GstFlowReturn
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
gst_avi_demux_stream_header_pull (GstAviDemux * avi)
|
2001-12-22 23:22:30 +00:00
|
|
|
|
{
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
GstBuffer *buf, *sub = NULL;
|
|
|
|
|
guint32 tag;
|
|
|
|
|
guint offset = 4;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
GstElement *element = GST_ELEMENT_CAST (avi);
|
2009-09-21 10:32:51 +00:00
|
|
|
|
GstClockTime stamp;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
GstTagList *tags = NULL;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
guint8 fourcc[4];
|
2009-09-21 10:32:51 +00:00
|
|
|
|
|
|
|
|
|
stamp = gst_util_get_timestamp ();
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
|
|
/* the header consists of a 'hdrl' LIST tag */
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
res = gst_riff_read_chunk (element, avi->sinkpad, &avi->offset, &tag, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK)
|
2007-01-22 13:06:43 +00:00
|
|
|
|
goto pull_range_failed;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
else if (tag != GST_RIFF_TAG_LIST)
|
|
|
|
|
goto no_list;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
else if (gst_buffer_get_size (buf) < 4)
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto no_header;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "parsing headers");
|
|
|
|
|
|
2006-02-14 16:58:30 +00:00
|
|
|
|
/* Find the 'hdrl' LIST tag */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_extract (buf, 0, fourcc, 4);
|
|
|
|
|
while (GST_READ_UINT32_LE (fourcc) != GST_RIFF_LIST_hdrl) {
|
2006-02-14 16:58:30 +00:00
|
|
|
|
GST_LOG_OBJECT (avi, "buffer contains %" GST_FOURCC_FORMAT,
|
2011-04-04 17:17:43 +00:00
|
|
|
|
GST_FOURCC_ARGS (GST_READ_UINT32_LE (fourcc)));
|
2006-02-14 16:58:30 +00:00
|
|
|
|
|
|
|
|
|
/* Eat up */
|
|
|
|
|
gst_buffer_unref (buf);
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
|
|
|
|
/* read new chunk */
|
|
|
|
|
res = gst_riff_read_chunk (element, avi->sinkpad, &avi->offset, &tag, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK)
|
2007-01-22 13:06:43 +00:00
|
|
|
|
goto pull_range_failed;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
else if (tag != GST_RIFF_TAG_LIST)
|
|
|
|
|
goto no_list;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
else if (gst_buffer_get_size (buf) < 4)
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto no_header;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_extract (buf, 0, fourcc, 4);
|
2006-02-14 16:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "hdrl LIST tag found");
|
|
|
|
|
|
2010-10-26 09:15:49 +00:00
|
|
|
|
gst_avi_demux_roundup_list (avi, &buf);
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/* the hdrl starts with a 'avih' header */
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
if (!gst_riff_parse_chunk (element, buf, &offset, &tag, &sub))
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto no_avih;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
else if (tag != GST_RIFF_TAG_avih)
|
|
|
|
|
goto no_avih;
|
2010-01-15 17:15:14 +00:00
|
|
|
|
else if (!gst_avi_demux_parse_avih (avi, sub, &avi->avih))
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
goto invalid_avih;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2007-01-22 13:06:43 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "AVI header ok, reading elements from header");
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/* now, read the elements from the header until the end */
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
while (gst_riff_parse_chunk (element, buf, &offset, &tag, &sub)) {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2006-04-10 10:10:55 +00:00
|
|
|
|
/* sub can be NULL on empty tags */
|
|
|
|
|
if (!sub)
|
|
|
|
|
continue;
|
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (sub, &map, GST_MAP_READ);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
switch (tag) {
|
|
|
|
|
case GST_RIFF_TAG_LIST:
|
2012-01-23 16:25:37 +00:00
|
|
|
|
if (map.size < 4)
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
switch (GST_READ_UINT32_LE (map.data)) {
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case GST_RIFF_LIST_strl:
|
2008-06-10 11:05:30 +00:00
|
|
|
|
if (!(gst_avi_demux_parse_stream (avi, sub))) {
|
|
|
|
|
GST_ELEMENT_WARNING (avi, STREAM, DEMUX, (NULL),
|
2009-08-04 09:39:59 +00:00
|
|
|
|
("failed to parse stream, ignoring"));
|
2008-06-10 11:05:30 +00:00
|
|
|
|
sub = NULL;
|
|
|
|
|
}
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case GST_RIFF_LIST_odml:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
gst_avi_demux_parse_odml (avi, sub);
|
2009-08-04 09:39:39 +00:00
|
|
|
|
sub = NULL;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
2009-10-18 13:51:34 +00:00
|
|
|
|
case GST_RIFF_LIST_INFO:
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_resize (sub, 4, -1);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
gst_riff_parse_info (element, sub, &tags);
|
|
|
|
|
if (tags) {
|
|
|
|
|
if (avi->globaltags) {
|
|
|
|
|
gst_tag_list_insert (avi->globaltags, tags,
|
|
|
|
|
GST_TAG_MERGE_REPLACE);
|
|
|
|
|
} else {
|
|
|
|
|
avi->globaltags = tags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tags = NULL;
|
2009-10-18 13:51:34 +00:00
|
|
|
|
break;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
default:
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
2005-11-21 13:38:24 +00:00
|
|
|
|
"Unknown list %" GST_FOURCC_FORMAT " in AVI header",
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GST_FOURCC_ARGS (GST_READ_UINT32_LE (map.data)));
|
|
|
|
|
GST_MEMDUMP_OBJECT (avi, "Unknown list", map.data, map.size);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
/* fall-through */
|
2010-02-01 12:43:04 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNQ:
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNK:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
goto next;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2010-01-08 12:17:22 +00:00
|
|
|
|
case GST_RIFF_IDIT:
|
|
|
|
|
gst_avi_demux_parse_idit (avi, sub);
|
|
|
|
|
goto next;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
default:
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
"Unknown tag %" GST_FOURCC_FORMAT " in AVI header at off %d",
|
|
|
|
|
GST_FOURCC_ARGS (tag), offset);
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GST_MEMDUMP_OBJECT (avi, "Unknown tag", map.data, map.size);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
/* fall-through */
|
2010-02-01 12:43:04 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNQ:
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_RIFF_TAG_JUNK:
|
2006-08-24 11:21:06 +00:00
|
|
|
|
next:
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (sub) {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (sub, &map);
|
2008-06-10 11:05:30 +00:00
|
|
|
|
gst_buffer_unref (sub);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
}
|
2006-04-10 10:10:55 +00:00
|
|
|
|
sub = NULL;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
2003-01-20 20:49:34 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_DEBUG ("elements parsed");
|
2002-06-18 19:17:04 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
/* check parsed streams */
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
if (avi->num_streams == 0)
|
|
|
|
|
goto no_streams;
|
|
|
|
|
else if (avi->num_streams != avi->avih->streams) {
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"Stream header mentioned %d streams, but %d available",
|
|
|
|
|
avi->avih->streams, avi->num_streams);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-09 17:55:22 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "skipping junk between header and data, offset=%"
|
|
|
|
|
G_GUINT64_FORMAT, avi->offset);
|
2005-08-09 14:40:02 +00:00
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
/* Now, find the data (i.e. skip all junk between header and data) */
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
do {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GstMapInfo map;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
guint size;
|
|
|
|
|
guint32 tag, ltag;
|
|
|
|
|
|
2012-03-16 20:47:21 +00:00
|
|
|
|
buf = NULL;
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
res = gst_pad_pull_range (avi->sinkpad, avi->offset, 12, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK) {
|
2007-01-22 13:06:43 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "pull_range failure while looking for tags");
|
|
|
|
|
goto pull_range_failed;
|
2011-04-04 17:17:43 +00:00
|
|
|
|
} else if (gst_buffer_get_size (buf) < 12) {
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"got %" G_GSIZE_FORMAT " bytes which is less than 12 bytes",
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_get_size (buf));
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
return GST_FLOW_ERROR;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
tag = GST_READ_UINT32_LE (map.data);
|
|
|
|
|
size = GST_READ_UINT32_LE (map.data + 4);
|
|
|
|
|
ltag = GST_READ_UINT32_LE (map.data + 8);
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
|
2008-12-09 17:55:22 +00:00
|
|
|
|
GST_DEBUG ("tag %" GST_FOURCC_FORMAT ", size %u",
|
|
|
|
|
GST_FOURCC_ARGS (tag), size);
|
2012-01-23 16:25:37 +00:00
|
|
|
|
GST_MEMDUMP ("Tag content", map.data, map.size);
|
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2009-06-09 08:38:52 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2008-12-09 17:55:22 +00:00
|
|
|
|
|
2009-06-09 08:38:52 +00:00
|
|
|
|
switch (tag) {
|
|
|
|
|
case GST_RIFF_TAG_LIST:{
|
|
|
|
|
switch (ltag) {
|
|
|
|
|
case GST_RIFF_LIST_movi:
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Reached the 'movi' tag, we're done with skipping");
|
|
|
|
|
goto skipping_done;
|
|
|
|
|
case GST_RIFF_LIST_INFO:
|
|
|
|
|
res =
|
|
|
|
|
gst_riff_read_chunk (element, avi->sinkpad, &avi->offset, &tag,
|
|
|
|
|
&buf);
|
|
|
|
|
if (res != GST_FLOW_OK) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "couldn't read INFO chunk");
|
|
|
|
|
goto pull_range_failed;
|
|
|
|
|
}
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG ("got size %" G_GSIZE_FORMAT, gst_buffer_get_size (buf));
|
2009-08-04 09:32:27 +00:00
|
|
|
|
if (size < 4) {
|
|
|
|
|
GST_DEBUG ("skipping INFO LIST prefix");
|
|
|
|
|
avi->offset += (4 - GST_ROUND_UP_2 (size));
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
|
2011-04-04 17:17:43 +00:00
|
|
|
|
sub = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, 4, -1);
|
2010-01-08 12:17:22 +00:00
|
|
|
|
gst_riff_parse_info (element, sub, &tags);
|
|
|
|
|
if (tags) {
|
|
|
|
|
if (avi->globaltags) {
|
|
|
|
|
gst_tag_list_insert (avi->globaltags, tags,
|
|
|
|
|
GST_TAG_MERGE_REPLACE);
|
|
|
|
|
} else {
|
|
|
|
|
avi->globaltags = tags;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tags = NULL;
|
2009-06-09 08:38:52 +00:00
|
|
|
|
if (sub) {
|
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
sub = NULL;
|
|
|
|
|
}
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
/* gst_riff_read_chunk() has already advanced avi->offset */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
GST_WARNING_OBJECT (avi,
|
|
|
|
|
"Skipping unknown list tag %" GST_FOURCC_FORMAT,
|
|
|
|
|
GST_FOURCC_ARGS (ltag));
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
2009-06-09 08:38:52 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2004-01-23 13:22:16 +00:00
|
|
|
|
}
|
2009-06-09 08:38:52 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Skipping unknown tag %" GST_FOURCC_FORMAT,
|
|
|
|
|
GST_FOURCC_ARGS (tag));
|
|
|
|
|
/* Fall-through */
|
|
|
|
|
case GST_MAKE_FOURCC ('J', 'U', 'N', 'Q'):
|
|
|
|
|
case GST_MAKE_FOURCC ('J', 'U', 'N', 'K'):
|
2009-10-18 13:52:02 +00:00
|
|
|
|
/* Only get buffer for debugging if the memdump is needed */
|
|
|
|
|
if (gst_debug_category_get_threshold (GST_CAT_DEFAULT) >= 9) {
|
2012-03-16 20:47:21 +00:00
|
|
|
|
buf = NULL;
|
2009-10-18 13:52:02 +00:00
|
|
|
|
res = gst_pad_pull_range (avi->sinkpad, avi->offset, size, &buf);
|
|
|
|
|
if (res != GST_FLOW_OK) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "couldn't read INFO chunk");
|
|
|
|
|
goto pull_range_failed;
|
|
|
|
|
}
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
GST_MEMDUMP ("Junk", map.data, map.size);
|
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2009-10-18 13:52:02 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
}
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
2009-06-09 08:38:52 +00:00
|
|
|
|
break;
|
2003-01-20 20:49:34 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
} while (1);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
skipping_done:
|
|
|
|
|
|
gst/avi/gstavidemux.c: unbreak AVI index handling, some more debug, remove an obsolete adapter_flush that caused stre...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_read_subindexes_pull),
(gst_avi_demux_sync), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_chain):
unbreak AVI index handling, some more debug, remove an obsolete
adapter_flush that caused streaming to wander off in the wild
2006-08-24 13:51:15 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "skipping done ... (streams=%u, stream[0].indexes=%p)",
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
avi->num_streams, avi->stream[0].indexes);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
|
|
/* create or read stream index (for seeking) */
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
if (avi->stream[0].indexes != NULL) {
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
/* we read a super index already (gst_avi_demux_parse_superindex() ) */
|
2009-09-23 10:56:07 +00:00
|
|
|
|
gst_avi_demux_read_subindexes_pull (avi);
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
}
|
2009-09-22 20:12:58 +00:00
|
|
|
|
if (!avi->have_index) {
|
|
|
|
|
if (avi->avih->flags & GST_RIFF_AVIH_HASINDEX)
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_stream_index (avi);
|
gst/avi/gstavidemux.c: Construct index for indexless files.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_odml), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_stream_header), (gst_avi_demux_loop):
Construct index for indexless files.
Make sure pad/buffers are correctly reset to NULL once we don't need
them anymore, else we get lovely segfaults/assertions.
* gst/wavparse/gstwavparse.c:
Yes, you can have 96KHz audio and wma in wav :(
2005-12-19 15:06:27 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* still no index, scan */
|
|
|
|
|
if (!avi->have_index) {
|
|
|
|
|
gst_avi_demux_stream_scan (avi);
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* still no index.. this is a fatal error for now.
|
|
|
|
|
* FIXME, we should switch to plain push mode without seeking
|
|
|
|
|
* instead of failing. */
|
|
|
|
|
if (!avi->have_index)
|
|
|
|
|
goto no_index;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* use the indexes now to construct nice durations */
|
2006-03-03 17:51:16 +00:00
|
|
|
|
gst_avi_demux_calculate_durations_from_index (avi);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2009-10-18 13:46:48 +00:00
|
|
|
|
gst_avi_demux_expose_streams (avi, FALSE);
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* do initial seek to the default segment values */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_do_seek (avi, &avi->segment);
|
2009-10-27 17:07:18 +00:00
|
|
|
|
|
2011-06-02 16:47:36 +00:00
|
|
|
|
/* create initial NEWSEGMENT event */
|
2010-01-20 10:22:04 +00:00
|
|
|
|
if (avi->seg_event)
|
|
|
|
|
gst_event_unref (avi->seg_event);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->seg_event = gst_event_new_segment (&avi->segment);
|
2005-07-16 16:43:53 +00:00
|
|
|
|
|
2009-09-21 10:32:51 +00:00
|
|
|
|
stamp = gst_util_get_timestamp () - stamp;
|
2009-12-07 20:54:07 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "pulling header took %" GST_TIME_FORMAT,
|
2009-09-21 10:32:51 +00:00
|
|
|
|
GST_TIME_ARGS (stamp));
|
|
|
|
|
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
/* at this point we know all the streams and we can signal the no more
|
|
|
|
|
* pads signal */
|
2005-01-13 17:11:08 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "signaling no more pads");
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT_CAST (avi));
|
ext/gnomevfs/gstgnomevfssrc.c: Some debug.
Original commit message from CVS:
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_get),
(gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
Some debug.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_handle_src_event), (gst_avi_demux_read_superindex),
(gst_avi_demux_read_subindexes), (gst_avi_demux_add_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_skip),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header):
* gst/avi/gstavidemux.h:
Support for openDML-2.0 indx/ix## chunks. Support for broken index
recovery (where, if part of the index is broken, we will still read
the rest of the index and recover the broken part by stream
scanning). More broken media support. EOS workarounds. General AVI
braindamage headache recovery. Aspirin included.
2004-10-12 12:29:45 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
return GST_FLOW_OK;
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
no_list:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("Invalid AVI header (no LIST at start): %"
|
|
|
|
|
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
no_header:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("Invalid AVI header (no hdrl at start): %"
|
|
|
|
|
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
no_avih:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("Invalid AVI header (no avih at start): %"
|
|
|
|
|
GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag)));
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
if (sub)
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
invalid_avih:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("Invalid AVI header (cannot parse avih at start)"));
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
no_streams:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("No streams found"));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
no_index:
|
|
|
|
|
{
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
GST_WARNING ("file without or too big index");
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
("Could not get/create index"));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
2007-01-22 13:06:43 +00:00
|
|
|
|
pull_range_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL),
|
|
|
|
|
("pull_range flow reading header: %s", gst_flow_get_name (res)));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-22 12:44:42 +00:00
|
|
|
|
/* move a stream to @index */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_move_stream (GstAviDemux * avi, GstAviStream * stream,
|
|
|
|
|
GstSegment * segment, guint index)
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Move stream %d to %u", stream->num, index);
|
|
|
|
|
|
|
|
|
|
if (segment->rate < 0.0) {
|
|
|
|
|
guint next_key;
|
|
|
|
|
/* Because we don't know the frame order we need to push from the prev keyframe
|
|
|
|
|
* to the next keyframe. If there is a smart decoder downstream he will notice
|
2012-01-03 14:26:21 +00:00
|
|
|
|
* that there are too many encoded frames send and return EOS when there
|
2009-09-21 16:04:25 +00:00
|
|
|
|
* are enough decoded frames to fill the segment. */
|
2009-09-22 10:35:30 +00:00
|
|
|
|
next_key = gst_avi_demux_index_next (avi, stream, index, TRUE);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
2009-09-22 12:44:42 +00:00
|
|
|
|
/* FIXME, we go back to 0, we should look at segment.start. We will however
|
|
|
|
|
* stop earlier when the see the timestamp < segment.start */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
stream->start_entry = 0;
|
|
|
|
|
stream->step_entry = index;
|
|
|
|
|
stream->current_entry = index;
|
|
|
|
|
stream->stop_entry = next_key;
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "reverse seek: start %u, step %u, stop %u",
|
|
|
|
|
stream->start_entry, stream->step_entry, stream->stop_entry);
|
|
|
|
|
} else {
|
|
|
|
|
stream->start_entry = index;
|
|
|
|
|
stream->step_entry = index;
|
|
|
|
|
stream->stop_entry = gst_avi_demux_index_last (avi, stream);
|
|
|
|
|
}
|
|
|
|
|
if (stream->current_entry != index) {
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Move DISCONT from %u to %u",
|
|
|
|
|
stream->current_entry, index);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
stream->current_entry = index;
|
|
|
|
|
stream->discont = TRUE;
|
|
|
|
|
}
|
2009-09-22 12:44:42 +00:00
|
|
|
|
|
|
|
|
|
/* update the buffer info */
|
|
|
|
|
gst_avi_demux_get_buffer_info (avi, stream, index,
|
|
|
|
|
&stream->current_timestamp, &stream->current_ts_end,
|
|
|
|
|
&stream->current_offset, &stream->current_offset_end);
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Moved to %u, ts %" GST_TIME_FORMAT
|
|
|
|
|
", ts_end %" GST_TIME_FORMAT ", off %" G_GUINT64_FORMAT
|
|
|
|
|
", off_end %" G_GUINT64_FORMAT, index,
|
|
|
|
|
GST_TIME_ARGS (stream->current_timestamp),
|
|
|
|
|
GST_TIME_ARGS (stream->current_ts_end), stream->current_offset,
|
|
|
|
|
stream->current_offset_end);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Seeking to offset %" G_GUINT64_FORMAT,
|
|
|
|
|
stream->index[index].offset);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
/*
|
|
|
|
|
* Do the actual seeking.
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
GstClockTime seek_time;
|
2012-04-26 11:46:11 +00:00
|
|
|
|
gboolean keyframe, before, after;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
guint i, index;
|
|
|
|
|
GstAviStream *stream;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
2011-06-02 16:47:36 +00:00
|
|
|
|
seek_time = segment->position;
|
2012-04-30 20:30:56 +00:00
|
|
|
|
keyframe = ! !(segment->flags & GST_SEEK_FLAG_KEY_UNIT);
|
|
|
|
|
before = ! !(segment->flags & GST_SEEK_FLAG_SNAP_BEFORE);
|
|
|
|
|
after = ! !(segment->flags & GST_SEEK_FLAG_SNAP_AFTER);
|
2005-11-11 16:48:58 +00:00
|
|
|
|
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "seek to: %" GST_TIME_FORMAT
|
2012-04-26 11:46:11 +00:00
|
|
|
|
" keyframe seeking:%d, %s", GST_TIME_ARGS (seek_time), keyframe,
|
|
|
|
|
snap_types[before ? 1 : 0][after ? 1 : 0]);
|
2009-09-22 12:44:42 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
/* FIXME, this code assumes the main stream with keyframes is stream 0,
|
|
|
|
|
* which is mostly correct... */
|
2009-10-18 13:48:06 +00:00
|
|
|
|
stream = &avi->stream[avi->main_stream];
|
2002-02-03 20:10:04 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
/* get the entry index for the requested position */
|
|
|
|
|
index = gst_avi_demux_index_for_time (avi, stream, seek_time);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Got entry %u", index);
|
2008-06-02 16:10:00 +00:00
|
|
|
|
|
|
|
|
|
/* check if we are already on a keyframe */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
if (!ENTRY_IS_KEYFRAME (&stream->index[index])) {
|
2012-04-26 11:46:11 +00:00
|
|
|
|
gboolean next;
|
|
|
|
|
|
|
|
|
|
next = after && !before;
|
|
|
|
|
if (segment->rate < 0)
|
|
|
|
|
next = !next;
|
|
|
|
|
|
|
|
|
|
if (next) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "not keyframe, searching forward");
|
|
|
|
|
/* now go to the next keyframe, this is where we should start
|
|
|
|
|
* decoding from. */
|
|
|
|
|
index = gst_avi_demux_index_next (avi, stream, index, TRUE);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "next keyframe at %u", index);
|
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "not keyframe, searching back");
|
|
|
|
|
/* now go to the previous keyframe, this is where we should start
|
|
|
|
|
* decoding from. */
|
|
|
|
|
index = gst_avi_demux_index_prev (avi, stream, index, TRUE);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "previous keyframe at %u", index);
|
|
|
|
|
}
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
2008-06-04 18:03:24 +00:00
|
|
|
|
|
2009-09-22 15:42:48 +00:00
|
|
|
|
/* move the main stream to this position */
|
|
|
|
|
gst_avi_demux_move_stream (avi, stream, segment, index);
|
2008-06-02 16:10:00 +00:00
|
|
|
|
|
|
|
|
|
if (keyframe) {
|
|
|
|
|
/* when seeking to a keyframe, we update the result seek time
|
|
|
|
|
* to the time of the keyframe. */
|
2009-09-22 15:42:48 +00:00
|
|
|
|
seek_time = stream->current_timestamp;
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "keyframe adjusted to %" GST_TIME_FORMAT,
|
|
|
|
|
GST_TIME_ARGS (seek_time));
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-02 16:47:36 +00:00
|
|
|
|
/* the seek time is also the position and stream time when going
|
2009-09-22 16:18:20 +00:00
|
|
|
|
* forwards */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
segment->position = seek_time;
|
2009-09-22 16:18:20 +00:00
|
|
|
|
if (segment->rate > 0.0)
|
|
|
|
|
segment->time = seek_time;
|
2009-09-22 12:44:42 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
/* now set DISCONT and align the other streams */
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
GstAviStream *ostream;
|
|
|
|
|
|
|
|
|
|
ostream = &avi->stream[i];
|
2009-10-18 14:02:01 +00:00
|
|
|
|
if ((ostream == stream) || (ostream->index == NULL))
|
2009-09-21 16:04:25 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* get the entry index for the requested position */
|
|
|
|
|
index = gst_avi_demux_index_for_time (avi, ostream, seek_time);
|
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* move to previous keyframe */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
if (!ENTRY_IS_KEYFRAME (&ostream->index[index]))
|
2009-09-22 10:35:30 +00:00
|
|
|
|
index = gst_avi_demux_index_prev (avi, ostream, index, TRUE);
|
2009-09-22 12:44:42 +00:00
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_move_stream (avi, ostream, segment, index);
|
2006-08-22 17:02:39 +00:00
|
|
|
|
}
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "done seek to: %" GST_TIME_FORMAT,
|
|
|
|
|
GST_TIME_ARGS (seek_time));
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-06 09:05:33 +00:00
|
|
|
|
/*
|
2010-01-18 16:13:06 +00:00
|
|
|
|
* Handle seek event in pull mode.
|
2006-09-06 09:05:33 +00:00
|
|
|
|
*/
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gst_avi_demux_handle_seek (GstAviDemux * avi, GstPad * pad, GstEvent * event)
|
|
|
|
|
{
|
|
|
|
|
gdouble rate;
|
|
|
|
|
GstFormat format;
|
|
|
|
|
GstSeekFlags flags;
|
|
|
|
|
GstSeekType cur_type = GST_SEEK_TYPE_NONE, stop_type;
|
|
|
|
|
gint64 cur, stop;
|
|
|
|
|
gboolean flush;
|
|
|
|
|
gboolean update;
|
|
|
|
|
GstSegment seeksegment = { 0, };
|
2009-09-22 16:18:20 +00:00
|
|
|
|
gint i;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
if (event) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "doing seek with event");
|
|
|
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
|
|
|
|
&cur_type, &cur, &stop_type, &stop);
|
|
|
|
|
|
|
|
|
|
/* we have to have a format as the segment format. Try to convert
|
|
|
|
|
* if not. */
|
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
2009-04-18 16:17:35 +00:00
|
|
|
|
gboolean res = TRUE;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
if (cur_type != GST_SEEK_TYPE_NONE)
|
2011-07-28 09:54:38 +00:00
|
|
|
|
res = gst_pad_query_convert (pad, format, cur, GST_FORMAT_TIME, &cur);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
2011-07-28 09:54:38 +00:00
|
|
|
|
res = gst_pad_query_convert (pad, format, stop, GST_FORMAT_TIME, &stop);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
if (!res)
|
|
|
|
|
goto no_format;
|
|
|
|
|
|
2011-07-28 09:54:38 +00:00
|
|
|
|
format = GST_FORMAT_TIME;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
2008-06-02 16:10:00 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"seek requested: rate %g cur %" GST_TIME_FORMAT " stop %"
|
|
|
|
|
GST_TIME_FORMAT, rate, GST_TIME_ARGS (cur), GST_TIME_ARGS (stop));
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
/* FIXME: can we do anything with rate!=1.0 */
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "doing seek without event");
|
|
|
|
|
flags = 0;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
rate = 1.0;
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* save flush flag */
|
|
|
|
|
flush = flags & GST_SEEK_FLAG_FLUSH;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
2005-11-11 16:48:58 +00:00
|
|
|
|
if (flush) {
|
2009-09-22 16:18:20 +00:00
|
|
|
|
GstEvent *fevent = gst_event_new_flush_start ();
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* for a flushing seek, we send a flush_start on all pads. This will
|
|
|
|
|
* eventually stop streaming with a WRONG_STATE. We can thus eventually
|
|
|
|
|
* take the STREAM_LOCK. */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "sending flush start");
|
2009-09-22 16:18:20 +00:00
|
|
|
|
gst_avi_demux_push_event (avi, gst_event_ref (fevent));
|
|
|
|
|
gst_pad_push_event (avi->sinkpad, fevent);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* a non-flushing seek, we PAUSE the task so that we can take the
|
|
|
|
|
* STREAM_LOCK */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "non flushing seek, pausing task");
|
2005-11-11 16:48:58 +00:00
|
|
|
|
gst_pad_pause_task (avi->sinkpad);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
2003-01-20 20:49:34 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* wait for streaming to stop */
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "wait for streaming to stop");
|
2005-11-21 18:09:02 +00:00
|
|
|
|
GST_PAD_STREAM_LOCK (avi->sinkpad);
|
2005-01-29 15:47:18 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* copy segment, we need this because we still need the old
|
|
|
|
|
* segment when we close the current segment. */
|
|
|
|
|
memcpy (&seeksegment, &avi->segment, sizeof (GstSegment));
|
2005-11-11 16:48:58 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
if (event) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "configuring seek");
|
2011-06-02 16:47:36 +00:00
|
|
|
|
gst_segment_do_seek (&seeksegment, rate, format, flags,
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
cur_type, cur, stop_type, stop, &update);
|
|
|
|
|
}
|
2011-06-02 16:47:36 +00:00
|
|
|
|
/* do the seek, seeksegment.position contains the new position, this
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
* actually never fails. */
|
2009-04-18 16:17:35 +00:00
|
|
|
|
gst_avi_demux_do_seek (avi, &seeksegment);
|
2005-11-11 16:48:58 +00:00
|
|
|
|
|
|
|
|
|
if (flush) {
|
2011-06-13 11:07:27 +00:00
|
|
|
|
GstEvent *fevent = gst_event_new_flush_stop (TRUE);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "sending flush stop");
|
2009-09-22 16:18:20 +00:00
|
|
|
|
gst_avi_demux_push_event (avi, gst_event_ref (fevent));
|
|
|
|
|
gst_pad_push_event (avi->sinkpad, fevent);
|
2005-11-11 16:48:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* now update the real segment info */
|
|
|
|
|
memcpy (&avi->segment, &seeksegment, sizeof (GstSegment));
|
|
|
|
|
|
|
|
|
|
/* post the SEGMENT_START message when we do segmented playback */
|
gst/avi/gstavidemux.*: Some cleanups, prepare to use GstSegment.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_next), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_subindex),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Some cleanups, prepare to use GstSegment.
Fix error in entry walking code.
Fix VBR detection.
Smarter timestamp calculation code.
Uniform error/eos handling.
2006-05-12 18:04:22 +00:00
|
|
|
|
if (avi->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
2010-01-15 17:13:24 +00:00
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (avi),
|
|
|
|
|
gst_message_new_segment_start (GST_OBJECT_CAST (avi),
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->segment.format, avi->segment.position));
|
2005-11-11 16:48:58 +00:00
|
|
|
|
}
|
2005-02-17 19:21:42 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* queue the segment event for the streaming thread. */
|
2010-01-20 10:22:04 +00:00
|
|
|
|
if (avi->seg_event)
|
|
|
|
|
gst_event_unref (avi->seg_event);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->seg_event = gst_event_new_segment (&avi->segment);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
|
|
|
|
if (!avi->streaming) {
|
|
|
|
|
gst_pad_start_task (avi->sinkpad, (GstTaskFunction) gst_avi_demux_loop,
|
2012-06-20 08:33:42 +00:00
|
|
|
|
avi->sinkpad, NULL);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
2010-02-16 14:00:13 +00:00
|
|
|
|
/* reset the last flow and mark discont, seek is always DISCONT */
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "marking DISCONT");
|
|
|
|
|
avi->stream[i].last_flow = GST_FLOW_OK;
|
|
|
|
|
avi->stream[i].discont = TRUE;
|
|
|
|
|
}
|
2005-11-21 18:09:02 +00:00
|
|
|
|
GST_PAD_STREAM_UNLOCK (avi->sinkpad);
|
2005-01-29 15:47:18 +00:00
|
|
|
|
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
return TRUE;
|
2005-11-11 16:48:58 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* ERRORS */
|
|
|
|
|
no_format:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "unsupported format given, seek aborted.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2005-01-29 15:47:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/*
|
2010-01-18 16:13:06 +00:00
|
|
|
|
* Handle seek event in push mode.
|
2009-12-04 14:13:12 +00:00
|
|
|
|
*/
|
2009-10-14 11:09:03 +00:00
|
|
|
|
static gboolean
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GstEvent * event)
|
2009-10-14 11:09:03 +00:00
|
|
|
|
{
|
|
|
|
|
gdouble rate;
|
|
|
|
|
GstFormat format;
|
|
|
|
|
GstSeekFlags flags;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GstSeekType cur_type = GST_SEEK_TYPE_NONE, stop_type;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
gint64 cur, stop;
|
2012-04-26 11:46:11 +00:00
|
|
|
|
gboolean keyframe, before, after;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
guint index;
|
|
|
|
|
guint n, str_num;
|
|
|
|
|
guint64 min_offset;
|
2010-03-09 17:06:52 +00:00
|
|
|
|
GstSegment seeksegment;
|
|
|
|
|
gboolean update;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* check we have the index */
|
|
|
|
|
if (!avi->have_index) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "no seek index built, seek aborted.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "doing push-based seek with event");
|
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
|
|
|
|
&cur_type, &cur, &stop_type, &stop);
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
|
gboolean res = TRUE;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (cur_type != GST_SEEK_TYPE_NONE)
|
2011-07-28 09:54:38 +00:00
|
|
|
|
res = gst_pad_query_convert (pad, format, cur, GST_FORMAT_TIME, &cur);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
2011-07-28 09:54:38 +00:00
|
|
|
|
res = gst_pad_query_convert (pad, format, stop, GST_FORMAT_TIME, &stop);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (!res) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "unsupported format given, seek aborted.");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2011-07-28 09:54:38 +00:00
|
|
|
|
format = GST_FORMAT_TIME;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-03-09 17:06:52 +00:00
|
|
|
|
/* let gst_segment handle any tricky stuff */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "configuring seek");
|
|
|
|
|
memcpy (&seeksegment, &avi->segment, sizeof (GstSegment));
|
2011-06-02 16:47:36 +00:00
|
|
|
|
gst_segment_do_seek (&seeksegment, rate, format, flags,
|
2010-03-09 17:06:52 +00:00
|
|
|
|
cur_type, cur, stop_type, stop, &update);
|
|
|
|
|
|
2012-04-30 20:30:56 +00:00
|
|
|
|
keyframe = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
cur = seeksegment.position;
|
2012-04-30 20:30:56 +00:00
|
|
|
|
before = ! !(flags & GST_SEEK_FLAG_SNAP_BEFORE);
|
|
|
|
|
after = ! !(flags & GST_SEEK_FLAG_SNAP_AFTER);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-01-19 09:51:08 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Seek requested: ts %" GST_TIME_FORMAT " stop %" GST_TIME_FORMAT
|
2012-04-26 11:46:11 +00:00
|
|
|
|
", kf %u, %s, rate %lf", GST_TIME_ARGS (cur), GST_TIME_ARGS (stop),
|
|
|
|
|
keyframe, snap_types[before ? 1 : 0][after ? 1 : 0], rate);
|
2010-03-09 17:06:52 +00:00
|
|
|
|
|
|
|
|
|
if (rate < 0) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "negative rate seek not supported in push mode");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* FIXME, this code assumes the main stream with keyframes is stream 0,
|
|
|
|
|
* which is mostly correct... */
|
|
|
|
|
str_num = avi->main_stream;
|
2010-01-19 09:51:08 +00:00
|
|
|
|
stream = &avi->stream[str_num];
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* get the entry index for the requested position */
|
|
|
|
|
index = gst_avi_demux_index_for_time (avi, stream, cur);
|
2010-01-19 09:51:08 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "str %u: Found entry %u for %" GST_TIME_FORMAT,
|
|
|
|
|
str_num, index, GST_TIME_ARGS (cur));
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* check if we are already on a keyframe */
|
|
|
|
|
if (!ENTRY_IS_KEYFRAME (&stream->index[index])) {
|
2012-04-26 11:46:11 +00:00
|
|
|
|
gboolean next;
|
|
|
|
|
|
|
|
|
|
next = after && !before;
|
|
|
|
|
if (seeksegment.rate < 0)
|
|
|
|
|
next = !next;
|
|
|
|
|
|
|
|
|
|
if (next) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Entry is not a keyframe - searching forward");
|
|
|
|
|
/* now go to the next keyframe, this is where we should start
|
|
|
|
|
* decoding from. */
|
|
|
|
|
index = gst_avi_demux_index_next (avi, stream, index, TRUE);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Found previous keyframe at %u", index);
|
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Entry is not a keyframe - searching back");
|
|
|
|
|
/* now go to the previous keyframe, this is where we should start
|
|
|
|
|
* decoding from. */
|
|
|
|
|
index = gst_avi_demux_index_prev (avi, stream, index, TRUE);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Found previous keyframe at %u", index);
|
|
|
|
|
}
|
2009-12-04 14:13:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gst_avi_demux_get_buffer_info (avi, stream, index,
|
|
|
|
|
&stream->current_timestamp, &stream->current_ts_end,
|
|
|
|
|
&stream->current_offset, &stream->current_offset_end);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-01-19 09:51:08 +00:00
|
|
|
|
/* re-use cur to be the timestamp of the seek as it _will_ be */
|
|
|
|
|
cur = stream->current_timestamp;
|
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
min_offset = stream->index[index].offset;
|
|
|
|
|
avi->seek_kf_offset = min_offset - 8;
|
2010-01-19 09:51:08 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Seek to: ts %" GST_TIME_FORMAT " (on str %u, idx %u, offset %"
|
|
|
|
|
G_GUINT64_FORMAT ")", GST_TIME_ARGS (stream->current_timestamp), str_num,
|
|
|
|
|
index, min_offset);
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
for (n = 0; n < avi->num_streams; n++) {
|
|
|
|
|
GstAviStream *str = &avi->stream[n];
|
|
|
|
|
guint idx;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (n == avi->main_stream)
|
|
|
|
|
continue;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* get the entry index for the requested position */
|
2010-01-19 09:51:08 +00:00
|
|
|
|
idx = gst_avi_demux_index_for_time (avi, str, cur);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "str %u: Found entry %u for %" GST_TIME_FORMAT, n,
|
|
|
|
|
idx, GST_TIME_ARGS (cur));
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
/* check if we are already on a keyframe */
|
|
|
|
|
if (!ENTRY_IS_KEYFRAME (&str->index[idx])) {
|
2012-04-26 11:46:11 +00:00
|
|
|
|
if (after && !before) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Entry is not a keyframe - searching forward");
|
|
|
|
|
/* now go to the next keyframe, this is where we should start
|
|
|
|
|
* decoding from. */
|
|
|
|
|
idx = gst_avi_demux_index_next (avi, str, idx, TRUE);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Found next keyframe at %u", idx);
|
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Entry is not a keyframe - searching back");
|
|
|
|
|
/* now go to the previous keyframe, this is where we should start
|
|
|
|
|
* decoding from. */
|
|
|
|
|
idx = gst_avi_demux_index_prev (avi, str, idx, TRUE);
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Found previous keyframe at %u", idx);
|
|
|
|
|
}
|
2009-12-04 14:13:12 +00:00
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-01-19 09:51:08 +00:00
|
|
|
|
gst_avi_demux_get_buffer_info (avi, str, idx,
|
|
|
|
|
&str->current_timestamp, &str->current_ts_end,
|
|
|
|
|
&str->current_offset, &str->current_offset_end);
|
|
|
|
|
|
|
|
|
|
if (str->index[idx].offset < min_offset) {
|
|
|
|
|
min_offset = str->index[idx].offset;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
2010-01-19 09:51:08 +00:00
|
|
|
|
"Found an earlier offset at %" G_GUINT64_FORMAT ", str %u",
|
|
|
|
|
min_offset, n);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
str_num = n;
|
|
|
|
|
stream = str;
|
|
|
|
|
index = idx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-01-19 09:51:08 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Seek performed: str %u, offset %" G_GUINT64_FORMAT ", idx %u, ts %"
|
|
|
|
|
GST_TIME_FORMAT ", ts_end %" GST_TIME_FORMAT ", off %" G_GUINT64_FORMAT
|
|
|
|
|
", off_end %" G_GUINT64_FORMAT, str_num, min_offset, index,
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GST_TIME_ARGS (stream->current_timestamp),
|
|
|
|
|
GST_TIME_ARGS (stream->current_ts_end), stream->current_offset,
|
|
|
|
|
stream->current_offset_end);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
|
2010-03-09 17:05:29 +00:00
|
|
|
|
/* index data refers to data, not chunk header (for pull mode convenience) */
|
|
|
|
|
min_offset -= 8;
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "seeking to chunk at offset %" G_GUINT64_FORMAT,
|
|
|
|
|
min_offset);
|
|
|
|
|
|
|
|
|
|
if (!perform_seek_to_offset (avi, min_offset)) {
|
2009-12-04 14:13:12 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "seek event failed!");
|
2009-10-14 11:09:03 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Handle whether we can perform the seek event or if we have to let the chain
|
|
|
|
|
* function handle seeks to build the seek indexes first.
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
gst_avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad,
|
|
|
|
|
GstEvent * event)
|
|
|
|
|
{
|
|
|
|
|
/* check for having parsed index already */
|
|
|
|
|
if (!avi->have_index) {
|
2010-03-11 16:02:44 +00:00
|
|
|
|
guint64 offset = 0;
|
2010-01-18 16:13:06 +00:00
|
|
|
|
gboolean building_index;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
GST_OBJECT_LOCK (avi);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* handle the seek event in the chain function */
|
|
|
|
|
avi->state = GST_AVI_DEMUX_SEEK;
|
|
|
|
|
|
|
|
|
|
/* copy the event */
|
2010-01-18 10:45:38 +00:00
|
|
|
|
if (avi->seek_event)
|
|
|
|
|
gst_event_unref (avi->seek_event);
|
|
|
|
|
avi->seek_event = gst_event_ref (event);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
/* set the building_index flag so that only one thread can setup the
|
|
|
|
|
* structures for index seeking. */
|
|
|
|
|
building_index = avi->building_index;
|
|
|
|
|
if (!building_index) {
|
|
|
|
|
avi->building_index = TRUE;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (avi->stream[0].indexes) {
|
|
|
|
|
avi->odml_stream = 0;
|
|
|
|
|
avi->odml_subidxs = avi->stream[avi->odml_stream].indexes;
|
|
|
|
|
offset = avi->odml_subidxs[0];
|
|
|
|
|
} else {
|
|
|
|
|
offset = avi->idx1_offset;
|
|
|
|
|
}
|
2010-01-18 16:13:06 +00:00
|
|
|
|
}
|
|
|
|
|
GST_OBJECT_UNLOCK (avi);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
if (!building_index) {
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* seek to the first subindex or legacy index */
|
|
|
|
|
GST_INFO_OBJECT (avi,
|
|
|
|
|
"Seeking to legacy index/first subindex at %" G_GUINT64_FORMAT,
|
|
|
|
|
offset);
|
2010-01-18 16:13:06 +00:00
|
|
|
|
return perform_seek_to_offset (avi, offset);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FIXME: we have to always return true so that we don't block the seek
|
|
|
|
|
* thread.
|
|
|
|
|
* Note: maybe it is OK to return true if we're still building the index */
|
|
|
|
|
return TRUE;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
}
|
2009-12-04 14:13:12 +00:00
|
|
|
|
|
|
|
|
|
return avi_demux_handle_seek_push (avi, pad, event);
|
2009-10-14 11:09:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-11-15 12:16:00 +00:00
|
|
|
|
/*
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
* Helper for gst_avi_demux_invert()
|
2005-11-15 12:16:00 +00:00
|
|
|
|
*/
|
|
|
|
|
static inline void
|
|
|
|
|
swap_line (guint8 * d1, guint8 * d2, guint8 * tmp, gint bytes)
|
|
|
|
|
{
|
|
|
|
|
memcpy (tmp, d1, bytes);
|
|
|
|
|
memcpy (d1, d2, bytes);
|
|
|
|
|
memcpy (d2, tmp, bytes);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-26 09:33:55 +00:00
|
|
|
|
|
|
|
|
|
#define gst_avi_demux_is_uncompressed(fourcc) \
|
2012-07-24 13:36:54 +00:00
|
|
|
|
(fourcc == GST_RIFF_DIB || \
|
|
|
|
|
fourcc == GST_RIFF_rgb || \
|
|
|
|
|
fourcc == GST_RIFF_RGB || fourcc == GST_RIFF_RAW)
|
2008-10-31 10:00:18 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
|
|
|
|
* Invert DIB buffers... Takes existing buffer and
|
|
|
|
|
* returns either the buffer or a new one (with old
|
|
|
|
|
* one dereferenced).
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
* FIXME: can't we preallocate tmp? and remember stride, bpp?
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
*/
|
2005-11-15 12:16:00 +00:00
|
|
|
|
static GstBuffer *
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_invert (GstAviStream * stream, GstBuffer * buf)
|
2005-11-15 12:16:00 +00:00
|
|
|
|
{
|
2009-02-25 11:05:22 +00:00
|
|
|
|
gint y, w, h;
|
2006-03-14 14:18:16 +00:00
|
|
|
|
gint bpp, stride;
|
2012-01-23 16:25:37 +00:00
|
|
|
|
guint8 *tmp = NULL;
|
|
|
|
|
GstMapInfo map;
|
2012-07-24 13:38:24 +00:00
|
|
|
|
guint32 fourcc;
|
2005-12-07 11:40:46 +00:00
|
|
|
|
|
2009-01-26 09:33:55 +00:00
|
|
|
|
if (stream->strh->type != GST_RIFF_FCC_vids)
|
|
|
|
|
return buf;
|
|
|
|
|
|
2012-07-24 13:55:12 +00:00
|
|
|
|
if (stream->strf.vids == NULL) {
|
|
|
|
|
GST_WARNING ("Failed to retrieve vids for stream");
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-24 13:38:24 +00:00
|
|
|
|
fourcc = (stream->strf.vids->compression) ?
|
|
|
|
|
stream->strf.vids->compression : stream->strh->fcc_handler;
|
|
|
|
|
if (!gst_avi_demux_is_uncompressed (fourcc)) {
|
2008-10-31 10:00:18 +00:00
|
|
|
|
return buf; /* Ignore non DIB buffers */
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-14 14:18:16 +00:00
|
|
|
|
|
2009-02-25 11:05:22 +00:00
|
|
|
|
h = stream->strf.vids->height;
|
|
|
|
|
w = stream->strf.vids->width;
|
2012-10-22 09:55:59 +00:00
|
|
|
|
bpp = stream->strf.vids->bit_cnt ? stream->strf.vids->bit_cnt : 8;
|
2011-11-08 15:35:26 +00:00
|
|
|
|
stride = GST_ROUND_UP_4 (w * (bpp / 8));
|
2006-03-14 14:18:16 +00:00
|
|
|
|
|
2006-01-23 09:59:03 +00:00
|
|
|
|
buf = gst_buffer_make_writable (buf);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READWRITE);
|
|
|
|
|
if (map.size < (stride * h)) {
|
2006-03-14 14:18:16 +00:00
|
|
|
|
GST_WARNING ("Buffer is smaller than reported Width x Height x Depth");
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2005-12-07 11:40:46 +00:00
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-14 14:18:16 +00:00
|
|
|
|
tmp = g_malloc (stride);
|
2005-11-15 12:16:00 +00:00
|
|
|
|
|
|
|
|
|
for (y = 0; y < h / 2; y++) {
|
2012-01-23 16:25:37 +00:00
|
|
|
|
swap_line (map.data + stride * y, map.data + stride * (h - 1 - y), tmp,
|
|
|
|
|
stride);
|
2005-11-15 12:16:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-04-04 17:17:43 +00:00
|
|
|
|
|
2012-10-16 00:02:11 +00:00
|
|
|
|
/* append palette to paletted RGB8 buffer data */
|
|
|
|
|
if (stream->rgb8_palette != NULL)
|
|
|
|
|
buf = gst_buffer_append (buf, gst_buffer_ref (stream->rgb8_palette));
|
|
|
|
|
|
2005-11-15 12:16:00 +00:00
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_add_assoc (GstAviDemux * avi, GstAviStream * stream,
|
|
|
|
|
GstClockTime timestamp, guint64 offset, gboolean keyframe)
|
|
|
|
|
{
|
|
|
|
|
/* do not add indefinitely for open-ended streaming */
|
|
|
|
|
if (G_UNLIKELY (avi->element_index && avi->seekable)) {
|
|
|
|
|
GST_LOG_OBJECT (avi, "adding association %" GST_TIME_FORMAT "-> %"
|
|
|
|
|
G_GUINT64_FORMAT, GST_TIME_ARGS (timestamp), offset);
|
|
|
|
|
gst_index_add_association (avi->element_index, avi->index_id,
|
2011-02-17 11:57:37 +00:00
|
|
|
|
keyframe ? GST_ASSOCIATION_FLAG_KEY_UNIT :
|
|
|
|
|
GST_ASSOCIATION_FLAG_DELTA_UNIT, GST_FORMAT_TIME, timestamp,
|
|
|
|
|
GST_FORMAT_BYTES, offset, NULL);
|
2011-02-18 08:12:47 +00:00
|
|
|
|
/* current_entry is DEFAULT (frame #) */
|
2009-10-14 11:08:47 +00:00
|
|
|
|
gst_index_add_association (avi->element_index, stream->index_id,
|
2011-02-17 15:57:42 +00:00
|
|
|
|
keyframe ? GST_ASSOCIATION_FLAG_KEY_UNIT :
|
2011-02-18 08:12:47 +00:00
|
|
|
|
GST_ASSOCIATION_FLAG_DELTA_UNIT, GST_FORMAT_TIME, timestamp,
|
2011-02-17 15:57:42 +00:00
|
|
|
|
GST_FORMAT_BYTES, offset, GST_FORMAT_DEFAULT, stream->current_entry,
|
|
|
|
|
NULL);
|
2009-10-14 11:08:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:08:47 +00:00
|
|
|
|
|
2006-07-03 15:28:48 +00:00
|
|
|
|
/*
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
* Returns the aggregated GstFlowReturn.
|
|
|
|
|
*/
|
2006-07-03 15:28:48 +00:00
|
|
|
|
static GstFlowReturn
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_avi_demux_combine_flows (GstAviDemux * avi, GstAviStream * stream,
|
2007-02-28 10:54:55 +00:00
|
|
|
|
GstFlowReturn ret)
|
2006-02-02 12:29:24 +00:00
|
|
|
|
{
|
gst/avi/: Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
Original commit message from CVS:
* gst/avi/README:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_query),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_sync),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_combine_flows),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data):
Don't abort on out-of-memory. Use stream-nr as unsigned integer only.
2007-04-04 12:39:41 +00:00
|
|
|
|
guint i;
|
2009-10-15 19:04:02 +00:00
|
|
|
|
gboolean unexpected = FALSE, not_linked = TRUE;
|
2006-02-02 12:29:24 +00:00
|
|
|
|
|
2007-02-28 10:54:55 +00:00
|
|
|
|
/* store the value */
|
|
|
|
|
stream->last_flow = ret;
|
2006-07-03 15:28:48 +00:00
|
|
|
|
|
2009-10-15 19:04:02 +00:00
|
|
|
|
/* any other error that is not-linked or eos can be returned right away */
|
2012-01-03 14:26:21 +00:00
|
|
|
|
if (G_LIKELY (ret != GST_FLOW_EOS && ret != GST_FLOW_NOT_LINKED))
|
2007-02-28 10:54:55 +00:00
|
|
|
|
goto done;
|
2006-02-02 12:29:24 +00:00
|
|
|
|
|
2007-02-28 10:54:55 +00:00
|
|
|
|
/* only return NOT_LINKED if all other pads returned NOT_LINKED */
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *ostream = &avi->stream[i];
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
2007-02-28 10:54:55 +00:00
|
|
|
|
ret = ostream->last_flow;
|
2009-10-15 19:04:02 +00:00
|
|
|
|
/* no unexpected or unlinked, return */
|
2012-01-03 14:26:21 +00:00
|
|
|
|
if (G_LIKELY (ret != GST_FLOW_EOS && ret != GST_FLOW_NOT_LINKED))
|
2007-02-28 10:54:55 +00:00
|
|
|
|
goto done;
|
2009-10-15 19:04:02 +00:00
|
|
|
|
|
|
|
|
|
/* we check to see if we have at least 1 unexpected or all unlinked */
|
2012-01-03 14:26:21 +00:00
|
|
|
|
unexpected |= (ret == GST_FLOW_EOS);
|
2009-10-15 19:04:02 +00:00
|
|
|
|
not_linked &= (ret == GST_FLOW_NOT_LINKED);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
}
|
2009-10-15 19:04:02 +00:00
|
|
|
|
/* when we get here, we all have unlinked or unexpected */
|
|
|
|
|
if (not_linked)
|
|
|
|
|
ret = GST_FLOW_NOT_LINKED;
|
|
|
|
|
else if (unexpected)
|
2012-01-03 14:26:21 +00:00
|
|
|
|
ret = GST_FLOW_EOS;
|
2007-02-28 10:54:55 +00:00
|
|
|
|
done:
|
2009-09-23 11:57:02 +00:00
|
|
|
|
GST_LOG_OBJECT (avi, "combined %s to return %s",
|
|
|
|
|
gst_flow_get_name (stream->last_flow), gst_flow_get_name (ret));
|
2007-02-28 10:54:55 +00:00
|
|
|
|
return ret;
|
2006-02-02 12:29:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
/* move @stream to the next position in its index */
|
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_advance (GstAviDemux * avi, GstAviStream * stream,
|
|
|
|
|
GstFlowReturn ret)
|
|
|
|
|
{
|
2009-09-22 12:44:42 +00:00
|
|
|
|
guint old_entry, new_entry;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
2009-09-22 12:44:42 +00:00
|
|
|
|
old_entry = stream->current_entry;
|
|
|
|
|
/* move forwards */
|
|
|
|
|
new_entry = old_entry + 1;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
|
|
|
|
/* see if we reached the end */
|
2010-09-29 08:34:36 +00:00
|
|
|
|
if (new_entry >= stream->stop_entry) {
|
2009-09-21 16:04:25 +00:00
|
|
|
|
if (avi->segment.rate < 0.0) {
|
|
|
|
|
if (stream->step_entry == stream->start_entry) {
|
|
|
|
|
/* we stepped all the way to the start, eos */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "reverse reached start %u", stream->start_entry);
|
|
|
|
|
goto eos;
|
|
|
|
|
}
|
|
|
|
|
/* backwards, stop becomes step, find a new step */
|
|
|
|
|
stream->stop_entry = stream->step_entry;
|
|
|
|
|
stream->step_entry = gst_avi_demux_index_prev (avi, stream,
|
2009-09-22 10:35:30 +00:00
|
|
|
|
stream->stop_entry, TRUE);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"reverse playback jump: start %u, step %u, stop %u",
|
|
|
|
|
stream->start_entry, stream->step_entry, stream->stop_entry);
|
|
|
|
|
|
2009-09-22 12:44:42 +00:00
|
|
|
|
/* and start from the previous keyframe now */
|
|
|
|
|
new_entry = stream->step_entry;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
} else {
|
|
|
|
|
/* EOS */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "forward reached stop %u", stream->stop_entry);
|
|
|
|
|
goto eos;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-09-22 12:44:42 +00:00
|
|
|
|
|
|
|
|
|
if (new_entry != old_entry) {
|
|
|
|
|
stream->current_entry = new_entry;
|
|
|
|
|
stream->current_total = stream->index[new_entry].total;
|
|
|
|
|
|
|
|
|
|
if (new_entry == old_entry + 1) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "moved forwards from %u to %u",
|
|
|
|
|
old_entry, new_entry);
|
|
|
|
|
/* we simply moved one step forwards, reuse current info */
|
|
|
|
|
stream->current_timestamp = stream->current_ts_end;
|
|
|
|
|
stream->current_offset = stream->current_offset_end;
|
|
|
|
|
gst_avi_demux_get_buffer_info (avi, stream, new_entry,
|
|
|
|
|
NULL, &stream->current_ts_end, NULL, &stream->current_offset_end);
|
|
|
|
|
} else {
|
|
|
|
|
/* we moved DISCONT, full update */
|
|
|
|
|
gst_avi_demux_get_buffer_info (avi, stream, new_entry,
|
|
|
|
|
&stream->current_timestamp, &stream->current_ts_end,
|
|
|
|
|
&stream->current_offset, &stream->current_offset_end);
|
|
|
|
|
/* and MARK discont for this stream */
|
|
|
|
|
stream->last_flow = GST_FLOW_OK;
|
|
|
|
|
stream->discont = TRUE;
|
2009-09-22 16:18:20 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Moved from %u to %u, ts %" GST_TIME_FORMAT
|
|
|
|
|
", ts_end %" GST_TIME_FORMAT ", off %" G_GUINT64_FORMAT
|
|
|
|
|
", off_end %" G_GUINT64_FORMAT, old_entry, new_entry,
|
|
|
|
|
GST_TIME_ARGS (stream->current_timestamp),
|
|
|
|
|
GST_TIME_ARGS (stream->current_ts_end), stream->current_offset,
|
|
|
|
|
stream->current_offset_end);
|
2009-09-22 12:44:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-09-21 16:04:25 +00:00
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
/* ERROR */
|
|
|
|
|
eos:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "we are EOS");
|
2009-09-22 12:44:42 +00:00
|
|
|
|
/* setting current_timestamp to -1 marks EOS */
|
|
|
|
|
stream->current_timestamp = -1;
|
2012-01-03 14:26:21 +00:00
|
|
|
|
return GST_FLOW_EOS;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-22 16:18:20 +00:00
|
|
|
|
/* find the stream with the lowest current position when going forwards or with
|
|
|
|
|
* the highest position when going backwards, this is the stream
|
|
|
|
|
* we should push from next */
|
|
|
|
|
static gint
|
|
|
|
|
gst_avi_demux_find_next (GstAviDemux * avi, gfloat rate)
|
|
|
|
|
{
|
|
|
|
|
guint64 min_time, max_time;
|
|
|
|
|
guint stream_num, i;
|
|
|
|
|
|
|
|
|
|
max_time = 0;
|
|
|
|
|
min_time = G_MAXUINT64;
|
|
|
|
|
stream_num = -1;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
guint64 position;
|
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
|
|
|
|
|
stream = &avi->stream[i];
|
2010-01-26 10:18:28 +00:00
|
|
|
|
|
|
|
|
|
/* ignore streams that finished */
|
2012-01-03 14:26:21 +00:00
|
|
|
|
if (stream->last_flow == GST_FLOW_EOS)
|
2010-01-26 10:18:28 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2009-09-22 16:18:20 +00:00
|
|
|
|
position = stream->current_timestamp;
|
|
|
|
|
|
|
|
|
|
/* position of -1 is EOS */
|
|
|
|
|
if (position != -1) {
|
|
|
|
|
if (rate > 0.0 && position < min_time) {
|
|
|
|
|
min_time = position;
|
|
|
|
|
stream_num = i;
|
|
|
|
|
} else if (rate < 0.0 && position >= max_time) {
|
|
|
|
|
max_time = position;
|
|
|
|
|
stream_num = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return stream_num;
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_loop_data (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2009-09-22 16:18:20 +00:00
|
|
|
|
guint stream_num;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream;
|
|
|
|
|
gboolean processed = FALSE;
|
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
guint64 offset, size;
|
|
|
|
|
GstClockTime timestamp, duration;
|
2009-09-22 12:44:42 +00:00
|
|
|
|
guint64 out_offset, out_offset_end;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gboolean keyframe;
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GstAviIndexEntry *entry;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
|
|
|
|
do {
|
2009-09-22 16:18:20 +00:00
|
|
|
|
stream_num = gst_avi_demux_find_next (avi, avi->segment.rate);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
|
|
|
|
/* all are EOS */
|
|
|
|
|
if (G_UNLIKELY (stream_num == -1)) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "all streams are EOS");
|
|
|
|
|
goto eos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* we have the stream now */
|
|
|
|
|
stream = &avi->stream[stream_num];
|
|
|
|
|
|
|
|
|
|
/* skip streams without pads */
|
|
|
|
|
if (!stream->pad) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "skipping entry from stream %d without pad",
|
|
|
|
|
stream_num);
|
|
|
|
|
goto next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* get the timing info for the entry */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
timestamp = stream->current_timestamp;
|
|
|
|
|
duration = stream->current_ts_end - timestamp;
|
|
|
|
|
out_offset = stream->current_offset;
|
|
|
|
|
out_offset_end = stream->current_offset_end;
|
|
|
|
|
|
|
|
|
|
/* get the entry data info */
|
|
|
|
|
entry = &stream->index[stream->current_entry];
|
|
|
|
|
offset = entry->offset;
|
|
|
|
|
size = entry->size;
|
|
|
|
|
keyframe = ENTRY_IS_KEYFRAME (entry);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
|
|
|
|
/* skip empty entries */
|
|
|
|
|
if (size == 0) {
|
2009-10-03 15:18:28 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Skipping entry %u (%" G_GUINT64_FORMAT ", %p)",
|
2009-09-21 16:04:25 +00:00
|
|
|
|
stream->current_entry, size, stream->pad);
|
|
|
|
|
goto next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (avi->segment.rate > 0.0) {
|
|
|
|
|
/* only check this for fowards playback for now */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
if (keyframe && GST_CLOCK_TIME_IS_VALID (avi->segment.stop)
|
2009-09-21 16:04:25 +00:00
|
|
|
|
&& (timestamp > avi->segment.stop)) {
|
|
|
|
|
goto eos_stop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-03 15:18:28 +00:00
|
|
|
|
GST_LOG ("reading buffer (size=%" G_GUINT64_FORMAT "), stream %d, pos %"
|
2009-10-09 09:30:00 +00:00
|
|
|
|
G_GUINT64_FORMAT " (0x%" G_GINT64_MODIFIER "x), kf %d", size,
|
|
|
|
|
stream_num, offset, offset, keyframe);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* FIXME, check large chunks and cut them up */
|
|
|
|
|
|
2009-09-21 16:04:25 +00:00
|
|
|
|
/* pull in the data */
|
2012-03-16 20:47:21 +00:00
|
|
|
|
buf = NULL;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
ret = gst_pad_pull_range (avi->sinkpad, offset, size, &buf);
|
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
|
goto pull_failed;
|
|
|
|
|
|
|
|
|
|
/* check for short buffers, this is EOS as well */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
if (gst_buffer_get_size (buf) < size)
|
2009-09-21 16:04:25 +00:00
|
|
|
|
goto short_buffer;
|
|
|
|
|
|
2012-10-16 00:02:11 +00:00
|
|
|
|
/* invert the picture if needed, and append palette for RGB8P */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
buf = gst_avi_demux_invert (stream, buf);
|
|
|
|
|
|
|
|
|
|
/* mark non-keyframes */
|
2012-04-03 09:50:00 +00:00
|
|
|
|
if (keyframe) {
|
2009-09-22 15:42:48 +00:00
|
|
|
|
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
2012-04-03 09:50:00 +00:00
|
|
|
|
GST_BUFFER_PTS (buf) = timestamp;
|
|
|
|
|
} else {
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT);
|
2012-04-03 09:50:00 +00:00
|
|
|
|
GST_BUFFER_PTS (buf) = GST_CLOCK_TIME_NONE;
|
|
|
|
|
}
|
|
|
|
|
GST_BUFFER_DTS (buf) = timestamp;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GST_BUFFER_DURATION (buf) = duration;
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_BUFFER_OFFSET (buf) = out_offset;
|
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = out_offset_end;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
2009-09-22 15:42:48 +00:00
|
|
|
|
/* mark discont when pending */
|
|
|
|
|
if (stream->discont) {
|
2010-01-20 10:27:23 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "setting DISCONT flag");
|
2009-09-22 15:42:48 +00:00
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
|
stream->discont = FALSE;
|
|
|
|
|
}
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
gst_avi_demux_add_assoc (avi, stream, timestamp, offset, keyframe);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:08:47 +00:00
|
|
|
|
|
2009-09-23 11:57:02 +00:00
|
|
|
|
/* update current position in the segment */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->segment.position = timestamp;
|
2009-09-23 11:57:02 +00:00
|
|
|
|
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Pushing buffer of size %" G_GSIZE_FORMAT ", ts %"
|
2009-09-22 12:44:42 +00:00
|
|
|
|
GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT ", off %" G_GUINT64_FORMAT
|
2009-09-23 11:57:02 +00:00
|
|
|
|
", off_end %" G_GUINT64_FORMAT,
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_get_size (buf), GST_TIME_ARGS (timestamp),
|
2009-09-23 11:57:02 +00:00
|
|
|
|
GST_TIME_ARGS (duration), out_offset, out_offset_end);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
|
|
|
|
|
ret = gst_pad_push (stream->pad, buf);
|
|
|
|
|
|
|
|
|
|
/* mark as processed, we increment the frame and byte counters then
|
|
|
|
|
* leave the while loop and return the GstFlowReturn */
|
|
|
|
|
processed = TRUE;
|
|
|
|
|
|
|
|
|
|
if (avi->segment.rate < 0) {
|
2012-01-03 14:26:21 +00:00
|
|
|
|
if (timestamp > avi->segment.stop && ret == GST_FLOW_EOS) {
|
|
|
|
|
/* In reverse playback we can get a GST_FLOW_EOS when
|
2009-09-21 16:04:25 +00:00
|
|
|
|
* we are at the end of the segment, so we just need to jump
|
|
|
|
|
* back to the previous section. */
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "downstream has reached end of segment");
|
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
next:
|
2009-09-22 12:44:42 +00:00
|
|
|
|
/* move to next item */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
ret = gst_avi_demux_advance (avi, stream, ret);
|
|
|
|
|
|
|
|
|
|
/* combine flows */
|
|
|
|
|
ret = gst_avi_demux_combine_flows (avi, stream, ret);
|
|
|
|
|
} while (!processed);
|
|
|
|
|
|
|
|
|
|
beach:
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
/* special cases */
|
|
|
|
|
eos:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "No samples left for any streams - EOS");
|
2012-01-03 14:26:21 +00:00
|
|
|
|
ret = GST_FLOW_EOS;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
goto beach;
|
|
|
|
|
}
|
|
|
|
|
eos_stop:
|
|
|
|
|
{
|
|
|
|
|
GST_LOG_OBJECT (avi, "Found keyframe after segment,"
|
|
|
|
|
" setting EOS (%" GST_TIME_FORMAT " > %" GST_TIME_FORMAT ")",
|
|
|
|
|
GST_TIME_ARGS (timestamp), GST_TIME_ARGS (avi->segment.stop));
|
2012-01-03 14:26:21 +00:00
|
|
|
|
ret = GST_FLOW_EOS;
|
2010-01-26 10:18:28 +00:00
|
|
|
|
/* move to next stream */
|
|
|
|
|
goto next;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
}
|
|
|
|
|
pull_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "pull range failed: pos=%" G_GUINT64_FORMAT
|
2009-10-03 15:18:28 +00:00
|
|
|
|
" size=%" G_GUINT64_FORMAT, offset, size);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
goto beach;
|
|
|
|
|
}
|
|
|
|
|
short_buffer:
|
|
|
|
|
{
|
|
|
|
|
GST_WARNING_OBJECT (avi, "Short read at offset %" G_GUINT64_FORMAT
|
2011-11-21 19:31:31 +00:00
|
|
|
|
", only got %" G_GSIZE_FORMAT "/%" G_GUINT64_FORMAT
|
|
|
|
|
" bytes (truncated file?)", offset, gst_buffer_get_size (buf), size);
|
2009-09-21 16:04:25 +00:00
|
|
|
|
gst_buffer_unref (buf);
|
2012-01-03 14:26:21 +00:00
|
|
|
|
ret = GST_FLOW_EOS;
|
2009-09-21 16:04:25 +00:00
|
|
|
|
goto beach;
|
|
|
|
|
}
|
|
|
|
|
}
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/*
|
2006-09-06 09:05:33 +00:00
|
|
|
|
* Read data. If we have an index it delegates to
|
|
|
|
|
* gst_avi_demux_process_next_entry().
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
*/
|
|
|
|
|
static GstFlowReturn
|
|
|
|
|
gst_avi_demux_stream_data (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
guint32 tag = 0;
|
|
|
|
|
guint32 size = 0;
|
|
|
|
|
gint stream_nr = 0;
|
|
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
|
|
|
|
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (avi->have_eos)) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* Clean adapter, we're done */
|
|
|
|
|
gst_adapter_clear (avi->adapter);
|
2012-01-03 14:26:21 +00:00
|
|
|
|
return GST_FLOW_EOS;
|
2009-10-14 11:09:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (G_UNLIKELY (avi->todrop)) {
|
|
|
|
|
guint drop;
|
|
|
|
|
|
|
|
|
|
if ((drop = gst_adapter_available (avi->adapter))) {
|
|
|
|
|
if (drop > avi->todrop)
|
|
|
|
|
drop = avi->todrop;
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Dropping %d bytes", drop);
|
|
|
|
|
gst_adapter_flush (avi->adapter, drop);
|
|
|
|
|
avi->todrop -= drop;
|
|
|
|
|
avi->offset += drop;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Iterate until need more data, so adapter won't grow too much */
|
|
|
|
|
while (1) {
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (!gst_avi_demux_peek_chunk_info (avi, &tag, &size))) {
|
2006-09-13 13:26:15 +00:00
|
|
|
|
return GST_FLOW_OK;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GST_DEBUG ("Trying chunk (%" GST_FOURCC_FORMAT "), size %d",
|
|
|
|
|
GST_FOURCC_ARGS (tag), size);
|
|
|
|
|
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_LIKELY ((tag & 0xff) >= '0' && (tag & 0xff) <= '9' &&
|
|
|
|
|
((tag >> 8) & 0xff) >= '0' && ((tag >> 8) & 0xff) <= '9')) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_LOG ("Chunk ok");
|
|
|
|
|
} else if ((tag & 0xffff) == (('x' << 8) | 'i')) {
|
|
|
|
|
GST_DEBUG ("Found sub-index tag");
|
2009-08-08 19:54:00 +00:00
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size) || size == 0) {
|
|
|
|
|
/* accept 0 size buffer here */
|
|
|
|
|
avi->abort_buffering = FALSE;
|
|
|
|
|
GST_DEBUG (" skipping %d bytes for now", size);
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
return GST_FLOW_OK;
|
2010-01-19 17:37:31 +00:00
|
|
|
|
} else if (tag == GST_RIFF_TAG_RIFF) {
|
|
|
|
|
/* RIFF tags can appear in ODML files, just jump over them */
|
|
|
|
|
if (gst_adapter_available (avi->adapter) >= 12) {
|
|
|
|
|
GST_DEBUG ("Found RIFF tag, skipping RIFF header");
|
|
|
|
|
gst_adapter_flush (avi->adapter, 12);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
return GST_FLOW_OK;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
} else if (tag == GST_RIFF_TAG_idx1) {
|
2010-01-19 17:37:31 +00:00
|
|
|
|
GST_DEBUG ("Found index tag");
|
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size) || size == 0) {
|
|
|
|
|
/* accept 0 size buffer here */
|
|
|
|
|
avi->abort_buffering = FALSE;
|
|
|
|
|
GST_DEBUG (" skipping %d bytes for now", size);
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
|
|
|
|
}
|
|
|
|
|
return GST_FLOW_OK;
|
2009-06-17 09:54:53 +00:00
|
|
|
|
} else if (tag == GST_RIFF_TAG_LIST) {
|
|
|
|
|
/* movi chunks might be grouped in rec list */
|
|
|
|
|
if (gst_adapter_available (avi->adapter) >= 12) {
|
|
|
|
|
GST_DEBUG ("Found LIST tag, skipping LIST header");
|
|
|
|
|
gst_adapter_flush (avi->adapter, 12);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
return GST_FLOW_OK;
|
2010-02-01 12:43:04 +00:00
|
|
|
|
} else if (tag == GST_RIFF_TAG_JUNK || tag == GST_RIFF_TAG_JUNQ) {
|
2009-06-17 09:54:53 +00:00
|
|
|
|
/* rec list might contain JUNK chunks */
|
|
|
|
|
GST_DEBUG ("Found JUNK tag");
|
2009-08-08 19:54:00 +00:00
|
|
|
|
if (gst_avi_demux_peek_chunk (avi, &tag, &size) || size == 0) {
|
|
|
|
|
/* accept 0 size buffer here */
|
|
|
|
|
avi->abort_buffering = FALSE;
|
|
|
|
|
GST_DEBUG (" skipping %d bytes for now", size);
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
2009-06-17 09:54:53 +00:00
|
|
|
|
}
|
|
|
|
|
return GST_FLOW_OK;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG ("No more stream chunks, send EOS");
|
|
|
|
|
avi->have_eos = TRUE;
|
2012-01-03 14:26:21 +00:00
|
|
|
|
return GST_FLOW_EOS;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (!gst_avi_demux_peek_chunk (avi, &tag, &size))) {
|
2009-08-08 19:54:00 +00:00
|
|
|
|
/* supposedly one hopes to catch a nicer chunk later on ... */
|
|
|
|
|
/* FIXME ?? give up here rather than possibly ending up going
|
|
|
|
|
* through the whole file */
|
|
|
|
|
if (avi->abort_buffering) {
|
|
|
|
|
avi->abort_buffering = FALSE;
|
2010-07-22 09:46:35 +00:00
|
|
|
|
if (size) {
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8);
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return GST_FLOW_OK;
|
2009-08-08 19:54:00 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
2006-10-05 16:37:33 +00:00
|
|
|
|
GST_DEBUG ("chunk ID %" GST_FOURCC_FORMAT ", size %u",
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_FOURCC_ARGS (tag), size);
|
|
|
|
|
|
2006-09-13 13:26:15 +00:00
|
|
|
|
stream_nr = CHUNKID_TO_STREAMNR (tag);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (stream_nr < 0 || stream_nr >= avi->num_streams)) {
|
2006-09-13 13:26:15 +00:00
|
|
|
|
/* recoverable */
|
|
|
|
|
GST_WARNING ("Invalid stream ID %d (%" GST_FOURCC_FORMAT ")",
|
|
|
|
|
stream_nr, GST_FOURCC_ARGS (tag));
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
2006-09-13 13:26:15 +00:00
|
|
|
|
} else {
|
2009-09-21 16:04:25 +00:00
|
|
|
|
GstAviStream *stream;
|
2006-09-13 13:26:15 +00:00
|
|
|
|
GstClockTime next_ts = 0;
|
2010-01-21 10:55:15 +00:00
|
|
|
|
GstBuffer *buf = NULL;
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
guint64 offset;
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2010-01-21 10:55:15 +00:00
|
|
|
|
gboolean saw_desired_kf = stream_nr != avi->main_stream
|
|
|
|
|
|| avi->offset >= avi->seek_kf_offset;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2010-01-21 10:55:15 +00:00
|
|
|
|
if (stream_nr == avi->main_stream && avi->offset == avi->seek_kf_offset) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Desired keyframe reached");
|
|
|
|
|
avi->seek_kf_offset = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (saw_desired_kf) {
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8);
|
|
|
|
|
/* get buffer */
|
2010-07-22 09:46:35 +00:00
|
|
|
|
if (size) {
|
|
|
|
|
buf = gst_adapter_take_buffer (avi->adapter, GST_ROUND_UP_2 (size));
|
|
|
|
|
/* patch the size */
|
2011-04-04 17:17:43 +00:00
|
|
|
|
gst_buffer_resize (buf, 0, size);
|
2010-07-22 09:46:35 +00:00
|
|
|
|
} else {
|
|
|
|
|
buf = NULL;
|
|
|
|
|
}
|
2010-01-21 10:55:15 +00:00
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Desired keyframe not yet reached, flushing chunk");
|
|
|
|
|
gst_adapter_flush (avi->adapter, 8 + GST_ROUND_UP_2 (size));
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
offset = avi->offset;
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-09-21 23:28:54 +00:00
|
|
|
|
avi->offset += 8 + GST_ROUND_UP_2 (size);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2006-09-13 13:26:15 +00:00
|
|
|
|
stream = &avi->stream[stream_nr];
|
|
|
|
|
|
|
|
|
|
/* set delay (if any)
|
|
|
|
|
if (stream->strh->init_frames == stream->current_frame &&
|
|
|
|
|
stream->delay == 0)
|
|
|
|
|
stream->delay = next_ts;
|
|
|
|
|
*/
|
|
|
|
|
|
2009-08-04 17:45:43 +00:00
|
|
|
|
/* parsing of corresponding header may have failed */
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (!stream->pad)) {
|
2009-08-04 17:45:43 +00:00
|
|
|
|
GST_WARNING_OBJECT (avi, "no pad for stream ID %" GST_FOURCC_FORMAT,
|
|
|
|
|
GST_FOURCC_ARGS (tag));
|
2010-01-21 10:55:15 +00:00
|
|
|
|
if (buf)
|
|
|
|
|
gst_buffer_unref (buf);
|
2006-09-13 13:26:15 +00:00
|
|
|
|
} else {
|
2009-08-04 17:45:43 +00:00
|
|
|
|
/* get time of this buffer */
|
2011-07-28 09:54:38 +00:00
|
|
|
|
gst_pad_query_position (stream->pad, GST_FORMAT_TIME,
|
|
|
|
|
(gint64 *) & next_ts);
|
2009-08-04 17:45:43 +00:00
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
gst_avi_demux_add_assoc (avi, stream, next_ts, offset, FALSE);
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:08:47 +00:00
|
|
|
|
|
2009-09-22 20:12:58 +00:00
|
|
|
|
/* increment our positions */
|
2009-09-22 12:44:42 +00:00
|
|
|
|
stream->current_entry++;
|
|
|
|
|
stream->current_total += size;
|
2009-09-21 16:09:12 +00:00
|
|
|
|
|
2010-01-21 10:55:15 +00:00
|
|
|
|
/* update current position in the segment */
|
2011-06-02 16:47:36 +00:00
|
|
|
|
avi->segment.position = next_ts;
|
2006-09-13 13:26:15 +00:00
|
|
|
|
|
2010-01-21 10:55:15 +00:00
|
|
|
|
if (saw_desired_kf && buf) {
|
|
|
|
|
GstClockTime dur_ts = 0;
|
gst/avi/gstavidemux.c: remove dead code, tweak debugs statements, add comments, use _uint64_scale instead _uint64_sca...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_peek_chunk), (gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
remove dead code, tweak debugs statements, add comments, use
_uint64_scale instead _uint64_scale_int when using guint64 values,
small optimizations, reflow some error handling
2006-11-24 07:46:54 +00:00
|
|
|
|
|
2012-10-16 00:02:11 +00:00
|
|
|
|
/* invert the picture if needed, and append palette for RGB8P */
|
2010-01-21 10:55:15 +00:00
|
|
|
|
buf = gst_avi_demux_invert (stream, buf);
|
2009-07-24 15:04:31 +00:00
|
|
|
|
|
2011-07-28 09:54:38 +00:00
|
|
|
|
gst_pad_query_position (stream->pad, GST_FORMAT_TIME,
|
|
|
|
|
(gint64 *) & dur_ts);
|
2006-09-13 13:26:15 +00:00
|
|
|
|
|
2012-04-03 09:50:00 +00:00
|
|
|
|
GST_BUFFER_DTS (buf) = next_ts;
|
|
|
|
|
GST_BUFFER_PTS (buf) = GST_CLOCK_TIME_NONE;
|
2010-01-21 10:55:15 +00:00
|
|
|
|
GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
|
|
|
|
|
if (stream->strh->type == GST_RIFF_FCC_vids) {
|
|
|
|
|
GST_BUFFER_OFFSET (buf) = stream->current_entry - 1;
|
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = stream->current_entry;
|
|
|
|
|
} else {
|
|
|
|
|
GST_BUFFER_OFFSET (buf) = GST_BUFFER_OFFSET_NONE;
|
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = GST_BUFFER_OFFSET_NONE;
|
|
|
|
|
}
|
2006-09-13 13:26:15 +00:00
|
|
|
|
|
2010-01-21 10:55:15 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi,
|
|
|
|
|
"Pushing buffer with time=%" GST_TIME_FORMAT ", duration %"
|
|
|
|
|
GST_TIME_FORMAT ", offset %" G_GUINT64_FORMAT
|
|
|
|
|
" and size %d over pad %s", GST_TIME_ARGS (next_ts),
|
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)),
|
|
|
|
|
GST_BUFFER_OFFSET (buf), size, GST_PAD_NAME (stream->pad));
|
|
|
|
|
|
|
|
|
|
/* mark discont when pending */
|
|
|
|
|
if (G_UNLIKELY (stream->discont)) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Setting DISCONT");
|
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
|
stream->discont = FALSE;
|
|
|
|
|
}
|
|
|
|
|
res = gst_pad_push (stream->pad, buf);
|
2010-07-22 09:46:35 +00:00
|
|
|
|
buf = NULL;
|
2007-02-28 10:54:55 +00:00
|
|
|
|
|
2010-01-21 10:55:15 +00:00
|
|
|
|
/* combine flows */
|
|
|
|
|
res = gst_avi_demux_combine_flows (avi, stream, res);
|
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
|
|
|
|
GST_DEBUG ("Push failed; %s", gst_flow_get_name (res));
|
|
|
|
|
return res;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Send pending tags.
|
|
|
|
|
*/
|
2006-07-03 15:28:48 +00:00
|
|
|
|
static void
|
|
|
|
|
push_tag_lists (GstAviDemux * avi)
|
|
|
|
|
{
|
|
|
|
|
guint i;
|
2009-09-23 12:25:08 +00:00
|
|
|
|
GstTagList *tags;
|
2006-07-03 15:28:48 +00:00
|
|
|
|
|
|
|
|
|
if (!avi->got_tags)
|
|
|
|
|
return;
|
|
|
|
|
|
2006-07-10 20:11:34 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Pushing pending tag lists");
|
|
|
|
|
|
2009-09-23 12:25:08 +00:00
|
|
|
|
for (i = 0; i < avi->num_streams; i++) {
|
|
|
|
|
GstAviStream *stream = &avi->stream[i];
|
|
|
|
|
GstPad *pad = stream->pad;
|
|
|
|
|
|
|
|
|
|
tags = stream->taglist;
|
|
|
|
|
|
|
|
|
|
if (pad && tags) {
|
|
|
|
|
GST_DEBUG_OBJECT (pad, "Tags: %" GST_PTR_FORMAT, tags);
|
|
|
|
|
|
2012-07-27 22:19:51 +00:00
|
|
|
|
gst_pad_push_event (pad, gst_event_new_tag (tags));
|
2009-09-23 12:25:08 +00:00
|
|
|
|
stream->taglist = NULL;
|
2006-07-03 15:28:48 +00:00
|
|
|
|
}
|
2009-09-23 12:25:08 +00:00
|
|
|
|
}
|
2009-06-18 22:36:28 +00:00
|
|
|
|
|
2009-09-23 12:25:08 +00:00
|
|
|
|
if (!(tags = avi->globaltags))
|
2011-10-30 11:44:53 +00:00
|
|
|
|
tags = gst_tag_list_new_empty ();
|
2009-06-18 22:36:28 +00:00
|
|
|
|
|
2009-09-23 12:25:08 +00:00
|
|
|
|
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE,
|
2009-06-18 22:36:28 +00:00
|
|
|
|
GST_TAG_CONTAINER_FORMAT, "AVI", NULL);
|
|
|
|
|
|
2009-09-23 12:25:08 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Global tags: %" GST_PTR_FORMAT, tags);
|
2012-07-27 22:19:51 +00:00
|
|
|
|
gst_tag_list_set_scope (tags, GST_TAG_SCOPE_GLOBAL);
|
|
|
|
|
gst_avi_demux_push_event (avi, gst_event_new_tag (tags));
|
2009-06-18 22:36:28 +00:00
|
|
|
|
avi->globaltags = NULL;
|
2006-07-03 15:28:48 +00:00
|
|
|
|
avi->got_tags = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
static void
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
gst_avi_demux_loop (GstPad * pad)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
{
|
2007-02-28 10:54:55 +00:00
|
|
|
|
GstFlowReturn res;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (GST_PAD_PARENT (pad));
|
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
switch (avi->state) {
|
|
|
|
|
case GST_AVI_DEMUX_START:
|
2009-09-23 12:25:08 +00:00
|
|
|
|
res = gst_avi_demux_stream_init_pull (avi);
|
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_WARNING ("stream_init flow: %s", gst_flow_get_name (res));
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
goto pause;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->state = GST_AVI_DEMUX_HEADER;
|
|
|
|
|
/* fall-through */
|
|
|
|
|
case GST_AVI_DEMUX_HEADER:
|
2009-09-23 12:25:08 +00:00
|
|
|
|
res = gst_avi_demux_stream_header_pull (avi);
|
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_WARNING ("stream_header flow: %s", gst_flow_get_name (res));
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
goto pause;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
avi->state = GST_AVI_DEMUX_MOVI;
|
ext/flac/gstflacdec.c: Only return true if we actually filled something in. Prevents player applications from showing...
Original commit message from CVS:
* ext/flac/gstflacdec.c: (gst_flacdec_src_query):
Only return true if we actually filled something in. Prevents
player applications from showing a random length for flac files.
* gst-libs/gst/riff/riff-read.c: (gst_riff_read_class_init),
(gst_riff_read_use_event), (gst_riff_read_handle_event),
(gst_riff_read_seek), (gst_riff_read_skip), (gst_riff_read_strh),
(gst_riff_read_strf_vids_with_data),
(gst_riff_read_strf_auds_with_data), (gst_riff_read_strf_iavs):
OK, ok, so I implemented event handling. Apparently it's normal
that we receive random events at random points without asking
for it.
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_src_convert), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Implement non-lineair chunk handling and subchunk processing.
The first solves playback of AVI files where the audio and video
data of individual buffers that we read are not synchronized.
This should not happen according to the wonderful AVI specs, but
of course it does happen in reality. It is also a prerequisite for
the second. Subchunk processing allows us to cut chunks in small
pieces and process each of these pieces separately. This is
required because I've seen several AVI files with incredibly large
audio chunks, even some files with only one audio chunk for the
whole file. This allows for proper playback including seeking.
This patch is supposed to fix all AVI A/V sync issues.
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(flx_decode_chunks), (flx_decode_color), (gst_flxdec_loop):
Work.
* gst/modplug/gstmodplug.cc:
Proper return value setting for the query() function.
* gst/playback/gstplaybasebin.c: (setup_source):
Being in non-playing state (after, e.g., EOS) is not necessarily
a bad thing. Allow for that. This fixes playback of short files.
They don't actually playback fully now, because the clock already
runs. This means that small files (<500kB) with a small length
(<2sec) will still not or barely play. Other files, such as mod
or flx, will work correctly, however.
2004-09-29 09:45:40 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
case GST_AVI_DEMUX_MOVI:
|
2010-01-20 10:22:04 +00:00
|
|
|
|
if (G_UNLIKELY (avi->seg_event)) {
|
|
|
|
|
gst_avi_demux_push_event (avi, avi->seg_event);
|
|
|
|
|
avi->seg_event = NULL;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
if (G_UNLIKELY (avi->got_tags)) {
|
2006-07-03 15:28:48 +00:00
|
|
|
|
push_tag_lists (avi);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* process each index entry in turn */
|
2009-09-21 16:04:25 +00:00
|
|
|
|
res = gst_avi_demux_loop_data (avi);
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
|
2007-02-28 10:54:55 +00:00
|
|
|
|
/* pause when error */
|
2009-06-24 10:36:31 +00:00
|
|
|
|
if (G_UNLIKELY (res != GST_FLOW_OK)) {
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
GST_INFO ("stream_movi flow: %s", gst_flow_get_name (res));
|
2007-02-28 10:54:55 +00:00
|
|
|
|
goto pause;
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
default:
|
2007-12-26 16:03:57 +00:00
|
|
|
|
GST_ERROR_OBJECT (avi, "unknown state %d", avi->state);
|
|
|
|
|
res = GST_FLOW_ERROR;
|
|
|
|
|
goto pause;
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
/* ERRORS */
|
2010-08-27 15:32:09 +00:00
|
|
|
|
pause:{
|
|
|
|
|
|
|
|
|
|
gboolean push_eos = FALSE;
|
|
|
|
|
GST_LOG_OBJECT (avi, "pausing task, reason %s", gst_flow_get_name (res));
|
|
|
|
|
gst_pad_pause_task (avi->sinkpad);
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
|
2012-01-03 14:26:21 +00:00
|
|
|
|
if (res == GST_FLOW_EOS) {
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
/* handle end-of-stream/segment */
|
2011-06-28 10:55:45 +00:00
|
|
|
|
/* so align our position with the end of it, if there is one
|
|
|
|
|
* this ensures a subsequent will arrive at correct base/acc time */
|
|
|
|
|
if (avi->segment.rate > 0.0 &&
|
|
|
|
|
GST_CLOCK_TIME_IS_VALID (avi->segment.stop))
|
|
|
|
|
avi->segment.position = avi->segment.stop;
|
|
|
|
|
else if (avi->segment.rate < 0.0)
|
|
|
|
|
avi->segment.position = avi->segment.start;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
if (avi->segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
gint64 stop;
|
|
|
|
|
|
|
|
|
|
if ((stop = avi->segment.stop) == -1)
|
|
|
|
|
stop = avi->segment.duration;
|
|
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (avi, "sending segment_done");
|
|
|
|
|
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
gst_element_post_message
|
2010-01-15 17:13:24 +00:00
|
|
|
|
(GST_ELEMENT_CAST (avi),
|
|
|
|
|
gst_message_new_segment_done (GST_OBJECT_CAST (avi),
|
|
|
|
|
GST_FORMAT_TIME, stop));
|
2012-07-05 11:13:09 +00:00
|
|
|
|
gst_avi_demux_push_event (avi,
|
|
|
|
|
gst_event_new_segment_done (GST_FORMAT_TIME, stop));
|
2010-08-27 15:32:09 +00:00
|
|
|
|
} else {
|
|
|
|
|
push_eos = TRUE;
|
gst/avi/gstavidemux.*: Some cleanups, prepare to use GstSegment.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_next), (gst_avi_demux_handle_src_query),
(gst_avi_demux_handle_src_event), (gst_avi_demux_parse_subindex),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Some cleanups, prepare to use GstSegment.
Fix error in entry walking code.
Fix VBR detection.
Smarter timestamp calculation code.
Uniform error/eos handling.
2006-05-12 18:04:22 +00:00
|
|
|
|
}
|
2012-01-03 14:26:21 +00:00
|
|
|
|
} else if (res == GST_FLOW_NOT_LINKED || res < GST_FLOW_EOS) {
|
2010-08-27 15:32:09 +00:00
|
|
|
|
/* for fatal errors we post an error message, wrong-state is
|
|
|
|
|
* not fatal because it happens due to flushes and only means
|
|
|
|
|
* that we should stop now. */
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, FAILED,
|
|
|
|
|
(_("Internal data stream error.")),
|
|
|
|
|
("streaming stopped, reason %s", gst_flow_get_name (res)));
|
2010-08-27 15:32:09 +00:00
|
|
|
|
push_eos = TRUE;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
if (push_eos) {
|
gst/avi/gstavidemux.*: Save some memory (8%) by repacking the index entry structure (more to come). Add more FIXMEs t...
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_reset), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_next_data_buffer),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_push_event), (gst_avi_demux_stream_header_pull),
(gst_avi_demux_do_seek), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data), (gst_avi_demux_loop):
* gst/avi/gstavidemux.h:
Save some memory (8%) by repacking the index entry structure (more to
come). Add more FIXMEs to questionable parts.
2007-02-12 15:29:44 +00:00
|
|
|
|
GST_INFO_OBJECT (avi, "sending eos");
|
2009-08-04 11:36:36 +00:00
|
|
|
|
if (!gst_avi_demux_push_event (avi, gst_event_new_eos ()) &&
|
2012-01-03 14:26:21 +00:00
|
|
|
|
(res == GST_FLOW_EOS)) {
|
2009-08-04 11:36:36 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX,
|
|
|
|
|
(NULL), ("got eos but no streams (yet)"));
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2011-11-17 14:02:55 +00:00
|
|
|
|
gst_avi_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
{
|
2007-02-28 10:54:55 +00:00
|
|
|
|
GstFlowReturn res;
|
2011-11-17 14:02:55 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
2010-01-20 10:27:23 +00:00
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "got DISCONT");
|
|
|
|
|
gst_adapter_clear (avi->adapter);
|
|
|
|
|
/* mark all streams DISCONT */
|
|
|
|
|
for (i = 0; i < avi->num_streams; i++)
|
|
|
|
|
avi->stream[i].discont = TRUE;
|
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
|
2011-11-21 19:31:31 +00:00
|
|
|
|
GST_DEBUG ("Store %" G_GSIZE_FORMAT " bytes in adapter",
|
|
|
|
|
gst_buffer_get_size (buf));
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
gst_adapter_push (avi->adapter, buf);
|
|
|
|
|
|
|
|
|
|
switch (avi->state) {
|
|
|
|
|
case GST_AVI_DEMUX_START:
|
|
|
|
|
if ((res = gst_avi_demux_stream_init_push (avi)) != GST_FLOW_OK) {
|
|
|
|
|
GST_WARNING ("stream_init flow: %s", gst_flow_get_name (res));
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
break;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
2006-10-28 16:37:20 +00:00
|
|
|
|
break;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
case GST_AVI_DEMUX_HEADER:
|
|
|
|
|
if ((res = gst_avi_demux_stream_header_push (avi)) != GST_FLOW_OK) {
|
|
|
|
|
GST_WARNING ("stream_header flow: %s", gst_flow_get_name (res));
|
gst/avi/gstavidemux.*: More attempts to turn this into readable code.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_finalize),
(gst_avi_demux_reset), (gst_avi_demux_index_last),
(gst_avi_demux_index_next), (gst_avi_demux_index_entry_for_time),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_index),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer), (gst_avi_demux_stream_scan),
(gst_avi_demux_massage_index),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header_pull), (gst_avi_demux_do_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_chain), (gst_avi_demux_sink_activate),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
More attempts to turn this into readable code.
Don't leak adapters.
Calculate duration according to index more efficiently.
Don't try to act like we drive the pipeline in chain mode.
2006-08-25 16:21:37 +00:00
|
|
|
|
break;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GST_AVI_DEMUX_MOVI:
|
2010-01-20 10:22:04 +00:00
|
|
|
|
if (G_UNLIKELY (avi->seg_event)) {
|
|
|
|
|
gst_avi_demux_push_event (avi, avi->seg_event);
|
|
|
|
|
avi->seg_event = NULL;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
if (G_UNLIKELY (avi->got_tags)) {
|
|
|
|
|
push_tag_lists (avi);
|
|
|
|
|
}
|
|
|
|
|
res = gst_avi_demux_stream_data (avi);
|
|
|
|
|
break;
|
2009-12-04 14:13:12 +00:00
|
|
|
|
case GST_AVI_DEMUX_SEEK:
|
2010-01-18 16:13:06 +00:00
|
|
|
|
{
|
|
|
|
|
GstEvent *event;
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
res = GST_FLOW_OK;
|
|
|
|
|
|
|
|
|
|
/* obtain and parse indexes */
|
2010-01-18 16:13:06 +00:00
|
|
|
|
if (avi->stream[0].indexes && !gst_avi_demux_read_subindexes_push (avi))
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* seek in subindex read function failed */
|
2010-01-18 16:13:06 +00:00
|
|
|
|
goto index_failed;
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
if (!avi->stream[0].indexes && !avi->have_index
|
|
|
|
|
&& avi->avih->flags & GST_RIFF_AVIH_HASINDEX)
|
|
|
|
|
gst_avi_demux_stream_index_push (avi);
|
|
|
|
|
|
|
|
|
|
if (avi->have_index) {
|
|
|
|
|
/* use the indexes now to construct nice durations */
|
|
|
|
|
gst_avi_demux_calculate_durations_from_index (avi);
|
|
|
|
|
} else {
|
|
|
|
|
/* still parsing indexes */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
GST_OBJECT_LOCK (avi);
|
|
|
|
|
event = avi->seek_event;
|
|
|
|
|
avi->seek_event = NULL;
|
|
|
|
|
GST_OBJECT_UNLOCK (avi);
|
|
|
|
|
|
2009-12-04 14:13:12 +00:00
|
|
|
|
/* calculate and perform seek */
|
2010-01-18 16:13:06 +00:00
|
|
|
|
if (!avi_demux_handle_seek_push (avi, avi->sinkpad, event))
|
|
|
|
|
goto seek_failed;
|
|
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
2009-12-04 14:13:12 +00:00
|
|
|
|
avi->state = GST_AVI_DEMUX_MOVI;
|
|
|
|
|
break;
|
2010-01-18 16:13:06 +00:00
|
|
|
|
}
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
default:
|
2007-02-28 10:54:55 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, FAILED, (NULL),
|
|
|
|
|
("Illegal internal state"));
|
|
|
|
|
res = GST_FLOW_ERROR;
|
|
|
|
|
break;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "state: %d res:%s", avi->state,
|
|
|
|
|
gst_flow_get_name (res));
|
|
|
|
|
|
2010-01-18 16:13:06 +00:00
|
|
|
|
if (G_UNLIKELY (avi->abort_buffering))
|
|
|
|
|
goto abort_buffering;
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
|
index_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("failed to read indexes"));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
seek_failed:
|
|
|
|
|
{
|
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("push mode seek failed"));
|
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
|
}
|
|
|
|
|
abort_buffering:
|
|
|
|
|
{
|
2009-08-08 19:54:00 +00:00
|
|
|
|
avi->abort_buffering = FALSE;
|
2009-10-08 09:20:09 +00:00
|
|
|
|
GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), ("unhandled buffer size"));
|
2010-01-18 16:13:06 +00:00
|
|
|
|
return GST_FLOW_ERROR;
|
2009-08-08 19:54:00 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-18 12:57:20 +00:00
|
|
|
|
gst_avi_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
{
|
2011-06-02 16:47:36 +00:00
|
|
|
|
GstQuery *query;
|
|
|
|
|
gboolean pull_mode;
|
|
|
|
|
|
|
|
|
|
query = gst_query_new_scheduling ();
|
|
|
|
|
|
|
|
|
|
if (!gst_pad_peer_query (sinkpad, query)) {
|
|
|
|
|
gst_query_unref (query);
|
|
|
|
|
goto activate_push;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-11 15:36:51 +00:00
|
|
|
|
pull_mode = gst_query_has_scheduling_mode_with_flags (query,
|
|
|
|
|
GST_PAD_MODE_PULL, GST_SCHEDULING_FLAG_SEEKABLE);
|
2011-07-04 09:06:54 +00:00
|
|
|
|
gst_query_unref (query);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
|
|
|
|
|
if (!pull_mode)
|
|
|
|
|
goto activate_push;
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (sinkpad, "activating pull");
|
2011-11-21 12:37:01 +00:00
|
|
|
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE);
|
2011-06-02 16:47:36 +00:00
|
|
|
|
|
|
|
|
|
activate_push:
|
|
|
|
|
{
|
|
|
|
|
GST_DEBUG_OBJECT (sinkpad, "activating push");
|
2011-11-21 12:37:01 +00:00
|
|
|
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-21 12:37:01 +00:00
|
|
|
|
gst_avi_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
|
|
|
|
GstPadMode mode, gboolean active)
|
gst/avi/: Port from -THREADED to HEAD, and fix for latest API changes of the day. Keep avimux dead for now.
Original commit message from CVS:
* gst/avi/Makefile.am:
* gst/avi/gstavi.c: (plugin_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
(gst_avi_demux_class_init), (gst_avi_demux_init),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_index_entry_for_byte),
(gst_avi_demux_index_entry_for_frame), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
(gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
(gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
(gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(gst_avi_demux_loop), (gst_avi_demux_sink_activate),
(gst_avi_demux_sink_activate_pull):
* gst/avi/gstavidemux.h:
Port from -THREADED to HEAD, and fix for latest API changes of
the day. Keep avimux dead for now.
2005-06-30 09:00:36 +00:00
|
|
|
|
{
|
2011-11-21 12:37:01 +00:00
|
|
|
|
gboolean res;
|
2011-11-18 12:57:20 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (parent);
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
|
2011-11-21 12:37:01 +00:00
|
|
|
|
switch (mode) {
|
|
|
|
|
case GST_PAD_MODE_PULL:
|
|
|
|
|
if (active) {
|
|
|
|
|
avi->streaming = FALSE;
|
|
|
|
|
res = gst_pad_start_task (sinkpad, (GstTaskFunction) gst_avi_demux_loop,
|
2012-06-20 08:33:42 +00:00
|
|
|
|
sinkpad, NULL);
|
2011-11-21 12:37:01 +00:00
|
|
|
|
} else {
|
|
|
|
|
res = gst_pad_stop_task (sinkpad);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GST_PAD_MODE_PUSH:
|
|
|
|
|
if (active) {
|
|
|
|
|
GST_DEBUG ("avi: activating push/chain function");
|
|
|
|
|
avi->streaming = TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
GST_DEBUG ("avi: deactivating push/chain function");
|
|
|
|
|
}
|
|
|
|
|
res = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
res = FALSE;
|
|
|
|
|
break;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
2011-11-21 12:37:01 +00:00
|
|
|
|
return res;
|
gst/avi/gstavidemux.*: Initial streaming support for avidemux (fixes #336465)
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_class_init),
(gst_avi_demux_init), (gst_avi_demux_dispose),
(gst_avi_demux_reset), (gst_avi_demux_index_next),
(gst_avi_demux_index_entry_for_time), (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_peek_chunk_info), (gst_avi_demux_peek_chunk),
(gst_avi_demux_stream_init_push), (gst_avi_demux_stream_init_pull),
(gst_avi_demux_parse_subindex),
(gst_avi_demux_read_subindexes_push),
(gst_avi_demux_read_subindexes_pull), (gst_avi_demux_parse_stream),
(sort), (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
(gst_avi_demux_sync), (gst_avi_demux_peek_tag),
(gst_avi_demux_massage_index), (gst_avi_demux_stream_header_push),
(gst_avi_demux_stream_header_pull),
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
(push_tag_lists), (gst_avi_demux_loop), (gst_avi_demux_chain),
(gst_avi_demux_sink_activate), (gst_avi_demux_activate_push),
(gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Initial streaming support for avidemux (fixes #336465)
2006-08-23 15:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#if 0
|
2009-10-14 11:08:47 +00:00
|
|
|
|
static void
|
|
|
|
|
gst_avi_demux_set_index (GstElement * element, GstIndex * index)
|
|
|
|
|
{
|
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (element);
|
|
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (avi);
|
|
|
|
|
if (avi->element_index)
|
|
|
|
|
gst_object_unref (avi->element_index);
|
|
|
|
|
if (index) {
|
|
|
|
|
avi->element_index = gst_object_ref (index);
|
|
|
|
|
} else {
|
|
|
|
|
avi->element_index = NULL;
|
|
|
|
|
}
|
|
|
|
|
GST_OBJECT_UNLOCK (avi);
|
|
|
|
|
/* object lock might be taken again */
|
|
|
|
|
if (index)
|
2010-01-15 17:13:24 +00:00
|
|
|
|
gst_index_get_writer_id (index, GST_OBJECT_CAST (element), &avi->index_id);
|
2009-10-14 11:08:47 +00:00
|
|
|
|
GST_DEBUG_OBJECT (avi, "Set index %" GST_PTR_FORMAT, avi->element_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GstIndex *
|
|
|
|
|
gst_avi_demux_get_index (GstElement * element)
|
|
|
|
|
{
|
|
|
|
|
GstIndex *result = NULL;
|
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (element);
|
|
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (avi);
|
|
|
|
|
if (avi->element_index)
|
|
|
|
|
result = gst_object_ref (avi->element_index);
|
|
|
|
|
GST_OBJECT_UNLOCK (avi);
|
|
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (avi, "Returning index %" GST_PTR_FORMAT, result);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2011-12-30 17:12:03 +00:00
|
|
|
|
#endif
|
2009-10-14 11:08:47 +00:00
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
|
static GstStateChangeReturn
|
|
|
|
|
gst_avi_demux_change_state (GstElement * element, GstStateChange transition)
|
2001-12-23 22:14:25 +00:00
|
|
|
|
{
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
GstStateChangeReturn ret;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
GstAviDemux *avi = GST_AVI_DEMUX (element);
|
2001-12-22 23:22:30 +00:00
|
|
|
|
|
2005-09-26 13:06:27 +00:00
|
|
|
|
switch (transition) {
|
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
gst/avi/gstavidemux.*: Precalc most of the duration query for each stream.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_reset),
(gst_avi_demux_index_entry_for_time),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_stream_init), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_index), (gst_avi_demux_peek_tag),
(gst_avi_demux_next_data_buffer),
(gst_avi_demux_calculate_durations_from_index),
(gst_avi_demux_stream_header), (gst_avi_demux_do_seek),
(gst_avi_demux_handle_seek), (gst_avi_demux_aggregated_flow),
(gst_avi_demux_process_next_entry), (gst_avi_demux_loop),
(gst_avi_demux_sink_activate_pull), (gst_avi_demux_change_state):
* gst/avi/gstavidemux.h:
Precalc most of the duration query for each stream.
Make seeking more correct.
Use GstSegment to track position and duration.
Code cleanups and leak fixes.
Calculate correct total duration based on index length.
2006-08-22 16:42:22 +00:00
|
|
|
|
avi->streaming = FALSE;
|
|
|
|
|
gst_segment_init (&avi->segment, GST_FORMAT_TIME);
|
2005-09-26 13:06:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
|
goto done;
|
2005-09-26 13:06:27 +00:00
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
|
switch (transition) {
|
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2010-06-23 10:15:13 +00:00
|
|
|
|
avi->have_index = FALSE;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst_avi_demux_reset (avi);
|
2001-12-23 22:14:25 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
gst/avi/gstavidemux.c: Use scaling code for added precission and more correct stop position in case scale==0.
Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_src_convert),
(gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
(gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
(gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
(gst_avi_demux_parse_subindex), (gst_avi_demux_parse_stream),
(gst_avi_demux_stream_header), (gst_avi_demux_change_state):
Use scaling code for added precission and more correct stop
position in case scale==0.
2006-02-19 16:02:25 +00:00
|
|
|
|
done:
|
|
|
|
|
return ret;
|
2001-12-22 23:22:30 +00:00
|
|
|
|
}
|