gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2003 Colin Walters <cwalters@gnome.org>
|
gst/playback/: Add playbin2.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstplayback.c: (plugin_init):
* gst/playback/test7.c: (update_scale), (warning_cb), (error_cb),
(eos_cb), (about_to_finish_cb), (main):
Add playbin2.
Added gapless playback example.
* gst/playback/gstplaybasebin.c:
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gst_play_bin_plugin_init):
* gst/playback/gstqueue2.c:
* gst/playback/test.c:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_class_init),
(pad_removed_cb):
* gst/playback/gststreaminfo.h:
Change email.
* gst/playback/gstplaybin2.c: (gst_play_bin_get_type),
(gst_play_bin_class_init), (init_group), (gst_play_bin_init),
(gst_play_bin_dispose), (gst_play_bin_set_uri),
(gst_play_bin_set_suburi), (gst_play_bin_set_property),
(gst_play_bin_get_property), (gst_play_bin_handle_message),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb), (perform_eos),
(drained_cb), (unlink_group), (activate_group),
(setup_next_source), (gst_play_bin_change_state),
(gst_play_bin2_plugin_init):
Added raw first version of playbin2. Does chained oggs and gapless
playback fine. No support for raw sinks yet. No visualisations or
subtitles yet.
* gst/playback/gstplaysink.c: (gst_play_sink_get_type),
(gst_play_sink_class_init), (gst_play_sink_init),
(gst_play_sink_dispose), (gst_play_sink_vis_unblocked),
(gst_play_sink_vis_blocked), (gst_play_sink_set_video_sink),
(gst_play_sink_set_audio_sink), (gst_play_sink_set_vis_plugin),
(gst_play_sink_set_property), (gst_play_sink_get_property),
(post_missing_element_message), (free_chain), (add_chain),
(activate_chain), (gen_video_chain), (gen_text_element),
(gen_audio_chain), (gen_vis_element), (gst_play_sink_get_mode),
(gst_play_sink_set_mode), (gst_play_sink_request_pad),
(gst_play_sink_release_pad), (gst_play_sink_send_event_to_sink),
(gst_play_sink_send_event), (gst_play_sink_change_state):
* gst/playback/gstplaysink.h:
Added Element that abstracts the sinks and their pipelines for playbin2.
2007-11-16 15:44:48 +00:00
|
|
|
* 2000,2005,2007 Wim Taymans <wim.taymans@gmail.com>
|
2007-06-06 13:36:26 +00:00
|
|
|
* 2007 Thiago Sousa Santos <thiagoss@lcc.ufcg.edu.br>
|
2010-06-15 06:59:11 +00:00
|
|
|
* SA 2010 ST-Ericsson <benjamin.gaignard@stericsson.com>
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
|
|
|
* gstqueue2.c:
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-queue2
|
|
|
|
*
|
|
|
|
* Data is queued until one of the limits specified by the
|
2010-01-20 01:33:38 +00:00
|
|
|
* #GstQueue2:max-size-buffers, #GstQueue2:max-size-bytes and/or
|
|
|
|
* #GstQueue2:max-size-time properties has been reached. Any attempt to push
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
* more buffers into the queue will block the pushing thread until more space
|
|
|
|
* becomes available.
|
|
|
|
*
|
|
|
|
* The queue will create a new thread on the source pad to decouple the
|
|
|
|
* processing on sink and source pad.
|
|
|
|
*
|
|
|
|
* You can query how many buffers are queued by reading the
|
2010-01-20 01:33:38 +00:00
|
|
|
* #GstQueue2:current-level-buffers property.
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
|
|
|
* The default queue size limits are 100 buffers, 2MB of data, or
|
|
|
|
* two seconds worth of data, whichever is reached first.
|
2007-06-06 13:36:26 +00:00
|
|
|
*
|
2009-07-10 18:49:46 +00:00
|
|
|
* If you set temp-tmpl to a value such as /tmp/gstreamer-XXXXXX, the element
|
|
|
|
* will allocate a random free filename and buffer data in the file.
|
|
|
|
* By using this, it will buffer the entire stream data on the file independently
|
|
|
|
* of the queue size limits, they will only be used for buffering statistics.
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*
|
2009-07-10 18:49:46 +00:00
|
|
|
* Since 0.10.24, setting the temp-location property with a filename is deprecated
|
|
|
|
* because it's impossible to securely open a temporary file in this way. The
|
|
|
|
* property will still be used to notify the application of the allocated
|
|
|
|
* filename, though.
|
|
|
|
*
|
|
|
|
* Last reviewed on 2009-07-10 (0.10.24)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
*/
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/gstqueue2.c: fix build.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_finalize), (update_time_level),
(apply_segment), (apply_buffer), (update_buffering),
(reset_rate_timer), (update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_filled),
(gst_queue_chain), (gst_queue_push_one), (gst_queue_loop),
(plugin_init):
fix build.
2007-05-17 13:36:11 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:21:36 +00:00
|
|
|
#include "gstqueue2.h"
|
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#include "gst/gst-i18n-lib.h"
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2009-03-20 13:17:19 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
#include <io.h> /* lseek, open, close, read */
|
|
|
|
#undef lseek
|
|
|
|
#define lseek _lseeki64
|
|
|
|
#undef off_t
|
|
|
|
#define off_t guint64
|
2009-07-10 18:49:46 +00:00
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
2009-03-20 13:17:19 +00:00
|
|
|
#endif
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (queue_debug);
|
|
|
|
#define GST_CAT_DEFAULT (queue_debug)
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
/* other defines */
|
|
|
|
#define DEFAULT_BUFFER_SIZE 4096
|
|
|
|
#define QUEUE_IS_USING_TEMP_FILE(queue) ((queue)->temp_location_set || (queue)->temp_template != NULL)
|
|
|
|
#define QUEUE_IS_USING_RING_BUFFER(queue) ((queue)->use_ring_buffer) /* for consistency with the above macro */
|
2010-06-15 14:12:02 +00:00
|
|
|
#define QUEUE_IS_USING_QUEUE(queue) (!QUEUE_IS_USING_TEMP_FILE(queue) && !QUEUE_IS_USING_RING_BUFFER (queue))
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-16 15:03:49 +00:00
|
|
|
#define QUEUE_MAX_BYTES(queue) MIN((queue)->max_level.bytes, (queue)->ring_buffer_max_size)
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* default property values */
|
|
|
|
#define DEFAULT_MAX_SIZE_BUFFERS 100 /* 100 buffers */
|
|
|
|
#define DEFAULT_MAX_SIZE_BYTES (2 * 1024 * 1024) /* 2 MB */
|
|
|
|
#define DEFAULT_MAX_SIZE_TIME 2 * GST_SECOND /* 2 seconds */
|
|
|
|
#define DEFAULT_USE_BUFFERING FALSE
|
|
|
|
#define DEFAULT_USE_RATE_ESTIMATE TRUE
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
#define DEFAULT_LOW_PERCENT 10
|
|
|
|
#define DEFAULT_HIGH_PERCENT 99
|
2010-01-22 16:55:39 +00:00
|
|
|
#define DEFAULT_TEMP_REMOVE TRUE
|
2010-06-16 10:24:25 +00:00
|
|
|
#define DEFAULT_RING_BUFFER_MAX_SIZE 0
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CUR_LEVEL_BUFFERS,
|
|
|
|
PROP_CUR_LEVEL_BYTES,
|
|
|
|
PROP_CUR_LEVEL_TIME,
|
|
|
|
PROP_MAX_SIZE_BUFFERS,
|
|
|
|
PROP_MAX_SIZE_BYTES,
|
|
|
|
PROP_MAX_SIZE_TIME,
|
|
|
|
PROP_USE_BUFFERING,
|
|
|
|
PROP_USE_RATE_ESTIMATE,
|
|
|
|
PROP_LOW_PERCENT,
|
|
|
|
PROP_HIGH_PERCENT,
|
2009-07-10 18:49:46 +00:00
|
|
|
PROP_TEMP_TEMPLATE,
|
2010-01-22 16:55:39 +00:00
|
|
|
PROP_TEMP_LOCATION,
|
|
|
|
PROP_TEMP_REMOVE,
|
2010-05-05 08:21:55 +00:00
|
|
|
PROP_RING_BUFFER_MAX_SIZE,
|
2010-01-22 16:55:39 +00:00
|
|
|
PROP_LAST
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
};
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_CLEAR_LEVEL(l) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
l.buffers = 0; \
|
|
|
|
l.bytes = 0; \
|
|
|
|
l.time = 0; \
|
|
|
|
l.rate_time = 0; \
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
#define STATUS(queue, pad, msg) \
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, \
|
|
|
|
"(%s:%s) " msg ": %u of %u buffers, %u of %u " \
|
|
|
|
"bytes, %" G_GUINT64_FORMAT " of %" G_GUINT64_FORMAT \
|
2007-06-07 09:11:27 +00:00
|
|
|
" ns, %"G_GUINT64_FORMAT" items", \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_DEBUG_PAD_NAME (pad), \
|
|
|
|
queue->cur_level.buffers, \
|
|
|
|
queue->max_level.buffers, \
|
|
|
|
queue->cur_level.bytes, \
|
|
|
|
queue->max_level.bytes, \
|
|
|
|
queue->cur_level.time, \
|
|
|
|
queue->max_level.time, \
|
2010-06-15 14:12:02 +00:00
|
|
|
(guint64) (!QUEUE_IS_USING_QUEUE(queue) ? \
|
2010-03-23 18:25:29 +00:00
|
|
|
queue->current->writing_pos - queue->current->max_reading_pos : \
|
2007-06-07 09:11:27 +00:00
|
|
|
queue->queue->length))
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_MUTEX_LOCK(q) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_mutex_lock (q->qlock); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
#define GST_QUEUE2_MUTEX_LOCK_CHECK(q,res,label) G_STMT_START { \
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (q); \
|
|
|
|
if (res != GST_FLOW_OK) \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
goto label; \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_MUTEX_UNLOCK(q) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_mutex_unlock (q->qlock); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
#define GST_QUEUE2_WAIT_DEL_CHECK(q, res, label) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->sinkpad, "wait for DEL"); \
|
|
|
|
q->waiting_del = TRUE; \
|
|
|
|
g_cond_wait (q->item_del, queue->qlock); \
|
|
|
|
q->waiting_del = FALSE; \
|
2010-03-24 17:18:13 +00:00
|
|
|
if (res != GST_FLOW_OK) { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->srcpad, "received DEL wakeup"); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
STATUS (queue, q->sinkpad, "received DEL"); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
#define GST_QUEUE2_WAIT_ADD_CHECK(q, res, label) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->srcpad, "wait for ADD"); \
|
|
|
|
q->waiting_add = TRUE; \
|
|
|
|
g_cond_wait (q->item_add, q->qlock); \
|
|
|
|
q->waiting_add = FALSE; \
|
2010-03-24 17:18:13 +00:00
|
|
|
if (res != GST_FLOW_OK) { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
STATUS (queue, q->srcpad, "received ADD wakeup"); \
|
|
|
|
goto label; \
|
|
|
|
} \
|
|
|
|
STATUS (queue, q->srcpad, "received ADD"); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_SIGNAL_DEL(q) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (q->waiting_del) { \
|
|
|
|
STATUS (q, q->srcpad, "signal DEL"); \
|
|
|
|
g_cond_signal (q->item_del); \
|
|
|
|
} \
|
|
|
|
} G_STMT_END
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
#define GST_QUEUE2_SIGNAL_ADD(q) G_STMT_START { \
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (q->waiting_add) { \
|
|
|
|
STATUS (q, q->sinkpad, "signal ADD"); \
|
|
|
|
g_cond_signal (q->item_add); \
|
|
|
|
} \
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
#define _do_init(bla) \
|
2009-10-29 10:35:08 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (queue_debug, "queue2", 0, "queue element"); \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (queue_dataflow, "queue2_dataflow", 0, \
|
|
|
|
"dataflow inside the queue element");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:35:08 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstQueue2, gst_queue2, GstElement, GST_TYPE_ELEMENT,
|
|
|
|
_do_init);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static void gst_queue2_finalize (GObject * object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static void gst_queue2_set_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
2009-10-29 10:30:11 +00:00
|
|
|
static void gst_queue2_get_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static GstFlowReturn gst_queue2_chain (GstPad * pad, GstBuffer * buffer);
|
|
|
|
static GstFlowReturn gst_queue2_bufferalloc (GstPad * pad, guint64 offset,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint size, GstCaps * caps, GstBuffer ** buf);
|
2009-10-29 10:30:11 +00:00
|
|
|
static GstFlowReturn gst_queue2_push_one (GstQueue2 * queue);
|
|
|
|
static void gst_queue2_loop (GstPad * pad);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static gboolean gst_queue2_handle_sink_event (GstPad * pad, GstEvent * event);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static gboolean gst_queue2_handle_src_event (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_queue2_handle_src_query (GstPad * pad, GstQuery * query);
|
2010-03-25 17:13:02 +00:00
|
|
|
static gboolean gst_queue2_handle_query (GstElement * element,
|
|
|
|
GstQuery * query);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static GstCaps *gst_queue2_getcaps (GstPad * pad);
|
|
|
|
static gboolean gst_queue2_acceptcaps (GstPad * pad, GstCaps * caps);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static GstFlowReturn gst_queue2_get_range (GstPad * pad, guint64 offset,
|
2007-06-06 13:36:26 +00:00
|
|
|
guint length, GstBuffer ** buffer);
|
2009-10-29 10:30:11 +00:00
|
|
|
static gboolean gst_queue2_src_checkgetrange_function (GstPad * pad);
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static gboolean gst_queue2_src_activate_pull (GstPad * pad, gboolean active);
|
|
|
|
static gboolean gst_queue2_src_activate_push (GstPad * pad, gboolean active);
|
|
|
|
static gboolean gst_queue2_sink_activate_push (GstPad * pad, gboolean active);
|
|
|
|
static GstStateChangeReturn gst_queue2_change_state (GstElement * element,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstStateChange transition);
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
static gboolean gst_queue2_is_empty (GstQueue2 * queue);
|
|
|
|
static gboolean gst_queue2_is_filled (GstQueue2 * queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-07-29 15:27:06 +00:00
|
|
|
static void update_cur_level (GstQueue2 * queue, GstQueue2Range * range);
|
|
|
|
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
/* static guint gst_queue2_signals[LAST_SIGNAL] = { 0 }; */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:35:08 +00:00
|
|
|
static void
|
|
|
|
gst_queue2_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&srctemplate));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sinktemplate));
|
|
|
|
|
2009-10-29 10:38:21 +00:00
|
|
|
gst_element_class_set_details_simple (gstelement_class, "Queue 2",
|
2009-10-29 10:35:08 +00:00
|
|
|
"Generic",
|
|
|
|
"Simple data queue",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
|
|
|
"Wim Taymans <wim.taymans@gmail.com>");
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_class_init (GstQueue2Class * klass)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
gobject_class->set_property = gst_queue2_set_property;
|
|
|
|
gobject_class->get_property = gst_queue2_get_property;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_BYTES,
|
|
|
|
g_param_spec_uint ("current-level-bytes", "Current level (kB)",
|
|
|
|
"Current amount of data in the queue (bytes)",
|
2008-03-22 15:00:53 +00:00
|
|
|
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_BUFFERS,
|
|
|
|
g_param_spec_uint ("current-level-buffers", "Current level (buffers)",
|
|
|
|
"Current number of buffers in the queue",
|
2008-03-22 15:00:53 +00:00
|
|
|
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CUR_LEVEL_TIME,
|
|
|
|
g_param_spec_uint64 ("current-level-time", "Current level (ns)",
|
|
|
|
"Current amount of data in the queue (in ns)",
|
2008-03-22 15:00:53 +00:00
|
|
|
0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_BYTES,
|
|
|
|
g_param_spec_uint ("max-size-bytes", "Max. size (kB)",
|
|
|
|
"Max. amount of data in the queue (bytes, 0=disable)",
|
2008-03-22 15:00:53 +00:00
|
|
|
0, G_MAXUINT, DEFAULT_MAX_SIZE_BYTES,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_BUFFERS,
|
|
|
|
g_param_spec_uint ("max-size-buffers", "Max. size (buffers)",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Max. number of buffers in the queue (0=disable)", 0, G_MAXUINT,
|
|
|
|
DEFAULT_MAX_SIZE_BUFFERS,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_SIZE_TIME,
|
|
|
|
g_param_spec_uint64 ("max-size-time", "Max. size (ns)",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Max. amount of data in the queue (in ns, 0=disable)", 0, G_MAXUINT64,
|
|
|
|
DEFAULT_MAX_SIZE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_USE_BUFFERING,
|
|
|
|
g_param_spec_boolean ("use-buffering", "Use buffering",
|
|
|
|
"Emit GST_MESSAGE_BUFFERING based on low-/high-percent thresholds",
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_USE_BUFFERING, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_USE_RATE_ESTIMATE,
|
|
|
|
g_param_spec_boolean ("use-rate-estimate", "Use Rate Estimate",
|
|
|
|
"Estimate the bitrate of the stream to calculate time level",
|
2008-03-22 15:00:53 +00:00
|
|
|
DEFAULT_USE_RATE_ESTIMATE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_LOW_PERCENT,
|
|
|
|
g_param_spec_int ("low-percent", "Low percent",
|
2008-03-22 15:00:53 +00:00
|
|
|
"Low threshold for buffering to start", 0, 100, DEFAULT_LOW_PERCENT,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_HIGH_PERCENT,
|
|
|
|
g_param_spec_int ("high-percent", "High percent",
|
2008-03-22 15:00:53 +00:00
|
|
|
"High threshold for buffering to finish", 0, 100,
|
|
|
|
DEFAULT_HIGH_PERCENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-07-10 18:49:46 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_TEMP_TEMPLATE,
|
|
|
|
g_param_spec_string ("temp-template", "Temporary File Template",
|
|
|
|
"File template to store temporary files in, should contain directory "
|
|
|
|
"and XXXXXX. (NULL == disabled)",
|
|
|
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_TEMP_LOCATION,
|
|
|
|
g_param_spec_string ("temp-location", "Temporary File Location",
|
2009-07-10 18:49:46 +00:00
|
|
|
"Location to store temporary files in (Deprecated: Only read this "
|
2010-01-22 16:55:39 +00:00
|
|
|
"property, use temp-template to configure the name template)",
|
2008-03-22 15:00:53 +00:00
|
|
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-01-22 17:00:53 +00:00
|
|
|
/**
|
|
|
|
* GstQueue2:temp-remove
|
|
|
|
*
|
|
|
|
* When temp-template is set, remove the temporary file when going to READY.
|
|
|
|
*
|
|
|
|
* Since: 0.10.26
|
|
|
|
*/
|
2010-01-22 16:55:39 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_TEMP_REMOVE,
|
|
|
|
g_param_spec_boolean ("temp-remove", "Remove the Temporary File",
|
|
|
|
"Remove the temp-location after use",
|
|
|
|
DEFAULT_TEMP_REMOVE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2010-05-05 08:21:55 +00:00
|
|
|
/**
|
|
|
|
* GstQueue2:ring-buffer-max-size
|
|
|
|
*
|
2010-06-16 10:24:25 +00:00
|
|
|
* The maximum size of the ring buffer in bytes. If set to 0, the ring
|
|
|
|
* buffer is disabled. Default 0.
|
2010-05-05 08:21:55 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.30
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_RING_BUFFER_MAX_SIZE,
|
2010-06-16 10:24:25 +00:00
|
|
|
g_param_spec_uint64 ("ring-buffer-max-size",
|
2010-06-06 07:30:48 +00:00
|
|
|
"Max. ring buffer size (bytes)",
|
2010-06-18 12:36:33 +00:00
|
|
|
"Max. amount of data in the ring buffer (bytes, 0 = disabled",
|
|
|
|
0, G_MAXUINT, DEFAULT_RING_BUFFER_MAX_SIZE,
|
2010-05-05 08:21:55 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* set several parent class virtual functions */
|
2009-10-29 10:30:11 +00:00
|
|
|
gobject_class->finalize = gst_queue2_finalize;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue2_change_state);
|
2010-03-25 17:13:02 +00:00
|
|
|
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_queue2_handle_query);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_init (GstQueue2 * queue, GstQueue2Class * g_class)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
queue->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
|
|
|
|
|
|
|
gst_pad_set_chain_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_chain));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_activatepush_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_sink_activate_push));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_event_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_sink_event));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_getcaps_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_getcaps));
|
2009-10-27 14:23:00 +00:00
|
|
|
gst_pad_set_acceptcaps_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_acceptcaps));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_bufferalloc_function (queue->sinkpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_bufferalloc));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
|
|
|
|
|
|
|
|
queue->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
gst_pad_set_activatepull_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_pull));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_activatepush_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_src_activate_push));
|
2007-06-06 13:36:26 +00:00
|
|
|
gst_pad_set_getrange_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_get_range));
|
2007-06-06 13:36:26 +00:00
|
|
|
gst_pad_set_checkgetrange_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_src_checkgetrange_function));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_getcaps_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_getcaps));
|
2009-10-27 14:23:00 +00:00
|
|
|
gst_pad_set_acceptcaps_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_acceptcaps));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_event_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_src_event));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_set_query_function (queue->srcpad,
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_queue2_handle_src_query));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
|
|
|
|
|
|
|
|
/* levels */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->max_level.buffers = DEFAULT_MAX_SIZE_BUFFERS;
|
|
|
|
queue->max_level.bytes = DEFAULT_MAX_SIZE_BYTES;
|
|
|
|
queue->max_level.time = DEFAULT_MAX_SIZE_TIME;
|
|
|
|
queue->max_level.rate_time = DEFAULT_MAX_SIZE_TIME;
|
|
|
|
queue->use_buffering = DEFAULT_USE_BUFFERING;
|
|
|
|
queue->use_rate_estimate = DEFAULT_USE_RATE_ESTIMATE;
|
|
|
|
queue->low_percent = DEFAULT_LOW_PERCENT;
|
|
|
|
queue->high_percent = DEFAULT_HIGH_PERCENT;
|
|
|
|
|
|
|
|
gst_segment_init (&queue->sink_segment, GST_FORMAT_TIME);
|
|
|
|
gst_segment_init (&queue->src_segment, GST_FORMAT_TIME);
|
|
|
|
|
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->is_eos = FALSE;
|
2007-12-14 18:46:12 +00:00
|
|
|
queue->in_timer = g_timer_new ();
|
|
|
|
queue->out_timer = g_timer_new ();
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
queue->qlock = g_mutex_new ();
|
|
|
|
queue->waiting_add = FALSE;
|
|
|
|
queue->item_add = g_cond_new ();
|
|
|
|
queue->waiting_del = FALSE;
|
|
|
|
queue->item_del = g_cond_new ();
|
|
|
|
queue->queue = g_queue_new ();
|
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* tempfile related */
|
2009-07-10 18:49:46 +00:00
|
|
|
queue->temp_template = NULL;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
queue->temp_location = NULL;
|
2009-07-10 18:49:46 +00:00
|
|
|
queue->temp_location_set = FALSE;
|
2010-01-22 16:55:39 +00:00
|
|
|
queue->temp_remove = DEFAULT_TEMP_REMOVE;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2010-06-16 10:24:25 +00:00
|
|
|
queue->use_ring_buffer = FALSE;
|
2010-06-18 15:43:40 +00:00
|
|
|
queue->ring_buffer = NULL;
|
2010-05-07 07:30:44 +00:00
|
|
|
queue->ring_buffer_max_size = DEFAULT_RING_BUFFER_MAX_SIZE;
|
2010-06-16 10:24:25 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"initialized queue's not_empty & not_full conditions");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* called only once, as opposed to dispose */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_finalize (GObject * object)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "finalizing queue");
|
|
|
|
|
|
|
|
while (!g_queue_is_empty (queue->queue)) {
|
|
|
|
GstMiniObject *data = g_queue_pop_head (queue->queue);
|
|
|
|
|
|
|
|
gst_mini_object_unref (data);
|
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
g_queue_free (queue->queue);
|
|
|
|
g_mutex_free (queue->qlock);
|
|
|
|
g_cond_free (queue->item_add);
|
|
|
|
g_cond_free (queue->item_del);
|
2007-12-14 18:46:12 +00:00
|
|
|
g_timer_destroy (queue->in_timer);
|
|
|
|
g_timer_destroy (queue->out_timer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* temp_file path cleanup */
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (queue->temp_template);
|
|
|
|
g_free (queue->temp_location);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
static void
|
|
|
|
debug_ranges (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GstQueue2Range *walk;
|
|
|
|
|
|
|
|
for (walk = queue->ranges; walk; walk = walk->next) {
|
2010-07-07 06:20:21 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"range [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT "] (rb [%"
|
|
|
|
G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT "]), reading %" G_GUINT64_FORMAT
|
|
|
|
" current range? %s", walk->offset, walk->writing_pos, walk->rb_offset,
|
|
|
|
walk->rb_writing_pos, walk->reading_pos,
|
|
|
|
walk == queue->current ? "**y**" : " n ");
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear all the downloaded ranges */
|
|
|
|
static void
|
|
|
|
clean_ranges (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "clean queue ranges");
|
|
|
|
|
|
|
|
g_slice_free_chain (GstQueue2Range, queue->ranges, next);
|
|
|
|
queue->ranges = NULL;
|
|
|
|
queue->current = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find a range that contains @offset or NULL when nothing does */
|
|
|
|
static GstQueue2Range *
|
|
|
|
find_range (GstQueue2 * queue, guint64 offset, guint64 length)
|
|
|
|
{
|
2010-03-24 09:57:08 +00:00
|
|
|
GstQueue2Range *range = NULL;
|
|
|
|
GstQueue2Range *walk;
|
2010-03-23 18:25:29 +00:00
|
|
|
|
|
|
|
/* first do a quick check for the current range */
|
|
|
|
for (walk = queue->ranges; walk; walk = walk->next) {
|
|
|
|
if (offset >= walk->offset && offset <= walk->writing_pos) {
|
|
|
|
/* we can reuse an existing range */
|
|
|
|
range = walk;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-07-02 15:40:08 +00:00
|
|
|
if (range) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"found range for %" G_GUINT64_FORMAT ": [%" G_GUINT64_FORMAT "-%"
|
|
|
|
G_GUINT64_FORMAT "]", offset, range->offset, range->writing_pos);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue, "no range for %" G_GUINT64_FORMAT, offset);
|
|
|
|
}
|
2010-03-23 18:25:29 +00:00
|
|
|
return range;
|
|
|
|
}
|
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
static void
|
|
|
|
update_cur_level (GstQueue2 * queue, GstQueue2Range * range)
|
|
|
|
{
|
|
|
|
guint64 max_reading_pos, writing_pos;
|
|
|
|
|
|
|
|
writing_pos = range->writing_pos;
|
|
|
|
max_reading_pos = range->max_reading_pos;
|
|
|
|
|
|
|
|
if (writing_pos > max_reading_pos)
|
|
|
|
queue->cur_level.bytes = writing_pos - max_reading_pos;
|
|
|
|
else
|
|
|
|
queue->cur_level.bytes = 0;
|
|
|
|
}
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* make a new range for @offset or reuse an existing range */
|
|
|
|
static GstQueue2Range *
|
|
|
|
add_range (GstQueue2 * queue, guint64 offset)
|
|
|
|
{
|
|
|
|
GstQueue2Range *range, *prev, *next;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "find range for %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
|
|
if ((range = find_range (queue, offset, 0))) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"reusing range %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT, range->offset,
|
|
|
|
range->writing_pos);
|
|
|
|
range->writing_pos = offset;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"new range %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT, offset, offset);
|
|
|
|
|
|
|
|
range = g_slice_new0 (GstQueue2Range);
|
|
|
|
range->offset = offset;
|
2010-05-07 07:30:44 +00:00
|
|
|
/* we want to write to the next location in the ring buffer */
|
|
|
|
range->rb_offset = queue->current ? queue->current->rb_writing_pos : 0;
|
2010-03-23 18:25:29 +00:00
|
|
|
range->writing_pos = offset;
|
2010-05-07 07:30:44 +00:00
|
|
|
range->rb_writing_pos = range->rb_offset;
|
2010-03-23 18:25:29 +00:00
|
|
|
range->reading_pos = offset;
|
|
|
|
range->max_reading_pos = offset;
|
|
|
|
|
|
|
|
/* insert sorted */
|
|
|
|
prev = NULL;
|
|
|
|
next = queue->ranges;
|
|
|
|
while (next) {
|
|
|
|
if (next->offset > offset) {
|
|
|
|
/* insert before next */
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"insert before range %p, offset %" G_GUINT64_FORMAT, next,
|
|
|
|
next->offset);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* try next */
|
|
|
|
prev = next;
|
|
|
|
next = next->next;
|
|
|
|
}
|
|
|
|
range->next = next;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range;
|
|
|
|
else
|
|
|
|
queue->ranges = range;
|
|
|
|
}
|
|
|
|
debug_ranges (queue);
|
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
/* update the stats for this range */
|
|
|
|
update_cur_level (queue, range);
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
return range;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* clear and init the download ranges for offset 0 */
|
|
|
|
static void
|
|
|
|
init_ranges (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "init queue ranges");
|
|
|
|
|
|
|
|
/* get rid of all the current ranges */
|
|
|
|
clean_ranges (queue);
|
|
|
|
/* make a range for offset 0 */
|
|
|
|
queue->current = add_range (queue, 0);
|
|
|
|
}
|
|
|
|
|
2009-10-27 14:23:00 +00:00
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_acceptcaps (GstPad * pad, GstCaps * caps)
|
2009-10-27 14:23:00 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2009-10-27 14:23:00 +00:00
|
|
|
GstPad *otherpad;
|
|
|
|
gboolean result;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
2009-10-27 14:23:00 +00:00
|
|
|
|
|
|
|
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
|
|
|
|
result = gst_pad_peer_accept_caps (otherpad, caps);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static GstCaps *
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_getcaps (GstPad * pad)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstPad *otherpad;
|
|
|
|
GstCaps *result;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
|
|
|
|
result = gst_pad_peer_get_caps (otherpad);
|
|
|
|
if (result == NULL)
|
|
|
|
result = gst_caps_new_any ();
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_bufferalloc (GstPad * pad, guint64 offset, guint size,
|
|
|
|
GstCaps * caps, GstBuffer ** buf)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstFlowReturn result;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* Forward to src pad, without setting caps on the src pad */
|
|
|
|
result = gst_pad_alloc_buffer (queue->srcpad, offset, size, caps, buf);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* calculate the diff between running time on the sink and src of the queue.
|
|
|
|
* This is the total amount of time in the queue. */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
update_time_level (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gint64 sink_time, src_time;
|
|
|
|
|
|
|
|
sink_time =
|
|
|
|
gst_segment_to_running_time (&queue->sink_segment, GST_FORMAT_TIME,
|
|
|
|
queue->sink_segment.last_stop);
|
|
|
|
|
|
|
|
src_time = gst_segment_to_running_time (&queue->src_segment, GST_FORMAT_TIME,
|
|
|
|
queue->src_segment.last_stop);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "sink %" GST_TIME_FORMAT ", src %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (sink_time), GST_TIME_ARGS (src_time));
|
|
|
|
|
|
|
|
if (sink_time >= src_time)
|
|
|
|
queue->cur_level.time = sink_time - src_time;
|
|
|
|
else
|
|
|
|
queue->cur_level.time = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* take a NEWSEGMENT event and apply the values to segment, updating the time
|
|
|
|
* level of queue. */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
apply_segment (GstQueue2 * queue, GstEvent * event, GstSegment * segment)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean update;
|
|
|
|
GstFormat format;
|
|
|
|
gdouble rate, arate;
|
|
|
|
gint64 start, stop, time;
|
|
|
|
|
|
|
|
gst_event_parse_new_segment_full (event, &update, &rate, &arate,
|
|
|
|
&format, &start, &stop, &time);
|
|
|
|
|
2007-06-28 10:21:19 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"received NEWSEGMENT update %d, rate %lf, applied rate %lf, "
|
|
|
|
"format %d, "
|
|
|
|
"%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
|
2007-08-10 10:08:05 +00:00
|
|
|
G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
|
2007-06-28 10:21:19 +00:00
|
|
|
|
|
|
|
if (format == GST_FORMAT_BYTES) {
|
2010-07-29 15:27:06 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
/* start is where we'll be getting from and as such writing next */
|
|
|
|
queue->current = add_range (queue, start);
|
|
|
|
/* update the stats for this range */
|
|
|
|
update_cur_level (queue, queue->current);
|
|
|
|
}
|
2007-06-28 10:21:19 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* now configure the values, we use these to track timestamps on the
|
|
|
|
* sinkpad. */
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
/* non-time format, pretent the current time segment is closed with a
|
|
|
|
* 0 start and unknown stop time. */
|
|
|
|
update = FALSE;
|
|
|
|
format = GST_FORMAT_TIME;
|
|
|
|
start = 0;
|
|
|
|
stop = -1;
|
|
|
|
time = 0;
|
|
|
|
}
|
|
|
|
gst_segment_set_newsegment_full (segment, update,
|
|
|
|
rate, arate, format, start, stop, time);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"configured NEWSEGMENT %" GST_SEGMENT_FORMAT, segment);
|
|
|
|
|
|
|
|
/* segment can update the time level of the queue */
|
|
|
|
update_time_level (queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* take a buffer and update segment, updating the time level of the queue. */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
apply_buffer (GstQueue2 * queue, GstBuffer * buffer, GstSegment * segment)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GstClockTime duration, timestamp;
|
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
duration = GST_BUFFER_DURATION (buffer);
|
|
|
|
|
|
|
|
/* if no timestamp is set, assume it's continuous with the previous
|
|
|
|
* time */
|
|
|
|
if (timestamp == GST_CLOCK_TIME_NONE)
|
|
|
|
timestamp = segment->last_stop;
|
|
|
|
|
|
|
|
/* add duration */
|
|
|
|
if (duration != GST_CLOCK_TIME_NONE)
|
|
|
|
timestamp += duration;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "last_stop updated to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp));
|
|
|
|
|
|
|
|
gst_segment_set_last_stop (segment, GST_FORMAT_TIME, timestamp);
|
|
|
|
|
|
|
|
/* calc diff with other end */
|
|
|
|
update_time_level (queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
update_buffering (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-11-10 13:10:56 +00:00
|
|
|
gint64 percent;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gboolean post = FALSE;
|
|
|
|
|
2007-06-12 08:38:06 +00:00
|
|
|
if (!queue->use_buffering || queue->high_percent <= 0)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return;
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
#define GET_PERCENT(format,alt_max) ((queue->max_level.format) > 0 ? (queue->cur_level.format) * 100 / ((alt_max) > 0 ? MIN ((alt_max), (queue->max_level.format)) : (queue->max_level.format)) : 0)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
if (queue->is_eos) {
|
|
|
|
/* on EOS we are always 100% full, we set the var here so that it we can
|
2009-11-10 12:52:30 +00:00
|
|
|
* reuse the logic below to stop buffering */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
percent = 100;
|
|
|
|
} else {
|
|
|
|
/* figure out the percent we are filled, we take the max of all formats. */
|
2010-05-18 15:42:07 +00:00
|
|
|
|
|
|
|
if (!QUEUE_IS_USING_RING_BUFFER (queue)) {
|
2010-06-06 07:30:48 +00:00
|
|
|
percent = GET_PERCENT (bytes, 0);
|
2010-05-18 15:42:07 +00:00
|
|
|
} else {
|
|
|
|
guint64 rb_size = queue->ring_buffer_max_size;
|
2010-06-06 07:30:48 +00:00
|
|
|
percent = GET_PERCENT (bytes, rb_size);
|
2010-05-18 15:42:07 +00:00
|
|
|
}
|
2010-06-06 07:30:48 +00:00
|
|
|
percent = MAX (percent, GET_PERCENT (time, 0));
|
|
|
|
percent = MAX (percent, GET_PERCENT (buffers, 0));
|
2007-06-28 11:06:56 +00:00
|
|
|
|
|
|
|
/* also apply the rate estimate when we need to */
|
|
|
|
if (queue->use_rate_estimate)
|
2010-06-06 07:30:48 +00:00
|
|
|
percent = MAX (percent, GET_PERCENT (rate_time, 0));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (queue->is_buffering) {
|
|
|
|
post = TRUE;
|
|
|
|
/* if we were buffering see if we reached the high watermark */
|
|
|
|
if (percent >= queue->high_percent)
|
|
|
|
queue->is_buffering = FALSE;
|
|
|
|
} else {
|
|
|
|
/* we were not buffering, check if we need to start buffering if we drop
|
|
|
|
* below the low threshold */
|
|
|
|
if (percent < queue->low_percent) {
|
|
|
|
queue->is_buffering = TRUE;
|
2007-09-17 16:22:17 +00:00
|
|
|
queue->buffering_iteration++;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
post = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (post) {
|
2008-04-09 21:40:17 +00:00
|
|
|
GstMessage *message;
|
2008-04-11 01:25:01 +00:00
|
|
|
GstBufferingMode mode;
|
2009-11-04 19:33:58 +00:00
|
|
|
gint64 buffering_left = -1;
|
2008-04-09 21:40:17 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* scale to high percent so that it becomes the 100% mark */
|
|
|
|
percent = percent * 100 / queue->high_percent;
|
|
|
|
/* clip */
|
|
|
|
if (percent > 100)
|
|
|
|
percent = 100;
|
|
|
|
|
2010-03-25 16:36:45 +00:00
|
|
|
queue->buffering_percent = percent;
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2009-11-04 19:33:58 +00:00
|
|
|
GstFormat fmt = GST_FORMAT_BYTES;
|
|
|
|
gint64 duration;
|
|
|
|
|
2010-06-16 10:00:30 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
|
|
|
mode = GST_BUFFERING_TIMESHIFT;
|
|
|
|
else
|
|
|
|
mode = GST_BUFFERING_DOWNLOAD;
|
|
|
|
|
2009-11-04 19:33:58 +00:00
|
|
|
if (queue->byte_in_rate > 0) {
|
|
|
|
if (gst_pad_query_peer_duration (queue->sinkpad, &fmt, &duration))
|
|
|
|
buffering_left =
|
|
|
|
(gdouble) ((duration -
|
2010-03-23 18:25:29 +00:00
|
|
|
queue->current->writing_pos) * 1000) / queue->byte_in_rate;
|
2009-11-04 19:33:58 +00:00
|
|
|
} else {
|
|
|
|
buffering_left = G_MAXINT64;
|
|
|
|
}
|
|
|
|
} else {
|
2008-04-11 01:25:01 +00:00
|
|
|
mode = GST_BUFFERING_STREAM;
|
2009-11-04 19:33:58 +00:00
|
|
|
}
|
2008-04-11 01:25:01 +00:00
|
|
|
|
2009-11-10 14:55:34 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "buffering %d percent", (gint) percent);
|
2009-11-10 13:10:56 +00:00
|
|
|
message = gst_message_new_buffering (GST_OBJECT_CAST (queue),
|
|
|
|
(gint) percent);
|
2008-04-11 01:25:01 +00:00
|
|
|
gst_message_set_buffering_stats (message, mode,
|
2009-11-04 19:33:58 +00:00
|
|
|
queue->byte_in_rate, queue->byte_out_rate, buffering_left);
|
2008-04-09 21:40:17 +00:00
|
|
|
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (queue), message);
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
2009-11-10 14:55:34 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "filled %d percent", (gint) percent);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef GET_PERCENT
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
reset_rate_timer (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
queue->bytes_in = 0;
|
|
|
|
queue->bytes_out = 0;
|
|
|
|
queue->byte_in_rate = 0.0;
|
|
|
|
queue->byte_out_rate = 0.0;
|
2007-12-14 18:46:12 +00:00
|
|
|
queue->last_in_elapsed = 0.0;
|
|
|
|
queue->last_out_elapsed = 0.0;
|
|
|
|
queue->in_timer_started = FALSE;
|
|
|
|
queue->out_timer_started = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2007-06-28 10:21:19 +00:00
|
|
|
/* the interval in seconds to recalculate the rate */
|
|
|
|
#define RATE_INTERVAL 0.2
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* Tuning for rate estimation. We use a large window for the input rate because
|
|
|
|
* it should be stable when connected to a network. The output rate is less
|
|
|
|
* stable (the elements preroll, queues behind a demuxer fill, ...) and should
|
|
|
|
* therefore adapt more quickly. */
|
|
|
|
#define AVG_IN(avg,val) ((avg) * 15.0 + (val)) / 16.0
|
|
|
|
#define AVG_OUT(avg,val) ((avg) * 3.0 + (val)) / 4.0
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
update_in_rates (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gdouble elapsed, period;
|
|
|
|
gdouble byte_in_rate;
|
|
|
|
|
2007-12-14 18:46:12 +00:00
|
|
|
if (!queue->in_timer_started) {
|
|
|
|
queue->in_timer_started = TRUE;
|
|
|
|
g_timer_start (queue->in_timer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-12-14 18:46:12 +00:00
|
|
|
elapsed = g_timer_elapsed (queue->in_timer, NULL);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* recalc after each interval. */
|
2007-12-14 18:46:12 +00:00
|
|
|
if (queue->last_in_elapsed + RATE_INTERVAL < elapsed) {
|
|
|
|
period = elapsed - queue->last_in_elapsed;
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
2007-12-14 18:46:12 +00:00
|
|
|
"rates: period %f, in %" G_GUINT64_FORMAT, period, queue->bytes_in);
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
|
|
|
|
byte_in_rate = queue->bytes_in / period;
|
|
|
|
|
|
|
|
if (queue->byte_in_rate == 0.0)
|
|
|
|
queue->byte_in_rate = byte_in_rate;
|
|
|
|
else
|
|
|
|
queue->byte_in_rate = AVG_IN (queue->byte_in_rate, byte_in_rate);
|
|
|
|
|
|
|
|
/* reset the values to calculate rate over the next interval */
|
2007-12-14 18:46:12 +00:00
|
|
|
queue->last_in_elapsed = elapsed;
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
queue->bytes_in = 0;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Tweak the buffering thresholds a little.
Original commit message from CVS:
* gst/playback/gstqueue2.c: (update_rates):
Tweak the buffering thresholds a little.
Update the buffer size with the previously calculate rate instead of
only when we calculate a new rate so that we get smoother buffering
updates.
* gst/playback/Makefile.am:
* gst/playback/gsturidecodebin.c: (gst_uri_decode_bin_base_init),
(gst_uri_decode_bin_class_init), (gst_uri_decode_bin_init),
(gst_uri_decode_bin_finalize), (gst_uri_decode_bin_set_property),
(gst_uri_decode_bin_get_property), (unknown_type),
(add_element_stream), (no_more_pads_full), (no_more_pads),
(source_no_more_pads), (new_decoded_pad), (array_has_value),
(gen_source_element), (has_all_raw_caps), (analyse_source),
(remove_decoders), (make_decoder), (remove_source),
(source_new_pad), (setup_source), (decoder_query_init),
(decoder_query_duration_fold), (decoder_query_duration_done),
(decoder_query_position_fold), (decoder_query_position_done),
(decoder_query_latency_fold), (decoder_query_latency_done),
(decoder_query_seeking_fold), (decoder_query_seeking_done),
(decoder_query_generic_fold), (gst_uri_decode_bin_query),
(gst_uri_decode_bin_change_state), (plugin_init):
New element that intergrates a source, optional buffering element and
decodebin.
2007-05-17 15:22:44 +00:00
|
|
|
if (queue->byte_in_rate > 0.0) {
|
|
|
|
queue->cur_level.rate_time =
|
|
|
|
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND;
|
|
|
|
}
|
2007-12-14 18:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "rates: in %f, time %" GST_TIME_FORMAT,
|
|
|
|
queue->byte_in_rate, GST_TIME_ARGS (queue->cur_level.rate_time));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
update_out_rates (GstQueue2 * queue)
|
2007-12-14 18:46:12 +00:00
|
|
|
{
|
|
|
|
gdouble elapsed, period;
|
|
|
|
gdouble byte_out_rate;
|
|
|
|
|
|
|
|
if (!queue->out_timer_started) {
|
|
|
|
queue->out_timer_started = TRUE;
|
|
|
|
g_timer_start (queue->out_timer);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
elapsed = g_timer_elapsed (queue->out_timer, NULL);
|
|
|
|
|
|
|
|
/* recalc after each interval. */
|
|
|
|
if (queue->last_out_elapsed + RATE_INTERVAL < elapsed) {
|
|
|
|
period = elapsed - queue->last_out_elapsed;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2007-12-14 18:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"rates: period %f, out %" G_GUINT64_FORMAT, period, queue->bytes_out);
|
|
|
|
|
|
|
|
byte_out_rate = queue->bytes_out / period;
|
|
|
|
|
|
|
|
if (queue->byte_out_rate == 0.0)
|
|
|
|
queue->byte_out_rate = byte_out_rate;
|
|
|
|
else
|
|
|
|
queue->byte_out_rate = AVG_OUT (queue->byte_out_rate, byte_out_rate);
|
|
|
|
|
|
|
|
/* reset the values to calculate rate over the next interval */
|
|
|
|
queue->last_out_elapsed = elapsed;
|
|
|
|
queue->bytes_out = 0;
|
|
|
|
}
|
2008-04-02 11:08:05 +00:00
|
|
|
if (queue->byte_in_rate > 0.0) {
|
|
|
|
queue->cur_level.rate_time =
|
|
|
|
queue->cur_level.bytes / queue->byte_in_rate * GST_SECOND;
|
|
|
|
}
|
2007-12-14 18:46:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "rates: out %f, time %" GST_TIME_FORMAT,
|
|
|
|
queue->byte_out_rate, GST_TIME_ARGS (queue->cur_level.rate_time));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-03-25 16:21:02 +00:00
|
|
|
static void
|
|
|
|
update_cur_pos (GstQueue2 * queue, GstQueue2Range * range, guint64 pos)
|
|
|
|
{
|
|
|
|
guint64 reading_pos, max_reading_pos;
|
|
|
|
|
|
|
|
reading_pos = pos;
|
|
|
|
max_reading_pos = range->max_reading_pos;
|
|
|
|
|
|
|
|
max_reading_pos = MAX (max_reading_pos, reading_pos);
|
|
|
|
|
2010-06-28 15:50:06 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
2010-07-02 15:40:08 +00:00
|
|
|
"updating max_reading_pos from %" G_GUINT64_FORMAT " to %"
|
|
|
|
G_GUINT64_FORMAT, range->max_reading_pos, max_reading_pos);
|
2010-03-25 16:21:02 +00:00
|
|
|
range->max_reading_pos = max_reading_pos;
|
|
|
|
|
|
|
|
update_cur_level (queue, range);
|
|
|
|
}
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
static gboolean
|
|
|
|
perform_seek_to_offset (GstQueue2 * queue, guint64 offset)
|
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "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);
|
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
if (res)
|
|
|
|
queue->current = add_range (queue, offset);
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
return res;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* see if there is enough data in the file to read a full buffer */
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_have_data (GstQueue2 * queue, guint64 offset, guint length)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
2010-03-23 18:25:29 +00:00
|
|
|
GstQueue2Range *range;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2010-03-25 16:21:02 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "looking for offset %" G_GUINT64_FORMAT ", len %u",
|
|
|
|
offset, length);
|
2010-03-23 18:25:29 +00:00
|
|
|
|
|
|
|
if ((range = find_range (queue, offset, length))) {
|
|
|
|
if (queue->current != range) {
|
2010-03-25 16:21:02 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "switching ranges, do seek to range position");
|
2010-03-23 18:25:29 +00:00
|
|
|
perform_seek_to_offset (queue, range->writing_pos);
|
|
|
|
}
|
2010-03-25 16:21:02 +00:00
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
GST_INFO_OBJECT (queue, "cur_level.bytes %u (max %u)",
|
2010-06-16 15:03:49 +00:00
|
|
|
queue->cur_level.bytes, QUEUE_MAX_BYTES (queue));
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* we have a range for offset */
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"we have a range %p, offset %" G_GUINT64_FORMAT ", writing_pos %"
|
|
|
|
G_GUINT64_FORMAT, range, range->offset, range->writing_pos);
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
if (!QUEUE_IS_USING_RING_BUFFER (queue) && queue->is_eos)
|
2010-03-23 18:25:29 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2010-05-26 02:11:48 +00:00
|
|
|
if (offset + length <= range->writing_pos)
|
2010-03-23 18:25:29 +00:00
|
|
|
return TRUE;
|
2010-05-19 14:04:15 +00:00
|
|
|
else
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Need more data (%" G_GUINT64_FORMAT " bytes more)",
|
2010-06-06 07:30:48 +00:00
|
|
|
(offset + length) - range->writing_pos);
|
2010-03-23 18:25:29 +00:00
|
|
|
|
|
|
|
} else {
|
2010-03-25 16:21:02 +00:00
|
|
|
GST_INFO_OBJECT (queue, "not found in any range");
|
2010-03-24 17:18:13 +00:00
|
|
|
/* we don't have the range, see how far away we are, FIXME, find a good
|
|
|
|
* threshold based on the incomming rate. */
|
2010-06-07 08:16:04 +00:00
|
|
|
if (!queue->is_eos && queue->current) {
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
if (offset < queue->current->offset || offset >
|
2010-07-02 15:40:08 +00:00
|
|
|
queue->current->writing_pos + QUEUE_MAX_BYTES (queue) -
|
2010-06-15 14:12:02 +00:00
|
|
|
queue->cur_level.bytes) {
|
|
|
|
perform_seek_to_offset (queue, offset);
|
2010-07-02 15:40:08 +00:00
|
|
|
} else {
|
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"requested data is within range, wait for data");
|
2010-06-15 14:12:02 +00:00
|
|
|
}
|
2010-05-19 14:04:15 +00:00
|
|
|
} else if (offset < queue->current->writing_pos + 200000) {
|
2010-03-25 16:21:02 +00:00
|
|
|
update_cur_pos (queue, queue->current, offset + length);
|
|
|
|
GST_INFO_OBJECT (queue, "wait for data");
|
|
|
|
}
|
2010-06-06 07:30:48 +00:00
|
|
|
return FALSE;
|
2010-03-25 16:21:02 +00:00
|
|
|
}
|
2010-03-24 17:18:13 +00:00
|
|
|
|
|
|
|
/* too far away, do a seek */
|
2010-03-23 18:25:29 +00:00
|
|
|
perform_seek_to_offset (queue, offset);
|
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
#ifdef HAVE_FSEEKO
|
|
|
|
#define FSEEK_FILE(file,offset) (fseeko (file, (off_t) offset, SEEK_SET) != 0)
|
|
|
|
#elif defined (G_OS_UNIX) || defined (G_OS_WIN32)
|
|
|
|
#define FSEEK_FILE(file,offset) (lseek (fileno (file), (off_t) offset, SEEK_SET) == (off_t) -1)
|
|
|
|
#else
|
|
|
|
#define FSEEK_FILE(file,offset) (fseek (file, offset, SEEK_SET) != 0)
|
|
|
|
#endif
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
static gint64
|
2010-05-07 07:30:44 +00:00
|
|
|
gst_queue2_read_data_at_offset (GstQueue2 * queue, guint64 offset, guint length,
|
|
|
|
guint8 * dst)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
2010-06-18 15:43:40 +00:00
|
|
|
guint8 *ring_buffer;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
size_t res;
|
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
ring_buffer = queue->ring_buffer;
|
|
|
|
|
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue) && FSEEK_FILE (queue->temp_file, offset))
|
2007-06-06 09:08:50 +00:00
|
|
|
goto seek_failed;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
/* this should not block */
|
2010-05-07 07:30:44 +00:00
|
|
|
GST_LOG_OBJECT (queue, "Reading %d bytes from offset %" G_GUINT64_FORMAT,
|
|
|
|
length, offset);
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
res = fread (dst, 1, length, queue->temp_file);
|
|
|
|
} else {
|
|
|
|
memcpy (dst, ring_buffer + offset, length);
|
|
|
|
res = length;
|
|
|
|
}
|
|
|
|
|
2007-06-13 18:20:57 +00:00
|
|
|
GST_LOG_OBJECT (queue, "read %" G_GSIZE_FORMAT " bytes", res);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
if (G_UNLIKELY (res < length)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (!QUEUE_IS_USING_TEMP_FILE (queue))
|
|
|
|
goto could_not_read;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* check for errors or EOF */
|
|
|
|
if (ferror (queue->temp_file))
|
|
|
|
goto could_not_read;
|
|
|
|
if (feof (queue->temp_file) && length > 0)
|
|
|
|
goto eos;
|
|
|
|
}
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
return res;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
seek_failed:
|
|
|
|
{
|
2010-06-15 10:37:33 +00:00
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, SEEK, (NULL), GST_ERROR_SYSTEM);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
could_not_read:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("non-regular file hits EOS");
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_queue2_create_read (GstQueue2 * queue, guint64 offset, guint length,
|
|
|
|
GstBuffer ** buffer)
|
|
|
|
{
|
|
|
|
GstBuffer *buf;
|
|
|
|
guint8 *data;
|
|
|
|
guint64 file_offset;
|
2010-06-06 07:30:48 +00:00
|
|
|
guint block_length, remaining, read_length;
|
2010-06-15 14:12:02 +00:00
|
|
|
gint64 read_return;
|
2010-06-16 15:03:49 +00:00
|
|
|
guint64 rb_size;
|
2010-06-18 12:36:33 +00:00
|
|
|
guint64 rpos;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
/* allocate the output buffer of the requested size */
|
|
|
|
buf = gst_buffer_new_and_alloc (length);
|
|
|
|
data = GST_BUFFER_DATA (buf);
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "Reading %u bytes from %" G_GUINT64_FORMAT, length,
|
|
|
|
offset);
|
|
|
|
|
2010-06-28 15:50:06 +00:00
|
|
|
rpos = offset;
|
2010-06-16 15:03:49 +00:00
|
|
|
rb_size = queue->ring_buffer_max_size;
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
remaining = length;
|
|
|
|
while (remaining > 0) {
|
|
|
|
/* configure how much/whether to read */
|
2010-06-18 12:36:33 +00:00
|
|
|
if (!gst_queue2_have_data (queue, rpos, remaining)) {
|
2010-06-16 09:11:11 +00:00
|
|
|
read_length = 0;
|
|
|
|
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
2010-06-16 09:20:00 +00:00
|
|
|
guint64 level;
|
|
|
|
|
|
|
|
/* calculate how far away the offset is */
|
2010-06-18 12:36:33 +00:00
|
|
|
if (queue->current->writing_pos > rpos)
|
|
|
|
level = queue->current->writing_pos - rpos;
|
2010-06-16 09:20:00 +00:00
|
|
|
else
|
|
|
|
level = 0;
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
2010-06-16 09:20:00 +00:00
|
|
|
"reading %" G_GUINT64_FORMAT ", writing %" G_GUINT64_FORMAT
|
|
|
|
", level %" G_GUINT64_FORMAT,
|
2010-07-02 15:40:08 +00:00
|
|
|
rpos, queue->current->writing_pos, level);
|
2010-06-16 09:20:00 +00:00
|
|
|
|
2010-06-16 15:03:49 +00:00
|
|
|
if (level >= rb_size) {
|
2010-06-16 09:11:11 +00:00
|
|
|
/* we don't have the data but if we have a ring buffer that is full, we
|
|
|
|
* need to read */
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
2010-07-07 06:20:21 +00:00
|
|
|
"ring buffer full, reading ring-buffer-max-size %"
|
|
|
|
G_GUINT64_FORMAT " bytes", rb_size);
|
2010-06-16 15:03:49 +00:00
|
|
|
read_length = rb_size;
|
2010-07-02 15:40:08 +00:00
|
|
|
} else if (queue->is_eos) {
|
|
|
|
/* won't get any more data so read any data we have */
|
|
|
|
if (level) {
|
|
|
|
GST_DEBUG_OBJECT (queue, "EOS hit but read %u bytes that we have",
|
|
|
|
level);
|
|
|
|
read_length = level;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"EOS hit and we don't have any requested data");
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
2010-06-16 09:11:11 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 12:36:33 +00:00
|
|
|
|
2010-06-16 09:11:11 +00:00
|
|
|
if (read_length == 0) {
|
2010-07-02 15:40:08 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)
|
|
|
|
&& queue->current->max_reading_pos > rpos) {
|
2010-06-18 12:36:33 +00:00
|
|
|
/* protect cached data (data between offset and max_reading_pos)
|
|
|
|
* and update current level */
|
2010-06-28 15:50:06 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"protecting cached data [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT
|
|
|
|
"]", rpos, queue->current->max_reading_pos);
|
2010-06-18 12:36:33 +00:00
|
|
|
queue->current->max_reading_pos = rpos;
|
|
|
|
update_cur_level (queue, queue->current);
|
|
|
|
}
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "waiting for add");
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
|
|
|
continue;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
} else {
|
2010-06-06 07:30:48 +00:00
|
|
|
/* we have the requested data so read it */
|
|
|
|
read_length = remaining;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2010-07-02 15:40:08 +00:00
|
|
|
/* set range reading_pos to actual reading position for this read */
|
|
|
|
queue->current->reading_pos = rpos;
|
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
/* congfigure how much and from where to read */
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
file_offset =
|
2010-06-18 12:36:33 +00:00
|
|
|
(queue->current->rb_offset + (rpos -
|
2010-06-16 15:03:49 +00:00
|
|
|
queue->current->offset)) % rb_size;
|
|
|
|
if (file_offset + read_length > rb_size) {
|
|
|
|
block_length = rb_size - file_offset;
|
2010-06-06 07:30:48 +00:00
|
|
|
} else {
|
|
|
|
block_length = read_length;
|
|
|
|
}
|
|
|
|
} else {
|
2010-06-18 12:36:33 +00:00
|
|
|
file_offset = rpos;
|
2010-06-06 07:30:48 +00:00
|
|
|
block_length = read_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* while we still have data to read, we loop */
|
|
|
|
while (read_length > 0) {
|
|
|
|
read_return =
|
2010-05-07 07:30:44 +00:00
|
|
|
gst_queue2_read_data_at_offset (queue, file_offset, block_length,
|
2010-06-06 07:30:48 +00:00
|
|
|
data);
|
2010-06-15 14:12:02 +00:00
|
|
|
if (read_return < 0)
|
|
|
|
goto read_error;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
file_offset += read_return;
|
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
2010-06-16 15:03:49 +00:00
|
|
|
file_offset %= rb_size;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-06 07:30:48 +00:00
|
|
|
data += read_return;
|
|
|
|
read_length -= read_return;
|
|
|
|
block_length = read_length;
|
|
|
|
remaining -= read_return;
|
2010-06-16 09:20:00 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
rpos = (queue->current->reading_pos += read_return);
|
|
|
|
update_cur_pos (queue, queue->current, queue->current->reading_pos);
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
2010-06-06 07:30:48 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
|
|
|
GST_DEBUG_OBJECT (queue, "%u bytes left to read", remaining);
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_BUFFER_SIZE (buf) = length;
|
|
|
|
GST_BUFFER_OFFSET (buf) = offset;
|
|
|
|
GST_BUFFER_OFFSET_END (buf) = offset + length;
|
|
|
|
|
|
|
|
*buffer = buf;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "we are flushing");
|
|
|
|
return GST_FLOW_WRONG_STATE;
|
|
|
|
}
|
2010-06-15 14:12:02 +00:00
|
|
|
read_error:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "we have a read error");
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return read_return;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* should be called with QUEUE_LOCK */
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
static GstMiniObject *
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_read_item_from_file (GstQueue2 * queue)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GstMiniObject *item;
|
|
|
|
|
|
|
|
if (queue->starting_segment != NULL) {
|
|
|
|
item = GST_MINI_OBJECT_CAST (queue->starting_segment);
|
|
|
|
queue->starting_segment = NULL;
|
|
|
|
} else {
|
|
|
|
GstFlowReturn ret;
|
|
|
|
GstBuffer *buffer;
|
2010-03-23 18:25:29 +00:00
|
|
|
guint64 reading_pos;
|
|
|
|
|
|
|
|
reading_pos = queue->current->reading_pos;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
ret =
|
2010-03-23 18:25:29 +00:00
|
|
|
gst_queue2_create_read (queue, reading_pos, DEFAULT_BUFFER_SIZE,
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
&buffer);
|
2010-06-15 14:12:02 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
switch (ret) {
|
|
|
|
case GST_FLOW_OK:
|
|
|
|
item = GST_MINI_OBJECT_CAST (buffer);
|
|
|
|
break;
|
|
|
|
case GST_FLOW_UNEXPECTED:
|
|
|
|
item = GST_MINI_OBJECT_CAST (gst_event_new_eos ());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
item = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_open_temp_location_file (GstQueue2 * queue)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
2009-07-10 18:49:46 +00:00
|
|
|
gint fd = -1;
|
|
|
|
gchar *name = NULL;
|
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
if (queue->temp_file)
|
|
|
|
goto already_opened;
|
|
|
|
|
2009-07-10 18:49:46 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "opening temp file %s", queue->temp_template);
|
|
|
|
|
|
|
|
/* we have two cases:
|
|
|
|
* - temp_location was set to something !NULL (Deprecated). in this case we
|
|
|
|
* open the specified filename.
|
|
|
|
* - temp_template was set, allocate a filename and open that filename
|
|
|
|
*/
|
|
|
|
if (!queue->temp_location_set) {
|
|
|
|
/* nothing to do */
|
|
|
|
if (queue->temp_template == NULL)
|
|
|
|
goto no_directory;
|
|
|
|
|
|
|
|
/* make copy of the template, we don't want to change this */
|
|
|
|
name = g_strdup (queue->temp_template);
|
|
|
|
fd = g_mkstemp (name);
|
|
|
|
if (fd == -1)
|
|
|
|
goto mkstemp_failed;
|
|
|
|
|
|
|
|
/* open the file for update/writing */
|
|
|
|
queue->temp_file = fdopen (fd, "wb+");
|
|
|
|
/* error creating file */
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
goto open_failed;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (queue->temp_location);
|
|
|
|
queue->temp_location = name;
|
2008-04-02 11:08:05 +00:00
|
|
|
|
2009-07-10 18:49:46 +00:00
|
|
|
g_object_notify (G_OBJECT (queue), "temp-location");
|
|
|
|
} else {
|
|
|
|
/* open the file for update/writing, this is deprecated but we still need to
|
|
|
|
* support it for API/ABI compatibility */
|
|
|
|
queue->temp_file = g_fopen (queue->temp_location, "wb+");
|
|
|
|
/* error creating file */
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
goto open_failed;
|
|
|
|
}
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "opened temp file %s", queue->temp_template);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
2010-03-23 18:25:29 +00:00
|
|
|
already_opened:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "temp file was already open");
|
|
|
|
return TRUE;
|
|
|
|
}
|
2009-07-10 18:49:46 +00:00
|
|
|
no_directory:
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, NOT_FOUND,
|
2009-07-10 18:49:46 +00:00
|
|
|
(_("No Temp directory specified.")), (NULL));
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2009-07-10 18:49:46 +00:00
|
|
|
mkstemp_failed:
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, OPEN_READ,
|
2009-07-10 18:49:46 +00:00
|
|
|
(_("Could not create temp file \"%s\"."), queue->temp_template),
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
GST_ERROR_SYSTEM);
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
open_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, OPEN_READ,
|
|
|
|
(_("Could not open file \"%s\" for reading."), name), GST_ERROR_SYSTEM);
|
|
|
|
g_free (name);
|
|
|
|
if (fd != -1)
|
|
|
|
close (fd);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_close_temp_location_file (GstQueue2 * queue)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
/* nothing to do */
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
return;
|
2008-04-09 21:40:17 +00:00
|
|
|
|
2008-04-02 11:08:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "closing temp file");
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
fflush (queue->temp_file);
|
|
|
|
fclose (queue->temp_file);
|
2010-01-22 16:55:39 +00:00
|
|
|
|
|
|
|
if (queue->temp_remove)
|
|
|
|
remove (queue->temp_location);
|
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
queue->temp_file = NULL;
|
2010-03-23 18:25:29 +00:00
|
|
|
clean_ranges (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
|
2009-07-10 20:01:39 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_flush_temp_file (GstQueue2 * queue)
|
2009-07-10 20:01:39 +00:00
|
|
|
{
|
|
|
|
if (queue->temp_file == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "flushing temp file");
|
|
|
|
|
|
|
|
queue->temp_file = g_freopen (queue->temp_location, "wb+", queue->temp_file);
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_locked_flush (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue))
|
|
|
|
gst_queue2_flush_temp_file (queue);
|
|
|
|
init_ranges (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
} else {
|
|
|
|
while (!g_queue_is_empty (queue->queue)) {
|
|
|
|
GstMiniObject *data = g_queue_pop_head (queue->queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* Then lose another reference because we are supposed to destroy that
|
|
|
|
data when flushing */
|
|
|
|
gst_mini_object_unref (data);
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_segment_init (&queue->sink_segment, GST_FORMAT_TIME);
|
|
|
|
gst_segment_init (&queue->src_segment, GST_FORMAT_TIME);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
if (queue->starting_segment != NULL)
|
|
|
|
gst_event_unref (queue->starting_segment);
|
|
|
|
queue->starting_segment = NULL;
|
|
|
|
queue->segment_event_received = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* we deleted a lot of something */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-06-15 10:37:33 +00:00
|
|
|
static gboolean
|
|
|
|
gst_queue2_wait_free_space (GstQueue2 * queue)
|
|
|
|
{
|
|
|
|
/* We make space available if we're "full" according to whatever
|
|
|
|
* the user defined as "full". */
|
|
|
|
if (gst_queue2_is_filled (queue)) {
|
|
|
|
gboolean started;
|
|
|
|
|
|
|
|
/* pause the timer while we wait. The fact that we are waiting does not mean
|
|
|
|
* the byterate on the input pad is lower */
|
|
|
|
if ((started = queue->in_timer_started))
|
|
|
|
g_timer_stop (queue->in_timer);
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
|
|
|
"queue is full, waiting for free space");
|
|
|
|
do {
|
|
|
|
/* Wait for space to be available, we could be unlocked because of a flush. */
|
|
|
|
GST_QUEUE2_WAIT_DEL_CHECK (queue, queue->sinkresult, out_flushing);
|
|
|
|
}
|
|
|
|
while (gst_queue2_is_filled (queue));
|
|
|
|
|
|
|
|
/* and continue if we were running before */
|
|
|
|
if (started)
|
|
|
|
g_timer_continue (queue->in_timer);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is flushing");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
static gboolean
|
2010-06-18 15:43:40 +00:00
|
|
|
gst_queue2_create_write (GstQueue2 * queue, GstBuffer * buffer)
|
2010-05-07 07:30:44 +00:00
|
|
|
{
|
2010-06-18 15:43:40 +00:00
|
|
|
guint8 *data, *ring_buffer;
|
2010-06-16 16:25:35 +00:00
|
|
|
guint size, rb_size;
|
2010-06-18 12:36:33 +00:00
|
|
|
guint64 writing_pos, new_writing_pos, max_reading_pos;
|
2010-06-16 16:25:35 +00:00
|
|
|
gint64 space;
|
2010-06-18 12:36:33 +00:00
|
|
|
GstQueue2Range *range, *prev, *next;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue))
|
|
|
|
writing_pos = queue->current->rb_writing_pos;
|
|
|
|
else
|
|
|
|
writing_pos = queue->current->writing_pos;
|
|
|
|
max_reading_pos = queue->current->max_reading_pos;
|
2010-06-18 15:43:40 +00:00
|
|
|
ring_buffer = queue->ring_buffer;
|
2010-06-16 15:03:49 +00:00
|
|
|
rb_size = queue->ring_buffer_max_size;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-16 16:25:35 +00:00
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
|
|
|
data = GST_BUFFER_DATA (buffer);
|
2010-06-15 14:12:02 +00:00
|
|
|
|
2010-07-02 15:40:08 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "Writing %u bytes to %" G_GUINT64_FORMAT, size,
|
|
|
|
GST_BUFFER_OFFSET (buffer));
|
|
|
|
|
2010-06-16 16:25:35 +00:00
|
|
|
while (size > 0) {
|
|
|
|
guint to_write;
|
2010-06-06 07:30:48 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
/* calculate the space in the ring buffer not used by data from
|
|
|
|
* the current range */
|
|
|
|
while (QUEUE_MAX_BYTES (queue) <= queue->cur_level.bytes) {
|
|
|
|
/* wait until there is some free space */
|
|
|
|
GST_QUEUE2_WAIT_DEL_CHECK (queue, queue->sinkresult, out_flushing);
|
|
|
|
}
|
|
|
|
/* get the amount of space we have */
|
|
|
|
space = QUEUE_MAX_BYTES (queue) - queue->cur_level.bytes;
|
|
|
|
|
|
|
|
/* calculate if we need to split or if we can write the entire
|
|
|
|
* buffer now */
|
|
|
|
to_write = MIN (size, space);
|
|
|
|
|
|
|
|
/* the writing position in the ring buffer after writing (part
|
|
|
|
* or all of) the buffer */
|
|
|
|
new_writing_pos = (writing_pos + to_write) % rb_size;
|
|
|
|
|
|
|
|
prev = NULL;
|
|
|
|
range = queue->ranges;
|
|
|
|
|
|
|
|
/* if we need to overwrite data in the ring buffer, we need to
|
|
|
|
* update the ranges
|
|
|
|
*
|
|
|
|
* warning: this code is complicated and includes some
|
|
|
|
* simplifications - pen, paper and diagrams for the cases
|
|
|
|
* recommended! */
|
|
|
|
while (range) {
|
|
|
|
guint64 range_data_start, range_data_end;
|
|
|
|
GstQueue2Range *range_to_destroy = NULL;
|
|
|
|
|
|
|
|
range_data_start = range->rb_offset;
|
|
|
|
range_data_end = range->rb_writing_pos;
|
|
|
|
|
2010-07-07 06:20:21 +00:00
|
|
|
/* handle the special case where the range has no data in it */
|
|
|
|
if (range->writing_pos == range->offset) {
|
|
|
|
if (range != queue->current) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Removing range: offset %" G_GUINT64_FORMAT ", wpos %"
|
|
|
|
G_GUINT64_FORMAT, range->offset, range->writing_pos);
|
|
|
|
/* remove range */
|
|
|
|
range_to_destroy = range;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range->next;
|
|
|
|
}
|
|
|
|
goto next_range;
|
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (range_data_end > range_data_start) {
|
|
|
|
if (writing_pos >= range_data_end && new_writing_pos >= writing_pos)
|
|
|
|
goto next_range;
|
|
|
|
|
|
|
|
if (new_writing_pos > range_data_start) {
|
|
|
|
if (new_writing_pos >= range_data_end) {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Removing range: offset %" G_GUINT64_FORMAT ", wpos %"
|
|
|
|
G_GUINT64_FORMAT, range->offset, range->writing_pos);
|
|
|
|
/* remove range */
|
|
|
|
range_to_destroy = range;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range->next;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"advancing offsets from %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ") to %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ")", range->offset, range->rb_offset,
|
|
|
|
range->offset + new_writing_pos - range_data_start,
|
|
|
|
new_writing_pos);
|
|
|
|
range->offset += (new_writing_pos - range_data_start);
|
|
|
|
range->rb_offset = new_writing_pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
guint64 new_wpos_virt = writing_pos + to_write;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (new_wpos_virt <= range_data_start)
|
|
|
|
goto next_range;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (new_wpos_virt > rb_size && new_writing_pos >= range_data_end) {
|
2010-05-19 14:04:15 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Removing range: offset %" G_GUINT64_FORMAT ", wpos %"
|
|
|
|
G_GUINT64_FORMAT, range->offset, range->writing_pos);
|
2010-05-07 07:30:44 +00:00
|
|
|
/* remove range */
|
|
|
|
range_to_destroy = range;
|
|
|
|
if (prev)
|
|
|
|
prev->next = range->next;
|
|
|
|
} else {
|
2010-05-19 14:04:15 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"advancing offsets from %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ") to %" G_GUINT64_FORMAT " (%"
|
|
|
|
G_GUINT64_FORMAT ")", range->offset, range->rb_offset,
|
|
|
|
range->offset + new_writing_pos - range_data_start,
|
|
|
|
new_writing_pos);
|
2010-06-18 12:36:33 +00:00
|
|
|
range->offset += (new_wpos_virt - range_data_start);
|
2010-05-07 07:30:44 +00:00
|
|
|
range->rb_offset = new_writing_pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
next_range:
|
|
|
|
if (!range_to_destroy)
|
|
|
|
prev = range;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
range = range->next;
|
|
|
|
if (range_to_destroy) {
|
|
|
|
if (range_to_destroy == queue->ranges)
|
|
|
|
queue->ranges = range;
|
|
|
|
g_slice_free (GstQueue2Range, range_to_destroy);
|
|
|
|
range_to_destroy = NULL;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
}
|
2010-06-18 12:36:33 +00:00
|
|
|
} else {
|
|
|
|
space = to_write = size;
|
|
|
|
new_writing_pos = writing_pos + to_write;
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)
|
|
|
|
&& FSEEK_FILE (queue->temp_file, writing_pos))
|
2010-06-15 10:37:33 +00:00
|
|
|
goto seek_failed;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
|
|
|
if (new_writing_pos > writing_pos) {
|
2010-07-02 15:40:08 +00:00
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"writing %u bytes to range [%" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT
|
|
|
|
"] (rb wpos %" G_GUINT64_FORMAT ")", to_write, queue->current->offset,
|
|
|
|
queue->current->writing_pos, queue->current->rb_writing_pos);
|
2010-06-18 12:36:33 +00:00
|
|
|
/* either not using ring buffer or no wrapping, just write */
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (fwrite (data, to_write, 1, queue->temp_file) != 1)
|
|
|
|
goto handle_error;
|
|
|
|
} else {
|
|
|
|
memcpy (ring_buffer + writing_pos, data, to_write);
|
|
|
|
}
|
2010-06-18 12:36:33 +00:00
|
|
|
|
|
|
|
if (!QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
/* try to merge with next range */
|
|
|
|
while ((next = queue->current->next)) {
|
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"checking merge with next range %" G_GUINT64_FORMAT " < %"
|
|
|
|
G_GUINT64_FORMAT, new_writing_pos, next->offset);
|
|
|
|
if (new_writing_pos < next->offset)
|
|
|
|
break;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "merging ranges %" G_GUINT64_FORMAT,
|
|
|
|
next->writing_pos);
|
|
|
|
|
2010-06-28 15:50:06 +00:00
|
|
|
/* remove the group, we could choose to not read the data in this range
|
|
|
|
* again. This would involve us doing a seek to the current writing position
|
|
|
|
* in the range. FIXME, It would probably make sense to do a seek when there
|
|
|
|
* is a lot of data in the range we merged with to avoid reading it all
|
|
|
|
* again. */
|
2010-06-18 12:36:33 +00:00
|
|
|
queue->current->next = next->next;
|
|
|
|
g_slice_free (GstQueue2Range, next);
|
|
|
|
|
|
|
|
debug_ranges (queue);
|
|
|
|
}
|
|
|
|
goto update_and_signal;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
} else {
|
|
|
|
/* wrapping */
|
|
|
|
guint block_one, block_two;
|
|
|
|
|
|
|
|
block_one = rb_size - writing_pos;
|
2010-06-16 16:25:35 +00:00
|
|
|
block_two = to_write - block_one;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-15 15:26:15 +00:00
|
|
|
if (block_one > 0) {
|
|
|
|
GST_INFO_OBJECT (queue, "writing %u bytes", block_one);
|
|
|
|
/* write data to end of ring buffer */
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (fwrite (data, block_one, 1, queue->temp_file) != 1)
|
|
|
|
goto handle_error;
|
|
|
|
} else {
|
|
|
|
memcpy (ring_buffer + writing_pos, data, block_one);
|
|
|
|
}
|
2010-06-15 15:26:15 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue) && FSEEK_FILE (queue->temp_file, 0))
|
2010-06-15 10:37:33 +00:00
|
|
|
goto seek_failed;
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-15 15:26:15 +00:00
|
|
|
if (block_two > 0) {
|
|
|
|
GST_INFO_OBJECT (queue, "writing %u bytes", block_two);
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (fwrite (data + block_one, block_two, 1, queue->temp_file) != 1)
|
|
|
|
goto handle_error;
|
|
|
|
} else {
|
|
|
|
memcpy (ring_buffer, data + block_one, block_two);
|
|
|
|
}
|
2010-06-15 15:26:15 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
update_and_signal:
|
2010-05-07 07:30:44 +00:00
|
|
|
/* update the writing positions */
|
2010-06-16 16:25:35 +00:00
|
|
|
size -= to_write;
|
|
|
|
GST_INFO_OBJECT (queue,
|
|
|
|
"wrote %u bytes to %" G_GUINT64_FORMAT " (%u bytes remaining to write)",
|
|
|
|
to_write, writing_pos, size);
|
|
|
|
|
2010-06-18 12:36:33 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
data += to_write;
|
|
|
|
queue->current->writing_pos += to_write;
|
|
|
|
queue->current->rb_writing_pos = writing_pos = new_writing_pos;
|
|
|
|
} else {
|
|
|
|
queue->current->writing_pos = writing_pos = new_writing_pos;
|
|
|
|
}
|
|
|
|
update_cur_level (queue, queue->current);
|
|
|
|
|
2010-06-25 10:58:27 +00:00
|
|
|
/* update the buffering status */
|
|
|
|
update_buffering (queue);
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
GST_INFO_OBJECT (queue, "cur_level.bytes %u (max %u)",
|
2010-06-16 15:03:49 +00:00
|
|
|
queue->cur_level.bytes, QUEUE_MAX_BYTES (queue));
|
2010-05-07 07:30:44 +00:00
|
|
|
|
2010-06-16 14:13:28 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2010-06-16 16:25:35 +00:00
|
|
|
};
|
2010-05-07 07:30:44 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "we are flushing");
|
|
|
|
/* FIXME - GST_FLOW_UNEXPECTED ? */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-06-15 10:37:33 +00:00
|
|
|
seek_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, SEEK, (NULL), GST_ERROR_SYSTEM);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
handle_error:
|
|
|
|
{
|
|
|
|
switch (errno) {
|
|
|
|
case ENOSPC:{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, NO_SPACE_LEFT, (NULL), (NULL));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
GST_ELEMENT_ERROR (queue, RESOURCE, WRITE,
|
|
|
|
(_("Error while writing to download file.")),
|
|
|
|
("%s", g_strerror (errno)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* enqueue an item an update the level stats */
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
if (GST_IS_BUFFER (item)) {
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint size;
|
|
|
|
|
|
|
|
buffer = GST_BUFFER_CAST (item);
|
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
|
|
|
|
|
|
|
/* add buffer to the statistics */
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-25 16:21:02 +00:00
|
|
|
queue->cur_level.buffers++;
|
|
|
|
queue->cur_level.bytes += size;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->bytes_in += size;
|
2009-07-14 15:03:35 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* apply new buffer to segment stats */
|
|
|
|
apply_buffer (queue, buffer, &queue->sink_segment);
|
|
|
|
/* update the byterate stats */
|
2007-12-14 18:46:12 +00:00
|
|
|
update_in_rates (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-06-25 10:58:27 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
/* FIXME - check return value? */
|
|
|
|
gst_queue2_create_write (queue, buffer);
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else if (GST_IS_EVENT (item)) {
|
|
|
|
GstEvent *event;
|
|
|
|
|
|
|
|
event = GST_EVENT_CAST (item);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* Zero the thresholds, this makes sure the queue is completely
|
|
|
|
* filled and we can read all data from the queue. */
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "we have EOS");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->is_eos = TRUE;
|
|
|
|
break;
|
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
apply_segment (queue, event, &queue->sink_segment);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* This is our first new segment, we hold it
|
|
|
|
* as we can't save it on the temp file */
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
if (queue->segment_event_received)
|
|
|
|
goto unexpected_event;
|
|
|
|
|
|
|
|
queue->segment_event_received = TRUE;
|
2009-07-14 15:03:35 +00:00
|
|
|
if (queue->starting_segment != NULL)
|
|
|
|
gst_event_unref (queue->starting_segment);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
queue->starting_segment = event;
|
2009-07-14 15:03:35 +00:00
|
|
|
item = NULL;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
2007-09-17 16:22:17 +00:00
|
|
|
/* a new segment allows us to accept more buffers if we got UNEXPECTED
|
|
|
|
* from downstream */
|
|
|
|
queue->unexpected = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue))
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
goto unexpected_event;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
g_warning ("Unexpected item %p added in queue %s (refcounting problem?)",
|
|
|
|
item, GST_OBJECT_NAME (queue));
|
|
|
|
/* we can't really unref since we don't know what it is */
|
|
|
|
item = NULL;
|
|
|
|
}
|
|
|
|
|
2007-06-12 08:38:06 +00:00
|
|
|
if (item) {
|
2010-06-25 10:58:27 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
/* update the buffering status */
|
|
|
|
update_buffering (queue);
|
2007-06-12 08:38:06 +00:00
|
|
|
|
|
|
|
g_queue_push_tail (queue->queue, item);
|
2010-06-25 10:58:27 +00:00
|
|
|
} else {
|
2009-07-14 15:03:35 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT_CAST (item));
|
2010-06-25 10:58:27 +00:00
|
|
|
}
|
2009-07-14 15:03:35 +00:00
|
|
|
|
2010-07-02 15:40:08 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2007-06-12 08:38:06 +00:00
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
unexpected_event:
|
|
|
|
{
|
|
|
|
g_warning
|
|
|
|
("Unexpected event of kind %s can't be added in temp file of queue %s ",
|
|
|
|
gst_event_type_get_name (GST_EVENT_TYPE (item)),
|
|
|
|
GST_OBJECT_NAME (queue));
|
|
|
|
gst_event_unref (GST_EVENT_CAST (item));
|
|
|
|
return;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dequeue an item from the queue and update level stats */
|
|
|
|
static GstMiniObject *
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_locked_dequeue (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GstMiniObject *item;
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue))
|
2009-10-29 10:30:11 +00:00
|
|
|
item = gst_queue2_read_item_from_file (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
else
|
|
|
|
item = g_queue_pop_head (queue->queue);
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (item == NULL)
|
|
|
|
goto no_item;
|
|
|
|
|
|
|
|
if (GST_IS_BUFFER (item)) {
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint size;
|
|
|
|
|
|
|
|
buffer = GST_BUFFER_CAST (item);
|
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"retrieved buffer %p from queue", buffer);
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-25 16:21:02 +00:00
|
|
|
queue->cur_level.buffers--;
|
|
|
|
queue->cur_level.bytes -= size;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->bytes_out += size;
|
2010-03-25 16:21:02 +00:00
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
apply_buffer (queue, buffer, &queue->src_segment);
|
|
|
|
/* update the byterate stats */
|
2007-12-14 18:46:12 +00:00
|
|
|
update_out_rates (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* update the buffering */
|
|
|
|
update_buffering (queue);
|
|
|
|
|
|
|
|
} else if (GST_IS_EVENT (item)) {
|
|
|
|
GstEvent *event = GST_EVENT_CAST (item);
|
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"retrieved event %p from queue", event);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* queue is empty now that we dequeued the EOS */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_CLEAR_LEVEL (queue->cur_level);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
apply_segment (queue, event, &queue->src_segment);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
g_warning
|
|
|
|
("Unexpected item %p dequeued from queue %s (refcounting problem?)",
|
|
|
|
item, GST_OBJECT_NAME (queue));
|
|
|
|
item = NULL;
|
|
|
|
}
|
2010-06-15 14:12:02 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return item;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_item:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "the queue is empty");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_handle_sink_event (GstPad * pad, GstEvent * event)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_OBJECT_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "received flush start event");
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-23 18:25:29 +00:00
|
|
|
/* forward event */
|
|
|
|
gst_pad_push_event (queue->srcpad, event);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* now unblock the chain function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
2010-03-23 18:25:29 +00:00
|
|
|
/* unblock the loop and chain functions */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-03-23 18:25:29 +00:00
|
|
|
/* make sure it pauses, this should happen since we sent
|
|
|
|
* flush_start downstream. */
|
|
|
|
gst_pad_pause_task (queue->srcpad);
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "loop stopped");
|
2010-06-16 09:10:23 +00:00
|
|
|
} else {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
/* flush the sink pad */
|
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "received flush stop event");
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-23 18:25:29 +00:00
|
|
|
/* forward event */
|
|
|
|
gst_pad_push_event (queue->srcpad, event);
|
|
|
|
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
gst_queue2_locked_flush (queue);
|
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2010-03-23 18:25:29 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
|
|
|
/* reset rate counters */
|
|
|
|
reset_rate_timer (queue);
|
|
|
|
gst_pad_start_task (queue->srcpad, (GstTaskFunction) gst_queue2_loop,
|
|
|
|
queue->srcpad);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
} else {
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->segment_event_received = FALSE;
|
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2010-06-16 09:10:23 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2010-03-23 18:25:29 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2010-06-16 09:10:23 +00:00
|
|
|
|
|
|
|
gst_event_unref (event);
|
2010-03-23 18:25:29 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
if (GST_EVENT_IS_SERIALIZED (event)) {
|
|
|
|
/* serialized events go in the queue */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing);
|
2007-09-17 16:22:17 +00:00
|
|
|
/* refuse more events on EOS */
|
|
|
|
if (queue->is_eos)
|
|
|
|
goto out_eos;
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_locked_enqueue (queue, event);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
|
|
|
/* non-serialized events are passed upstream. */
|
|
|
|
gst_pad_push_event (queue->srcpad, event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2007-09-17 16:22:17 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "refusing event, we are flushing");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-09-17 16:22:17 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
out_eos:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "refusing event, we are EOS");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-09-17 16:22:17 +00:00
|
|
|
gst_event_unref (event);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_is_empty (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
/* never empty on EOS */
|
|
|
|
if (queue->is_eos)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue) && queue->current) {
|
2010-05-07 07:30:44 +00:00
|
|
|
return queue->current->writing_pos <= queue->current->max_reading_pos;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
} else {
|
|
|
|
if (queue->queue->length == 0)
|
|
|
|
return TRUE;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_is_filled (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
/* always filled on EOS */
|
|
|
|
if (queue->is_eos)
|
|
|
|
return TRUE;
|
|
|
|
|
2010-06-15 10:37:33 +00:00
|
|
|
#define CHECK_FILLED(format,alt_max) ((queue->max_level.format) > 0 && \
|
|
|
|
(queue->cur_level.format) >= ((alt_max) ? \
|
|
|
|
MIN ((queue->max_level.format), (alt_max)) : (queue->max_level.format)))
|
2010-06-06 07:30:48 +00:00
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
/* if using a ring buffer we're filled if all ring buffer space is used
|
|
|
|
* _by the current range_ */
|
2010-05-18 15:21:40 +00:00
|
|
|
if (QUEUE_IS_USING_RING_BUFFER (queue)) {
|
|
|
|
guint max_bytes = queue->max_level.bytes;
|
|
|
|
guint64 rb_size = queue->ring_buffer_max_size;
|
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"max bytes %u, rb size %" G_GUINT64_FORMAT ", cur bytes %u", max_bytes,
|
|
|
|
rb_size, queue->cur_level.bytes);
|
2010-06-06 07:30:48 +00:00
|
|
|
return CHECK_FILLED (bytes, rb_size);
|
2010-05-18 15:21:40 +00:00
|
|
|
}
|
2010-05-07 07:30:44 +00:00
|
|
|
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
/* if using file, we're never filled if we don't have EOS */
|
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue))
|
|
|
|
return FALSE;
|
|
|
|
|
2008-03-24 14:08:22 +00:00
|
|
|
/* we are never filled when we have no buffers at all */
|
|
|
|
if (queue->cur_level.buffers == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* we are filled if one of the current levels exceeds the max */
|
2010-06-06 07:30:48 +00:00
|
|
|
res = CHECK_FILLED (buffers, 0) || CHECK_FILLED (bytes, 0)
|
|
|
|
|| CHECK_FILLED (time, 0);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* if we need to, use the rate estimate to check against the max time we are
|
|
|
|
* allowed to queue */
|
|
|
|
if (queue->use_rate_estimate)
|
2010-06-06 07:30:48 +00:00
|
|
|
res |= CHECK_FILLED (rate_time, 0);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
#undef CHECK_FILLED
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_chain (GstPad * pad, GstBuffer * buffer)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_OBJECT_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"received buffer %p of size %d, time %" GST_TIME_FORMAT ", duration %"
|
|
|
|
GST_TIME_FORMAT, buffer, GST_BUFFER_SIZE (buffer),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)));
|
|
|
|
|
|
|
|
/* we have to lock the queue since we span threads */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->sinkresult, out_flushing);
|
2007-09-17 16:22:17 +00:00
|
|
|
/* when we received EOS, we refuse more data */
|
|
|
|
if (queue->is_eos)
|
|
|
|
goto out_eos;
|
|
|
|
/* when we received unexpected from downstream, refuse more buffers */
|
|
|
|
if (queue->unexpected)
|
|
|
|
goto out_unexpected;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2010-06-15 10:37:33 +00:00
|
|
|
if (!gst_queue2_wait_free_space (queue))
|
|
|
|
goto out_flushing;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* put buffer in queue now */
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_locked_enqueue (queue, buffer);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* special conditions */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2010-03-24 17:18:13 +00:00
|
|
|
GstFlowReturn ret = queue->sinkresult;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"exit because task paused, reason: %s", gst_flow_get_name (ret));
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2007-09-17 16:22:17 +00:00
|
|
|
out_eos:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-09-17 16:22:17 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
|
|
|
out_unexpected:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"exit because we received UNEXPECTED");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-09-17 16:22:17 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return GST_FLOW_UNEXPECTED;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dequeue an item from the queue an push it downstream. This functions returns
|
|
|
|
* the result of the push. */
|
|
|
|
static GstFlowReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_push_one (GstQueue2 * queue)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
|
|
|
GstMiniObject *data;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
data = gst_queue2_locked_dequeue (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (data == NULL)
|
|
|
|
goto no_item;
|
|
|
|
|
2007-09-17 16:22:17 +00:00
|
|
|
next:
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (GST_IS_BUFFER (data)) {
|
2007-10-15 11:38:39 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
buffer = GST_BUFFER_CAST (data);
|
|
|
|
caps = GST_BUFFER_CAPS (buffer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2007-10-15 11:38:39 +00:00
|
|
|
/* set caps before pushing the buffer so that core does not try to do
|
|
|
|
* something fancy to check if this is possible. */
|
|
|
|
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
|
|
|
gst_pad_set_caps (queue->srcpad, caps);
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
result = gst_pad_push (queue->srcpad, buffer);
|
|
|
|
|
|
|
|
/* need to check for srcresult here as well */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
2007-09-17 16:22:17 +00:00
|
|
|
if (result == GST_FLOW_UNEXPECTED) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"got UNEXPECTED from downstream");
|
|
|
|
/* stop pushing buffers, we dequeue all items until we see an item that we
|
|
|
|
* can push again, which is EOS or NEWSEGMENT. If there is nothing in the
|
|
|
|
* queue we can push, we set a flag to make the sinkpad refuse more
|
|
|
|
* buffers with an UNEXPECTED return value until we receive something
|
|
|
|
* pushable again or we get flushed. */
|
2009-10-29 10:30:11 +00:00
|
|
|
while ((data = gst_queue2_locked_dequeue (queue))) {
|
2007-09-17 16:22:17 +00:00
|
|
|
if (GST_IS_BUFFER (data)) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"dropping UNEXPECTED buffer %p", data);
|
|
|
|
gst_buffer_unref (GST_BUFFER_CAST (data));
|
|
|
|
} else if (GST_IS_EVENT (data)) {
|
|
|
|
GstEvent *event = GST_EVENT_CAST (data);
|
|
|
|
GstEventType type = GST_EVENT_TYPE (event);
|
|
|
|
|
|
|
|
if (type == GST_EVENT_EOS || type == GST_EVENT_NEWSEGMENT) {
|
|
|
|
/* we found a pushable item in the queue, push it out */
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
2007-09-21 14:37:26 +00:00
|
|
|
"pushing pushable event %s after UNEXPECTED",
|
2007-09-17 16:22:17 +00:00
|
|
|
GST_EVENT_TYPE_NAME (event));
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"dropping UNEXPECTED event %p", event);
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* no more items in the queue. Set the unexpected flag so that upstream
|
|
|
|
* make us refuse any more buffers on the sinkpad. Since we will still
|
|
|
|
* accept EOS and NEWSEGMENT we return _FLOW_OK to the caller so that the
|
|
|
|
* task function does not shut down. */
|
|
|
|
queue->unexpected = TRUE;
|
|
|
|
result = GST_FLOW_OK;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else if (GST_IS_EVENT (data)) {
|
|
|
|
GstEvent *event = GST_EVENT_CAST (data);
|
|
|
|
GstEventType type = GST_EVENT_TYPE (event);
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
gst_pad_push_event (queue->srcpad, event);
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* if we're EOS, return UNEXPECTED so that the task pauses. */
|
2007-09-17 16:22:17 +00:00
|
|
|
if (type == GST_EVENT_EOS) {
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"pushed EOS event %p, return UNEXPECTED", event);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
result = GST_FLOW_UNEXPECTED;
|
2007-09-17 16:22:17 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_item:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"exit because we have no item in the queue");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
out_flushing:
|
|
|
|
{
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we are flushing");
|
|
|
|
return GST_FLOW_WRONG_STATE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* called repeadedly with @pad as the source pad. This function should push out
|
|
|
|
* data to the peer element. */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_loop (GstPad * pad)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* have to lock for thread-safety */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
if (gst_queue2_is_empty (queue)) {
|
2007-12-14 18:46:12 +00:00
|
|
|
gboolean started;
|
|
|
|
|
|
|
|
/* pause the timer while we wait. The fact that we are waiting does not mean
|
|
|
|
* the byterate on the output pad is lower */
|
|
|
|
if ((started = queue->out_timer_started))
|
|
|
|
g_timer_stop (queue->out_timer);
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue,
|
|
|
|
"queue is empty, waiting for new data");
|
|
|
|
do {
|
|
|
|
/* Wait for data to be available, we could be unlocked because of a flush. */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_WAIT_ADD_CHECK (queue, queue->srcresult, out_flushing);
|
2007-12-14 18:46:12 +00:00
|
|
|
}
|
2009-10-29 10:30:11 +00:00
|
|
|
while (gst_queue2_is_empty (queue));
|
2007-12-14 18:46:12 +00:00
|
|
|
|
|
|
|
/* and continue if we were running before */
|
|
|
|
if (started)
|
|
|
|
g_timer_continue (queue->out_timer);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
2009-10-29 10:30:11 +00:00
|
|
|
ret = gst_queue2_push_one (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = ret;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = ret;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto out_flushing;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2009-08-06 10:18:36 +00:00
|
|
|
gboolean eos = queue->is_eos;
|
|
|
|
GstFlowReturn ret = queue->srcresult;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
gst_pad_pause_task (queue->srcpad);
|
|
|
|
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
|
|
|
|
"pause task, reason: %s", gst_flow_get_name (queue->srcresult));
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2009-08-06 10:18:36 +00:00
|
|
|
/* let app know about us giving up if upstream is not expected to do so */
|
|
|
|
/* UNEXPECTED is already taken care of elsewhere */
|
|
|
|
if (eos && (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) &&
|
|
|
|
(ret != GST_FLOW_UNEXPECTED)) {
|
|
|
|
GST_ELEMENT_ERROR (queue, STREAM, FAILED,
|
|
|
|
(_("Internal data flow error.")),
|
|
|
|
("streaming task paused, reason %s (%d)",
|
|
|
|
gst_flow_get_name (ret), ret));
|
|
|
|
gst_pad_push_event (queue->srcpad, gst_event_new_eos ());
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_handle_src_event (GstPad * pad, GstEvent * event)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "got event %p (%s)",
|
|
|
|
event, GST_EVENT_TYPE_NAME (event));
|
|
|
|
#endif
|
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_FLUSH_START:
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-24 17:18:13 +00:00
|
|
|
/* just forward upstream */
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
} else {
|
|
|
|
/* now unblock the getrange function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
GST_DEBUG_OBJECT (queue, "flushing");
|
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* when using a temp file, we eat the event */
|
|
|
|
res = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2010-03-24 17:18:13 +00:00
|
|
|
/* just forward upstream */
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
} else {
|
|
|
|
/* now unblock the getrange function */
|
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-06-16 14:13:28 +00:00
|
|
|
if (queue->current) {
|
|
|
|
/* forget the highest read offset, we'll calculate a new one when we
|
|
|
|
* get the next getrange request. We need to do this in order to reset
|
|
|
|
* the buffering percentage */
|
2010-03-25 16:21:02 +00:00
|
|
|
queue->current->max_reading_pos = 0;
|
2010-06-16 14:13:28 +00:00
|
|
|
}
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* when using a temp file, we eat the event */
|
|
|
|
res = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = gst_pad_push_event (queue->sinkpad, event);
|
|
|
|
break;
|
2008-04-02 11:08:05 +00:00
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_peer_query (GstQueue2 * queue, GstPad * pad, GstQuery * query)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2007-06-11 11:32:26 +00:00
|
|
|
gboolean ret = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstPad *peer;
|
|
|
|
|
2007-06-11 11:32:26 +00:00
|
|
|
if ((peer = gst_pad_get_peer (pad))) {
|
|
|
|
ret = gst_pad_query (peer, query);
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2007-06-11 11:32:26 +00:00
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_handle_src_query (GstPad * pad, GstQuery * query)
|
2007-06-11 11:32:26 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-11 11:32:26 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (GST_PAD_PARENT (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
{
|
|
|
|
gint64 peer_pos;
|
|
|
|
GstFormat format;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
if (!gst_queue2_peer_query (queue, queue->sinkpad, query))
|
2007-06-11 11:32:26 +00:00
|
|
|
goto peer_failed;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* get peer position */
|
|
|
|
gst_query_parse_position (query, &format, &peer_pos);
|
|
|
|
|
|
|
|
/* FIXME: this code assumes that there's no discont in the queue */
|
|
|
|
switch (format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
peer_pos -= queue->cur_level.bytes;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
peer_pos -= queue->cur_level.time;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (queue, "dropping query in %s format, don't "
|
|
|
|
"know how to adjust value", gst_format_get_name (format));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
/* set updated position */
|
|
|
|
gst_query_set_position (query, format, peer_pos);
|
|
|
|
break;
|
|
|
|
}
|
2007-06-11 11:32:26 +00:00
|
|
|
case GST_QUERY_DURATION:
|
|
|
|
{
|
2008-04-02 11:08:05 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "doing peer query");
|
2007-06-11 11:32:26 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
if (!gst_queue2_peer_query (queue, queue->sinkpad, query))
|
2007-06-11 11:32:26 +00:00
|
|
|
goto peer_failed;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "peer query success");
|
|
|
|
break;
|
|
|
|
}
|
2008-04-09 21:40:17 +00:00
|
|
|
case GST_QUERY_BUFFERING:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (queue, "query buffering");
|
|
|
|
|
2010-05-26 02:11:48 +00:00
|
|
|
/* FIXME - is this condition correct? what should ring buffer do? */
|
2010-06-15 14:12:02 +00:00
|
|
|
if (QUEUE_IS_USING_QUEUE (queue)) {
|
2008-04-09 21:40:17 +00:00
|
|
|
/* no temp file, just forward to the peer */
|
2009-10-29 10:30:11 +00:00
|
|
|
if (!gst_queue2_peer_query (queue, queue->sinkpad, query))
|
2008-04-09 21:40:17 +00:00
|
|
|
goto peer_failed;
|
|
|
|
GST_DEBUG_OBJECT (queue, "buffering forwarded to peer");
|
|
|
|
} else {
|
|
|
|
gint64 start, stop;
|
2010-03-23 18:25:29 +00:00
|
|
|
guint64 writing_pos;
|
2010-03-25 16:36:45 +00:00
|
|
|
gint percent;
|
2010-03-24 18:02:12 +00:00
|
|
|
gint64 estimated_total, buffering_left;
|
|
|
|
GstFormat peer_fmt;
|
|
|
|
gint64 duration;
|
2010-04-09 10:35:47 +00:00
|
|
|
gboolean peer_res, is_buffering, is_eos;
|
2010-03-24 18:02:12 +00:00
|
|
|
gdouble byte_in_rate, byte_out_rate;
|
|
|
|
|
|
|
|
/* we need a current download region */
|
|
|
|
if (queue->current == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
writing_pos = queue->current->writing_pos;
|
|
|
|
byte_in_rate = queue->byte_in_rate;
|
|
|
|
byte_out_rate = queue->byte_out_rate;
|
|
|
|
is_buffering = queue->is_buffering;
|
2010-04-09 10:35:47 +00:00
|
|
|
is_eos = queue->is_eos;
|
2010-03-25 16:36:45 +00:00
|
|
|
percent = queue->buffering_percent;
|
2010-03-24 18:02:12 +00:00
|
|
|
|
2010-04-09 10:35:47 +00:00
|
|
|
if (is_eos) {
|
|
|
|
/* we're EOS, we know the duration in bytes now */
|
|
|
|
peer_res = TRUE;
|
|
|
|
duration = writing_pos;
|
|
|
|
} else {
|
|
|
|
/* get duration of upstream in bytes */
|
|
|
|
peer_fmt = GST_FORMAT_BYTES;
|
|
|
|
peer_res = gst_pad_query_peer_duration (queue->sinkpad, &peer_fmt,
|
|
|
|
&duration);
|
|
|
|
}
|
2010-03-24 18:02:12 +00:00
|
|
|
|
|
|
|
/* calculate remaining and total download time */
|
|
|
|
if (peer_res && byte_in_rate > 0.0) {
|
|
|
|
estimated_total = (duration * 1000) / byte_in_rate;
|
|
|
|
buffering_left = ((duration - writing_pos) * 1000) / byte_in_rate;
|
|
|
|
} else {
|
|
|
|
estimated_total = -1;
|
|
|
|
buffering_left = -1;
|
|
|
|
}
|
2010-04-09 13:19:12 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "estimated %" G_GINT64_FORMAT ", left %"
|
|
|
|
G_GINT64_FORMAT, estimated_total, buffering_left);
|
2008-04-09 21:40:17 +00:00
|
|
|
|
|
|
|
gst_query_parse_buffering_range (query, &format, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
switch (format) {
|
|
|
|
case GST_FORMAT_PERCENT:
|
2010-03-24 18:02:12 +00:00
|
|
|
/* we need duration */
|
|
|
|
if (!peer_res)
|
2008-04-09 21:40:17 +00:00
|
|
|
goto peer_failed;
|
|
|
|
|
2010-05-07 07:30:44 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"duration %" G_GINT64_FORMAT ", writing %" G_GINT64_FORMAT,
|
|
|
|
duration, writing_pos);
|
2008-04-09 21:40:17 +00:00
|
|
|
|
|
|
|
start = 0;
|
|
|
|
/* get our available data relative to the duration */
|
|
|
|
if (duration != -1)
|
2010-03-23 18:25:29 +00:00
|
|
|
stop = GST_FORMAT_PERCENT_MAX * writing_pos / duration;
|
2008-04-09 21:40:17 +00:00
|
|
|
else
|
|
|
|
stop = -1;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
start = 0;
|
2010-03-24 18:02:12 +00:00
|
|
|
stop = writing_pos;
|
2008-04-09 21:40:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
start = -1;
|
|
|
|
stop = -1;
|
|
|
|
break;
|
|
|
|
}
|
2010-03-25 16:36:45 +00:00
|
|
|
gst_query_set_buffering_percent (query, is_buffering, percent);
|
2010-03-24 18:02:12 +00:00
|
|
|
gst_query_set_buffering_range (query, format, start, stop,
|
|
|
|
estimated_total);
|
|
|
|
gst_query_set_buffering_stats (query, GST_BUFFERING_DOWNLOAD,
|
|
|
|
byte_in_rate, byte_out_rate, buffering_left);
|
2008-04-09 21:40:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
/* peer handled other queries */
|
2009-10-29 10:30:11 +00:00
|
|
|
if (!gst_queue2_peer_query (queue, queue->sinkpad, query))
|
2007-06-11 11:32:26 +00:00
|
|
|
goto peer_failed;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2007-06-11 11:32:26 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
peer_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (queue, "failed peer query");
|
|
|
|
return FALSE;
|
|
|
|
}
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-03-25 17:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gst_queue2_handle_query (GstElement * element, GstQuery * query)
|
|
|
|
{
|
|
|
|
/* simply forward to the srcpad query function */
|
|
|
|
return gst_queue2_handle_src_query (GST_QUEUE2_CAST (element)->srcpad, query);
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
static GstFlowReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_get_range (GstPad * pad, guint64 offset, guint length,
|
2007-06-06 13:36:26 +00:00
|
|
|
GstBuffer ** buffer)
|
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-06 13:36:26 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2_CAST (gst_pad_get_parent (pad));
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing);
|
2007-06-06 13:36:26 +00:00
|
|
|
length = (length == -1) ? DEFAULT_BUFFER_SIZE : length;
|
2010-06-16 09:11:32 +00:00
|
|
|
offset = (offset == -1) ? queue->current->reading_pos : offset;
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2010-05-19 14:04:15 +00:00
|
|
|
GST_DEBUG_OBJECT (queue,
|
|
|
|
"Getting range: offset %" G_GUINT64_FORMAT ", length %u", offset, length);
|
2010-05-07 07:30:44 +00:00
|
|
|
/* FIXME - function will block when the range is not yet available */
|
2009-10-29 10:30:11 +00:00
|
|
|
ret = gst_queue2_create_read (queue, offset, length, buffer);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
|
|
|
|
gst_object_unref (queue);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
out_flushing:
|
|
|
|
{
|
2010-03-24 17:18:13 +00:00
|
|
|
ret = queue->srcresult;
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "we are flushing");
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2010-03-24 17:18:13 +00:00
|
|
|
return ret;
|
2007-06-06 13:36:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_src_checkgetrange_function (GstPad * pad)
|
2007-06-06 13:36:26 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-06 13:36:26 +00:00
|
|
|
gboolean ret;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
|
2008-04-09 21:40:17 +00:00
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* we can operate in pull mode when we are using a tempfile */
|
2010-06-15 14:12:02 +00:00
|
|
|
ret = !QUEUE_IS_USING_QUEUE (queue);
|
2008-04-09 21:40:17 +00:00
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
gst_object_unref (GST_OBJECT (queue));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sink currently only operates in push mode */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_sink_activate_push (GstPad * pad, gboolean active)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean result = TRUE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
if (active) {
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "activating push mode");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2007-09-17 16:22:17 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
reset_rate_timer (queue);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
|
|
|
/* unblock chain function */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "deactivating push mode");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_locked_flush (queue);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (queue);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* src operating in push mode, we start a task on the source pad that pushes out
|
|
|
|
* buffers from the queue */
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_src_activate_push (GstPad * pad, gboolean active)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
|
|
|
gboolean result = FALSE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
if (active) {
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "activating push mode");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2007-09-17 16:22:17 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2009-10-29 10:30:11 +00:00
|
|
|
result = gst_pad_start_task (pad, (GstTaskFunction) gst_queue2_loop, pad);
|
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
} else {
|
|
|
|
/* unblock loop function */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "deactivating push mode");
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
/* the item add signal will unblock */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* step 2, make sure streaming finishes */
|
|
|
|
result = gst_pad_stop_task (pad);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (queue);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2007-06-06 13:36:26 +00:00
|
|
|
/* pull mode, downstream will call our getrange function */
|
|
|
|
static gboolean
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_src_activate_pull (GstPad * pad, gboolean active)
|
2007-06-06 13:36:26 +00:00
|
|
|
{
|
|
|
|
gboolean result;
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
2007-06-06 13:36:26 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
|
2007-06-06 13:36:26 +00:00
|
|
|
|
|
|
|
if (active) {
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
/* open the temp file now */
|
|
|
|
result = gst_queue2_open_temp_location_file (queue);
|
|
|
|
} else if (!queue->ring_buffer) {
|
|
|
|
queue->ring_buffer = malloc (queue->ring_buffer_max_size);
|
2010-06-28 15:50:06 +00:00
|
|
|
result = ! !queue->ring_buffer;
|
2010-06-18 15:43:40 +00:00
|
|
|
}
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "activating pull mode");
|
2010-06-28 15:50:06 +00:00
|
|
|
init_ranges (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
queue->srcresult = GST_FLOW_OK;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_OK;
|
2007-09-17 16:22:17 +00:00
|
|
|
queue->is_eos = FALSE;
|
|
|
|
queue->unexpected = FALSE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
} else {
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "no temp file, cannot activate pull mode");
|
|
|
|
/* this is not allowed, we cannot operate in pull mode without a temp
|
|
|
|
* file. */
|
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
2007-06-06 13:36:26 +00:00
|
|
|
result = FALSE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
}
|
|
|
|
} else {
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
GST_DEBUG_OBJECT (queue, "deactivating pull mode");
|
|
|
|
queue->srcresult = GST_FLOW_WRONG_STATE;
|
2010-03-24 17:18:13 +00:00
|
|
|
queue->sinkresult = GST_FLOW_WRONG_STATE;
|
2007-06-06 13:36:26 +00:00
|
|
|
/* this will unlock getrange */
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
result = TRUE;
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
2007-06-06 13:36:26 +00:00
|
|
|
}
|
|
|
|
gst_object_unref (queue);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static GstStateChangeReturn
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_change_state (GstElement * element, GstStateChange transition)
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
queue = GST_QUEUE2 (element);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2010-06-15 14:12:02 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
2010-06-18 15:43:40 +00:00
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
if (!gst_queue2_open_temp_location_file (queue))
|
|
|
|
ret = GST_STATE_CHANGE_FAILURE;
|
|
|
|
} else {
|
|
|
|
if (queue->ring_buffer) {
|
|
|
|
free (queue->ring_buffer);
|
|
|
|
queue->ring_buffer = NULL;
|
|
|
|
}
|
|
|
|
if (!(queue->ring_buffer = malloc (queue->ring_buffer_max_size)))
|
|
|
|
ret = GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
|
|
|
init_ranges (queue);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
}
|
|
|
|
queue->segment_event_received = FALSE;
|
|
|
|
queue->starting_segment = NULL;
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-06-13 14:31:21 +00:00
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
2010-06-13 14:31:21 +00:00
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
2010-06-18 15:43:40 +00:00
|
|
|
if (!QUEUE_IS_USING_QUEUE (queue)) {
|
|
|
|
if (QUEUE_IS_USING_TEMP_FILE (queue)) {
|
|
|
|
gst_queue2_close_temp_location_file (queue);
|
|
|
|
} else if (queue->ring_buffer) {
|
|
|
|
free (queue->ring_buffer);
|
|
|
|
queue->ring_buffer = NULL;
|
|
|
|
}
|
|
|
|
}
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
if (queue->starting_segment != NULL) {
|
|
|
|
gst_event_unref (queue->starting_segment);
|
|
|
|
queue->starting_segment = NULL;
|
|
|
|
}
|
2010-07-05 11:43:05 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* changing the capacity of the queue must wake up
|
|
|
|
* the _chain function, it might have more room now
|
|
|
|
* to store the buffer/event in the queue */
|
|
|
|
#define QUEUE_CAPACITY_CHANGE(q)\
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_DEL (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* Changing the minimum required fill level must
|
|
|
|
* wake up the _loop function as it might now
|
|
|
|
* be able to preceed.
|
|
|
|
*/
|
|
|
|
#define QUEUE_THRESHOLD_CHANGE(q)\
|
2010-03-24 17:18:13 +00:00
|
|
|
GST_QUEUE2_SIGNAL_ADD (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2008-06-24 16:22:45 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_set_temp_template (GstQueue2 * queue, const gchar * template)
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
{
|
|
|
|
GstState state;
|
|
|
|
|
|
|
|
/* the element must be stopped in order to do this */
|
|
|
|
GST_OBJECT_LOCK (queue);
|
|
|
|
state = GST_STATE (queue);
|
|
|
|
if (state != GST_STATE_READY && state != GST_STATE_NULL)
|
|
|
|
goto wrong_state;
|
|
|
|
GST_OBJECT_UNLOCK (queue);
|
|
|
|
|
|
|
|
/* set new location */
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (queue->temp_template);
|
|
|
|
queue->temp_template = g_strdup (template);
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
2008-06-24 16:22:45 +00:00
|
|
|
return;
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
|
|
|
|
/* ERROR */
|
|
|
|
wrong_state:
|
|
|
|
{
|
2009-07-10 18:49:46 +00:00
|
|
|
GST_WARNING_OBJECT (queue, "setting temp-template property in wrong state");
|
gst/playback/gstqueue2.c: Add support for filebased buffering. Fixes #441264.
Original commit message from CVS:
Based on patch by: Thiago Sousa Santos <thiagossantos at gmail dot com>
* gst/playback/gstqueue2.c: (gst_queue_class_init),
(gst_queue_init), (gst_queue_finalize),
(gst_queue_write_buffer_to_file), (gst_queue_have_data),
(gst_queue_create_read), (gst_queue_read_item_from_file),
(gst_queue_open_temp_location_file),
(gst_queue_close_temp_location_file), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_is_empty), (gst_queue_is_filled),
(gst_queue_change_state), (gst_queue_set_temp_location),
(gst_queue_set_property):
Add support for filebased buffering. Fixes #441264.
2007-06-05 16:14:23 +00:00
|
|
|
GST_OBJECT_UNLOCK (queue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_set_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
/* someone could change levels here, and since this
|
|
|
|
* affects the get/put funcs, we need to lock for safety. */
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_MAX_SIZE_BYTES:
|
|
|
|
queue->max_level.bytes = g_value_get_uint (value);
|
|
|
|
QUEUE_CAPACITY_CHANGE (queue);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_BUFFERS:
|
|
|
|
queue->max_level.buffers = g_value_get_uint (value);
|
|
|
|
QUEUE_CAPACITY_CHANGE (queue);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_TIME:
|
|
|
|
queue->max_level.time = g_value_get_uint64 (value);
|
|
|
|
/* set rate_time to the same value. We use an extra field in the level
|
|
|
|
* structure so that we can easily access and compare it */
|
|
|
|
queue->max_level.rate_time = queue->max_level.time;
|
|
|
|
QUEUE_CAPACITY_CHANGE (queue);
|
|
|
|
break;
|
|
|
|
case PROP_USE_BUFFERING:
|
|
|
|
queue->use_buffering = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_USE_RATE_ESTIMATE:
|
|
|
|
queue->use_rate_estimate = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case PROP_LOW_PERCENT:
|
|
|
|
queue->low_percent = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case PROP_HIGH_PERCENT:
|
|
|
|
queue->high_percent = g_value_get_int (value);
|
|
|
|
break;
|
2009-07-10 18:49:46 +00:00
|
|
|
case PROP_TEMP_TEMPLATE:
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_set_temp_template (queue, g_value_get_string (value));
|
2009-07-10 18:49:46 +00:00
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
case PROP_TEMP_LOCATION:
|
2009-07-10 18:49:46 +00:00
|
|
|
g_free (queue->temp_location);
|
|
|
|
queue->temp_location = g_value_dup_string (value);
|
|
|
|
/* you can set the property back to NULL to make it use the temp-tmpl
|
|
|
|
* property. */
|
|
|
|
queue->temp_location_set = queue->temp_location != NULL;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
break;
|
2010-01-22 16:55:39 +00:00
|
|
|
case PROP_TEMP_REMOVE:
|
|
|
|
queue->temp_remove = g_value_get_boolean (value);
|
|
|
|
break;
|
2010-05-05 08:21:55 +00:00
|
|
|
case PROP_RING_BUFFER_MAX_SIZE:
|
2010-06-16 10:24:25 +00:00
|
|
|
queue->ring_buffer_max_size = g_value_get_uint64 (value);
|
2010-06-28 15:50:06 +00:00
|
|
|
queue->use_ring_buffer = ! !queue->ring_buffer_max_size;
|
2010-05-05 08:21:55 +00:00
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-10-29 10:30:11 +00:00
|
|
|
gst_queue2_get_property (GObject * object,
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2009-10-29 10:30:11 +00:00
|
|
|
GstQueue2 *queue = GST_QUEUE2 (object);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_LOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_CUR_LEVEL_BYTES:
|
|
|
|
g_value_set_uint (value, queue->cur_level.bytes);
|
|
|
|
break;
|
|
|
|
case PROP_CUR_LEVEL_BUFFERS:
|
|
|
|
g_value_set_uint (value, queue->cur_level.buffers);
|
|
|
|
break;
|
|
|
|
case PROP_CUR_LEVEL_TIME:
|
|
|
|
g_value_set_uint64 (value, queue->cur_level.time);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_BYTES:
|
|
|
|
g_value_set_uint (value, queue->max_level.bytes);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_BUFFERS:
|
|
|
|
g_value_set_uint (value, queue->max_level.buffers);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_SIZE_TIME:
|
|
|
|
g_value_set_uint64 (value, queue->max_level.time);
|
|
|
|
break;
|
|
|
|
case PROP_USE_BUFFERING:
|
|
|
|
g_value_set_boolean (value, queue->use_buffering);
|
|
|
|
break;
|
|
|
|
case PROP_USE_RATE_ESTIMATE:
|
|
|
|
g_value_set_boolean (value, queue->use_rate_estimate);
|
|
|
|
break;
|
|
|
|
case PROP_LOW_PERCENT:
|
|
|
|
g_value_set_int (value, queue->low_percent);
|
|
|
|
break;
|
|
|
|
case PROP_HIGH_PERCENT:
|
|
|
|
g_value_set_int (value, queue->high_percent);
|
|
|
|
break;
|
2009-07-10 18:49:46 +00:00
|
|
|
case PROP_TEMP_TEMPLATE:
|
|
|
|
g_value_set_string (value, queue->temp_template);
|
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
case PROP_TEMP_LOCATION:
|
|
|
|
g_value_set_string (value, queue->temp_location);
|
|
|
|
break;
|
2010-01-22 16:55:39 +00:00
|
|
|
case PROP_TEMP_REMOVE:
|
|
|
|
g_value_set_boolean (value, queue->temp_remove);
|
|
|
|
break;
|
2010-05-05 08:21:55 +00:00
|
|
|
case PROP_RING_BUFFER_MAX_SIZE:
|
2010-06-16 10:24:25 +00:00
|
|
|
g_value_set_uint64 (value, queue->ring_buffer_max_size);
|
2010-05-05 08:21:55 +00:00
|
|
|
break;
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-10-29 10:30:11 +00:00
|
|
|
GST_QUEUE2_MUTEX_UNLOCK (queue);
|
gst/playback/: On our way to playbin2 this is the new network queue that does buffering all by itself using high and ...
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstqueue2.c: (gst_queue_get_type),
(gst_queue_class_init), (gst_queue_init), (gst_queue_finalize),
(gst_queue_getcaps), (gst_queue_bufferalloc),
(gst_queue_acceptcaps), (update_time_level), (apply_segment),
(apply_buffer), (update_buffering), (reset_rate_timer),
(update_rates), (gst_queue_locked_flush),
(gst_queue_locked_enqueue), (gst_queue_locked_dequeue),
(gst_queue_handle_sink_event), (gst_queue_is_empty),
(gst_queue_is_filled), (gst_queue_chain), (gst_queue_push_one),
(gst_queue_loop), (gst_queue_handle_src_event),
(gst_queue_handle_src_query), (gst_queue_sink_activate_push),
(gst_queue_src_activate_push), (gst_queue_change_state),
(gst_queue_set_property), (gst_queue_get_property), (plugin_init):
On our way to playbin2 this is the new network queue that does buffering
all by itself using high and low watermarks. It can also measure up and
downstream bandwidth to optimally size the queue.
2007-05-17 11:57:44 +00:00
|
|
|
}
|