Fixed buffer flag handling gstplay used old flag handling updated some plugins for the new objects/error handling

Original commit message from CVS:
Fixed buffer flag handling
gstplay used old flag handling
updated some plugins for the new objects/error handling
Fixed a serious buffer error in gst_buffer_append
This commit is contained in:
Wim Taymans 2000-12-29 19:45:45 +00:00
parent 2e6abf825a
commit c306021ce3
11 changed files with 38 additions and 26 deletions

View file

@ -81,6 +81,8 @@ noinst_HEADERS = \
gsti386.h \ gsti386.h \
gstppc.h gstppc.h
CFLAGS += -g -Wall
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS) libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE) libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)

View file

@ -26,7 +26,9 @@
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <gstasyncdisksrc.h> //#define GST_DEBUG_ENABLED
#include "gstasyncdisksrc.h"
GstElementDetails gst_asyncdisksrc_details = { GstElementDetails gst_asyncdisksrc_details = {
@ -242,12 +244,15 @@ gst_asyncdisksrc_get (GstPad *pad)
} else } else
GST_BUFFER_SIZE (buf) = src->bytes_per_read; GST_BUFFER_SIZE (buf) = src->bytes_per_read;
src->curoffset += GST_BUFFER_SIZE (buf); DEBUG ("map %p, offset %d, size %ld\n", src->map, src->curoffset, GST_BUFFER_SIZE (buf));
g_print ("offset %d\n", src->curoffset); //gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
src->curoffset += GST_BUFFER_SIZE (buf);
if (src->new_seek) { if (src->new_seek) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
DEBUG ("new seek\n");
src->new_seek = FALSE; src->new_seek = FALSE;
} }
@ -292,14 +297,14 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
GST_BUFFER_OFFSET (buf) = offset; GST_BUFFER_OFFSET (buf) = offset;
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
g_print ("offset %d\n", offset);
if ((offset + size) > src->size) { if ((offset + size) > src->size) {
GST_BUFFER_SIZE (buf) = src->size - offset; GST_BUFFER_SIZE (buf) = src->size - offset;
// FIXME: set the buffer's EOF bit here // FIXME: set the buffer's EOF bit here
} else } else
GST_BUFFER_SIZE (buf) = size; GST_BUFFER_SIZE (buf) = size;
DEBUG ("map %p, offset %d, size %ld\n", src->map, offset, GST_BUFFER_SIZE (buf));
/* we're done, return the buffer off now */ /* we're done, return the buffer off now */
return buf; return buf;
} }
@ -330,7 +335,7 @@ gboolean gst_asyncdisksrc_open_file (GstAsyncDiskSrc *src)
return FALSE; return FALSE;
} }
GST_FLAG_SET (src, GST_ASYNCDISKSRC_OPEN); GST_FLAG_SET (src, GST_ASYNCDISKSRC_OPEN);
src->new_seek = FALSE; src->new_seek = TRUE;
} }
return TRUE; return TRUE;
} }

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#define GST_DEBUG_ENABLED //#define GST_DEBUG_ENABLED
#include "gst_private.h" #include "gst_private.h"
#include "gstautoplug.h" #include "gstautoplug.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#define GST_DEBUG_ENABLED //#define GST_DEBUG_ENABLED
#include "gst_private.h" #include "gst_private.h"
#include "gstbin.h" #include "gstbin.h"

View file

