summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-16 22:07:48 +0200
committerwm4 <wm4@nowhere>2013-06-16 22:07:48 +0200
commitd81b71c7f7cb6f5b3a047fbfeeb41d4888e7c5b6 (patch)
tree0d50b238c1a798db9ef09838800c99653c06e408 /core
parent4d3a2c7e0dac38546f5fc2c7737a6ec1f09e30f6 (diff)
parentf794444309a826478fefa00bf13d660793066b81 (diff)
downloadmpv-d81b71c7f7cb6f5b3a047fbfeeb41d4888e7c5b6.tar.bz2
mpv-d81b71c7f7cb6f5b3a047fbfeeb41d4888e7c5b6.tar.xz
Merge branch 'cache_new'
Diffstat (limited to 'core')
-rw-r--r--core/mplayer.c39
-rw-r--r--core/options.c3
-rw-r--r--core/timeline/tl_matroska.c4
3 files changed, 22 insertions, 24 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index d38363b9ce..86260a0598 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -108,7 +108,6 @@
#ifdef CONFIG_DVBIN
#include "stream/dvbin.h"
#endif
-#include "stream/cache2.h"
//**************************************************************************//
// Playtree
@@ -137,10 +136,6 @@
#include "demux/demux.h"
#include "demux/stheader.h"
-#ifdef CONFIG_DVDREAD
-#include "stream/stream_dvd.h"
-#endif
-
#include "audio/filter/af.h"
#include "audio/decode/dec_audio.h"
#include "video/decode/dec_video.h"
@@ -938,13 +933,13 @@ static int find_new_tid(struct MPContext *mpctx, enum stream_type t)
// Map stream number (as used by libdvdread) to MPEG IDs (as used by demuxer).
static int map_id_from_demuxer(struct demuxer *d, enum stream_type type, int id)
{
- if (d->stream->type == STREAMTYPE_DVD && type == STREAM_SUB)
+ if (d->stream->uncached_type == STREAMTYPE_DVD && type == STREAM_SUB)
id = id & 0x1F;
return id;
}
static int map_id_to_demuxer(struct demuxer *d, enum stream_type type, int id)
{
- if (d->stream->type == STREAMTYPE_DVD && type == STREAM_SUB)
+ if (d->stream->uncached_type == STREAMTYPE_DVD && type == STREAM_SUB)
id = id | 0x20;
return id;
}
@@ -1013,9 +1008,9 @@ static void add_dvd_tracks(struct MPContext *mpctx)
#ifdef CONFIG_DVDREAD
struct demuxer *demuxer = mpctx->demuxer;
struct stream *stream = demuxer->stream;
- if (stream->type == STREAMTYPE_DVD) {
- int n_subs = dvd_number_of_subs(stream);
- for (int n = 0; n < n_subs; n++) {
+ struct stream_dvd_info_req info;
+ if (stream_control(stream, STREAM_CTRL_GET_DVD_INFO, &info) > 0) {
+ for (int n = 0; n < info.num_subs; n++) {
struct track *track = talloc_ptrtype(NULL, track);
*track = (struct track) {
.type = STREAM_SUB,
@@ -1963,7 +1958,11 @@ static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st
int width, int height)
{
#ifdef CONFIG_DVDREAD
- if (st->type != STREAMTYPE_DVD)
+ if (!st)
+ return;
+
+ struct stream_dvd_info_req info;
+ if (stream_control(st, STREAM_CTRL_GET_DVD_INFO, &info) < 0)
return;
struct mp_csp_params csp = MP_CSP_PARAMS_DEFAULTS;
@@ -1972,8 +1971,6 @@ static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st
float cmatrix[3][4];
mp_get_yuv2rgb_coeffs(&csp, cmatrix);
- int *palette = ((dvd_priv_t *)st->priv)->cur_pgc->palette;
-
if (width == 0 || height == 0) {
width = 720;
height = 480;
@@ -1983,7 +1980,7 @@ static void set_dvdsub_fake_extradata(struct dec_sub *dec_sub, struct stream *st
s = talloc_asprintf_append(s, "size: %dx%d\n", width, height);
s = talloc_asprintf_append(s, "palette: ");
for (int i = 0; i < 16; i++) {
- int color = palette[i];
+ int color = info.palette[i];
int c[3] = {(color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff};
mp_map_int_color(cmatrix, 8, c);
color = (c[2] << 16) | (c[1] << 8) | c[0];
@@ -3942,7 +3939,7 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename,
struct stream *stream = open_stream(filename, &mpctx->opts, &format);
if (!stream)
goto err_out;
- stream_enable_cache_percent(stream, stream_cache,
+ stream_enable_cache_percent(&stream, stream_cache,
opts->stream_cache_min_percent,
opts->stream_cache_seek_min_percent);
// deal with broken demuxers: preselect streams
@@ -4225,10 +4222,7 @@ static void play_current_file(struct MPContext *mpctx)
}
// CACHE2: initial prefill: 20% later: 5% (should be set by -cacheopts)
-#ifdef CONFIG_DVBIN
-goto_enable_cache: ;
-#endif
- int res = stream_enable_cache_percent(mpctx->stream,
+ int res = stream_enable_cache_percent(&mpctx->stream,
opts->stream_cache_size,
opts->stream_cache_min_percent,
opts->stream_cache_seek_min_percent);
@@ -4238,6 +4232,10 @@ goto_enable_cache: ;
stream_set_capture_file(mpctx->stream, opts->stream_capture);
+#ifdef CONFIG_DVBIN
+goto_reopen_demuxer: ;
+#endif
+
//============ Open DEMUXERS --- DETECT file type =======================
mpctx->audio_delay = opts->audio_delay;
@@ -4424,9 +4422,8 @@ goto_enable_cache: ;
if (mpctx->dvbin_reopen) {
mpctx->stop_play = 0;
uninit_player(mpctx, INITIALIZED_ALL - (INITIALIZED_STREAM | INITIALIZED_GETCH2 | (opts->fixed_vo ? INITIALIZED_VO : 0)));
- cache_uninit(mpctx->stream);
mpctx->dvbin_reopen = 0;
- goto goto_enable_cache;
+ goto goto_reopen_demuxer;
}
#endif
diff --git a/core/options.c b/core/options.c
index d3dd9d19c8..f3e262fc17 100644
--- a/core/options.c
+++ b/core/options.c
@@ -322,7 +322,8 @@ const m_option_t mp_opts[] = {
#ifdef CONFIG_STREAM_CACHE
OPT_CHOICE_OR_INT("cache", stream_cache_size, 0, 32, 0x7fffffff,
- ({"no", -1}),
+ ({"no", 0},
+ {"auto", -1}),
OPTDEF_INT(-1)),
OPT_FLOATRANGE("cache-min", stream_cache_min_percent, 0, 0, 99),
OPT_FLOATRANGE("cache-seek-min", stream_cache_seek_min_percent, 0, 0, 99),
diff --git a/core/timeline/tl_matroska.c b/core/timeline/tl_matroska.c
index 98ba635bec..11fcc67583 100644
--- a/core/timeline/tl_matroska.c
+++ b/core/timeline/tl_matroska.c
@@ -141,7 +141,7 @@ static int enable_cache(struct MPContext *mpctx, struct stream **stream,
return -1;
}
- stream_enable_cache_percent(*stream,
+ stream_enable_cache_percent(stream,
opts->stream_cache_size,
opts->stream_cache_min_percent,
opts->stream_cache_seek_min_percent);
@@ -230,7 +230,7 @@ static int find_ordered_chapter_sources(struct MPContext *mpctx,
char *main_filename = mpctx->demuxer->filename;
mp_msg(MSGT_CPLAYER, MSGL_INFO, "This file references data from "
"other sources.\n");
- if (mpctx->demuxer->stream->type != STREAMTYPE_FILE) {
+ if (mpctx->demuxer->stream->uncached_type != STREAMTYPE_FILE) {
mp_msg(MSGT_CPLAYER, MSGL_WARN, "Playback source is not a "
"normal disk file. Will not search for related files.\n");
} else {