summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/load_plugins.c27
-rw-r--r--src/xine-engine/metronom.c33
2 files changed, 32 insertions, 28 deletions
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index ec8af4637..3f563dd62 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -1195,10 +1195,13 @@ static char *catalog_filename(xine_t *this, int createdir) {
static void save_catalog (xine_t *this) {
FILE *fp;
char *const cachefile = catalog_filename(this, 1);
+ char *cachefile_new;
if ( ! cachefile ) return;
- if( (fp = fopen(cachefile,"w")) != NULL ) {
+ asprintf(&cachefile_new, "%s.new", cachefile);
+
+ if( (fp = fopen(cachefile_new,"w")) != NULL ) {
int i;
fprintf(fp, "# this file is automatically created by xine, do not edit.\n\n");
@@ -1207,9 +1210,29 @@ static void save_catalog (xine_t *this) {
for (i = 0; i < PLUGIN_TYPE_MAX; i++) {
save_plugin_list (this, fp, this->plugin_catalog->plugin_lists[i]);
}
- fclose(fp);
+ if (fclose(fp))
+ {
+ const char *err = strerror (errno);
+ xine_log (this, XINE_LOG_MSG,
+ _("failed to save catalogue cache: %s\n"), err);
+ goto do_unlink;
+ }
+ else if (rename (cachefile_new, cachefile))
+ {
+ const char *err = strerror (errno);
+ xine_log (this, XINE_LOG_MSG,
+ _("failed to replace catalogue cache: %s\n"), err);
+ do_unlink:
+ if (unlink (cachefile_new) && errno != ENOENT)
+ {
+ err = strerror (errno);
+ xine_log (this, XINE_LOG_MSG,
+ _("failed to remove new catalogue cache: %s\n"), err);
+ }
+ }
}
free(cachefile);
+ free(cachefile_new);
}
/*
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index b120181b4..bd4c1e42f 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.c
@@ -304,6 +304,8 @@ static void metronom_handle_discontinuity (metronom_t *this, int type,
/* video_vpts and audio_vpts adjustements */
cur_time = this->xine->clock->get_current_time(this->xine->clock);
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG,
+ "current time : %" PRId64 "\n", cur_time);
switch (type) {
case DISC_STREAMSTART:
@@ -320,33 +322,12 @@ static void metronom_handle_discontinuity (metronom_t *this, int type,
case DISC_ABSOLUTE:
case DISC_RELATIVE:
- if (this->video_vpts < cur_time) {
- /* still frame */
- if (this->audio_vpts > cur_time) {
- /* still frame with audio */
- this->video_vpts = this->audio_vpts;
- xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video vpts adjusted to audio vpts %" PRId64 "\n", this->video_vpts);
- } else {
- /* still frame, no audio */
- this->video_vpts = this->prebuffer + cur_time;
- this->audio_vpts = this->video_vpts;
- this->audio_vpts_rmndr = 0;
- this->force_video_jump = 1;
- this->force_audio_jump = 1;
- this->video_drift = 0;
- xprintf(this->xine, XINE_VERBOSITY_DEBUG, "vpts adjusted with prebuffer to %" PRId64 "\n",
- this->video_vpts);
- }
+ if (this->video_vpts < this->audio_vpts) {
+ this->video_vpts = this->audio_vpts;
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video vpts adjusted to audio vpts %" PRId64 "\n", this->video_vpts);
} else {
- /* video */
- if (this->audio_vpts < cur_time) {
- /* video, no sound */
- this->audio_vpts = this->video_vpts;
- this->audio_vpts_rmndr = 0;
- xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio vpts adjusted to video vpts %" PRId64 "\n", this->video_vpts);
- } else {
- /* video + audio */
- }
+ this->audio_vpts = this->video_vpts;
+ xprintf(this->xine, XINE_VERBOSITY_DEBUG, "audio vpts adjusted to video vpts %" PRId64 "\n", this->video_vpts);
}
break;
}