Compare commits
44
Commits
harmony-port
...
v0.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b20c24413 | ||
|
|
5c42d1eb92 | ||
|
|
e34132f8d5 | ||
|
|
bd7ff23f96 | ||
|
|
e6c184e2b1 | ||
|
|
33c4920967 | ||
|
|
0c36f655e1 | ||
|
|
cd31697dd8 | ||
|
|
c497b82583 | ||
|
|
6f5dfb5102 | ||
|
|
59f970d492 | ||
|
|
29c74b42b4 | ||
|
|
4b2a3e50e2 | ||
|
|
35b01c9604 | ||
|
|
09b95257fe | ||
|
|
0cf2df38d1 | ||
|
|
4326fdfe2a | ||
|
|
9755850b3d | ||
|
|
96b50e770b | ||
|
|
9f6551160a | ||
|
|
89b854165e | ||
|
|
0beece4397 | ||
|
|
8abdf1f56e | ||
|
|
5a81f7678e | ||
|
|
e26286dfdb | ||
|
|
389232e5a2 | ||
|
|
c5de0b0a6c | ||
|
|
f9bdfc0782 | ||
|
|
5c9a7e24f6 | ||
|
|
b56f61d2ab | ||
|
|
82ab3a8160 | ||
|
|
e371f2ebd3 | ||
|
|
29b68d69c0 | ||
|
|
6c770eb6df | ||
|
|
965f336917 | ||
|
|
47fae324c7 | ||
|
|
6ab0dbf2ed | ||
|
|
c002196ffe | ||
|
|
3c8fc4588d | ||
|
|
416015f059 | ||
|
|
773db053aa | ||
|
|
a8c09d003f | ||
|
|
1284a6b6b0 | ||
|
|
78c35e42ea |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@ LUA SCRIPTING
|
||||
|
||||
mpv can load Lua scripts. These scripts can be used to control mpv in a similar
|
||||
way to slave mode. mpv provides the builtin module ``mp`` (can be loaded
|
||||
with ``require 'mpv'``), which provides functions to send commands to the
|
||||
with ``require 'mp'``), which provides functions to send commands to the
|
||||
mpv core and to retrieve information about playback state, user settings,
|
||||
file information, and so on.
|
||||
|
||||
|
||||
@@ -1369,8 +1369,7 @@ OPTIONS
|
||||
:trace: very noisy debug messages
|
||||
|
||||
One special case is the ``identify`` module name. This is silenced by
|
||||
default, and can be set to ``trace`` level to enable the remains of the
|
||||
code once enabled with the ``-identify`` option.
|
||||
default, and can be enabled with the ``-identify`` option.
|
||||
|
||||
``--msgmodule``
|
||||
Prepend module name in front of each console message.
|
||||
@@ -1609,6 +1608,9 @@ OPTIONS
|
||||
controls how much of the image is cropped. May not work with all video
|
||||
output drivers.
|
||||
|
||||
``--pause``
|
||||
Start the player in paused state.
|
||||
|
||||
``--playing-msg=<string>``
|
||||
Print out a string after starting playback. The string is expanded for
|
||||
properties, e.g. ``--playing-msg='file: ${filename}'`` will print the string
|
||||
@@ -2023,8 +2025,10 @@ OPTIONS
|
||||
the top of the screen) alongside the normal subtitle, and provides a way
|
||||
to render two subtitles at once.
|
||||
|
||||
there are some caveats associated with this feature. For example, secondary
|
||||
subtitles are never shown on the terminal if video is disabled.
|
||||
there are some caveats associated with this feature. For example, bitmap
|
||||
subtitles will always be rendered in their usual position, so selecting a
|
||||
bitmap subtitle as secondary subtitle will result in overlapping subtitles.
|
||||
Secondary subtitles are never shown on the terminal if video is disabled.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
+2
-2
@@ -429,7 +429,7 @@ Available filters are:
|
||||
``'--vf=lavfi=yadif:o="threads=2,thread_type=slice"'``
|
||||
forces a specific threading configuration.
|
||||
|
||||
``noise[=<strength>[:average][:pattern][:temporal][:uniform][:hq]``
|
||||
``noise[=<strength>[:averaged][:pattern][:temporal][:uniform][:hq]``
|
||||
Adds noise.
|
||||
|
||||
``strength``
|
||||
@@ -438,7 +438,7 @@ Available filters are:
|
||||
(using ``--vf=lavfi=[noise=...]``), or tell the libavfilter developers
|
||||
to stop being stupid.
|
||||
|
||||
``average``
|
||||
``averaged``
|
||||
averaged temporal noise (smoother, but a lot slower)
|
||||
|
||||
``pattern``
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
Changes
|
||||
-------
|
||||
|
||||
- Build system switches to waf. The old build system is still available by
|
||||
running ``./old-configure``, but it will be removed some time in the future.
|
||||
- The "run" input command changes in a not backwards compatible way.
|
||||
- Some input.conf commands were replaced (such as speed_mult).
|
||||
- Many audio/video filter have changed sub-options in a not backwards
|
||||
compatible way. (This is a consequence of unifying audio/video filter
|
||||
option parsing.)
|
||||
- Most video filters now use libavfilter internally if available.
|
||||
- Disable key autorepeat for some key binds, which prevents accidentally
|
||||
triggering a binding multiple times.
|
||||
- Encoding: install and include encoding profiles by default.
|
||||
|
||||
Bug fixes
|
||||
---------
|
||||
|
||||
- Fix a bug that degraded vdpau playback after ~1 hour of runtime.
|
||||
- Restrict hardware decoding to codecs where it generally makes sense. This
|
||||
excludes mpeg4 for example, which often causes hardware decoders to decode to
|
||||
garbage. Use ``--hwdec-codecs`` to enable hardware decoding for more codecs.
|
||||
|
||||
New features
|
||||
------------
|
||||
|
||||
- Add window-scale property, which allows changing the window size via mpv key
|
||||
bindings.
|
||||
- Add revert_seek command, which is meant to undo accidental seeks.
|
||||
- Hardware decoding (vdpau, vda, vaapi) can now be used with vo_opengl.
|
||||
- Pulseaudio: set pulse stream name to mpv window title (like MPlayer).
|
||||
- Support showing 2 subtitles at a time (``--secondary-sid``).
|
||||
- Re-add some basic ``dvdnav://`` support. This doesn't handle navigation
|
||||
highlights correctly, but navigation should mostly work. (Note that
|
||||
``dvdnav://`` by default starts the longest title, instead of the DVD menu.
|
||||
The menu is available with ``dvdnav://menu``.)
|
||||
- Win32: you can drop files on the mpv window.
|
||||
|
||||
This listing is not complete. There are many more bug fixes and changes. The
|
||||
complete change log can be viewed by running ``git log f572d2..f06a87`` in
|
||||
the git repository.
|
||||
@@ -15,6 +15,9 @@
|
||||
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libavutil/mem.h>
|
||||
@@ -145,6 +148,8 @@ static void mp_audio_destructor(void *ptr)
|
||||
void mp_audio_realloc(struct mp_audio *mpa, int samples)
|
||||
{
|
||||
assert(samples >= 0);
|
||||
if (samples >= INT_MAX / mpa->sstride)
|
||||
abort(); // oom
|
||||
int size = MPMAX(samples * mpa->sstride, 1);
|
||||
for (int n = 0; n < mpa->num_planes; n++) {
|
||||
if (size != mpa->allocated[n]) {
|
||||
|
||||
+4
-5
@@ -585,9 +585,11 @@ static void audio_resume(struct ao *ao)
|
||||
|
||||
if (snd_pcm_state(p->alsa) == SND_PCM_STATE_SUSPENDED) {
|
||||
MP_INFO(ao, "PCM in suspend mode, trying to resume.\n");
|
||||
|
||||
while ((err = snd_pcm_resume(p->alsa)) == -EAGAIN)
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if (p->can_pause) {
|
||||
err = snd_pcm_pause(p->alsa, 0);
|
||||
CHECK_ALSA_ERROR("pcm resume error");
|
||||
@@ -639,11 +641,8 @@ static int play(struct ao *ao, void **data, int samples, int flags)
|
||||
/* nothing to do */
|
||||
res = 0;
|
||||
} else if (res == -ESTRPIPE) { /* suspend */
|
||||
MP_INFO(ao, "PCM in suspend mode, trying to resume.\n");
|
||||
while ((res = snd_pcm_resume(p->alsa)) == -EAGAIN)
|
||||
sleep(1);
|
||||
}
|
||||
if (res < 0) {
|
||||
audio_resume(ao);
|
||||
} else if (res < 0) {
|
||||
MP_ERR(ao, "Write error: %s\n", snd_strerror(res));
|
||||
res = snd_pcm_prepare(p->alsa);
|
||||
int err = res;
|
||||
|
||||
@@ -19,5 +19,14 @@
|
||||
// At this point both gcc and clang had __sync_synchronize support for some
|
||||
// time. We only support a full memory barrier.
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_ATOMIC_BUILTINS
|
||||
# define mp_memory_barrier() __atomic_thread_fence(__ATOMIC_SEQ_CST)
|
||||
# define mp_atomic_add_and_fetch(a, b) __atomic_add_fetch(a, b,__ATOMIC_SEQ_CST)
|
||||
#elif HAVE_SYNC_BUILTINS
|
||||
# define mp_memory_barrier() __sync_synchronize()
|
||||
# define mp_atomic_add_and_fetch(a, b) __sync_add_and_fetch(a, b)
|
||||
#else
|
||||
# error "this should have been a configuration error, report a bug please"
|
||||
#endif
|
||||
@@ -152,6 +152,7 @@ struct demuxer_params {
|
||||
int matroska_wanted_segment;
|
||||
bool *matroska_was_valid;
|
||||
struct ass_library *ass_library;
|
||||
bool expect_subtitle;
|
||||
};
|
||||
|
||||
typedef struct demuxer {
|
||||
|
||||
@@ -1337,6 +1337,9 @@ static int d_open_file(struct demuxer *demuxer, enum demux_check check)
|
||||
if (check > DEMUX_CHECK_REQUEST)
|
||||
return -1;
|
||||
|
||||
if (!demuxer->params || !demuxer->params->expect_subtitle)
|
||||
return -1;
|
||||
|
||||
struct stream *ps = read_probe_stream(demuxer->stream, PROBE_SIZE);
|
||||
|
||||
struct subreader sr;
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
Type=Application
|
||||
Name=mpv Media Player
|
||||
Name[ca]=Reproductor multimèdia mpv
|
||||
Name[cs]=mpv přehrávač
|
||||
Name[pl]=mpv odtwarzacz multimedialny
|
||||
Name[ru]=Проигрыватель mpv
|
||||
GenericName=Multimedia player
|
||||
GenericName[cs]=Multimediální přehrávač
|
||||
Comment=Play movies and songs
|
||||
Comment[ca]=Reproduïu vídeos i cançons
|
||||
Comment[cs]=Přehrává filmy a hudbu
|
||||
Comment[de]=Filme und Musik abspielen
|
||||
Comment[es]=Reproduzca vídeos y canciones
|
||||
Comment[fr]=Lecteur multimédia
|
||||
|
||||
@@ -1329,6 +1329,38 @@ if test "$_pthreads" = no ; then
|
||||
die "Unable to find pthreads support."
|
||||
fi
|
||||
|
||||
|
||||
echocheck "compiler support for __atomic built-ins"
|
||||
_atomic=no
|
||||
for _ld_tmp in "" "-latomic" ; do
|
||||
statement_check stdint.h 'int64_t test = 0; test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)' $_ld_tmp &&
|
||||
libs_mplayer="$libs_mplayer $_ld_tmp" && _atomic=yes && break
|
||||
done
|
||||
if test "$_atomic" = yes ; then
|
||||
def_atomic="#define HAVE_ATOMIC_BUILTINS 1"
|
||||
else
|
||||
def_atomic="#define HAVE_ATOMIC_BUILTINS 0"
|
||||
fi
|
||||
echores "$_atomic"
|
||||
|
||||
if test "$_atomic" = no ; then
|
||||
echocheck "compiler support for __sync built-ins"
|
||||
_sync=no
|
||||
statement_check stdint.h 'int64_t test = 0; test = __sync_add_and_fetch(&test, 1)' && _sync=yes
|
||||
if test "$_sync" = yes ; then
|
||||
def_sync="#define HAVE_SYNC_BUILTINS 1"
|
||||
else
|
||||
def_sync="#define HAVE_SYNC_BUILTINS 0"
|
||||
fi
|
||||
echores "$_sync"
|
||||
else
|
||||
def_sync="#define HAVE_SYNC_BUILTINS 0"
|
||||
fi
|
||||
|
||||
if test "$_atomic" = no && test "$_sync" = no ; then
|
||||
die "your compiler must support either __atomic or __sync built-ins."
|
||||
fi
|
||||
|
||||
if test "$_pthreads" = yes ; then
|
||||
|
||||
# Cargo-cult for -lrt, which is needed on not so recent glibc version for
|
||||
@@ -3521,6 +3553,8 @@ $def_avresample_has_set_channel_mapping
|
||||
|
||||
$def_fast_64bit
|
||||
$def_pthreads
|
||||
$def_atomic
|
||||
$def_sync
|
||||
|
||||
#define HAVE_INLINE_ASM 1
|
||||
|
||||
|
||||
@@ -1299,6 +1299,17 @@ static int parse_msglevels(struct mp_log *log, const m_option_t *opt,
|
||||
if (param.start == NULL)
|
||||
return M_OPT_MISSING_PARAM;
|
||||
|
||||
if (bstr_equals0(param, "help")) {
|
||||
mp_info(log, "Syntax: --msglevel=module1=level:module2=level:...\n"
|
||||
"'module' is output prefix as shown with -v, or a prefix\n"
|
||||
"of it. level is one of:\n\n"
|
||||
" fatal error warn info status v debug trace\n\n"
|
||||
"The level specifies the minimum log level a message\n"
|
||||
"must have to be printed.\n"
|
||||
"The special module name 'all' affects all modules.\n");
|
||||
return M_OPT_EXIT;
|
||||
}
|
||||
|
||||
bstr s = param;
|
||||
while (1) {
|
||||
int res = mp_msg_split_msglevel(&s, &(bstr){0}, &(int){0});
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ char *mp_get_win_config_path(const char *filename)
|
||||
void *tmp = talloc_new(NULL);
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
if (SHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE, NULL,
|
||||
if (SHGetFolderPathW(NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE, NULL,
|
||||
SHGFP_TYPE_CURRENT, w_appdir) != S_OK)
|
||||
w_appdir[0] = '\0';
|
||||
#endif
|
||||
|
||||
+5
-1
@@ -3052,6 +3052,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
|
||||
case MP_CMD_RUN: {
|
||||
#ifndef __MINGW32__
|
||||
mp_msg(mpctx->statusline, MSGL_STATUS, "\n");
|
||||
char *args[MP_CMD_MAX_ARGS + 1] = {0};
|
||||
for (int n = 0; n < cmd->nargs; n++)
|
||||
args[n] = cmd->args[n].v.s;
|
||||
@@ -3062,7 +3063,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
// about having to wait for the second process to terminate.
|
||||
if (fork() == 0) {
|
||||
execvp(args[0], args);
|
||||
_exit(0);
|
||||
// mp_msg() is not safe to be called from a forked process.
|
||||
char s[] = "Executing program failed.\n";
|
||||
write(2, s, sizeof(s) - 1);
|
||||
_exit(1);
|
||||
}
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,13 @@ bool mp_parse_cfgfiles(struct MPContext *mpctx)
|
||||
bool r = true;
|
||||
char *conffile;
|
||||
|
||||
// The #if is a stupid hack to avoid errors if libavfilter is not available.
|
||||
#if HAVE_VF_LAVFI && HAVE_ENCODING
|
||||
conffile = mp_find_config_file(tmp, mpctx->global, "encoding-profiles.conf");
|
||||
if (conffile && mp_path_exists(conffile))
|
||||
m_config_parse_config_file(mpctx->mconfig, conffile, 0);
|
||||
#endif
|
||||
|
||||
if (m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mpv.conf", 0) < 0) {
|
||||
r = false;
|
||||
goto done;
|
||||
@@ -77,13 +84,6 @@ bool mp_parse_cfgfiles(struct MPContext *mpctx)
|
||||
}
|
||||
}
|
||||
|
||||
// The #if is a stupid hack to avoid errors if libavfilter is not available.
|
||||
#if HAVE_VF_LAVFI && HAVE_ENCODING
|
||||
conffile = mp_find_config_file(tmp, mpctx->global, "encoding-profiles.conf");
|
||||
if (conffile && mp_path_exists(conffile))
|
||||
m_config_parse_config_file(mpctx->mconfig, conffile, 0);
|
||||
#endif
|
||||
|
||||
done:
|
||||
talloc_free(tmp);
|
||||
return r;
|
||||
|
||||
@@ -128,6 +128,7 @@ struct track {
|
||||
|
||||
// If this track is from an external file (e.g. subtitle file).
|
||||
bool is_external;
|
||||
bool no_default; // pretend it's not external for auto-selection
|
||||
char *external_filename;
|
||||
bool auto_loaded;
|
||||
|
||||
|
||||
+1
-1
@@ -243,7 +243,7 @@ void mp_nav_get_highlight(struct osd_state *osd, struct mp_osd_res res,
|
||||
sub->y = nav->highlight[1];
|
||||
sub->w = MPCLAMP(nav->highlight[2] - sub->x, 0, sizes[0]);
|
||||
sub->h = MPCLAMP(nav->highlight[3] - sub->y, 0, sizes[1]);
|
||||
sub->stride = sub->w;
|
||||
sub->stride = sub->w * 4;
|
||||
out_imgs->format = SUBBITMAP_RGBA;
|
||||
out_imgs->parts = sub;
|
||||
out_imgs->num_parts = sub->w > 0 && sub->h > 0 && nav->hi_visible;
|
||||
|
||||
+11
-6
@@ -281,7 +281,7 @@ void reselect_demux_streams(struct MPContext *mpctx)
|
||||
// Note: we assume that all demuxer streams are covered by the track list.
|
||||
for (int t = 0; t < mpctx->num_tracks; t++) {
|
||||
struct track *track = mpctx->tracks[t];
|
||||
if (track->demuxer)
|
||||
if (track->demuxer && track->stream)
|
||||
demuxer_select_track(track->demuxer, track->stream, track->selected);
|
||||
}
|
||||
}
|
||||
@@ -508,7 +508,7 @@ static int match_lang(char **langs, char *lang)
|
||||
* lang is a string list, NULL is same as empty list
|
||||
* Sort tracks based on the following criteria, and pick the first:
|
||||
* 0) track matches tid (always wins)
|
||||
* 1) track is external
|
||||
* 1) track is external (no_default cancels this)
|
||||
* 1b) track was passed explicitly (is not an auto-loaded subtitle)
|
||||
* 2) earlier match in lang list
|
||||
* 3) track is marked default
|
||||
@@ -520,8 +520,10 @@ static int match_lang(char **langs, char *lang)
|
||||
// Return whether t1 is preferred over t2
|
||||
static bool compare_track(struct track *t1, struct track *t2, char **langs)
|
||||
{
|
||||
if (t1->is_external != t2->is_external)
|
||||
return t1->is_external;
|
||||
bool ext1 = t1->is_external && !t1->no_default;
|
||||
bool ext2 = t2->is_external && !t2->no_default;
|
||||
if (ext1 != ext2)
|
||||
return ext1;
|
||||
if (t1->auto_loaded != t2->auto_loaded)
|
||||
return !t1->auto_loaded;
|
||||
int l1 = match_lang(langs, t1->lang), l2 = match_lang(langs, t2->lang);
|
||||
@@ -549,7 +551,7 @@ static struct track *select_track(struct MPContext *mpctx,
|
||||
if (!pick || compare_track(track, pick, langs))
|
||||
pick = track;
|
||||
}
|
||||
if (pick && !select_fallback && !pick->is_external
|
||||
if (pick && !select_fallback && !(pick->is_external && !pick->no_default)
|
||||
&& !match_lang(langs, pick->lang) && !pick->default_track)
|
||||
pick = NULL;
|
||||
if (pick && pick->attached_picture && !mpctx->opts->audio_display)
|
||||
@@ -776,6 +778,7 @@ static struct track *open_external_file(struct MPContext *mpctx, char *filename,
|
||||
opts->stream_cache_seek_min_percent);
|
||||
struct demuxer_params params = {
|
||||
.ass_library = mpctx->ass_library, // demux_libass requires it
|
||||
.expect_subtitle = filter == STREAM_SUB,
|
||||
};
|
||||
struct demuxer *demuxer =
|
||||
demux_open(stream, demuxer_name, ¶ms, mpctx->global);
|
||||
@@ -838,8 +841,10 @@ static void open_subtitles_from_resolve(struct MPContext *mpctx)
|
||||
struct track *t =
|
||||
open_external_file(mpctx, s, opts->sub_demuxer_name, 0, STREAM_SUB);
|
||||
talloc_free(s);
|
||||
if (t)
|
||||
if (t) {
|
||||
t->lang = talloc_strdup(t, sub->lang);
|
||||
t->no_default = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -485,8 +485,8 @@ void update_osd_msg(struct MPContext *mpctx)
|
||||
mpctx->terminal_osd_text = talloc_strdup(mpctx, msg->msg);
|
||||
// Multi-line message => clear what will be the second line
|
||||
write_status_line(mpctx, "");
|
||||
MP_MSG(mpctx, MSGL_STATUS, "%s%s\n", opts->term_osd_esc,
|
||||
mpctx->terminal_osd_text);
|
||||
mp_msg(mpctx->statusline, MSGL_STATUS,
|
||||
"%s%s\n", opts->term_osd_esc, mpctx->terminal_osd_text);
|
||||
print_status(mpctx);
|
||||
}
|
||||
}
|
||||
@@ -512,6 +512,6 @@ void update_osd_msg(struct MPContext *mpctx)
|
||||
// Clear the term osd line
|
||||
if (opts->term_osd && mpctx->terminal_osd_text[0]) {
|
||||
mpctx->terminal_osd_text[0] = '\0';
|
||||
MP_MSG(mpctx, MSGL_STATUS, "%s\n", opts->term_osd_esc);
|
||||
mp_msg(mpctx->statusline, MSGL_STATUS, "%s\n", opts->term_osd_esc);
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ static void reconfig_video(struct MPContext *mpctx,
|
||||
const struct mp_image_params *params,
|
||||
bool probe_only)
|
||||
{
|
||||
struct MPOpts *opts = mpctx->opts;
|
||||
struct dec_video *d_video = mpctx->d_video;
|
||||
|
||||
d_video->decoder_output = *params;
|
||||
@@ -96,6 +97,19 @@ static void reconfig_video(struct MPContext *mpctx,
|
||||
int r = vo_reconfig(mpctx->video_out, &p, 0);
|
||||
if (r < 0)
|
||||
d_video->vfilter->initialized = -1;
|
||||
|
||||
if (r >= 0) {
|
||||
if (opts->gamma_gamma != 1000)
|
||||
video_set_colors(d_video, "gamma", opts->gamma_gamma);
|
||||
if (opts->gamma_brightness != 1000)
|
||||
video_set_colors(d_video, "brightness", opts->gamma_brightness);
|
||||
if (opts->gamma_contrast != 1000)
|
||||
video_set_colors(d_video, "contrast", opts->gamma_contrast);
|
||||
if (opts->gamma_saturation != 1000)
|
||||
video_set_colors(d_video, "saturation", opts->gamma_saturation);
|
||||
if (opts->gamma_hue != 1000)
|
||||
video_set_colors(d_video, "hue", opts->gamma_hue);
|
||||
}
|
||||
}
|
||||
|
||||
static void recreate_video_filters(struct MPContext *mpctx)
|
||||
|
||||
+1
-1
@@ -562,7 +562,7 @@ struct bstr stream_peek(stream_t *s, int len)
|
||||
while (buf_valid < len) {
|
||||
int chunk = MPMAX(len - buf_valid, STREAM_BUFFER_SIZE);
|
||||
if (s->sector_size)
|
||||
chunk = STREAM_BUFFER_SIZE;
|
||||
chunk = s->sector_size;
|
||||
assert(buf_valid + chunk <= TOTAL_BUFFER_SIZE);
|
||||
int read = stream_read_unbuffered(s, &s->buffer[buf_valid], chunk);
|
||||
if (read == 0)
|
||||
|
||||
@@ -1520,6 +1520,7 @@ pvr_stream_open (stream_t *stream, int mode)
|
||||
return STREAM_UNSUPPORTED;
|
||||
|
||||
pvr = pvr_init ();
|
||||
pvr->log = stream->log;
|
||||
|
||||
/**
|
||||
* if the url, i.e. 'pvr://8', contains the channel, use it,
|
||||
|
||||
@@ -54,6 +54,7 @@ void *ta_find_parent(void *ptr);
|
||||
|
||||
// Utility functions
|
||||
size_t ta_calc_array_size(size_t element_size, size_t count);
|
||||
size_t ta_calc_prealloc_elems(size_t nextidx);
|
||||
void *ta_new_context(void *ta_parent);
|
||||
void *ta_steal_(void *ta_parent, void *ptr);
|
||||
void *ta_memdup(void *ta_parent, void *ptr, size_t size);
|
||||
|
||||
+6
-3
@@ -77,14 +77,17 @@ char *ta_talloc_asprintf_append_buffer(char *s, const char *fmt, ...) TA_PRF(2,
|
||||
|
||||
#define MP_TALLOC_ELEMS(p) (talloc_get_size(p) / sizeof((p)[0]))
|
||||
|
||||
#define MP_RESIZE_ARRAY(ctx, p, count) do { \
|
||||
(p) = talloc_realloc_size((ctx), p, (count) * sizeof((p)[0])); } while (0)
|
||||
#define MP_RESIZE_ARRAY(ctx, p, count) \
|
||||
do { \
|
||||
(p) = ta_xrealloc_size(ctx, p, \
|
||||
ta_calc_array_size(sizeof((p)[0]), count)); \
|
||||
} while (0)
|
||||
|
||||
#define MP_TARRAY_GROW(ctx, p, nextidx) \
|
||||
do { \
|
||||
size_t nextidx_ = (nextidx); \
|
||||
if (nextidx_ >= MP_TALLOC_ELEMS(p)) \
|
||||
MP_RESIZE_ARRAY(ctx, p, (nextidx_ + 1) * 2);\
|
||||
MP_RESIZE_ARRAY(ctx, p, ta_calc_prealloc_elems(nextidx_)); \
|
||||
} while (0)
|
||||
|
||||
#define MP_GROW_ARRAY(p, nextidx) MP_TARRAY_GROW(NULL, p, nextidx)
|
||||
|
||||
@@ -30,6 +30,17 @@ size_t ta_calc_array_size(size_t element_size, size_t count)
|
||||
return element_size * count;
|
||||
}
|
||||
|
||||
// This is used when an array has to be enlarged for appending new elements.
|
||||
// Return a "good" size for the new array (in number of elements). This returns
|
||||
// a value >= nextidx, unless the calculation overflows, in which case SIZE_MAX
|
||||
// is returned.
|
||||
size_t ta_calc_prealloc_elems(size_t nextidx)
|
||||
{
|
||||
if (nextidx >= ((size_t)-1) / 2 - 1)
|
||||
return (size_t)-1;
|
||||
return (nextidx + 1) * 2;
|
||||
}
|
||||
|
||||
static void dummy_dtor(void *p){}
|
||||
|
||||
/* Create an empty (size 0) TA allocation, which is prepared in a way such that
|
||||
|
||||
@@ -436,17 +436,6 @@ int video_reconfig_filters(struct dec_video *d_video,
|
||||
|
||||
d_video->vf_input = p;
|
||||
|
||||
if (opts->gamma_gamma != 1000)
|
||||
video_set_colors(d_video, "gamma", opts->gamma_gamma);
|
||||
if (opts->gamma_brightness != 1000)
|
||||
video_set_colors(d_video, "brightness", opts->gamma_brightness);
|
||||
if (opts->gamma_contrast != 1000)
|
||||
video_set_colors(d_video, "contrast", opts->gamma_contrast);
|
||||
if (opts->gamma_saturation != 1000)
|
||||
video_set_colors(d_video, "saturation", opts->gamma_saturation);
|
||||
if (opts->gamma_hue != 1000)
|
||||
video_set_colors(d_video, "hue", opts->gamma_hue);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+14
-15
@@ -71,6 +71,9 @@ struct vo_cocoa_state {
|
||||
void (*resize_redraw)(struct vo *vo, int w, int h);
|
||||
|
||||
struct mp_log *log;
|
||||
|
||||
uint32_t old_dwidth;
|
||||
uint32_t old_dheight;
|
||||
};
|
||||
|
||||
void *vo_cocoa_glgetaddr(const char *s)
|
||||
@@ -356,14 +359,6 @@ static void cocoa_set_window_title(struct vo *vo, const char *title)
|
||||
talloc_free(talloc_ctx);
|
||||
}
|
||||
|
||||
static void update_window(struct vo *vo, int d_width, int d_height)
|
||||
{
|
||||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
[s->window queueNewVideoSize:NSMakeSize(d_width, d_height)];
|
||||
cocoa_set_window_title(vo, vo_get_window_title(vo));
|
||||
vo_cocoa_fullscreen(vo);
|
||||
}
|
||||
|
||||
static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
|
||||
{
|
||||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
@@ -386,9 +381,8 @@ static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height)
|
||||
vo_cocoa_set_current_context(vo, false);
|
||||
}
|
||||
|
||||
int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
|
||||
uint32_t d_height, uint32_t flags,
|
||||
int gl3profile)
|
||||
int vo_cocoa_config_window(struct vo *vo, uint32_t width, uint32_t height,
|
||||
uint32_t flags, int gl3profile)
|
||||
{
|
||||
struct vo_cocoa_state *s = vo->cocoa;
|
||||
__block int ctxok = 0;
|
||||
@@ -398,6 +392,10 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
|
||||
s->enable_resize_redraw = false;
|
||||
s->aspdat = vo->aspdat;
|
||||
|
||||
bool reset_size = s->old_dwidth != width || s->old_dheight != height;
|
||||
s->old_dwidth = width;
|
||||
s->old_dheight = height;
|
||||
|
||||
if (flags & VOFLAG_HIDDEN) {
|
||||
// This is certainly the first execution of vo_config_window and
|
||||
// is called in order for an OpenGL based VO to perform detection
|
||||
@@ -417,16 +415,17 @@ int vo_cocoa_config_window(struct vo *vo, uint32_t d_width,
|
||||
}
|
||||
|
||||
if (!s->window)
|
||||
create_window(vo, d_width, d_height, flags);
|
||||
create_window(vo, width, height, flags);
|
||||
}
|
||||
|
||||
if (s->window) {
|
||||
// Everything is properly initialized
|
||||
update_window(vo, d_width, d_height);
|
||||
if (reset_size)
|
||||
[s->window queueNewVideoSize:NSMakeSize(width, height)];
|
||||
cocoa_set_window_title(vo, vo_get_window_title(vo));
|
||||
vo_cocoa_fullscreen(vo);
|
||||
}
|
||||
});
|
||||
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
s->inside_sync_section = false;
|
||||
s->enable_resize_redraw = true;
|
||||
});
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <IOSurface/IOSurface.h>
|
||||
#include <CoreVideo/CoreVideo.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/CGLIOSurface.h>
|
||||
|
||||
#include "video/decode/dec_video.h"
|
||||
#include "cocoa_common.h"
|
||||
|
||||
+47
-65
@@ -16,27 +16,10 @@
|
||||
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <wayland-egl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "wayland_common.h"
|
||||
#include "gl_common.h"
|
||||
|
||||
struct egl_context {
|
||||
EGLSurface egl_surface;
|
||||
|
||||
struct wl_egl_window *egl_window;
|
||||
|
||||
struct {
|
||||
EGLDisplay dpy;
|
||||
EGLContext ctx;
|
||||
EGLConfig conf;
|
||||
} egl;
|
||||
};
|
||||
|
||||
static void egl_resize(struct vo_wayland_state *wl,
|
||||
struct egl_context *ctx)
|
||||
static void egl_resize(struct vo_wayland_state *wl)
|
||||
{
|
||||
int32_t x = wl->window.sh_x;
|
||||
int32_t y = wl->window.sh_y;
|
||||
@@ -45,7 +28,7 @@ static void egl_resize(struct vo_wayland_state *wl,
|
||||
|
||||
// get the real size of the window
|
||||
// this improves moving the window while resizing it
|
||||
wl_egl_window_get_attached_size(ctx->egl_window,
|
||||
wl_egl_window_get_attached_size(wl->egl_context.egl_window,
|
||||
&wl->window.width,
|
||||
&wl->window.height);
|
||||
|
||||
@@ -60,7 +43,7 @@ static void egl_resize(struct vo_wayland_state *wl,
|
||||
if (y != 0)
|
||||
y = wl->window.height - height;
|
||||
|
||||
wl_egl_window_resize(ctx->egl_window, width, height, x, y);
|
||||
wl_egl_window_resize(wl->egl_context.egl_window, width, height, x, y);
|
||||
|
||||
wl->window.width = width;
|
||||
wl->window.height = height;
|
||||
@@ -74,7 +57,6 @@ static void egl_resize(struct vo_wayland_state *wl,
|
||||
}
|
||||
|
||||
static bool egl_create_context(struct vo_wayland_state *wl,
|
||||
struct egl_context *egl_ctx,
|
||||
MPGLContext *ctx,
|
||||
bool enable_alpha)
|
||||
{
|
||||
@@ -83,7 +65,7 @@ static bool egl_create_context(struct vo_wayland_state *wl,
|
||||
GL *gl = ctx->gl;
|
||||
const char *eglstr = "";
|
||||
|
||||
if (!(egl_ctx->egl.dpy = eglGetDisplay(wl->display.display)))
|
||||
if (!(wl->egl_context.egl.dpy = eglGetDisplay(wl->display.display)))
|
||||
return false;
|
||||
|
||||
EGLint config_attribs[] = {
|
||||
@@ -98,7 +80,7 @@ static bool egl_create_context(struct vo_wayland_state *wl,
|
||||
};
|
||||
|
||||
/* major and minor here returns the supported EGL version (e.g.: 1.4) */
|
||||
if (eglInitialize(egl_ctx->egl.dpy, &major, &minor) != EGL_TRUE)
|
||||
if (eglInitialize(wl->egl_context.egl.dpy, &major, &minor) != EGL_TRUE)
|
||||
return false;
|
||||
|
||||
MP_VERBOSE(wl, "EGL version %d.%d\n", major, minor);
|
||||
@@ -106,38 +88,36 @@ static bool egl_create_context(struct vo_wayland_state *wl,
|
||||
EGLint context_attribs[] = {
|
||||
EGL_CONTEXT_MAJOR_VERSION_KHR,
|
||||
MPGL_VER_GET_MAJOR(ctx->requested_gl_version),
|
||||
/* EGL_CONTEXT_MINOR_VERSION_KHR, */
|
||||
/* MPGL_VER_GET_MINOR(ctx->requested_gl_version), */
|
||||
/* EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR, 0, */
|
||||
/* Segfaults on anything else than the major version */
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
if (eglBindAPI(EGL_OPENGL_API) != EGL_TRUE)
|
||||
return false;
|
||||
|
||||
eglChooseConfig(egl_ctx->egl.dpy, config_attribs,
|
||||
&egl_ctx->egl.conf, 1, &n);
|
||||
eglChooseConfig(wl->egl_context.egl.dpy, config_attribs,
|
||||
&wl->egl_context.egl.conf, 1, &n);
|
||||
|
||||
egl_ctx->egl.ctx = eglCreateContext(egl_ctx->egl.dpy,
|
||||
egl_ctx->egl.conf,
|
||||
wl->egl_context.egl.ctx = eglCreateContext(wl->egl_context.egl.dpy,
|
||||
wl->egl_context.egl.conf,
|
||||
EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
if (!egl_ctx->egl.ctx) {
|
||||
if (!wl->egl_context.egl.ctx) {
|
||||
/* fallback to any GL version */
|
||||
MP_WARN(wl, "can't create context for requested OpenGL version: "
|
||||
"fall back to any version available\n");
|
||||
context_attribs[0] = EGL_NONE;
|
||||
egl_ctx->egl.ctx = eglCreateContext(egl_ctx->egl.dpy,
|
||||
egl_ctx->egl.conf,
|
||||
wl->egl_context.egl.ctx = eglCreateContext(wl->egl_context.egl.dpy,
|
||||
wl->egl_context.egl.conf,
|
||||
EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
|
||||
if (!egl_ctx->egl.ctx)
|
||||
if (!wl->egl_context.egl.ctx)
|
||||
return false;
|
||||
}
|
||||
|
||||
eglMakeCurrent(egl_ctx->egl.dpy, NULL, NULL, egl_ctx->egl.ctx);
|
||||
eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, wl->egl_context.egl.ctx);
|
||||
|
||||
eglstr = eglQueryString(egl_ctx->egl.dpy, EGL_EXTENSIONS);
|
||||
eglstr = eglQueryString(wl->egl_context.egl.dpy, EGL_EXTENSIONS);
|
||||
|
||||
mpgl_load_functions(gl, (void*(*)(const GLubyte*))eglGetProcAddress, eglstr,
|
||||
wl->log);
|
||||
@@ -148,26 +128,24 @@ static bool egl_create_context(struct vo_wayland_state *wl,
|
||||
}
|
||||
|
||||
static void egl_create_window(struct vo_wayland_state *wl,
|
||||
struct egl_context *egl_ctx,
|
||||
uint32_t width,
|
||||
uint32_t height)
|
||||
{
|
||||
egl_ctx->egl_window = wl_egl_window_create(wl->window.surface,
|
||||
wl->egl_context.egl_window = wl_egl_window_create(wl->window.surface,
|
||||
wl->window.width,
|
||||
wl->window.height);
|
||||
|
||||
egl_ctx->egl_surface = eglCreateWindowSurface(egl_ctx->egl.dpy,
|
||||
egl_ctx->egl.conf,
|
||||
egl_ctx->egl_window,
|
||||
wl->egl_context.egl_surface = eglCreateWindowSurface(wl->egl_context.egl.dpy,
|
||||
wl->egl_context.egl.conf,
|
||||
wl->egl_context.egl_window,
|
||||
NULL);
|
||||
|
||||
eglMakeCurrent(egl_ctx->egl.dpy,
|
||||
egl_ctx->egl_surface,
|
||||
egl_ctx->egl_surface,
|
||||
egl_ctx->egl.ctx);
|
||||
eglMakeCurrent(wl->egl_context.egl.dpy,
|
||||
wl->egl_context.egl_surface,
|
||||
wl->egl_context.egl_surface,
|
||||
wl->egl_context.egl.ctx);
|
||||
|
||||
wl_display_dispatch_pending(wl->display.display);
|
||||
|
||||
}
|
||||
|
||||
static bool config_window_wayland(struct MPGLContext *ctx,
|
||||
@@ -175,7 +153,6 @@ static bool config_window_wayland(struct MPGLContext *ctx,
|
||||
uint32_t d_height,
|
||||
uint32_t flags)
|
||||
{
|
||||
struct egl_context * egl_ctx = ctx->priv;
|
||||
struct vo_wayland_state * wl = ctx->vo->wayland;
|
||||
bool enable_alpha = !!(flags & VOFLAG_ALPHA);
|
||||
bool ret = false;
|
||||
@@ -183,23 +160,23 @@ static bool config_window_wayland(struct MPGLContext *ctx,
|
||||
if (!vo_wayland_config(ctx->vo, d_width, d_height, flags))
|
||||
return false;
|
||||
|
||||
if (!egl_ctx->egl.ctx) {
|
||||
if (!wl->egl_context.egl.ctx) {
|
||||
/* Create OpenGL context */
|
||||
ret = egl_create_context(wl, egl_ctx, ctx, enable_alpha);
|
||||
ret = egl_create_context(wl, ctx, enable_alpha);
|
||||
|
||||
/* If successfully created the context and we don't want to hide the
|
||||
* window than also create the window immediately */
|
||||
if (ret && !(VOFLAG_HIDDEN & flags))
|
||||
egl_create_window(wl, egl_ctx, d_width, d_height);
|
||||
egl_create_window(wl, d_width, d_height);
|
||||
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
if (!egl_ctx->egl_window) {
|
||||
if (!wl->egl_context.egl_window) {
|
||||
/* If the context exists and the hidden flag is unset then
|
||||
* create the window */
|
||||
if (!(VOFLAG_HIDDEN & flags))
|
||||
egl_create_window(wl, egl_ctx, d_width, d_height);
|
||||
egl_create_window(wl, d_width, d_height);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -208,35 +185,40 @@ static bool config_window_wayland(struct MPGLContext *ctx,
|
||||
static void releaseGlContext_wayland(MPGLContext *ctx)
|
||||
{
|
||||
GL *gl = ctx->gl;
|
||||
struct egl_context * egl_ctx = ctx->priv;
|
||||
struct vo_wayland_state *wl = ctx->vo->wayland;
|
||||
|
||||
gl->Finish();
|
||||
eglMakeCurrent(egl_ctx->egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(egl_ctx->egl.dpy, egl_ctx->egl.ctx);
|
||||
eglTerminate(egl_ctx->egl.dpy);
|
||||
eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(wl->egl_context.egl.dpy, wl->egl_context.egl.ctx);
|
||||
eglTerminate(wl->egl_context.egl.dpy);
|
||||
eglReleaseThread();
|
||||
wl_egl_window_destroy(egl_ctx->egl_window);
|
||||
egl_ctx->egl.ctx = NULL;
|
||||
wl_egl_window_destroy(wl->egl_context.egl_window);
|
||||
wl->egl_context.egl.ctx = NULL;
|
||||
}
|
||||
|
||||
static void swapGlBuffers_wayland(MPGLContext *ctx)
|
||||
{
|
||||
struct egl_context * egl_ctx = ctx->priv;
|
||||
struct vo_wayland_state *wl = ctx->vo->wayland;
|
||||
eglSwapBuffers(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
|
||||
}
|
||||
|
||||
eglSwapBuffers(egl_ctx->egl.dpy, egl_ctx->egl_surface);
|
||||
static int control(struct vo *vo, int *events, int request, void *data)
|
||||
{
|
||||
struct vo_wayland_state *wl = vo->wayland;
|
||||
int r = vo_wayland_control(vo, events, request, data);
|
||||
|
||||
if (wl->window.events & VO_EVENT_RESIZE)
|
||||
egl_resize(wl, egl_ctx);
|
||||
if (*events & VO_EVENT_RESIZE)
|
||||
egl_resize(wl);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void mpgl_set_backend_wayland(MPGLContext *ctx)
|
||||
{
|
||||
ctx->priv = talloc_zero(ctx, struct egl_context);
|
||||
ctx->config_window = config_window_wayland;
|
||||
ctx->releaseGlContext = releaseGlContext_wayland;
|
||||
ctx->swapGlBuffers = swapGlBuffers_wayland;
|
||||
ctx->vo_control = vo_wayland_control;
|
||||
ctx->vo_control = control;
|
||||
ctx->vo_init = vo_wayland_init;
|
||||
ctx->vo_uninit = vo_wayland_uninit;
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QuartzCore/QuartzCore.h>
|
||||
#if HAVE_VDA_HWACCEL
|
||||
#include <IOSurface/IOSurface.h>
|
||||
#include <OpenGL/CGLIOSurface.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
+19
-15
@@ -240,9 +240,6 @@ static void buffer_swap(struct priv *p)
|
||||
struct buffer *tmp = p->back_buffer;
|
||||
p->back_buffer = p->front_buffer;
|
||||
p->front_buffer = tmp;
|
||||
|
||||
// after swap set is_new to false, but keep busy
|
||||
p->back_buffer->is_new = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,31 +247,30 @@ static void buffer_swap(struct priv *p)
|
||||
// is busy (unlikely)
|
||||
static struct buffer * buffer_get_back(struct priv *p)
|
||||
{
|
||||
if (p->back_buffer->is_new || p->back_buffer->is_busy)
|
||||
if (p->back_buffer->is_busy)
|
||||
return NULL;
|
||||
|
||||
p->back_buffer->is_busy = true;
|
||||
|
||||
return p->back_buffer;
|
||||
}
|
||||
|
||||
static bool buffer_finalise_back(struct priv *p)
|
||||
static bool buffer_finalise_back(struct buffer *buf)
|
||||
{
|
||||
p->back_buffer->is_new = true;
|
||||
p->back_buffer->is_busy = false;
|
||||
|
||||
buf->is_new = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct buffer * buffer_get_front(struct priv *p)
|
||||
{
|
||||
if (!p->front_buffer->is_new)
|
||||
return NULL;
|
||||
|
||||
p->front_buffer->is_busy = true;
|
||||
return p->front_buffer;
|
||||
}
|
||||
|
||||
static bool buffer_finalise_front(struct priv *p)
|
||||
static bool buffer_finalise_front(struct buffer *buf)
|
||||
{
|
||||
p->front_buffer->is_new = false; // is_busy is reset on handle_release
|
||||
buf->is_new = false; // is_busy is reset on handle_release
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -469,6 +465,7 @@ static void frame_handle_redraw(void *data,
|
||||
struct vo_wayland_state *wl = p->wl;
|
||||
struct buffer *buf = buffer_get_front(p);
|
||||
|
||||
if (buf) {
|
||||
if (p->resize_attach) {
|
||||
wl_surface_attach(wl->window.surface, buf->wlbuf, p->x, p->y);
|
||||
wl_surface_damage(wl->window.surface, 0, 0, p->dst_w, p->dst_h);
|
||||
@@ -478,7 +475,7 @@ static void frame_handle_redraw(void *data,
|
||||
wl_callback_destroy(callback);
|
||||
|
||||
p->redraw_callback = NULL;
|
||||
buffer_finalise_front(p);
|
||||
buffer_finalise_front(buf);
|
||||
p->resize_attach = false;
|
||||
|
||||
destroy_shm_buffer(&p->tmp_buffer);
|
||||
@@ -498,7 +495,14 @@ static void frame_handle_redraw(void *data,
|
||||
p->redraw_callback = wl_surface_frame(wl->window.surface);
|
||||
wl_callback_add_listener(p->redraw_callback, &frame_listener, p);
|
||||
wl_surface_commit(wl->window.surface);
|
||||
buffer_finalise_front(p);
|
||||
buffer_finalise_front(buf);
|
||||
}
|
||||
else {
|
||||
if (callback)
|
||||
wl_callback_destroy(callback);
|
||||
|
||||
p->redraw_callback = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_callback_listener frame_listener = {
|
||||
@@ -549,7 +553,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
|
||||
mp_sws_scale(p->sws, &img, &src);
|
||||
|
||||
mp_image_setrefp(&p->original_image, mpi);
|
||||
buffer_finalise_back(p);
|
||||
buffer_finalise_back(buf);
|
||||
}
|
||||
|
||||
static void draw_osd(struct vo *vo, struct osd_state *osd)
|
||||
|
||||
@@ -486,7 +486,7 @@ static int reinit_window_state(struct vo *vo)
|
||||
|
||||
DWORD style = update_style(vo, GetWindowLong(w32->window, GWL_STYLE));
|
||||
|
||||
if (vo->opts->fullscreen || vo->opts->ontop)
|
||||
if (vo->opts->ontop)
|
||||
layer = HWND_TOPMOST;
|
||||
|
||||
// xxx not sure if this can trigger any unwanted messages (WM_MOVE/WM_SIZE)
|
||||
@@ -506,6 +506,7 @@ static int reinit_window_state(struct vo *vo)
|
||||
vo->dheight = vo->opts->screenheight;
|
||||
w32->window_x = vo->xinerama_x;
|
||||
w32->window_y = vo->xinerama_y;
|
||||
style &= ~WS_OVERLAPPEDWINDOW;
|
||||
} else {
|
||||
if (toggle_fs) {
|
||||
// Restore window position and size when switching from fullscreen.
|
||||
|
||||
@@ -587,7 +587,6 @@ static void shedule_resize(struct vo_wayland_state *wl,
|
||||
// don't keep the aspect ration in fullscreen mode, because the compositor
|
||||
// shows the desktop in the border regions if the video has not the same
|
||||
// aspect ration as the screen
|
||||
if (!wl->window.is_fullscreen) {
|
||||
/* if only the height is changed we have to calculate the width
|
||||
* in any other case we calculate the height */
|
||||
switch (edges) {
|
||||
@@ -610,7 +609,6 @@ static void shedule_resize(struct vo_wayland_state *wl,
|
||||
height = (1 / wl->window.aspect) * width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (edges & WL_SHELL_SURFACE_RESIZE_LEFT)
|
||||
x = wl->window.width - width;
|
||||
@@ -788,8 +786,9 @@ void vo_wayland_uninit (struct vo *vo)
|
||||
|
||||
static void vo_wayland_ontop (struct vo *vo)
|
||||
{
|
||||
vo->opts->ontop = !vo->opts->ontop;
|
||||
vo->opts->fullscreen = !vo->opts->fullscreen;
|
||||
MP_DBG(vo->wayland, "going ontop\n");
|
||||
vo->opts->ontop = 0;
|
||||
vo->opts->fullscreen = 1;
|
||||
|
||||
/* use the already existing code to leave fullscreen mode and go into
|
||||
* toplevel mode */
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_GL_WAYLAND
|
||||
#include <wayland-egl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#endif
|
||||
|
||||
struct vo;
|
||||
|
||||
struct vo_wayland_output {
|
||||
@@ -43,6 +49,20 @@ struct vo_wayland_state {
|
||||
struct vo *vo;
|
||||
struct mp_log* log;
|
||||
|
||||
#if HAVE_GL_WAYLAND
|
||||
struct {
|
||||
EGLSurface egl_surface;
|
||||
|
||||
struct wl_egl_window *egl_window;
|
||||
|
||||
struct {
|
||||
EGLDisplay dpy;
|
||||
EGLContext ctx;
|
||||
EGLConfig conf;
|
||||
} egl;
|
||||
} egl_context;
|
||||
#endif
|
||||
|
||||
struct {
|
||||
int fd;
|
||||
struct wl_display *display;
|
||||
|
||||
@@ -3,7 +3,8 @@ from waftools.checks.generic import *
|
||||
from waflib import Utils
|
||||
import os
|
||||
|
||||
__all__ = ["check_pthreads", "check_iconv", "check_lua", "check_oss_4front"]
|
||||
__all__ = ["check_pthreads", "check_iconv", "check_lua", "check_oss_4front",
|
||||
"check_cocoa"]
|
||||
|
||||
pthreads_program = load_fragment('pthreads.c')
|
||||
|
||||
@@ -101,3 +102,13 @@ def check_oss_4front(ctx, dependency_identifier):
|
||||
fragment=load_fragment('oss_audio.c'))
|
||||
|
||||
return fn(ctx, dependency_identifier)
|
||||
|
||||
def check_cocoa(ctx, dependency_identifier):
|
||||
fn = check_cc(
|
||||
fragment = load_fragment('cocoa.m'),
|
||||
compile_filename = 'test.m',
|
||||
framework_name = ['Cocoa', 'IOKit', 'OpenGL'],
|
||||
includes = ctx.srcnode.abspath(),
|
||||
linkflags = '-fobjc-arc')
|
||||
|
||||
return fn(ctx, dependency_identifier)
|
||||
@@ -2,6 +2,8 @@
|
||||
#import <OpenGL/OpenGL.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "osdep/macosx_compat.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@autoreleasepool {
|
||||
NSArray *ary = @[@1, @2, @3];
|
||||
|
||||
@@ -77,7 +77,7 @@ main_dependencies = [
|
||||
'desc': 'linker support for --nxcompat --no-seh --dynamicbase',
|
||||
'func': check_cc(linkflags=['-Wl,--nxcompat', '-Wl,--no-seh', '-Wl,--dynamicbase'])
|
||||
}, {
|
||||
'name': 'ebx_available',
|
||||
'name': 'ebx-available',
|
||||
'desc': 'ebx availability',
|
||||
'func': check_cc(fragment=load_fragment('ebx.c'))
|
||||
} , {
|
||||
@@ -98,6 +98,27 @@ main_dependencies = [
|
||||
'func': check_pthreads,
|
||||
'req': True,
|
||||
'fmsg': 'Unable to find pthreads support.'
|
||||
}, {
|
||||
'name': 'atomic-builtins',
|
||||
'desc': 'compiler support for __atomic built-ins',
|
||||
'func': check_libs(['atomic'],
|
||||
check_statement('stdint.h',
|
||||
'int64_t test = 0;'
|
||||
'test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)'))
|
||||
}, {
|
||||
'name': 'sync-builtins',
|
||||
'desc': 'compiler support for __sync built-ins',
|
||||
'func': check_statement('stdint.h',
|
||||
'int64_t test = 0;'
|
||||
'test = __sync_add_and_fetch(&test, 1)'),
|
||||
'deps_neg': [ 'atomic-builtins' ],
|
||||
}, {
|
||||
'name': 'thread-synchronization-builtins',
|
||||
'desc': 'compiler support for usable thread synchronization built-ins',
|
||||
'func': check_true,
|
||||
'deps_any': ['atomic-builtins', 'sync-builtins'],
|
||||
'req': True,
|
||||
'fmsg': 'your compiler must support either __atomic or __sync built-ins',
|
||||
}, {
|
||||
'name': 'librt',
|
||||
'desc': 'linking with -lrt',
|
||||
@@ -314,6 +335,7 @@ Libav libraries ({0}). Aborting.".format(" ".join(libav_pkg_config_checks))
|
||||
'name': '--libswresample',
|
||||
'desc': 'libswresample',
|
||||
'func': check_pkg_config('libswresample', '>= 0.17.102'),
|
||||
'deps_neg': ['libavresample'],
|
||||
}, {
|
||||
'name': 'resampler',
|
||||
'desc': 'usable resampler found',
|
||||
@@ -477,11 +499,7 @@ video_output_features = [
|
||||
{
|
||||
'name': '--cocoa',
|
||||
'desc': 'Cocoa',
|
||||
'func': check_cc(
|
||||
fragment=load_fragment('cocoa.m'),
|
||||
compile_filename='test.m',
|
||||
framework_name=['Cocoa', 'IOKit', 'OpenGL'],
|
||||
linkflags='-fobjc-arc')
|
||||
'func': check_cocoa
|
||||
} , {
|
||||
'name': 'gdi',
|
||||
'desc': 'GDI',
|
||||
|
||||
Reference in new issue
Block a user