mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
08eaa11259
Original commit message from CVS: - added playondemand plugin by Leif Morgan Johnson <lmjohns3@eos.ncsu.edu> - some fixes to int2float - aplied a patch from wrobell <wrobell@ite.pl> that is a first attempt at making automake 1.5 happy (gst now requires automake1.5). It's still not perfect but it builds. - Made the schedulers plugable. The default scheduler now lives inside a plugin. - Added a new mpeg1/2 parser/demuxer. - Fixed some compiler warnings in the core libs. - substantial work to GstThread (hopefully less race conditions). simplified the code in GstThread a bit. A state change can now also happen in the thread context. - reworked the state semantics of a bin. it'll now automatically get the highest state of its children. - the autoplugger now nests the threads so that a state change failure of one thread doesn't make its upstream thread lock. - GstQueue refuses to go to PLAYING if the sinkpad is not connected. This way the queue will not wedge in the _get lock. - GstQueue unlocks its mutexes when going to PAUSED. - make sure that when all elements in a bin/thread go to PAUSED, the bin is set to PAUSED too. - make a parent bin wait for its children to PAUSE before ending the iteration with FALSE (EOS) - Some changes to GstPlay to deal with EOS. - aplied the latest patch from Zeenix to gstrtp. end result: GstPlay doesn't crash on EOS and the pipeline is now shut down properly.
151 lines
3.4 KiB
C
151 lines
3.4 KiB
C
/* GStreamer
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
* 2000 Wim Taymans <wtay@chello.be>
|
|
*
|
|
* gsttrace.c: Tracing functions (depracated)
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <string.h>
|
|
|
|
#include "gst_private.h"
|
|
|
|
#include "gstlog.h"
|
|
#include "gsttrace.h"
|
|
|
|
static __inline__ void
|
|
read_tsc (guint64 * dst)
|
|
{
|
|
#ifdef HAVE_RDTSC
|
|
guint64 tsc;
|
|
__asm__ __volatile__ ("rdtsc":"=A" (tsc));
|
|
|
|
*dst = tsc;
|
|
#else
|
|
*dst = 0;
|
|
#endif
|
|
}
|
|
|
|
void
|
|
gst_trace_read_tsc (guint64 * dst)
|
|
{
|
|
read_tsc (dst);
|
|
}
|
|
|
|
GstTrace *_gst_trace_default = NULL;
|
|
gint _gst_trace_on = 1;
|
|
|
|
GstTrace *
|
|
gst_trace_new (guchar * filename, gint size)
|
|
{
|
|
GstTrace *trace = g_malloc (sizeof (GstTrace));
|
|
|
|
g_return_val_if_fail (trace != NULL, NULL);
|
|
trace->filename = g_strdup (filename);
|
|
g_print ("opening '%s'\n", trace->filename);
|
|
trace->fd = open (trace->filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
|
perror ("opening trace file");
|
|
g_return_val_if_fail (trace->fd > 0, NULL);
|
|
trace->buf = g_malloc (size * sizeof (GstTraceEntry));
|
|
g_return_val_if_fail (trace->buf != NULL, NULL);
|
|
trace->bufsize = size;
|
|
trace->bufoffset = 0;
|
|
|
|
return trace;
|
|
}
|
|
|
|
void
|
|
gst_trace_destroy (GstTrace * trace)
|
|
{
|
|
g_return_if_fail (trace != NULL);
|
|
g_return_if_fail (trace->buf != NULL);
|
|
|
|
if (gst_trace_get_remaining (trace) > 0)
|
|
gst_trace_flush (trace);
|
|
close (trace->fd);
|
|
g_free (trace->buf);
|
|
g_free (trace);
|
|
}
|
|
|
|
void
|
|
gst_trace_flush (GstTrace * trace)
|
|
{
|
|
if (!trace) {
|
|
trace = _gst_trace_default;
|
|
if (!trace)
|
|
return;
|
|
}
|
|
|
|
write (trace->fd, trace->buf, trace->bufoffset * sizeof (GstTraceEntry));
|
|
trace->bufoffset = 0;
|
|
}
|
|
|
|
void
|
|
gst_trace_text_flush (GstTrace * trace)
|
|
{
|
|
int i;
|
|
const int strsize = 20 + 1 + 10 + 1 + 10 + 1 + 112 + 1 + 1;
|
|
char str[strsize];
|
|
|
|
if (!trace) {
|
|
trace = _gst_trace_default;
|
|
if (!trace)
|
|
return;
|
|
}
|
|
|
|
for (i = 0; i < trace->bufoffset; i++) {
|
|
snprintf (str, strsize, "%20lld %10d %10d %s\n",
|
|
trace->buf[i].timestamp,
|
|
trace->buf[i].sequence, trace->buf[i].data, trace->buf[i].message);
|
|
write (trace->fd, str, strlen (str));
|
|
}
|
|
trace->bufoffset = 0;
|
|
}
|
|
|
|
void
|
|
gst_trace_set_default (GstTrace * trace)
|
|
{
|
|
g_return_if_fail (trace != NULL);
|
|
_gst_trace_default = trace;
|
|
}
|
|
|
|
void
|
|
_gst_trace_add_entry (GstTrace * trace, guint32 seq, guint32 data, gchar * msg)
|
|
{
|
|
GstTraceEntry *entry;
|
|
|
|
if (!trace) {
|
|
trace = _gst_trace_default;
|
|
if (!trace)
|
|
return;
|
|
}
|
|
|
|
entry = trace->buf + trace->bufoffset;
|
|
read_tsc (&(entry->timestamp));
|
|
entry->sequence = seq;
|
|
entry->data = data;
|
|
strncpy (entry->message, msg, 112);
|
|
trace->bufoffset++;
|
|
|
|
gst_trace_flush (trace);
|
|
}
|