@ -166,7 +166,8 @@ gst_buffer_append (GstBuffer *buffer,
GST_BUFFER_LOCK (buffer); GST_BUFFER_LOCK (buffer);
// the buffer is not used by anyone else // the buffer is not used by anyone else
if (GST_BUFFER_REFCOUNT (buffer) == 1 && buffer->parent == NULL) { if (GST_BUFFER_REFCOUNT (buffer) == 1 && buffer->parent == NULL
&& !GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_DONTFREE)) {
// save the old size // save the old size
size = buffer->size; size = buffer->size;
buffer->size += append->size; buffer->size += append->size;

View file

@ -47,11 +47,11 @@ extern "C" {
#define GST_BUFFER_FLAGS(buf) \ #define GST_BUFFER_FLAGS(buf) \
(GST_BUFFER(buf)->flags) (GST_BUFFER(buf)->flags)
#define GST_BUFFER_FLAG_IS_SET(buf,flag) \ #define GST_BUFFER_FLAG_IS_SET(buf,flag) \
(GST_BUFFER_FLAGS(buf) & (flag)) (GST_BUFFER_FLAGS(buf) & (1<<(flag)))
#define GST_BUFFER_FLAG_SET(buf,flag) \ #define GST_BUFFER_FLAG_SET(buf,flag) \
G_STMT_START{ (GST_BUFFER_FLAGS(buf) |= (flag)); }G_STMT_END G_STMT_START{ (GST_BUFFER_FLAGS(buf) |= (1<<(flag))); }G_STMT_END
#define GST_BUFFER_FLAG_UNSET(buf,flag) \ #define GST_BUFFER_FLAG_UNSET(buf,flag) \
G_STMT_START{ (GST_BUFFER_FLAGS(buf) &= ~(flag)); }G_STMT_END G_STMT_START{ (GST_BUFFER_FLAGS(buf) &= ~(1<<(flag))); }G_STMT_END
#define GST_BUFFER_TYPE(buf) (GST_BUFFER(buf)->type) #define GST_BUFFER_TYPE(buf) (GST_BUFFER(buf)->type)

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#define GST_DEBUG_ENABLED //#define GST_DEBUG_ENABLED
#include "gst_private.h" #include "gst_private.h"
#include "gstpipeline.h" #include "gstpipeline.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#define GST_DEBUG_ENABLED //#define GST_DEBUG_ENABLED
#include "gst_private.h" #include "gst_private.h"
#include "gstprops.h" #include "gstprops.h"

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#define GST_DEBUG_ENABLED //#define GST_DEBUG_ENABLED
#include "gst_private.h" #include "gst_private.h"
#include "gstscheduler.h" #include "gstscheduler.h"

View file

@ -142,8 +142,6 @@ gst_play_init (GstPlay *play)
gst_pipeline_add_sink (GST_PIPELINE (priv->pipeline), priv->audio_play); gst_pipeline_add_sink (GST_PIPELINE (priv->pipeline), priv->audio_play);
gst_pipeline_add_sink (GST_PIPELINE (priv->pipeline), priv->video_show); gst_pipeline_add_sink (GST_PIPELINE (priv->pipeline), priv->video_show);
//gst_bin_add (GST_BIN (priv->thread), priv->pipeline);
play->state = GST_PLAY_STOPPED; play->state = GST_PLAY_STOPPED;
play->flags = 0; play->flags = 0;
@ -220,7 +218,7 @@ gst_play_object_added (GstElement *pipeline,
priv = (GstPlayPrivate *)play->priv; priv = (GstPlayPrivate *)play->priv;
if (GST_FLAGS (element) & GST_ELEMENT_NO_SEEK) { if (GST_FLAG_IS_SET (element, GST_ELEMENT_NO_SEEK)) {
priv->can_seek = FALSE; priv->can_seek = FALSE;
} }
@ -259,8 +257,8 @@ gst_play_set_uri (GstPlay *play,
priv->uri = g_strdup (uri); priv->uri = g_strdup (uri);
priv->src = gst_elementfactory_make ("disksrc", "disk_src"); //priv->src = gst_elementfactory_make ("disksrc", "disk_src");
//priv->src = gst_elementfactory_make ("asyncdisksrc", "disk_src"); priv->src = gst_elementfactory_make ("asyncdisksrc", "disk_src");
//priv->src = gst_elementfactory_make ("dvdsrc", "disk_src"); //priv->src = gst_elementfactory_make ("dvdsrc", "disk_src");
g_return_val_if_fail (priv->src != NULL, -1); g_return_val_if_fail (priv->src != NULL, -1);
gtk_object_set (GTK_OBJECT (priv->src),"location",uri,NULL); gtk_object_set (GTK_OBJECT (priv->src),"location",uri,NULL);
@ -281,6 +279,7 @@ gst_play_set_uri (GstPlay *play,
play->flags |= GST_PLAY_TYPE_AUDIO; play->flags |= GST_PLAY_TYPE_AUDIO;
} }
// hmmmm hack? FIXME
GST_FLAG_UNSET (priv->pipeline, GST_BIN_FLAG_MANAGER); GST_FLAG_UNSET (priv->pipeline, GST_BIN_FLAG_MANAGER);
gst_bin_add (GST_BIN (priv->thread), priv->pipeline); gst_bin_add (GST_BIN (priv->thread), priv->pipeline);

View file

@ -26,7 +26,9 @@
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <gstasyncdisksrc.h> //#define GST_DEBUG_ENABLED
#include "gstasyncdisksrc.h"
GstElementDetails gst_asyncdisksrc_details = { GstElementDetails gst_asyncdisksrc_details = {
@ -242,12 +244,15 @@ gst_asyncdisksrc_get (GstPad *pad)
} else } else
GST_BUFFER_SIZE (buf) = src->bytes_per_read; GST_BUFFER_SIZE (buf) = src->bytes_per_read;
src->curoffset += GST_BUFFER_SIZE (buf); DEBUG ("map %p, offset %d, size %ld\n", src->map, src->curoffset, GST_BUFFER_SIZE (buf));
g_print ("offset %d\n", src->curoffset); //gst_util_dump_mem (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
src->curoffset += GST_BUFFER_SIZE (buf);
if (src->new_seek) { if (src->new_seek) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
DEBUG ("new seek\n");
src->new_seek = FALSE; src->new_seek = FALSE;
} }
@ -292,14 +297,14 @@ gst_asyncdisksrc_get_region (GstPad *pad, gulong offset, gulong size)
GST_BUFFER_OFFSET (buf) = offset; GST_BUFFER_OFFSET (buf) = offset;
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
g_print ("offset %d\n", offset);
if ((offset + size) > src->size) { if ((offset + size) > src->size) {
GST_BUFFER_SIZE (buf) = src->size - offset; GST_BUFFER_SIZE (buf) = src->size - offset;
// FIXME: set the buffer's EOF bit here // FIXME: set the buffer's EOF bit here
} else } else
GST_BUFFER_SIZE (buf) = size; GST_BUFFER_SIZE (buf) = size;
DEBUG ("map %p, offset %d, size %ld\n", src->map, offset, GST_BUFFER_SIZE (buf));
/* we're done, return the buffer off now */ /* we're done, return the buffer off now */
return buf; return buf;
} }
@ -330,7 +335,7 @@ gboolean gst_asyncdisksrc_open_file (GstAsyncDiskSrc *src)
return FALSE; return FALSE;
} }
GST_FLAG_SET (src, GST_ASYNCDISKSRC_OPEN); GST_FLAG_SET (src, GST_ASYNCDISKSRC_OPEN);
src->new_seek = FALSE; src->new_seek = TRUE;
} }
return TRUE; return TRUE;
} }