summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-21 20:36:45 +0100
committerwm4 <wm4@nowhere>2013-12-21 21:43:16 +0100
commit0335011f11d9d13f70db6c46ed6189a74d48ec67 (patch)
tree03a146b06b5a8c405f5c521abadeeea35c296920
parent3dbc9007b080028f0aebbbf8b9ab1233cd70c45b (diff)
downloadmpv-0335011f11d9d13f70db6c46ed6189a74d48ec67.tar.bz2
mpv-0335011f11d9d13f70db6c46ed6189a74d48ec67.tar.xz
stream: mp_msg conversions
We also drop some slave mode stuff from stream_vcd.
-rw-r--r--common/encode_lavc.c9
-rw-r--r--common/playlist_parser.c2
-rw-r--r--demux/demux_mf.c2
-rw-r--r--input/input.c2
-rw-r--r--player/loadfile.c4
-rw-r--r--player/timeline/tl_cue.c2
-rw-r--r--player/timeline/tl_matroska.c4
-rw-r--r--player/timeline/tl_mpv_edl.c2
-rw-r--r--stream/cache.c43
-rw-r--r--stream/cdd.h4
-rw-r--r--stream/cdinfo.c41
-rw-r--r--stream/cookies.c34
-rw-r--r--stream/cookies.h2
-rw-r--r--stream/dvb_tune.c108
-rw-r--r--stream/dvb_tune.h6
-rw-r--r--stream/dvbin.h3
-rw-r--r--stream/rar.c6
-rw-r--r--stream/rar.h2
-rw-r--r--stream/stream.c84
-rw-r--r--stream/stream.h10
-rw-r--r--stream/stream_bluray.c26
-rw-r--r--stream/stream_cdda.c16
-rw-r--r--stream/stream_dvb.c127
-rw-r--r--stream/stream_dvd.c152
-rw-r--r--stream/stream_dvd_common.c12
-rw-r--r--stream/stream_dvd_common.h3
-rw-r--r--stream/stream_dvdnav.c46
-rw-r--r--stream/stream_file.c12
-rw-r--r--stream/stream_lavf.c12
-rw-r--r--stream/stream_pvr.c219
-rw-r--r--stream/stream_radio.c106
-rw-r--r--stream/stream_rar.c4
-rw-r--r--stream/stream_smb.c8
-rw-r--r--stream/stream_vcd.c16
-rw-r--r--stream/vcd_read.h49
-rw-r--r--stream/vcd_read_darwin.h46
-rw-r--r--stream/vcd_read_fbsd.h29
-rw-r--r--stream/vcd_read_win32.h34
-rw-r--r--video/out/gl_lcms.c9
39 files changed, 557 insertions, 739 deletions
diff --git a/common/encode_lavc.c b/common/encode_lavc.c
index 18f6395b6d..1efe388507 100644
--- a/common/encode_lavc.c
+++ b/common/encode_lavc.c
@@ -399,8 +399,8 @@ static void encode_2pass_prepare(struct encode_lavc_context *ctx,
buf[sizeof(buf) - 1] = 0;
if (value_has_flag(de ? de->value : "", "pass2")) {
- if (!(*bytebuf = stream_open(buf, NULL))) {
- mp_msg(MSGT_ENCODE, MSGL_WARN, "%s: could not open '%s', "
+ if (!(*bytebuf = stream_open(buf, ctx->global))) {
+ MP_WARN(ctx, "%s: could not open '%s', "
"disabling 2-pass encoding at pass 2\n", prefix, buf);
stream->codec->flags &= ~CODEC_FLAG_PASS2;
set_to_avdictionary(ctx, dictp, "flags", "-pass2");
@@ -421,9 +421,8 @@ static void encode_2pass_prepare(struct encode_lavc_context *ctx,
}
if (value_has_flag(de ? de->value : "", "pass1")) {
- if (!(*bytebuf = open_output_stream(buf, NULL))) {
- mp_msg(
- MSGT_ENCODE, MSGL_WARN,
+ if (!(*bytebuf = open_output_stream(buf, ctx->global))) {
+ MP_WARN(ctx,
"%s: could not open '%s', disabling "
"2-pass encoding at pass 1\n",
prefix, ctx->avc->filename);
diff --git a/common/playlist_parser.c b/common/playlist_parser.c
index f33f7204b6..2e06009db5 100644
--- a/common/playlist_parser.c
+++ b/common/playlist_parser.c
@@ -499,7 +499,7 @@ struct playlist *playlist_parse_file(const char *file, struct mpv_global *global
{
struct mp_log *log = mp_log_new(NULL, global->log, "!playlist_parser");
struct playlist *ret = NULL;
- stream_t *stream = stream_open(file, global->opts);
+ stream_t *stream = stream_open(file, global);
if(!stream) {
mp_err(log, "Error while opening playlist file %s: %s\n",
file, strerror(errno));
diff --git a/demux/demux_mf.c b/demux/demux_mf.c
index 1d80cfaa85..1284c7fd7f 100644
--- a/demux/demux_mf.c
+++ b/demux/demux_mf.c
@@ -68,7 +68,7 @@ static int demux_mf_fill_buffer(demuxer_t *demuxer)
if (!stream) {
char *filename = mf->names[mf->curr_frame];
if (filename)
- stream = stream_open(filename, demuxer->opts);
+ stream = stream_open(filename, demuxer->global);
}
if (stream) {
diff --git a/input/input.c b/input/input.c
index 8dd8e76bd8..8756985793 100644
--- a/input/input.c
+++ b/input/input.c
@@ -2208,7 +2208,7 @@ static int parse_config_file(struct input_ctx *ictx, char *file, bool warn)
"Input config file %s not found.\n", file);
goto done;
}
- s = stream_open(file, NULL);
+ s = stream_open(file, ictx->global);
if (!s) {
MP_ERR(ictx, "Can't open input config file %s.\n", file);
goto done;
diff --git a/player/loadfile.c b/player/loadfile.c
index 1d668b9c2c..63c83e64e4 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -724,7 +724,7 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename,
char *disp_filename = filename;
if (strncmp(disp_filename, "memory://", 9) == 0)
disp_filename = "memory://"; // avoid noise
- struct stream *stream = stream_open(filename, mpctx->opts);
+ struct stream *stream = stream_open(filename, mpctx->global);
if (!stream)
goto err_out;
stream_enable_cache_percent(&stream, stream_cache,
@@ -1046,7 +1046,7 @@ static void play_current_file(struct MPContext *mpctx)
}
stream_filename = mpctx->resolve_result->url;
}
- mpctx->stream = stream_open(stream_filename, opts);
+ mpctx->stream = stream_open(stream_filename, mpctx->global);
if (!mpctx->stream) { // error...
demux_was_interrupted(mpctx);
goto terminate_playback;
diff --git a/player/timeline/tl_cue.c b/player/timeline/tl_cue.c
index 80eaf5ef76..6731ab4058 100644
--- a/player/timeline/tl_cue.c
+++ b/player/timeline/tl_cue.c
@@ -188,7 +188,7 @@ static bool try_open(struct MPContext *mpctx, char *filename)
|| bstrcasecmp(bstr0(mpctx->demuxer->filename), bfilename) == 0)
return false;
- struct stream *s = stream_open(filename, mpctx->opts);
+ struct stream *s = stream_open(filename, mpctx->global);
if (!s)
return false;
struct demuxer *d = demux_open(s, NULL, NULL, mpctx->global);
diff --git a/player/timeline/tl_matroska.c b/player/timeline/tl_matroska.c
index 720bd3f979..59dc024e14 100644
--- a/player/timeline/tl_matroska.c
+++ b/player/timeline/tl_matroska.c
@@ -127,7 +127,7 @@ static int enable_cache(struct MPContext *mpctx, struct stream **stream,
free_demuxer(*demuxer);
free_stream(*stream);
- *stream = stream_open(filename, opts);
+ *stream = stream_open(filename, mpctx->global);
if (!*stream) {
talloc_free(filename);
return -1;
@@ -174,7 +174,7 @@ static bool check_file_seg(struct MPContext *mpctx, struct demuxer ***sources,
.matroska_wanted_segment = segment,
.matroska_was_valid = &was_valid,
};
- struct stream *s = stream_open(filename, mpctx->opts);
+ struct stream *s = stream_open(filename, mpctx->global);
if (!s)
return false;
struct demuxer *d = demux_open(s, "mkv", &params, mpctx->global);
diff --git a/player/timeline/tl_mpv_edl.c b/player/timeline/tl_mpv_edl.c
index b256e0bdd5..651c937c23 100644
--- a/player/timeline/tl_mpv_edl.c
+++ b/player/timeline/tl_mpv_edl.c
@@ -123,7 +123,7 @@ static struct demuxer *open_file(char *filename, struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
struct demuxer *d = NULL;
- struct stream *s = stream_open(filename, opts);
+ struct stream *s = stream_open(filename, mpctx->global);
if (s) {
stream_enable_cache_percent(&s,
opts->stream_cache_size,
diff --git a/stream/cache.c b/stream/cache.c
index 5f01275674..e622ae9af8 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -73,6 +73,8 @@ struct priv {
int64_t seek_limit; // keep filling cache if distance is less that seek limit
struct byte_meta *bm; // additional per-byte metadata
+ struct mp_log *log;
+
// Owned by the main thread
stream_t *cache; // wrapper stream, used by demuxer etc.
@@ -142,10 +144,9 @@ static int cache_wakeup_and_wait(struct priv *s, double *retry_time)
// Print a "more severe" warning after waiting 1 second and no new data
if ((*retry_time) >= 1.0) {
- mp_msg(MSGT_CACHE, MSGL_ERR, "Cache keeps not responding.\n");
+ MP_ERR(s, "Cache keeps not responding.\n");
} else if (*retry_time > 0.1) {
- mp_msg(MSGT_CACHE, MSGL_WARN,
- "Cache is not responding - slow/stuck network connection?\n");
+ MP_WARN(s, "Cache is not responding - slow/stuck network connection?\n");
}
double start = mp_time_sec();
@@ -211,14 +212,13 @@ static bool cache_fill(struct priv *s)
if (read < s->min_filepos || read > s->max_filepos) {
// seek...
- mp_msg(MSGT_CACHE, MSGL_DBG2,
- "Out of boundaries... seeking to %" PRId64 " \n", read);
+ MP_DBG(s, "Out of boundaries... seeking to %" PRId64 " \n", read);
// drop cache contents only if seeking backward or too much fwd.
// This is also done for on-disk files, since it loses the backseek cache.
// That in turn can cause major bandwidth increase and performance
// issues with e.g. mov or badly interleaved files
if (read < s->min_filepos || read >= s->max_filepos + s->seek_limit) {
- mp_msg(MSGT_CACHE, MSGL_V, "Dropping cache at pos %"PRId64", "
+ MP_VERBOSE(s, "Dropping cache at pos %"PRId64", "
"cached range: %"PRId64"-%"PRId64".\n", read,
s->min_filepos, s->max_filepos);
cache_drop_contents(s);
@@ -280,7 +280,7 @@ static bool cache_fill(struct priv *s)
s->idle = s->eof;
s->reads++;
if (s->eof)
- mp_msg(MSGT_CACHE, MSGL_V, "EOF reached.\n");
+ MP_VERBOSE(s, "EOF reached.\n");
pthread_cond_signal(&s->wakeup);
@@ -404,10 +404,10 @@ static void cache_execute_control(struct priv *s)
bool pos_changed = old_pos != stream_tell(s->stream);
bool ok = s->control_res == STREAM_OK;
if (pos_changed && !ok) {
- mp_msg(MSGT_STREAM, MSGL_ERR, "STREAM_CTRL changed stream pos but "
+ MP_ERR(s, "STREAM_CTRL changed stream pos but "
"returned error, this is not allowed!\n");
} else if (pos_changed || (ok && control_needs_flush(s->control))) {
- mp_msg(MSGT_CACHE, MSGL_V, "Dropping cache due to control()\n");
+ MP_VERBOSE(s, "Dropping cache due to control()\n");
s->read_filepos = stream_tell(s->stream);
s->control_flush = true;
cache_drop_contents(s);
@@ -442,7 +442,7 @@ static void *cache_thread(void *arg)
}
pthread_cond_signal(&s->wakeup);
pthread_mutex_unlock(&s->mutex);
- mp_msg(MSGT_CACHE, MSGL_V, "Cache exiting...\n");
+ MP_VERBOSE(s, "Cache exiting...\n");
return NULL;
}
@@ -454,8 +454,7 @@ static int cache_fill_buffer(struct stream *cache, char *buffer, int max_len)
pthread_mutex_lock(&s->mutex);
if (cache->pos != s->read_filepos)
- mp_msg(MSGT_CACHE, MSGL_ERR,
- "!!! read_filepos differs !!! report this bug...\n");
+ MP_ERR(s, "!!! read_filepos differs !!! report this bug...\n");
int t = cache_read(s, buffer, max_len);
// wakeup the cache thread, possibly make it read more data ahead
@@ -471,7 +470,7 @@ static int cache_seek(stream_t *cache, int64_t pos)
pthread_mutex_lock(&s->mutex);
- mp_msg(MSGT_CACHE, MSGL_DBG2, "request seek: %" PRId64 " <= to=%" PRId64
+ MP_DBG(s, "request seek: %" PRId64 " <= to=%" PRId64
" (cur=%" PRId64 ") <= %" PRId64 " \n",
s->min_filepos, pos, s->read_filepos, s->max_filepos);
@@ -496,7 +495,7 @@ static int cache_control(stream_t *cache, int cmd, void *arg)
if (r != STREAM_ERROR)
goto done;
- mp_msg(MSGT_CACHE, MSGL_V, "[cache] blocking for STREAM_CTRL %d\n", cmd);
+ MP_VERBOSE(s, "[cache] blocking for STREAM_CTRL %d\n", cmd);
s->control = cmd;
s->control_arg = arg;
@@ -524,7 +523,7 @@ static void cache_uninit(stream_t *cache)
{
struct priv *s = cache->priv;
if (s->cache_thread_running) {
- mp_msg(MSGT_CACHE, MSGL_V, "Terminating cache...\n");
+ MP_VERBOSE(s, "Terminating cache...\n");
pthread_mutex_lock(&s->mutex);
s->control = CACHE_CTRL_QUIT;
pthread_cond_signal(&s->wakeup);
@@ -546,16 +545,16 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
if (size < 1)
return -1;
- mp_msg(MSGT_NETWORK, MSGL_INFO, "Cache size set to %" PRId64 " KiB\n",
+ MP_INFO(cache, "Cache size set to %" PRId64 " KiB\n",
size / 1024);
if (size > SIZE_MAX) {
- mp_msg(MSGT_CACHE, MSGL_FATAL,
- "Cache size larger than max. allocation size\n");
+ MP_FATAL(cache, "Cache size larger than max. allocation size\n");
return -1;
}
struct priv *s = talloc_zero(NULL, struct priv);
+ s->log = cache->log;
//64kb min_size
s->fill_limit = FFMAX(16 * 1024, BYTE_META_CHUNK_SIZE * 2);
@@ -566,7 +565,7 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
s->bm = malloc((s->buffer_size / BYTE_META_CHUNK_SIZE + 2) *
sizeof(struct byte_meta));
if (!s->buffer || !s->bm) {
- mp_msg(MSGT_CACHE, MSGL_ERR, "Failed to allocate cache buffer.\n");
+ MP_ERR(s, "Failed to allocate cache buffer.\n");
free(s->buffer);
free(s->bm);
talloc_free(s);
@@ -594,7 +593,7 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
min = s->buffer_size - s->fill_limit;
if (pthread_create(&s->cache_thread, NULL, cache_thread, s) != 0) {
- mp_msg(MSGT_CACHE, MSGL_ERR, "Starting cache process/thread failed: %s.\n",
+ MP_ERR(s, "Starting cache process/thread failed: %s.\n",
strerror(errno));
return -1;
}
@@ -610,7 +609,7 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
break;
if (stream_control(s->cache, STREAM_CTRL_GET_CACHE_IDLE, &idle) < 0)
break;
- mp_msg(MSGT_CACHE, MSGL_STATUS, "\rCache fill: %5.2f%% "
+ MP_INFO(s, "\rCache fill: %5.2f%% "
"(%" PRId64 " bytes) ", 100.0 * fill / s->buffer_size, fill);
if (fill >= min)
break;
@@ -623,6 +622,6 @@ int stream_cache_init(stream_t *cache, stream_t *stream, int64_t size,
cache_wakeup_and_wait(s, &(double){0});
pthread_mutex_unlock(&s->mutex);
}
- mp_msg(MSGT_CACHE, MSGL_STATUS, "\n");
+ MP_INFO(s, "\n");
return 1;
}
diff --git a/stream/cdd.h b/stream/cdd.h
index e44b2ae24a..93b3dfb2b2 100644
--- a/stream/cdd.h
+++ b/stream/cdd.h
@@ -21,6 +21,8 @@
#include <sys/types.h>
+struct mp_log;
+
typedef struct cd_track {
char *name;
unsigned int track_nb;
@@ -51,6 +53,6 @@ void cd_info_free(cd_info_t *cd_info);
cd_track_t* cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length);
cd_track_t* cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb);
-void cd_info_debug(cd_info_t *cd_info);
+void cd_info_debug(cd_info_t *cd_info, struct mp_log *log);
#endif /* MPLAYER_CDD_H */
diff --git a/stream/cdinfo.c b/stream/cdinfo.c
index 6398809a0a..2e6e34b1be 100644
--- a/stream/cdinfo.c
+++ b/stream/cdinfo.c
@@ -40,7 +40,6 @@ cd_info_new(void) {
cd_info = malloc(sizeof(cd_info_t));
if( cd_info==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
return NULL;
}
@@ -74,14 +73,12 @@ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, u
cd_track = malloc(sizeof(cd_track_t));
if( cd_track==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
return NULL;
}
memset(cd_track, 0, sizeof(cd_track_t));
cd_track->name = malloc(strlen(track_name)+1);
if( cd_track->name==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
free(cd_track);
return NULL;
}
@@ -126,32 +123,32 @@ cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb) {
return NULL;
}
-void
-cd_info_debug(cd_info_t *cd_info) {
+void cd_info_debug(cd_info_t *cd_info, struct mp_log *log)
+{
cd_track_t *current_track;
- mp_msg(MSGT_DEMUX, MSGL_INFO, "================ CD INFO === start =========\n");
+ mp_info(log, "================ CD INFO === start =========\n");
if( cd_info==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_INFO, "cd_info is NULL\n");
+ mp_info(log, "cd_info is NULL\n");
return;
}
- mp_msg(MSGT_DEMUX, MSGL_INFO, " artist=[%s]\n", cd_info->artist);
- mp_msg(MSGT_DEMUX, MSGL_INFO, " album=[%s]\n", cd_info->album);
- mp_msg(MSGT_DEMUX, MSGL_INFO, " genre=[%s]\n", cd_info->genre);
- mp_msg(MSGT_DEMUX, MSGL_INFO, " nb_tracks=%d\n", cd_info->nb_tracks);
- mp_msg(MSGT_DEMUX, MSGL_INFO, " length= %2d:%02d.%02d\n", cd_info->min, cd_info->sec, cd_info->msec);
-
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_ARTIST=%s\n", cd_info->artist);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_ALBUM=%s\n", cd_info->album);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_GENRE=%s\n", cd_info->genre);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_LENGTH_MSF=%02d:%02d.%02d\n", cd_info->min, cd_info->sec, cd_info->msec);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_TRACKS=%d\n", cd_info->nb_tracks);
+ mp_info(log, " artist=[%s]\n", cd_info->artist);
+ mp_info(log, " album=[%s]\n", cd_info->album);
+ mp_info(log, " genre=[%s]\n", cd_info->genre);
+ mp_info(log, " nb_tracks=%d\n", cd_info->nb_tracks);
+ mp_info(log, " length= %2d:%02d.%02d\n", cd_info->min, cd_info->sec, cd_info->msec);
+
+ mp_info(log, "ID_CDDB_INFO_ARTIST=%s\n", cd_info->artist);
+ mp_info(log, "ID_CDDB_INFO_ALBUM=%s\n", cd_info->album);
+ mp_info(log, "ID_CDDB_INFO_GENRE=%s\n", cd_info->genre);
+ mp_info(log, "ID_CDDB_INFO_LENGTH_MSF=%02d:%02d.%02d\n", cd_info->min, cd_info->sec, cd_info->msec);
+ mp_info(log, "ID_CDDB_INFO_TRACKS=%d\n", cd_info->nb_tracks);
current_track = cd_info->first;
while( current_track!=NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_INFO, " #%2d %2d:%02d.%02d @ %7ld\t[%s] \n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec, current_track->frame_begin, current_track->name);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_TRACK_%d_NAME=%s\n", current_track->track_nb, current_track->name);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CDDB_INFO_TRACK_%d_MSF=%02d:%02d.%02d\n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec);
+ mp_info(log, " #%2d %2d:%02d.%02d @ %7ld\t[%s] \n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec, current_track->frame_begin, current_track->name);
+ mp_info(log, "ID_CDDB_INFO_TRACK_%d_NAME=%s\n", current_track->track_nb, current_track->name);
+ mp_info(log, "ID_CDDB_INFO_TRACK_%d_MSF=%02d:%02d.%02d\n", current_track->track_nb, current_track->min, current_track->sec, current_track->msec);
current_track = current_track->next;
}
- mp_msg(MSGT_DEMUX, MSGL_INFO, "================ CD INFO === end =========\n");
+ mp_info(log, "================ CD INFO === end =========\n");
}
diff --git a/stream/cookies.c b/stream/cookies.c
index 3fcf11b68f..f29db88b57 100644
--- a/stream/cookies.c
+++ b/stream/cookies.c
@@ -92,40 +92,40 @@ static int parse_line(char **ptr, char *cols[6])
}
/* Loads a file into RAM */
-static char *load_file(const char *filename, int64_t * length)
+static char *load_file(struct mp_log *log, const char *filename, int64_t * length)
{
int fd;
char *buffer = NULL;
- mp_msg(MSGT_NETWORK, MSGL_V, "Loading cookie file: %s\n", filename);
+ mp_verbose(log, "Loading cookie file: %s\n", filename);
fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
- mp_msg(MSGT_NETWORK, MSGL_V, "Could not open");
+ mp_verbose(log, "Could not open");
goto err_out;
}
*length = lseek(fd, 0, SEEK_END);
if (*length < 0) {
- mp_msg(MSGT_NETWORK, MSGL_V, "Could not find EOF");
+ mp_verbose(log, "Could not find EOF");
goto err_out;
}
if (*length > SIZE_MAX - 1) {
- mp_msg(MSGT_NETWORK, MSGL_V, "File too big, could not malloc.");
+ mp_verbose(log, "File too big, could not malloc.");
goto err_out;
}
lseek(fd, 0, SEEK_SET);
if (!(buffer = malloc(*length + 1))) {
- mp_msg(MSGT_NETWORK, MSGL_V, "Could not malloc.");
+ mp_verbose(log, "Could not malloc.");
goto err_out;
}
if (read(fd, buffer, *length) != *length) {
- mp_msg(MSGT_NETWORK, MSGL_V, "Read is behaving funny.");
+ mp_verbose(log, "Read is behaving funny.");
goto err_out;
}
close(fd);
@@ -140,14 +140,15 @@ err_out:
}
/* Loads a cookies.txt file into a linked list. */
-static struct cookie_list_type *load_cookies_from(const char *filename,
+static struct cookie_list_type *load_cookies_from(struct mp_log *log,
+ const char *filename,
struct cookie_list_type
*list)
{
char *ptr, *file;
int64_t length;
- ptr = file = load_file(filename, &length);
+ ptr = file = load_file(log, filename, &length);
if (!ptr)
return list;
@@ -169,22 +170,13 @@ static struct cookie_list_type *load_cookies_from(const char *filename,
return list;
}
-/* Attempt to load cookies.txt. Returns a pointer to the linked list contain the cookies. */
-static struct cookie_list_type *load_cookies(void)
-{
- if (cookies_file)
- return load_cookies_from(cookies_file, NULL);
-
- return NULL;
-}
-
// Return a cookies string as expected by lavf (libavformat/http.c). The format
// is like a Set-Cookie header (http://curl.haxx.se/rfc/cookie_spec.html),
// separated by newlines.
-char *cookies_lavf(void)
+char *cookies_lavf(struct mp_log *log)
{
- if (!cookie_list)
- cookie_list = load_cookies();
+ if (!cookie_list && cookies_file)
+ cookie_list = load_cookies_from(log, cookies_file, NULL);
struct cookie_list_type *list = cookie_list;
char *res = talloc_strdup(NULL, "");
diff --git a/stream/cookies.h b/stream/cookies.h
index e8b548c112..86c1e3bce9 100644
--- a/stream/cookies.h
+++ b/stream/cookies.h
@@ -24,6 +24,6 @@
#ifndef MPLAYER_COOKIES_H
#define MPLAYER_COOKIES_H
-char *cookies_lavf(void);
+char *cookies_lavf(struct mp_log *log);
#endif /* MPLAYER_COOKIES_H */
diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c
index 0e40ea088f..0cf19a8fba 100644
--- a/stream/dvb_tune.c
+++ b/stream/dvb_tune.c
@@ -43,7 +43,7 @@
-int dvb_get_tuner_type(int fe_fd)
+int dvb_get_tuner_type(int fe_fd, struct mp_log *log)
{
struct dvb_frontend_info fe_info;
@@ -52,31 +52,31 @@ int dvb_get_tuner_type(int fe_fd)
res = ioctl(fe_fd, FE_GET_INFO, &fe_info);
if(res < 0)
{
- mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd);
+ mp_err(log, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd);
return 0;
}
switch(fe_info.type)
{
case FE_OFDM:
- mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-T\n");
+ mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-T\n");
return TUNER_TER;
case FE_QPSK:
- mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-S\n");
+ mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-S\n");
return TUNER_SAT;
case FE_QAM:
- mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n");
+ mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-C\n");
return TUNER_CBL;
#ifdef DVB_ATSC
case FE_ATSC:
- mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
+ mp_verbose(log, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
return TUNER_ATSC;
#endif
default:
- mp_msg(MSGT_DEMUX, MSGL_ERR, "UNKNOWN TUNER TYPE\n");
+ mp_err(log, "UNKNOWN TUNER TYPE\n");
return 0;
}
@@ -93,22 +93,22 @@ int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt)
priv->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
if(priv->fe_fd < 0)
{
- mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno);
+ MP_ERR(priv, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno);
return 0;
}
priv->demux_fds_cnt = 0;
- mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt);
+ MP_VERBOSE(priv, "DVB_OPEN_DEVICES(%d)\n", demux_cnt);
for(i = 0; i < demux_cnt; i++)
{
priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
if(priv->demux_fds[i] < 0)
{
- mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno);
+ MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno);
return 0;
}
else
{
- mp_msg(MSGT_DEMUX, MSGL_V, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev, priv->demux_fds[i], priv->demux_fds_cnt);
+ MP_VERBOSE(priv, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev, priv->demux_fds[i], priv->demux_fds_cnt);
priv->demux_fds_cnt++;
}
}
@@ -117,7 +117,7 @@ int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt)
priv->dvr_fd = open(dvr_dev, O_RDONLY| O_NONBLOCK | O_CLOEXEC);
if(priv->dvr_fd < 0)
{
- mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno);
+ MP_ERR(priv, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno);
return 0;
}
@@ -131,12 +131,12 @@ int dvb_fix_demuxes(dvb_priv_t *priv, int cnt)
char demux_dev[32];
sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", priv->card);
- mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt);
+ MP_VERBOSE(priv, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt);
if(priv->demux_fds_cnt >= cnt)
{
for(i = priv->demux_fds_cnt-1; i >= cnt; i--)
{
- mp_msg(MSGT_DEMUX, MSGL_V, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]);
+ MP_VERBOSE(priv, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]);
close(priv->demux_fds[i]);
}
priv->demux_fds_cnt = cnt;
@@ -146,10 +146,10 @@ int dvb_fix_demuxes(dvb_priv_t *priv, int cnt)
for(i = priv->demux_fds_cnt; i < cnt; i++)
{
priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
- mp_msg(MSGT_DEMUX, MSGL_V, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]);
+ MP_VERBOSE(priv, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]);
if(priv->demux_fds