...
 
Commits (20)
  • Wim Taymans's avatar
    Various plugin updates to have something to play with. · a38477f1
    Wim Taymans authored
    Original commit message from CVS:
    Various plugin updates to have something to play with.
    a38477f1
  • Wim Taymans's avatar
    Added new dir · b55e609d
    Wim Taymans authored
    Original commit message from CVS:
    Added new dir
    b55e609d
  • Wim Taymans's avatar
    Various plugin updates. · a5207892
    Wim Taymans authored
    Original commit message from CVS:
    Various plugin updates.
    a5207892
  • Wim Taymans's avatar
    Ogg demuxer updates, uses decoder plugin internally to convert granulepos to timestamps. · 962b47c7
    Wim Taymans authored
    Original commit message from CVS:
    Ogg demuxer updates, uses decoder plugin internally to convert
    granulepos to timestamps.
    Various other plugin updates.
    962b47c7
  • Wim Taymans's avatar
    First attempt at seeking in ogg vorbis. · c678ed93
    Wim Taymans authored
    Original commit message from CVS:
    First attempt at seeking in ogg vorbis.
    Fix some plugins with new DISCONT values.
    c678ed93
  • Wim Taymans's avatar
    Implement flushing. · dc7434a4
    Wim Taymans authored
    Original commit message from CVS:
    * examples/seeking/seek.c: (dynamic_link), (make_vorbis_pipeline),
    (make_theora_pipeline), (do_seek), (start_seek), (stop_seek):
    * ext/ogg/gstoggdemux.c: (gst_ogg_pad_get_type),
    (gst_ogg_pad_init), (gst_ogg_pad_src_query), (gst_ogg_pad_event),
    (gst_ogg_demux_factory_filter), (compare_ranks),
    (gst_ogg_pad_internal_chain), (gst_ogg_pad_typefind),
    (gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
    (gst_ogg_chain_new), (gst_ogg_chain_free),
    (gst_ogg_chain_new_stream), (gst_ogg_chain_get_stream),
    (gst_ogg_chain_has_stream), (gst_ogg_demux_base_init),
    (gst_ogg_demux_init), (gst_ogg_demux_submit_buffer),
    (gst_ogg_demux_seek), (gst_ogg_demux_get_data),
    (gst_ogg_demux_get_next_page), (gst_ogg_demux_get_prev_page),
    (gst_ogg_demux_perform_seek),
    (gst_ogg_demux_bisect_forward_serialno),
    (gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
    (gst_ogg_demux_find_pad), (gst_ogg_demux_find_chains),
    (gst_ogg_demux_chain_unlocked), (gst_ogg_demux_chain),
    (gst_ogg_demux_loop), (gst_ogg_demux_sink_activate),
    (gst_ogg_print):
    * sys/xvimage/xvimagesink.c: (gst_xvimagesink_sink_link),
    (gst_xvimagesink_event), (gst_xvimagesink_show_frame),
    (gst_xvimagesink_finish_preroll), (gst_xvimagesink_chain),
    (gst_xvimagesink_buffer_alloc):
    * sys/xvimage/xvimagesink.h:
    Implement flushing.
    Improved seeking in ogg.
    dc7434a4
  • Thomas Vander Stichele's avatar
    fix possible segfault · c1e8ac52
    Thomas Vander Stichele authored
    Original commit message from CVS:
    fix possible segfault
    c1e8ac52
  • Wim Taymans's avatar
    Ogg fixes. xvimagesink clock unscheduling for faster state changes. · 84a221c3
    Wim Taymans authored
    Original commit message from CVS:
    Ogg fixes.
    xvimagesink clock unscheduling for faster state changes.
    Small updates for plugins that use GstTask.
    84a221c3
  • Wim Taymans's avatar
    Handle EOS in oggdemux. Activate chains on BOS pages. · b2f0739d
    Wim Taymans authored
    Original commit message from CVS:
    * examples/seeking/seek.c: (dynamic_link), (make_vorbis_pipeline),
    (make_theora_pipeline), (do_seek), (start_seek), (stop_seek):
    * ext/ogg/gstoggdemux.c: (gst_ogg_pad_get_type),
    (gst_ogg_pad_class_init), (gst_ogg_pad_init),
    (gst_ogg_pad_dispose), (gst_ogg_pad_finalize),
    (gst_ogg_pad_getcaps), (gst_ogg_pad_src_query),
    (gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
    (compare_ranks), (gst_ogg_pad_internal_chain),
    (gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
    (gst_ogg_pad_submit_page), (gst_ogg_chain_new),
    (gst_ogg_chain_free), (gst_ogg_chain_new_stream),
    (gst_ogg_chain_get_stream), (gst_ogg_chain_has_stream),
    (gst_ogg_demux_base_init), (gst_ogg_demux_init),
    (gst_ogg_demux_finalize), (gst_ogg_demux_submit_buffer),
    (gst_ogg_demux_seek), (gst_ogg_demux_get_data),
    (gst_ogg_demux_get_next_page), (gst_ogg_demux_get_prev_page),
    (gst_ogg_demux_deactivate_current_chain),
    (gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
    (gst_ogg_demux_bisect_forward_serialno),
    (gst_ogg_demux_read_chain), (gst_ogg_demux_read_end_chain),
    (gst_ogg_demux_find_pad), (gst_ogg_demux_find_chain),
    (gst_ogg_demux_find_chains), (gst_ogg_demux_chain_unlocked),
    (gst_ogg_demux_chain), (gst_ogg_demux_send_eos),
    (gst_ogg_demux_loop), (gst_ogg_demux_sink_activate),
    (gst_ogg_print):
    * sys/xvimage/xvimagesink.c: (gst_xvimagesink_sink_link),
    (gst_xvimagesink_change_state), (gst_xvimagesink_event),
    (gst_xvimagesink_show_frame), (gst_xvimagesink_finish_preroll),
    (gst_xvimagesink_chain), (gst_xvimagesink_buffer_alloc),
    (gst_xvimagesink_init):
    * sys/xvimage/xvimagesink.h:
    Handle EOS in oggdemux. Activate chains on BOS pages.
    Do not wait for preroll when xvimagesink is in EOS.
    b2f0739d
  • Wim Taymans's avatar
    Fix osssink state changes. · dd227ff4
    Wim Taymans authored
    Original commit message from CVS:
    Fix osssink state changes.
    Reset the ogg stream when seeking.
    dd227ff4
  • Wim Taymans's avatar
    Clock fixes. · c94e7a02
    Wim Taymans authored
    Original commit message from CVS:
    Clock fixes.
    Added seeking in theora/vorbis ogg files.
    Make playbin compile.
    c94e7a02
  • Wim Taymans's avatar
    No more bytestream. · 31a54928
    Wim Taymans authored
    Original commit message from CVS:
    No more bytestream.
    31a54928
  • Wim Taymans's avatar
    Some small fixes. · 077734c2
    Wim Taymans authored
    Original commit message from CVS:
    Some small fixes.
    077734c2
  • Wim Taymans's avatar
    Fix the demuxer again. · dc2d9945
    Wim Taymans authored
    Original commit message from CVS:
    Fix the demuxer again.
    dc2d9945
  • Ronald S. Bultje's avatar
    gst/playback/NOTE: Add note on autoplugging in 0.9 (basically duplicate of... · 684882f7
    Ronald S. Bultje authored
    gst/playback/NOTE: Add note on autoplugging in 0.9 (basically duplicate of Dave´s 0.9-suggested-changes, but in a se...
    
    Original commit message from CVS:
    * gst/playback/NOTE:
    Add note on autoplugging in 0.9 (basically duplicate of Dave´s
    0.9-suggested-changes, but in a separate document so people
    specifically looking at porting decodebin don´t miss it).
    684882f7
  • Ronald S. Bultje's avatar
    ext/gnomevfs/: Disable gnomevfssink for now, make gnomevfssrc work. · dd27dfd5
    Ronald S. Bultje authored
    Original commit message from CVS:
    * ext/gnomevfs/Makefile.am:
    * ext/gnomevfs/gstgnomevfs.c: (plugin_init):
    * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnomevfssrc_base_init),
    (gst_gnomevfssrc_class_init), (gst_gnomevfssrc_init),
    (gst_gnomevfssrc_get_property), (gst_gnomevfssrc_get),
    (gst_gnomevfssrc_open_file), (gst_gnomevfssrc_close_file),
    (gst_gnomevfssrc_getrange), (gst_gnomevfssrc_loop),
    (gst_gnomevfssrc_activate), (gst_gnomevfssrc_change_state),
    (gst_gnomevfssrc_srcpad_query), (gst_gnomevfssrc_srcpad_event):
    Disable gnomevfssink for now, make gnomevfssrc work.
    dd27dfd5
  • Ronald S. Bultje's avatar
    examples/seeking/seek.c: Add AVI pipeline. · 4649822e
    Ronald S. Bultje authored
    Original commit message from CVS:
    * examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline):
    Add AVI pipeline.
    * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
    (gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
    (gst_riff_create_video_template_caps),
    (gst_riff_create_audio_template_caps),
    (gst_riff_create_iavs_template_caps):
    * gst-libs/gst/riff/riff-media.h:
    Remove obsolete non-data functions, make data functions the
    default.
    * gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk),
    (gst_riff_parse_chunk), (gst_riff_parse_file_header),
    (gst_riff_parse_strh), (gst_riff_parse_strf_vids),
    (gst_riff_parse_strf_auds), (gst_riff_parse_strf_iavs),
    (gst_riff_parse_info):
    * gst-libs/gst/riff/riff-read.h:
    * gst-libs/gst/riff/riff.c: (plugin_init):
    Change from bytestream-wrapping to pure RIFF parsing (can be used
    chain-based if someone would want that). Add gtk-doc comments.
    * gst/avi/Makefile.am:
    * gst/avi/gstavi.c: (plugin_init):
    Disable mux for now.
    * gst/avi/gstavidemux.c: (gst_avi_demux_get_type),
    (gst_avi_demux_class_init), (gst_avi_demux_init),
    (gst_avi_demux_reset), (gst_avi_demux_src_convert),
    (gst_avi_demux_handle_src_query), (gst_avi_demux_handle_src_event),
    (gst_avi_demux_parse_file_header), (gst_avi_demux_stream_init),
    (gst_avi_demux_parse_avih), (gst_avi_demux_parse_superindex),
    (gst_avi_demux_parse_subindex), (gst_avi_demux_read_subindexes),
    (gst_avi_demux_parse_stream), (gst_avi_demux_parse_odml),
    (gst_avi_demux_parse_index), (gst_avi_demux_stream_index),
    (gst_avi_demux_stream_scan), (gst_avi_demux_massage_index),
    (gst_avi_demux_stream_header), (gst_avi_demux_handle_seek),
    (gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
    (gst_avi_demux_loop), (gst_avi_demux_sink_activate):
    * gst/avi/gstavidemux.h:
    Port to changed RIFF API, port to 0.9, add locking. Add gtk-doc
    comments to some relevant functions. Seeking is weird, works
    otherwise. Some parts are still disabled.
    4649822e
  • Wim Taymans's avatar
    Fix compilation again. · 002836cd
    Wim Taymans authored
    Original commit message from CVS:
    Fix compilation again.
    002836cd
  • Jan Schmidt's avatar
    examples/seeking/seek.c: Add realtime scrubbing to the seek example. · 593fb4a9
    Jan Schmidt authored
    Original commit message from CVS:
    * examples/seeking/seek.c: (end_scrub), (do_seek), (seek_cb),
    (start_seek), (stop_seek):
    Add realtime scrubbing to the seek example.
    * ext/ogg/gstoggdemux.c: (gst_ogg_demux_perform_seek):
    Avoid overflowing 64-bits on large files when estimating
    the new position during a seek.
    593fb4a9
  • Ronald S. Bultje's avatar
    gst/avi/gstavidemux.c: Implement accurate seeking, fix keyframe seeking. · 1b9ed877
    Ronald S. Bultje authored
    Original commit message from CVS:
    * gst/avi/gstavidemux.c: (gst_avi_demux_index_next),
    (gst_avi_demux_index_entry_for_time),
    (gst_avi_demux_index_entry_for_byte),
    (gst_avi_demux_index_entry_for_frame),
    (gst_avi_demux_handle_src_event),
    (gst_avi_demux_process_next_entry):
    Implement accurate seeking, fix keyframe seeking.
    1b9ed877
This diff is collapsed.
common @ b2638c10
Subproject commit ded6dc5186cb7f8c64cb06a8591b9f787122c6f1
Subproject commit b2638c100721f67b280c3b43b21f1ce1c9b5e316
......@@ -12,7 +12,7 @@ AM_MAINTAINER_MODE
dnl when going to/from release please set the nano (fourth number) right !
dnl releases only do Wall, cvs and prerelease does Werror too
AS_VERSION(gst-plugins, GST_PLUGINS_VERSION, 0, 8, 6, 1, GST_CVS="no", GST_CVS="yes")
AS_VERSION(gst-plugins-threaded, GST_PLUGINS_VERSION, 0, 9, 0, 0, GST_CVS="no", GST_CVS="yes")
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
......@@ -2032,6 +2032,7 @@ gst-libs/gst/xwindowlistener/Makefile
gst-libs/ext/Makefile
examples/dynparams/Makefile
examples/capsfilter/Makefile
examples/negotiation/Makefile
examples/seeking/Makefile
examples/indexing/Makefile
examples/gstplay/Makefile
......
examples = queue colorspace
noinst_PROGRAMS = $(examples)
# we have nothing but apps here, we can do this safely
LIBS = $(GST_LIBS) $(GTK_LIBS) $(GST_CONTROL_LIBS)
AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
/*
* colorspace.c
*
* demo application for negotiation of a simple plugin.
*/
#include <string.h>
#include <gst/gst.h>
static GstElement *pipeline;
static GstElement *space;
static GstPad *src;
static GstPad *sink;
static GstPad *test;
static gboolean caught_error = FALSE;
static GMainLoop *loop;
static gboolean
message_received (GstBus * bus, GstMessage * message, gpointer data)
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_EOS:
if (g_main_loop_is_running (loop))
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ERROR:
gst_object_default_error (GST_MESSAGE_SRC (message),
GST_MESSAGE_ERROR_GERROR (message),
GST_MESSAGE_ERROR_DEBUG (message));
caught_error = TRUE;
if (g_main_loop_is_running (loop))
g_main_loop_quit (loop);
break;
default:
break;
}
gst_message_unref (message);
return TRUE;
}
static GstFlowReturn
my_chain (GstPad * pad, GstBuffer * buffer)
{
g_print ("got buffer\n");
return GST_FLOW_OK;
}
int
main (int argc, char *argv[])
{
GstBus *bus;
GstBuffer *buffer;
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("pipeline");
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
loop = g_main_loop_new (NULL, FALSE);
gst_bus_add_watch (bus, message_received, pipeline);
space = gst_element_factory_make ("ffmpegcolorspace", "space");
gst_bin_add (GST_BIN (pipeline), space);
sink = gst_element_get_pad (space, "sink");
src = gst_element_get_pad (space, "src");
gst_element_set_state (pipeline, GST_STATE_PLAYING);
test = gst_pad_new ("test", GST_PAD_SINK);
gst_pad_set_chain_function (test, my_chain);
gst_pad_link (src, test);
gst_pad_set_active (test, TRUE);
gst_pad_set_caps (sink,
gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_STR_FOURCC ("YUY2"),
"width", G_TYPE_INT, 240,
"height", G_TYPE_INT, 120, "framerate", G_TYPE_DOUBLE, 30.0, NULL));
while (g_main_context_iteration (NULL, FALSE));
buffer = gst_buffer_new ();
GST_REAL_PAD (sink)->chainfunc (sink, buffer);
while (g_main_context_iteration (NULL, FALSE));
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}
/*
* queue.c
*
* demo application for negotiation over queues.
*/
#include <string.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
static GstElement *pipeline;
static GstElement *src;
static GstElement *queue;
static GstElement *sink;
static GstPad *pad1, *peer1;
static GstPad *pad2, *peer2;
static gboolean caught_error = FALSE;
static GMainLoop *loop;
static gboolean
message_received (GstBus * bus, GstMessage * message, gpointer data)
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_EOS:
if (g_main_loop_is_running (loop))
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ERROR:
gst_object_default_error (GST_MESSAGE_SRC (message),
GST_MESSAGE_ERROR_GERROR (message),
GST_MESSAGE_ERROR_DEBUG (message));
caught_error = TRUE;
if (g_main_loop_is_running (loop))
g_main_loop_quit (loop);
break;
default:
break;
}
gst_message_unref (message);
return TRUE;
}
static void
block_done (GstPad * pad, gboolean blocked, gpointer data)
{
if (blocked) {
g_print ("pad blocked\n");
/* let's unlink to be cool too */
gst_pad_unlink (pad2, peer2);
} else {
g_print ("pad unblocked\n");
}
}
static gboolean
do_block (GstPipeline * pipeline)
{
static gint iter = 0;
if (iter++ % 2) {
g_print ("blocking pad..");
if (!gst_pad_set_blocked_async (pad2, TRUE, block_done, NULL))
g_print ("was blocked\n");
} else {
/* and relink */
gst_pad_link (pad2, peer2);
g_print ("unblocking pad..");
if (!gst_pad_set_blocked_async (pad2, FALSE, block_done, NULL))
g_print ("was unblocked\n");
}
return TRUE;
}
static gboolean
do_renegotiate (GstPipeline * pipeline)
{
GstCaps *caps;
static gint iter = 0;
g_print ("reneg\n");
if (iter++ % 2) {
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_STR_FOURCC ("I420"),
"width", G_TYPE_INT, 320,
"height", G_TYPE_INT, 240, "framerate", G_TYPE_DOUBLE, 5.0, NULL);
} else {
caps = gst_caps_new_simple ("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_STR_FOURCC ("YUY2"),
"width", G_TYPE_INT, 240,
"height", G_TYPE_INT, 120, "framerate", G_TYPE_DOUBLE, 30.0, NULL);
}
gst_pad_relink_filtered (pad1, peer1, caps);
gst_caps_unref (caps);
return TRUE;
}
int
main (int argc, char *argv[])
{
GstBus *bus;
gtk_init (&argc, &argv);
gst_init (&argc, &argv);
pipeline = gst_pipeline_new ("pipeline");
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
loop = g_main_loop_new (NULL, FALSE);
gst_bus_add_watch (bus, message_received, pipeline);
src = gst_element_factory_make ("videotestsrc", "src");
queue = gst_element_factory_make ("queue", "queue");
sink = gst_element_factory_make ("xvimagesink", "sink");
gst_bin_add (GST_BIN (pipeline), src);
gst_bin_add (GST_BIN (pipeline), queue);
gst_bin_add (GST_BIN (pipeline), sink);
pad1 = gst_element_get_pad (src, "src");
peer1 = gst_element_get_pad (queue, "sink");
pad2 = gst_element_get_pad (queue, "src");
peer2 = gst_element_get_pad (sink, "sink");
gst_pad_link (pad1, peer1);
gst_pad_link (pad2, peer2);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_timeout_add (1000, (GSourceFunc) do_block, pipeline);
g_main_loop_run (loop);
g_timeout_add (200, (GSourceFunc) do_renegotiate, pipeline);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}
This diff is collapsed.
......@@ -3,8 +3,11 @@ plugin_LTLIBRARIES = libgstgnomevfs.la
libgstgnomevfs_la_SOURCES = \
gstgnomevfs.c \
gstgnomevfssrc.c \
gstgnomevfssink.c \
gstgnomevfsuri.c
EXTRA_DIST = \
gstgnomevfssink.c
libgstgnomevfs_la_CFLAGS = $(GST_CFLAGS) $(GNOME_VFS_CFLAGS)
libgstgnomevfs_la_LIBADD = $(GNOME_VFS_LIBS)
libgstgnomevfs_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
......
......@@ -34,10 +34,9 @@ plugin_init (GstPlugin * plugin)
{
gnome_vfs_init ();
if (!gst_element_register (plugin, "gnomevfssrc",
GST_RANK_SECONDARY, gst_gnomevfssrc_get_type ()) ||
!gst_element_register (plugin, "gnomevfssink",
GST_RANK_SECONDARY, gst_gnomevfssink_get_type ())) {
if (!gst_element_register (plugin, "gnomevfssrc", GST_RANK_SECONDARY, gst_gnomevfssrc_get_type ()) /*||
!gst_element_register (plugin, "gnomevfssink",
GST_RANK_SECONDARY, gst_gnomevfssink_get_type ()) */ ) {
return FALSE;
}
#ifdef ENABLE_NLS
......
This diff is collapsed.
ogg demuxer
-----------
This ogg demuxer has two modes of operation, which both share a significant
amount of code. The first mode is the streaming mode which is automatically
selected when the demuxer is connected to a non-getrange based element. When
connected to a getrange based element the ogg demuxer can do full seeking
with great efficiency.
1) the streaming mode.
In this mode, the ogg demuxer receives buffers in the _chain() function which
are then simply submited to the ogg sync layer. Pages are then processed when the
sync layer detects them, pads are created for new chains and packets are sent to
the peer elements of the pads.
In this mode, no seeking is possible. This is the typical case when the stream is
read from a network source.
In this mode, no setup is done at startup, the pages are just read and decoded.
A new logical chain is detected when one of the pages has the BOS flag set. At this
point the existing pads are removed and new pads are created for all the logical
streams in this new chain.
2) the random access mode.
In this mode, the ogg file is first scanned to detect the position and length of
all chains. This scanning is performed using a recursive binary search algorithm
that is explained below.
find_chains(start, end)
{
ret1 = read_next_pages (start);
ret2 = read_prev_page (end);
if (WAS_HEADER (ret1)) {
}
else {
}
}
a) read first and last pages
start end
V V
+-----------------------+-------------+--------------------+
| 111 | 222 | 333 |
BOS BOS BOS EOS
after reading start, serial 111, BOS, chain[0] = 111
after reading end, serial 333, EOS
start serialno != end serialno, binary search start, (end-start)/2
start bisect end
V V V
+-----------------------+-------------+--------------------+
| 111 | 222 | 333 |
after reading start, serial 111, BOS, chain[0] = 111
after reading end, serial 222, EOS
while (
testcases
---------
a) stream without BOS
+----------------------------------------------------------+
111 |
EOS
b) chained stream, first chain without BOS
+-------------------+--------------------------------------+
111 | 222 |
BOS EOS
c) chained stream
+-------------------+--------------------------------------+
| 111 | 222 |
BOS BOS EOS
d) chained stream, second without BOS
+-------------------+--------------------------------------+
| 111 | 222 |
BOS EOS
ogg and the granulepos
----------------------
an ogg streams contains pages with a serial number and a granule pos. The granulepos
is a number that is codec specific and denotes the 'position' of the last packet
in that page.
is a number that is codec specific and denotes the 'position' of the last sample in
the last packet in that page.
ogg has therefore no notion about time, it only knows about bytes and granule positions.
......
......@@ -32,9 +32,6 @@ GST_DEBUG_CATEGORY (vorbisdec_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstbytestream"))
return FALSE;
gst_ogg_demux_plugin_init (plugin);
gst_ogg_mux_plugin_init (plugin);
gst_ogm_parse_plugin_init (plugin);
......
This diff is collapsed.
......@@ -219,6 +219,9 @@ gst_ogg_mux_class_init (GstOggMuxClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->get_property = gst_ogg_mux_get_property;
gobject_class->set_property = gst_ogg_mux_set_property;
gstelement_class->request_new_pad = gst_ogg_mux_request_new_pad;
g_object_class_install_property (gobject_class, ARG_MAX_DELAY,
......@@ -232,8 +235,6 @@ gst_ogg_mux_class_init (GstOggMuxClass * klass)
gstelement_class->change_state = gst_ogg_mux_change_state;
gstelement_class->get_property = gst_ogg_mux_get_property;
gstelement_class->set_property = gst_ogg_mux_set_property;
}
static const GstEventMask *
......@@ -259,7 +260,6 @@ gst_ogg_mux_init (GstOggMux * ogg_mux)
gst_pad_set_event_function (ogg_mux->srcpad, gst_ogg_mux_handle_src_event);
gst_element_add_pad (GST_ELEMENT (ogg_mux), ogg_mux->srcpad);
GST_FLAG_SET (GST_ELEMENT (ogg_mux), GST_ELEMENT_EVENT_AWARE);
GST_FLAG_SET (GST_ELEMENT (ogg_mux), GST_OGG_FLAG_BOS);
/* seed random number generator for creation of serial numbers */
......@@ -273,24 +273,20 @@ gst_ogg_mux_init (GstOggMux * ogg_mux)
ogg_mux->delta_pad = NULL;
gst_element_set_loop_function (GST_ELEMENT (ogg_mux), gst_ogg_mux_loop);
//gst_element_set_loop_function (GST_ELEMENT (ogg_mux), gst_ogg_mux_loop);
gst_ogg_mux_loop (GST_ELEMENT (ogg_mux));
}
static GstPadLinkReturn
gst_ogg_mux_sinkconnect (GstPad * pad, const GstCaps * vscaps)
gst_ogg_mux_sinkconnect (GstPad * pad, GstPad * peer)
{
GstOggMux *ogg_mux;
GstStructure *structure;
const gchar *mimetype;
ogg_mux = GST_OGG_MUX (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (ogg_mux, "sinkconnect triggered on %s",
gst_pad_get_name (pad));
structure = gst_caps_get_structure (vscaps, 0);
mimetype = gst_structure_get_name (structure);
return GST_PAD_LINK_OK;
}
......@@ -412,9 +408,10 @@ static GstBuffer *
gst_ogg_mux_next_buffer (GstOggPad * pad, gboolean * interrupt)
{
GstData *data = NULL;
GstBuffer *buffer = NULL;
while (data == NULL) {
data = gst_pad_pull (pad->pad);
while (buffer == NULL) {
//gst_pad_pull (pad->pad, &buffer);
GST_DEBUG ("muxer: pulled %s:%s %p", GST_DEBUG_PAD_NAME (pad->pad), data);
/* if it's an event, handle it */
if (GST_IS_EVENT (data)) {
......@@ -430,23 +427,18 @@ gst_ogg_mux_next_buffer (GstOggPad * pad, gboolean * interrupt)
pad->eos = TRUE;
gst_event_unref (event);
return NULL;
case GST_EVENT_INTERRUPT:
*interrupt = TRUE;
return NULL;
case GST_EVENT_DISCONTINUOUS:
{
guint64 value;
guint64 start_value, end_value;
if (GST_EVENT_DISCONT_NEW_MEDIA (event)) {
gst_pad_event_default (pad->pad, event);
break;
}
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) {
if (gst_event_discont_get_value (event, GST_FORMAT_TIME,
&start_value, &end_value)) {
GST_DEBUG_OBJECT (ogg_mux,
"got discont of %" G_GUINT64_FORMAT " on pad %s:%s",
value, GST_DEBUG_PAD_NAME (pad->pad));
"got discont of %" G_GUINT64_FORMAT " and %" G_GUINT64_FORMAT
" on pad %s:%s", start_value, end_value,
GST_DEBUG_PAD_NAME (pad->pad));
}
pad->offset = value;
pad->offset = start_value;
gst_event_unref (event);
}
......@@ -489,7 +481,7 @@ gst_ogg_mux_buffer_from_page (GstOggMux * mux, ogg_page * page, gboolean delta)
/* allocate space for header and body */
buffer = gst_pad_alloc_buffer (mux->srcpad, GST_BUFFER_OFFSET_NONE,
page->header_len + page->body_len);
page->header_len + page->body_len, NULL);
memcpy (GST_BUFFER_DATA (buffer), page->header, page->header_len);
memcpy (GST_BUFFER_DATA (buffer) + page->header_len,
page->body, page->body_len);
......@@ -511,7 +503,7 @@ gst_ogg_mux_push_page (GstOggMux * mux, ogg_page * page, gboolean delta)
if (GST_PAD_IS_USABLE (mux->srcpad)) {
GstBuffer *buffer = gst_ogg_mux_buffer_from_page (mux, page, delta);
gst_pad_push (mux->srcpad, GST_DATA (buffer));
gst_pad_push (mux->srcpad, buffer);
}
}
......@@ -817,7 +809,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
caps = gst_pad_get_caps (mux->srcpad);
if (caps) {
gst_ogg_mux_set_header_on_caps (caps, hbufs);
gst_pad_try_set_caps (mux->srcpad, caps);
//gst_pad_try_set_caps (mux->srcpad, caps);
}
/* and send the buffers */
hwalk = hbufs;
......@@ -827,7 +819,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
hwalk = hwalk->next;
if (GST_PAD_IS_USABLE (mux->srcpad)) {
gst_pad_push (mux->srcpad, GST_DATA (buf));
gst_pad_push (mux->srcpad, buf);
} else {
gst_buffer_unref (buf);
}
......@@ -897,9 +889,8 @@ gst_ogg_mux_loop (GstElement * element)
} else {
/* no pad to pull on, send EOS */
if (GST_PAD_IS_USABLE (ogg_mux->srcpad))
gst_pad_push (ogg_mux->srcpad,
GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (element);
gst_pad_push_event (ogg_mux->srcpad, gst_event_new (GST_EVENT_EOS));
//gst_element_set_eos (element);
return;
}
}
......
......@@ -133,7 +133,7 @@ static const GstFormat *gst_ogm_parse_get_sink_formats (GstPad * pad);
static gboolean gst_ogm_parse_sink_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
static void gst_ogm_parse_chain (GstPad * pad, GstData * data);
static GstFlowReturn gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer);
static GstElementStateReturn gst_ogm_parse_change_state (GstElement * element);
......@@ -366,11 +366,11 @@ gst_ogm_parse_sink_convert (GstPad * pad,
return res;
}
static void
gst_ogm_parse_chain (GstPad * pad, GstData * dat)
static GstFlowReturn
gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer)
{
GstOgmParse *ogm = GST_OGM_PARSE (gst_pad_get_parent (pad));
GstBuffer *buf = GST_BUFFER (dat);
GstBuffer *buf = GST_BUFFER (buffer);
guint8 *data = GST_BUFFER_DATA (buf);
guint size = GST_BUFFER_SIZE (buf);
......@@ -416,15 +416,18 @@ gst_ogm_parse_chain (GstPad * pad, GstData * dat)
caps = NULL;
break;
}
caps = gst_riff_create_audio_caps (codec_id, NULL, NULL, NULL);
gst_caps_set_simple (caps,
"channels", G_TYPE_INT, ogm->hdr.s.audio.channels,
"rate", G_TYPE_INT, ogm->hdr.samples_per_unit, NULL);
GST_LOG_OBJECT (ogm, "Type: %s, subtype: 0x%04x, "
caps =
gst_riff_create_audio_caps (codec_id, NULL, NULL, NULL, NULL,
NULL);
gst_caps_set_simple (caps, "channels", G_TYPE_INT,
ogm->hdr.s.audio.channels, "rate", G_TYPE_INT,
ogm->hdr.samples_per_unit, NULL);
GST_LOG_OBJECT (ogm,
"Type: %s, subtype: 0x%04x, "
"channels: %d, samplerate: %d, blockalign: %d, bps: %d",
ogm->hdr.streamtype, codec_id, ogm->hdr.s.audio.channels,
ogm->hdr.samples_per_unit,
ogm->hdr.s.audio.blockalign, ogm->hdr.s.audio.avgbytespersec);
ogm->hdr.samples_per_unit, ogm->hdr.s.audio.blockalign,
ogm->hdr.s.audio.avgbytespersec);
break;
}
case 'v':{
......@@ -441,7 +444,7 @@ gst_ogm_parse_chain (GstPad * pad, GstData * dat)
ogm->hdr.time_unit, 10000000. / ogm->hdr.time_unit,
ogm->hdr.samples_per_unit, ogm->hdr.default_len,
ogm->hdr.buffersize, ogm->hdr.bits_per_sample);
caps = gst_riff_create_video_caps (fcc, NULL, NULL, NULL);
caps = gst_riff_create_video_caps (fcc, NULL, NULL, NULL, NULL, NULL);
gst_caps_set_simple (caps,
"width", G_TYPE_INT, ogm->hdr.s.video.width,
"height", G_TYPE_INT, ogm->hdr.s.video.height,
......@@ -453,13 +456,13 @@ gst_ogm_parse_chain (GstPad * pad, GstData * dat)
}
ogm->srcpad = gst_pad_new_from_template (ogm->srcpadtempl, "src");
gst_pad_use_explicit_caps (ogm->srcpad);
if (!gst_pad_set_explicit_caps (ogm->srcpad, caps)) {
GST_ELEMENT_ERROR (ogm, CORE, NEGOTIATION, (NULL), (NULL));
//gst_object_unref (GST_OBJECT (ogm->srcpad));
ogm->srcpad = NULL;
break;
}
//gst_pad_use_explicit_caps (ogm->srcpad);
//if (!gst_pad_set_explicit_caps (ogm->srcpad, caps)) {
// GST_ELEMENT_ERROR (ogm, CORE, NEGOTIATION, (NULL), (NULL));
//gst_object_unref (GST_OBJECT (ogm->srcpad));
// ogm->srcpad = NULL;
// break;
//}
gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad);
break;
}
......@@ -492,8 +495,8 @@ gst_ogm_parse_chain (GstPad * pad, GstData * dat)
}
switch (ogm->hdr.streamtype[0]) {
case 'v':
if (keyframe)
GST_BUFFER_FLAG_SET (sbuf, GST_BUFFER_KEY_UNIT);
if (!keyframe)
GST_BUFFER_FLAG_SET (sbuf, GST_BUFFER_DELTA_UNIT);
GST_BUFFER_TIMESTAMP (sbuf) = (GST_SECOND / 10000000) *
ogm->next_granulepos * ogm->hdr.time_unit;
GST_BUFFER_DURATION (sbuf) = (GST_SECOND / 10000000) *
......@@ -510,7 +513,7 @@ gst_ogm_parse_chain (GstPad * pad, GstData * dat)
default:
g_assert_not_reached ();
}
gst_pad_push (ogm->srcpad, GST_DATA (sbuf));
gst_pad_push (ogm->srcpad, sbuf);
} else {
GST_ELEMENT_ERROR (ogm, STREAM, WRONG_TYPE,
("Wrong packet startcode 0x%02x", data[0]), (NULL));
......@@ -519,6 +522,8 @@ gst_ogm_parse_chain (GstPad * pad, GstData * dat)
}
gst_buffer_unref (buf);
return GST_FLOW_OK;
}
static GstElementStateReturn
......
This diff is collapsed.
......@@ -170,10 +170,10 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_BOILERPLATE (GstTheoraEnc, gst_theora_enc, GstElement, GST_TYPE_ELEMENT);
static void theora_enc_chain (GstPad * pad, GstData * data);
static gboolean theora_enc_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn theora_enc_chain (GstPad * pad, GstBuffer * buffer);
static GstElementStateReturn theora_enc_change_state (GstElement * element);
static GstPadLinkReturn theora_enc_sink_link (GstPad * pad,
const GstCaps * caps);
static gboolean theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps);
static void theora_enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void theora_enc_set_property (GObject * object, guint prop_id,
......@@ -255,13 +255,13 @@ gst_theora_enc_init (GstTheoraEnc * enc)
gst_pad_new_from_template (gst_static_pad_template_get
(&theora_enc_sink_factory), "sink");
gst_pad_set_chain_function (enc->sinkpad, theora_enc_chain);
gst_pad_set_link_function (enc->sinkpad, theora_enc_sink_link);
gst_pad_set_event_function (enc->sinkpad, theora_enc_sink_event);
gst_pad_set_setcaps_function (enc->sinkpad, theora_enc_sink_setcaps);
gst_element_add_pad (GST_ELEMENT (enc), enc->sinkpad);
enc->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&theora_enc_src_factory), "src");
gst_pad_use_explicit_caps (enc->srcpad);
gst_element_add_pad (GST_ELEMENT (enc), enc->srcpad);
enc->center = THEORA_DEF_CENTER;
......@@ -276,12 +276,10 @@ gst_theora_enc_init (GstTheoraEnc * enc)
enc->keyframe_threshold = THEORA_DEF_KEYFRAME_THRESHOLD;
enc->keyframe_mindistance = THEORA_DEF_KEYFRAME_MINDISTANCE;
enc->noise_sensitivity = THEORA_DEF_NOISE_SENSITIVITY;
GST_FLAG_SET (enc, GST_ELEMENT_EVENT_AWARE);
}
static GstPadLinkReturn
theora_enc_sink_link (GstPad * pad, const GstCaps * caps)
static gboolean
theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstStructure *structure = gst_caps_get_structure (caps, 0);
GstTheoraEnc *enc = GST_THEORA_ENC (gst_pad_get_parent (pad));
......@@ -289,9 +287,6 @@ theora_enc_sink_link (GstPad * pad, const GstCaps * caps)
GValue fps = { 0 };
GValue framerate = { 0 };
if (!gst_caps_is_fixed (caps))
return GST_PAD_LINK_DELAYED;
gst_structure_get_int (structure, "width", &enc->width);
gst_structure_get_int (structure, "height", &enc->height);
gst_structure_get_double (structure, "framerate", &enc->fps);
......@@ -352,7 +347,7 @@ theora_enc_sink_link (GstPad * pad, const GstCaps * caps)
theora_encode_init (&enc->state, &enc->info);
return GST_PAD_LINK_OK;
return TRUE;
}
/* prepare a buffer for transmission by passing data through libtheora */
......@@ -363,7 +358,7 @@ theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
GstBuffer *buf;
buf = gst_pad_alloc_buffer (enc->srcpad,
GST_BUFFER_OFFSET_NONE, packet->bytes);
GST_BUFFER_OFFSET_NONE, packet->bytes, GST_PAD_CAPS (enc->srcpad));
memcpy (GST_BUFFER_DATA (buf), packet->packet, packet->bytes);
GST_BUFFER_OFFSET (buf) = enc->bytes_out;
GST_BUFFER_OFFSET_END (buf) = packet->granulepos;
......@@ -373,10 +368,8 @@ theora_buffer_from_packet (GstTheoraEnc * enc, ogg_packet * packet,
/* the second most significant bit of the first data byte is cleared
* for keyframes */
if ((packet->packet[0] & 0x40) == 0) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT);
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_DELTA_UNIT);
} else {
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_KEY_UNIT);
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DELTA_UNIT);
}
......@@ -392,7 +385,7 @@ theora_push_buffer (GstTheoraEnc * enc, GstBuffer * buffer)
enc->bytes_out += GST_BUFFER_SIZE (buffer);
if (GST_PAD_IS_USABLE (enc->srcpad)) {
gst_pad_push (enc->srcpad, GST_DATA (buffer));
gst_pad_push (enc->srcpad, buffer);
} else {
gst_buffer_unref (buffer);
}
......@@ -439,31 +432,38 @@ theora_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
g_value_unset (&list);
}
static void
theora_enc_chain (GstPad * pad, GstData * data)
static gboolean
theora_enc_sink_event (GstPad * pad, GstEvent * event)
{
GstTheoraEnc *enc;
ogg_packet op;
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
/* push last packet with eos flag */
while (theora_encode_packetout (&enc->state, 1, &op)) {
GstClockTime out_time =
theora_granule_time (&enc->state, op.granulepos) * GST_SECOND;
theora_push_packet (enc, &op, out_time, GST_SECOND / enc->fps);
}
default:
return gst_pad_event_default (pad, event);
}
}
static GstFlowReturn
theora_enc_chain (GstPad * pad, GstBuffer * buffer)
{
GstTheoraEnc *enc;
ogg_packet op;
GstBuffer *buf;
GstClockTime in_time;
enc = GST_THEORA_ENC (gst_pad_get_parent (pad));
if (GST_IS_EVENT (data)) {
switch (GST_EVENT_TYPE (data)) {
case GST_EVENT_EOS:
/* push last packet with eos flag */
while (theora_encode_packetout (&enc->state, 1, &op)) {
GstClockTime out_time =
theora_granule_time (&enc->state, op.granulepos) * GST_SECOND;
theora_push_packet (enc, &op, out_time, GST_SECOND / enc->fps);
}
default:
gst_pad_event_default (pad, GST_EVENT (data));
return;
}
}
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
buf = GST_BUFFER (data);
buf = GST_BUFFER (buffer);
in_time = GST_BUFFER_TIMESTAMP (buf);
/* no packets written yet, setup headers */
......@@ -495,7 +495,7 @@ theora_enc_chain (GstPad * pad, GstData * data)
/* negotiate with these caps */
GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
gst_pad_try_set_caps (enc->srcpad, caps);
gst_pad_set_caps (enc->srcpad, caps);
/* push out the header buffers */
theora_push_buffer (enc, buf1);
......@@ -554,7 +554,7 @@ theora_enc_chain (GstPad * pad, GstData * data)
dst_uv_stride = enc->info_width / 2;
newbuf = gst_pad_alloc_buffer (enc->srcpad,
GST_BUFFER_OFFSET_NONE, y_size * 3 / 2);
GST_BUFFER_OFFSET_NONE, y_size * 3 / 2, GST_PAD_CAPS (enc->srcpad));
dest_y = yuv.y = GST_BUFFER_DATA (newbuf);
dest_u = yuv.u = yuv.y + y_size;
......@@ -655,6 +655,8 @@ theora_enc_chain (GstPad * pad, GstData * data)
gst_buffer_unref (buf);
}
return GST_FLOW_OK;
}
static GstElementStateReturn
......
plugin_LTLIBRARIES = libgstvorbis.la
libgstvorbis_la_SOURCES = vorbis.c \
vorbisdec.c vorbisenc.c oggvorbisenc.c vorbisparse.c
vorbisdec.c vorbisenc.c vorbisparse.c
libgstvorbis_la_CFLAGS = $(GST_CFLAGS) $(VORBIS_CFLAGS)
## AM_PATH_VORBIS also sets VORBISENC_LIBS
libgstvorbis_la_LIBADD = $(VORBIS_LIBS) $(VORBISENC_LIBS) $(VORBISFILE_LIBS)
libgstvorbis_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = vorbisenc.h vorbisdec.h oggvorbisenc.h vorbisparse.h
noinst_HEADERS = vorbisenc.h vorbisdec.h vorbisparse.h
......@@ -22,7 +22,6 @@
#endif
#include "vorbisenc.h"
#include "oggvorbisenc.h"
#include "vorbisdec.h"
#include "vorbisparse.h"
......@@ -33,12 +32,7 @@ GST_DEBUG_CATEGORY (vorbisparse_debug);
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstbytestream") ||
!gst_library_load ("gstaudio") || !gst_library_load ("gsttags"))
return FALSE;
if (!gst_element_register (plugin, "vorbisenc", GST_RANK_NONE,
GST_TYPE_OGGVORBISENC))
if (!gst_library_load ("gstaudio") || !gst_library_load ("gsttags"))
return FALSE;
if (!gst_element_register (plugin, "rawvorbisenc", GST_RANK_NONE,
......
This diff is collapsed.
......@@ -103,7 +103,8 @@ static void gst_vorbisenc_base_init (gpointer g_class);
static void gst_vorbisenc_class_init (VorbisEncClass * klass);
static void gst_vorbisenc_init (VorbisEnc * vorbisenc);
static void gst_vorbisenc_chain (GstPad * pad, GstData * _data);
static gboolean gst_vorbisenc_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_vorbisenc_setup (VorbisEnc * vorbisenc);
static void gst_vorbisenc_get_property (GObject * object, guint prop_id,
......@@ -197,6 +198,9 @@ gst_vorbisenc_class_init (VorbisEncClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_vorbisenc_set_property;
gobject_class->get_property = gst_vorbisenc_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_BITRATE,
g_param_spec_int ("max-bitrate", "Maximum Bitrate",
"Specify a maximum bitrate (in bps). Useful for streaming "
......@@ -226,14 +230,11 @@ gst_vorbisenc_class_init (VorbisEncClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_vorbisenc_set_property;
gobject_class->get_property = gst_vorbisenc_get_property;
gstelement_class->change_state = gst_vorbisenc_change_state;
}
static GstPadLinkReturn
gst_vorbisenc_sinkconnect (GstPad * pad, const GstCaps * caps)
static gboolean
gst_vorbisenc_sink_setcaps (GstPad * pad, GstCaps * caps)
{
VorbisEnc *vorbisenc;
GstStructure *structure;
......@@ -248,9 +249,9 @@ gst_vorbisenc_sinkconnect (GstPad * pad, const GstCaps * caps)
gst_vorbisenc_setup (vorbisenc);
if (vorbisenc->setup)
return GST_PAD_LINK_OK;
return TRUE;
return GST_PAD_LINK_REFUSED;
return FALSE;
}
static gboolean
......@@ -447,8 +448,9 @@ gst_vorbisenc_init (VorbisEnc * vorbisenc)
vorbisenc->sinkpad =
gst_pad_new_from_template (gst_vorbisenc_sink_template, "sink");
gst_element_add_pad (GST_ELEMENT (vorbisenc), vorbisenc->sinkpad);
gst_pad_set_event_function (vorbisenc->sinkpad, gst_vorbisenc_sink_event);
gst_pad_set_chain_function (vorbisenc->sinkpad, gst_vorbisenc_chain);
gst_pad_set_link_function (vorbisenc->sinkpad, gst_vorbisenc_sinkconnect);
gst_pad_set_setcaps_function (vorbisenc->sinkpad, gst_vorbisenc_sink_setcaps);
gst_pad_set_convert_function (vorbisenc->sinkpad,
GST_DEBUG_FUNCPTR (gst_vorbisenc_convert_sink));
gst_pad_set_formats_function (vorbisenc->sinkpad,
......@@ -482,9 +484,6 @@ gst_vorbisenc_init (VorbisEnc * vorbisenc)
vorbisenc->header_sent = FALSE;
vorbisenc->tags = gst_tag_list_new ();
/* we're chained and we can deal with events */
GST_FLAG_SET (vorbisenc, GST_ELEMENT_EVENT_AWARE);
}
......@@ -736,7 +735,7 @@ gst_vorbisenc_push_buffer (VorbisEnc * vorbisenc, GstBuffer * buffer)
vorbisenc->bytes_out += GST_BUFFER_SIZE (buffer);
if (GST_PAD_IS_USABLE (vorbisenc->srcpad)) {
gst_pad_push (vorbisenc->srcpad, GST_DATA (buffer));
gst_pad_push (vorbisenc->srcpad, buffer);
} else {
gst_buffer_unref (buffer);
}
......@@ -782,45 +781,49 @@ gst_vorbisenc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
g_value_unset (&list);
}
static void
gst_vorbisenc_chain (GstPad * pad, GstData * _data)
static gboolean
gst_vorbisenc_sink_event (GstPad * pad, GstEvent * event)
{
GstBuffer *buf = GST_BUFFER (_data);
gboolean res = TRUE;
VorbisEnc *vorbisenc;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
/* end of file. this can be done implicitly in the mainline,
but it's easier to see here in non-clever fashion.
Tell the library we're at end of stream so that it can handle
the last frame and mark end of stream in the output properly */
vorbis_analysis_wrote (&vorbisenc->vd, 0);
vorbisenc->eos = TRUE;
gst_event_unref (event);
break;
case GST_EVENT_TAG:
if (vorbisenc->tags) {
gst_tag_list_insert (vorbisenc->tags, gst_event_tag_get_list (event),
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (vorbisenc)));
} else {
g_assert_not_reached ();
}
res = gst_pad_event_default (pad, event);
break;
default:
res = gst_pad_event_default (pad, event);
break;
}
return res;
}
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
static GstFlowReturn
gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer)
{
GstBuffer *buf = GST_BUFFER (buffer);
VorbisEnc *vorbisenc;
if (GST_IS_EVENT (buf)) {
GstEvent *event = GST_EVENT (buf);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
/* end of file. this can be done implicitly in the mainline,
but it's easier to see here in non-clever fashion.
Tell the library we're at end of stream so that it can handle
the last frame and mark end of stream in the output properly */
vorbis_analysis_wrote (&vorbisenc->vd, 0);
vorbisenc->eos = TRUE;
gst_event_unref (event);
break;
case GST_EVENT_TAG:
if (vorbisenc->tags) {
gst_tag_list_insert (vorbisenc->tags, gst_event_tag_get_list (event),
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (vorbisenc)));
} else {
g_assert_not_reached ();
}
gst_pad_event_default (pad, event);
return;
default:
gst_pad_event_default (pad, event);
return;
}
} else {
vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
{
gfloat *data;
gulong size;
gulong i, j;
......@@ -830,7 +833,7 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data)
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (vorbisenc, CORE, NEGOTIATION, (NULL),
("encoder not initialized (input is not audio?)"));
return;
return GST_FLOW_UNEXPECTED;
}
if (!vorbisenc->header_sent) {
......@@ -863,7 +866,7 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data)
/* negotiate with these caps */
GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
gst_pad_try_set_caps (vorbisenc->srcpad, caps);
gst_pad_set_caps (vorbisenc->srcpad, caps);
/* push out buffers */
gst_vorbisenc_push_buffer (vorbisenc, buf1);
......@@ -915,9 +918,10 @@ gst_vorbisenc_chain (GstPad * pad, GstData * _data)
vorbis_block_clear (&vorbisenc->vb);
vorbis_dsp_clear (&vorbisenc->vd);
vorbis_info_clear (&vorbisenc->vi);
gst_pad_push (vorbisenc->srcpad, GST_DATA (gst_event_new (GST_EVENT_EOS)));
gst_element_set_eos (GST_ELEMENT (vorbisenc));
gst_pad_push_event (vorbisenc->srcpad, gst_event_new (GST_EVENT_EOS));
//gst_element_set_eos (GST_ELEMENT (vorbisenc));
}
return GST_FLOW_OK;
}
static void
......
......@@ -62,7 +62,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_BOILERPLATE (GstVorbisParse, gst_vorbis_parse, GstElement,
GST_TYPE_ELEMENT);
static void vorbis_parse_chain (GstPad * pad, GstData * data);
static GstFlowReturn vorbis_parse_chain (GstPad * pad, GstBuffer * buffer);
static GstElementStateReturn vorbis_parse_change_state (GstElement * element);
static void
......@@ -143,23 +143,22 @@ vorbis_parse_set_header_on_caps (GstVorbisParse * parse, GstCaps * caps)
g_value_unset (&list);
}
static void
vorbis_parse_chain (GstPad * pad, GstData * data)
static GstFlowReturn
vorbis_parse_chain (GstPad * pad, GstBuffer * buffer)
{
GstBuffer *buf;
GstVorbisParse *parse;
parse = GST_VORBIS_PARSE (gst_pad_get_parent (pad));
g_assert (parse);
parse = GST_VORBIS_PARSE (GST_PAD_PARENT (pad));
buf = GST_BUFFER (data);
buf = GST_BUFFER (buffer);
parse->packetno++;
/* if 1 <= packetno <= 3, it's streamheader,
* so put it on the streamheader list and return */
if (parse->packetno <= 3) {
parse->streamheader = g_list_append (parse->streamheader, buf);
return;
return GST_FLOW_OK;
}
/* else, if we haven't sent streamheader buffers yet,
......@@ -172,7 +171,7 @@ vorbis_parse_chain (GstPad * pad, GstData * data)
/* negotiate with these caps */
GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
gst_pad_try_set_caps (parse->srcpad, caps);
gst_pad_set_caps (parse->srcpad, caps);
/* push out buffers */
gst_pad_push (parse->srcpad, parse->streamheader->data);
......@@ -182,7 +181,9 @@ vorbis_parse_chain (GstPad * pad, GstData * data)
parse->streamheader_sent = TRUE;
}
/* just send on buffer by default */
gst_pad_push (parse->srcpad, data);
gst_pad_push (parse->srcpad, buf);
return GST_FLOW_OK;
}
static GstElementStateReturn
......
......@@ -27,8 +27,7 @@ SUBDIRS = \
video \
xoverlay \
$(X_DIR) \
. \
play
.
DIST_SUBDIRS = \
audio \
......
......@@ -30,10 +30,11 @@ static void gst_audio_clock_class_init (GstAudioClockClass * klass);
static void gst_audio_clock_init (GstAudioClock * clock);
static GstClockTime gst_audio_clock_get_internal_time (GstClock * clock);
static GstClockEntryStatus gst_audio_clock_id_wait_async (GstClock * clock,
GstClockEntry * entry);
static void gst_audio_clock_id_unschedule (GstClock * clock,
GstClockEntry * entry);
//static GstClockEntryStatus gst_audio_clock_id_wait_async (GstClock * clock,
// GstClockEntry * entry);
//static void gst_audio_clock_id_unschedule (GstClock * clock,
// GstClockEntry * entry);
static GstSystemClockClass *parent_class = NULL;
......@@ -79,8 +80,8 @@ gst_audio_clock_class_init (GstAudioClockClass * klass)
parent_class = g_type_class_ref (GST_TYPE_SYSTEM_CLOCK);
gstclock_class->get_internal_time = gst_audio_clock_get_internal_time;
gstclock_class->wait_async = gst_audio_clock_id_wait_async;
gstclock_class->unschedule = gst_audio_clock_id_unschedule;
//gstclock_class->wait_async = gst_audio_clock_id_wait_async;
//gstclock_class->unschedule = gst_audio_clock_id_unschedule;
}
static void
......@@ -178,6 +179,7 @@ gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time)
}
}
#if 0
static gint
compare_clock_entries (GstClockEntry * entry1, GstClockEntry * entry2)
{
......@@ -203,3 +205,4 @@ gst_audio_clock_id_unschedule (GstClock * clock, GstClockEntry * entry)
aclock->async_entries = g_slist_remove (aclock->async_entries, entry);
}
#endif
......@@ -51,7 +51,7 @@ static void gst_audiofilter_set_property (GObject * object, guint prop_id,
static void gst_audiofilter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_audiofilter_chain (GstPad * pad, GstData * _data);
static GstFlowReturn gst_audiofilter_chain (GstPad * pad, GstBuffer * buffer);
GstCaps *gst_audiofilter_class_get_capslist (GstAudiofilterClass * klass);
static GstElementClass *parent_class = NULL;
......@@ -113,18 +113,20 @@ gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
}
static GstPadLinkReturn
gst_audiofilter_link (GstPad * pad, const GstCaps * caps)
gst_audiofilter_link (GstPad * pad, GstPad * peer)
{
GstAudiofilter *audiofilter;
GstPadLinkReturn ret;
GstPadLinkReturn link_ret;
GstStructure *structure;
//GstPadLinkReturn ret;
//GstPadLinkReturn link_ret;
//GstStructure *structure;
GstAudiofilterClass *audiofilter_class;
GST_DEBUG ("gst_audiofilter_link");
audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter));
#if 0
ret = GST_PAD_LINK_DELAYED; /* intialise with dummy value */
if (pad == audiofilter->srcpad) {
link_ret = gst_pad_try_set_caps (audiofilter->sinkpad, caps);
......@@ -158,6 +160,7 @@ gst_audiofilter_link (GstPad * pad, const GstCaps * caps)
if (audiofilter_class->setup)
(audiofilter_class->setup) (audiofilter);
#endif
return GST_PAD_LINK_OK;
}
......@@ -177,7 +180,7 @@ gst_audiofilter_init (GTypeInstance * instance, gpointer g_class)
gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->sinkpad);
gst_pad_set_chain_function (audiofilter->sinkpad, gst_audiofilter_chain);
gst_pad_set_link_function (audiofilter->sinkpad, gst_audiofilter_link);
gst_pad_set_getcaps_function (audiofilter->sinkpad, gst_pad_proxy_getcaps);
//gst_pad_set_getcaps_function (audiofilter->sinkpad, gst_pad_proxy_getcaps);
pad_template =
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
......@@ -185,24 +188,24 @@ gst_audiofilter_init (GTypeInstance * instance, gpointer g_class)
audiofilter->srcpad = gst_pad_new_from_template (pad_template, "src");
gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->srcpad);
gst_pad_set_link_function (audiofilter->srcpad, gst_audiofilter_link);
gst_pad_set_getcaps_function (audiofilter->srcpad, gst_pad_proxy_getcaps);
//gst_pad_set_getcaps_function (audiofilter->srcpad, gst_pad_proxy_getcaps);
audiofilter->inited = FALSE;
}
static void
gst_audiofilter_chain (GstPad * pad, GstData * data)
static GstFlowReturn
gst_audiofilter_chain (GstPad * pad, GstBuffer * buffer)
{
GstBuffer *inbuf = GST_BUFFER (data);
GstBuffer *inbuf = GST_BUFFER (buffer);
GstAudiofilter *audiofilter;
GstBuffer *outbuf;
GstAudiofilterClass *audiofilter_class;
GST_DEBUG ("gst_audiofilter_chain");
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (inbuf != NULL);
g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
g_return_val_if_fail (inbuf != NULL, GST_FLOW_ERROR);
audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
//g_return_if_fail (audiofilter->inited);
......@@ -212,14 +215,14 @@ gst_audiofilter_chain (GstPad * pad, GstData * data)
GST_BUFFER_SIZE (inbuf), GST_OBJECT_NAME (audiofilter));
if (audiofilter->passthru) {
gst_pad_push (audiofilter->srcpad, data);
return;
gst_pad_push (audiofilter->srcpad, buffer);
return GST_FLOW_OK;
}
audiofilter->size = GST_BUFFER_SIZE (inbuf);
audiofilter->n_samples = audiofilter->size / audiofilter->bytes_per_sample;
if (gst_data_is_writable (data)) {
if (gst_data_is_writable (GST_DATA (buffer))) {
if (audiofilter_class->filter_inplace) {
(audiofilter_class->filter_inplace) (audiofilter, inbuf);
outbuf = inbuf;
......@@ -246,7 +249,9 @@ gst_audiofilter_chain (GstPad * pad, GstData * data)
gst_buffer_unref (inbuf);
}
gst_pad_push (audiofilter->srcpad, GST_DATA (outbuf));
gst_pad_push (audiofilter->srcpad, outbuf);
return GST_FLOW_OK;
}
static void
......
......@@ -49,7 +49,7 @@ main (gint argc, gchar * argv[])
str = gst_caps_to_string (caps);
g_print ("Test caps #2: %s\n", str);
g_free (str);
gst_caps_free (caps);
gst_caps_unref (caps);
return 0;
}
......@@ -55,25 +55,34 @@ gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
const GList *pads = NULL;
GstElement *element = NULL;
elements = (GList *) gst_bin_get_list (bin);
GST_LOCK (bin);
elements = bin->children;
/* traverse all elements looking for unconnected pads */
while (elements && pad == NULL) {
element = GST_ELEMENT (elements->data);
pads = gst_element_get_pad_list (element);
GST_LOCK (element);
pads = element->pads;
while (pads) {
GstPad *testpad = GST_PAD (pads->data);
/* check if the direction matches */
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
if (GST_PAD_DIRECTION (testpad) == direction) {
GST_LOCK (pad);
if (GST_PAD_PEER (testpad) == NULL) {
GST_UNLOCK (pad);
/* found it ! */
pad = GST_PAD (pads->data);
pad = testpad;
break;
}
GST_UNLOCK (pad);
}
if (pad)
break; /* found one already */
pads = g_list_next (pads);
}
GST_UNLOCK (element);
elements = g_list_next (elements);
}
GST_UNLOCK (bin);
return pad;
}
......@@ -147,7 +156,7 @@ gst_gconf_render_bin_from_description (const gchar * description)
/* parse the pipeline to a bin */
desc = g_strdup_printf ("bin.( %s )", description);
bin = GST_ELEMENT (gst_parse_launch (desc, &error));
//bin = GST_ELEMENT (gst_parse_launch (desc, &error));
g_free (desc);
if (error) {
g_print ("DEBUG: gstgconf: error parsing pipeline %s\n%s\n",
......
......@@ -273,7 +273,7 @@ G_STMT_START { \
#define CAPS_RESET(target) \
G_STMT_START { \
if (target) gst_caps_free (target); \
if (target) gst_caps_unref (target); \
target = NULL; \
} G_STMT_END
CAPS_RESET (priv->type);
......@@ -509,7 +509,9 @@ gmip_find_type (GstMediaInfoPriv * priv, GError ** error)
if (!gmip_find_type_pre (priv, error))
return FALSE;
GST_DEBUG ("gmip_find_type: iterating");
while ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
while ((priv->type == NULL)
// && gst_bin_iterate (GST_BIN (priv->pipeline))
)
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
return gmip_find_type_post (priv);
......@@ -616,7 +618,7 @@ gmip_find_stream (GstMediaInfoPriv * priv)
/* iterate until caps are found */
/* FIXME: this should be done through the plugin sending some signal
* that it is ready for queries */
while (gst_bin_iterate (GST_BIN (priv->pipeline)) && priv->format == NULL);
//while (gst_bin_iterate (GST_BIN (priv->pipeline)) && priv->format == NULL);
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
== GST_STATE_FAILURE)
g_warning ("Couldn't set to paused");
......@@ -659,7 +661,9 @@ gmip_find_track_metadata (GstMediaInfoPriv * priv)
{
gmip_find_track_metadata_pre (priv);
GST_DEBUG ("gmip_find_metadata: iterating");
while ((priv->metadata == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
while ((priv->metadata == NULL)
//&& gst_bin_iterate (GST_BIN (priv->pipeline))
)
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
gmip_find_track_metadata_post (priv);
......@@ -729,8 +733,9 @@ gmip_find_track_streaminfo (GstMediaInfoPriv * priv)
{
gmip_find_track_streaminfo_pre (priv);
GST_DEBUG ("DEBUG: gmip_find_streaminfo: iterating");
while ((priv->streaminfo == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)))
while ((priv->streaminfo == NULL)
// && gst_bin_iterate (GST_BIN (priv->pipeline))
)
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
gmip_find_track_streaminfo_post (priv);
......@@ -766,7 +771,9 @@ gmip_find_track_format (GstMediaInfoPriv * priv)
{
gmip_find_track_format_pre (priv);
GST_DEBUG ("DEBUG: gmip_find_format: iterating");
while ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
while ((priv->format == NULL)
//&& gst_bin_iterate (GST_BIN (priv->pipeline))
)
GMI_DEBUG ("+");
GMI_DEBUG ("\n");
gmip_find_track_format_post (priv);
......
......@@ -266,7 +266,8 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
gchar *mime;
GST_LOG ("STATE_TYPEFIND");
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
//if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
if ((priv->type == NULL)) {