* gst_version_string() returns a printable string.
*
* The gst_deinit() call is used to clean up all internal resources used
- * by <application>GStreamer</application>. It is mostly used in unit tests
+ * by <application>GStreamer</application>. It is mostly used in unit tests
* to check for leaks.
*
* Last reviewed on 2006-08-11 (0.10.10)
#include "gst.h"
#include <mm_ta/mm_ta.h>
-
+#include <time.h>
+#include <sys/time.h>
#define GST_CAT_DEFAULT GST_CAT_GST_INIT
extern const gchar *priv_gst_dump_dot_dir;
#endif
+extern gchar* _pri_gst_debug_file_path;
+
/* defaults */
/* set to TRUE when segfaults need to be left as is */
#ifndef GST_DISABLE_GST_DEBUG
ARG_DEBUG_LEVEL,
ARG_DEBUG,
+ ARG_DEBUG_FILE,
ARG_DEBUG_DISABLE,
ARG_DEBUG_NO_COLOR,
ARG_DEBUG_HELP,
"specific levels for the individual categories. Example: "
"GST_AUTOPLUG:5,GST_ELEMENT_*:3"),
N_("LIST")},
+ {"gst-debug-file", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) parse_goption_arg,
+ N_("Dump all logs into a given file."),
+ N_("FILE")},
{"gst-debug-no-color", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
(gpointer) parse_goption_arg, N_("Disable colored debugging output"),
NULL},
case ARG_DEBUG:
parse_debug_list (arg);
break;
+ case ARG_DEBUG_FILE:{
+ char* debug_file = NULL;
+ debug_file = arg;
+ if(debug_file) {
+ struct tm* tm;
+ time_t ctime;
+ time(&ctime);
+ tm = localtime(&ctime);
+
+ _pri_gst_debug_file_path = g_strdup_printf("%s-%d-%d:%d:%d:%d:%d:%d",
+ debug_file, getpid(),
+ tm->tm_year+1900,
+ tm->tm_mon+1,
+ tm->tm_mday,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec );
+ }
+ _gst_debug_redirect();
+ break;
+ }
case ARG_DEBUG_NO_COLOR:
gst_debug_set_colored (FALSE);
break;
{
"--gst-debug-level", ARG_DEBUG_LEVEL}, {
"--gst-debug", ARG_DEBUG}, {
+ "--gst-debug-file", ARG_DEBUG_FILE}, {
"--gst-debug-disable", ARG_DEBUG_DISABLE}, {
"--gst-debug-no-color", ARG_DEBUG_NO_COLOR}, {
"--gst-debug-help", ARG_DEBUG_HELP},
* This function is therefore mostly used by testsuites and other memory
* profiling tools.
*
- * After this call GStreamer (including this method) should not be used anymore.
+ * After this call GStreamer (including this method) should not be used anymore.
*/
void
gst_deinit (void)
_priv_gst_plugin_paths = NULL;
#endif
+ if(_pri_gst_debug_file_path)
+ g_free(_pri_gst_debug_file_path);
+ _pri_gst_debug_file_path = NULL;
+
clock = gst_system_clock_obtain ();
gst_object_unref (clock);
gst_object_unref (clock);
* get the running time: GST_DEBUG_RUNNING_TIME
*/
GstClockTime _priv_gst_info_start_time;
+gchar* _pri_gst_debug_file_path = NULL;
#if 0
#if defined __sgi__
{
const gchar *env;
- env = g_getenv ("GST_DEBUG_FILE");
- if (env != NULL && *env != '\0') {
- if (strcmp (env, "-") == 0) {
- log_file = stdout;
- } else {
- log_file = g_fopen (env, "w");
- if (log_file == NULL) {
- g_printerr ("Could not open log file '%s' for writing: %s\n", env,
- g_strerror (errno));
- log_file = stderr;
- }
- }
- } else {
- log_file = stderr;
- }
+ _gst_debug_redirect();
/* get time we started for debugging messages */
_priv_gst_info_start_time = gst_util_get_timestamp ();
}
}
+void _gst_debug_redirect (void)
+{
+ const gchar *env;
+
+ /* use local path first */
+ if (_pri_gst_debug_file_path){
+ env = _pri_gst_debug_file_path;
+ } else {
+ env = g_getenv ("GST_DEBUG_FILE");
+ }
+
+ if (env != NULL && *env != '\0') {
+ if (strcmp (env, "-") == 0) {
+ log_file = stdout;
+ } else {
+ log_file = g_fopen (env, "w");
+ if (log_file == NULL) {
+ g_printerr ("Could not open log file '%s' for writing: %s\n", env,
+ g_strerror (errno));
+ log_file = stderr;
+ }
+ }
+ } else {
+ log_file = stderr;
+ }
+}
+
+
/* we can't do this further above, because we initialize the GST_CAT_DEFAULT struct */
#define GST_CAT_DEFAULT _GST_CAT_DEBUG