Commit Graph

425 Commits

Author SHA1 Message Date
wm4 500ce69a06 client API: add API function that ensures total destruction
mpv_destroy() should perhaps better be called mpv_detach(), because it
destroys only the handle, not necessarily the player. The player is only
terminated if a quit command is sent.

This function quits automatically, and additionally waits until the
player is completely destroyed. It removes the possibility that the
player core is still uninitializing, while all client handles are
already destroyed. (Although in practice, the difference is usually not
important.)
2014-06-07 15:57:54 +02:00
wm4 a1000962e3 client API: change mpv_wait_event() timeout semantics
Now a negative timeout mean an infinite timeout. This is similar to the
poll() system call. Apparently this is more intuitive and less confusing
than specifying a "very high" value as timeout if you want to wait
forever.

For callers that never pass negative timeouts, nothing changes.
2014-06-07 15:57:47 +02:00
wm4 43d46a28fe client API: enlarge the message buffer if log level is high 2014-06-06 19:25:52 +02:00
wm4 3b7402b51c client API: call wakeup callback if there are new messages
Listening on messages currently uses polling (every time
mpv_wait_event() has no new events, the message buffer is polled and a
message event is possibly created). Improve this situation a bit, and
call the user-supplied wakeup callback.

This will increase the frequency with which the wakeup callback is
called, but the client is already supposed to be able to deal with this
situation. Also, as before, calling mpv_wait_event() from the wakeup
callback is forbidden, so the client can't read new messages from the
callback directly.

The wakeup pipe is written either. Since the wakeup pipe is created
lazily, we can't access the pipe handle without creating a race
condition or a deadlock. (This is actually very silly, since in practice
the race condition won't matter, but for now let's keep it clean.)
2014-06-06 19:24:30 +02:00
wm4 cdcdddfc63 client API: fix terminal usage
By default this is disabled. But if it's enabled, then we have to
account for proper states when enabling/disabling the terminal state
itself.
2014-06-06 17:28:13 +02:00
wm4 ecbb12923f client API: don't update properties in uninitialized state
If an API user calls mpv_wait_event() and mpv_observe_property() before
mpv_initialize(), it could happen that a property was accessed before
initialization, which is not ok.
2014-06-06 17:27:05 +02:00
wm4 4279712d1e client API: don't use the mpv config files by default
This was always intended this way, and even documented in client.h. Due
to an oversight it was never actually implemented.

The intention is that mpv embedded in applications and "real mpv" don't
conflict. An API user can undo this by setting the "config" option to
"yes", if using the user's mpv config is desired.
2014-06-06 17:26:01 +02:00
wm4 7716424d48 client API: use shared code for creating the wakeup pipe
Should be equivalent, reduces code duplication.
2014-06-06 17:22:53 +02:00
wm4 662592c860 client API: fix swapped pipe ends used with mpv_set_wakeup_callback
This was extremely wrong. It was never tested because nobody ever used
it (the feature was added for someone who never tried it in the end).
2014-06-06 17:21:30 +02:00
wm4 99e498611e lua: make warning about unknown scripts -v only 2014-06-04 00:33:17 +02:00
Marcoen Hirschberg af25e0aba8 command: format_bitrate: fix conversion to kbits and mbits
Bitrates are now expressed in bits/second. This commit fixes conversions
which assumed it was still in bytes/second.

Signed-off-by: wm4 <wm4@nowhere>
2014-06-02 22:20:25 +02:00
Marcoen Hirschberg d838bd6420 osc: keep track of the "fullscreen" state when it changes
This avoids having to poll the "fullscreen" property in the tick
callback.
2014-06-02 22:20:25 +02:00
Alessandro Ghedini f2a00f3de3 player: write file name to the watch later config file
This simply writes the file name as a comment to the top of the watch later
config file.

It can be useful to the user for determining whether a watch later config file
can be manually removed (e.g. in case the corresponding media file has been
deleted) or not.
2014-06-01 19:55:45 +02:00
Andrey Morozov b5e40e15a3 command: improve video-bitrate property
Signed-off-by: wm4 <wm4@nowhere>

Includes some cosmetic changes over the original PR.
2014-06-01 17:27:17 +02:00
wm4 5a5a3c53f7 client API: report success status when running commands
Until now, an error was reported only if the command couldn't be parsed.
Attempt to do more fine-grained reporting. This is not necessarily
perfect, but it's an improvement.
2014-06-01 03:41:46 +02:00
wm4 c84f873596 command: property notification when changing af/vf 2014-06-01 03:41:43 +02:00
wm4 69ad734af8 command: add const to mp_notify_property 2014-06-01 03:41:36 +02:00
wm4 c79689206c audio: change handling of an EOF corner case
This code handles buggy AOs (even if all AOs are bug-free, it's good for
robustness). Move handling of it to the AO feed thread. Now this check
doesn't require magic numbers and does exactly what's it supposed to do.
2014-05-30 02:16:43 +02:00
Marcoen Hirschberg 434242adb5 audio: rename i_bps to 'bitrate' to avoid confusion
Since i_bps now contains bits/sec, rename it to reflect this change.
2014-05-28 21:37:50 +02:00
Marcoen Hirschberg 6e58b20cce audio: change values from bytes-per-second to bits-per-second
The i_bps members of the sh_audio and dev_video structs are mostly used
for displaying the average audio and video bitrates. Keeping them in
bits-per-second avoids truncating them to bytes-per-second and changing
them back lateron.
2014-05-28 21:37:44 +02:00
ChrisK2 ff73d25308 osc: correct calculation of slider position
calculation the mouse position on the slider relied on how the
hitbox is positioned, change it according to new hitbox size.
2014-05-28 01:55:52 +02:00
ChrisK2 518e0b7320 osc: extend hitbox of seekbars to include gap
should make usage a bit easy

Fixes #810
2014-05-27 22:52:34 +02:00
wm4 799b5e1a5d lua: slightly nicer diagnostics output
When Lua itself prints errors such as:

  Error: [string "mp.defaults"]:387: syntax error near 'function'

It's unclear why the location is prefixed with "string ". And for some
reason, it disappears if you prefix the name with '@'. I suppose this is
done for the sake of luaL_loadstring. With the '@' prefix added, the
output is now:

  Error: mp.defaults:387: syntax error near 'function'
2014-05-27 00:02:34 +02:00
wm4 fbe59b23b1 lua: add missing include files
These are actually already included in osdep/io.h, but I think it's
cleaner to repeat them in the file where they are actually needed.
(osdep/io.h needs to have them for other reasons.)
2014-05-26 21:59:30 +02:00
wm4 6f20d6b74e lua: fix compilation with lua 5.2
Commit e2e450f9 started making use of luaL_register(), but OF COURSE
this function disappeared in Lua 5.2, and was replaced with a 5.2-only
alternative, slightly different mechanism.

So just NIH our own function. This is actually slightly more correct,
since it forces the user to call "require" to actually make the module
visible for builtin C-only modules other than "mp". Fix autoload.lua
accordingly.
2014-05-26 21:59:29 +02:00
Martin 9c18a920ff command: add write_watch_later_config command
Closes #808.

Signed-off-by: wm4 <wm4@nowhere>
2014-05-26 21:59:17 +02:00
wm4 e2e450f961 lua: add some filesystem utility functions
We need this only because Lua's stdlib is so scarce. Lua doesn't intend
to include a complete stdlib - they confine themselves to standard C,
both for portability reasons and to keep the code minimal. But standard
C does not provide much either.

It would be possible to use Lua POSIX wrapper libraries, but that would
be a messy (and unobvious) dependency. It's better to implement the
missing functions ourselves, as long as they're small in number.
2014-05-25 19:51:11 +02:00
ChrisK2 30fc1a42be osc: fix chapter list display
also fix small typo in DOCS
2014-05-24 17:47:31 +02:00
wm4 01c3847b80 client API: fix mpv_observe_property with MP_FORMAT_NONE
It returned only 1 change event (after registration), and then went
silent. This was accidentally broken some time ago.
2014-05-24 16:17:52 +02:00
wm4 a4d487f5b2 stream: don't use end_pos
Stop using it in most places, and prefer STREAM_CTRL_GET_SIZE. The
advantage is that always the correct size will be used. There can be no
doubt anymore whether the end_pos value is outdated (as it happens often
with files that are being downloaded).

Some streams still use end_pos. They don't change size, and it's easier
to emulate STREAM_CTRL_GET_SIZE using end_pos, instead of adding a
STREAM_CTRL_GET_SIZE implementation to these streams.

Make sure int64_t is always used for STREAM_CTRL_GET_SIZE (it was
uint64_t before).

Remove the seek flags mess, and replace them with a seekable flag. Every
stream must set it consistently now, and an assertion in stream.c checks
this. Don't distinguish between streams that can only be forward or
backwards seeked, since we have no such stream types.
2014-05-24 16:17:51 +02:00
wm4 e3c20bf350 stream: kill start_pos, remove --sb option
stream.start_pos was needed for optical media only, and (apparently) not
for very good reasons. Just get rid of it.

For stream_dvd, we don't need to do anything. Byte seeking was already
removed from it earlier.

For stream_cdda and stream_vcd, emulate the start_pos by offsetting the
stream pos as seen by the rest of mpv.

The bits in discnav.c and loadfile.c were for dealing with the code
seeking back to the start in demux.c. Handle this differently by
assuming the demuxer is always initialized with the stream at start
position, and instead seek back if initializing the demuxer fails.

Remove the --sb option, which worked by modifying stream.start_pos. If
someone really wants this option, it could be added back by creating a
"slice" stream (actually ffmpeg already has such a thing).
2014-05-24 16:17:50 +02:00
wm4 3316cf5f9b player: don't init/uninit terminal at runtime
This seems like an unnecessary complication.
2014-05-24 16:17:50 +02:00
ChrisK2 ce69afab44 lua/osc: forgot some changed files in previous commit 2014-05-23 13:24:27 +02:00
ChrisK2 c6915d7325 lua/osc: small overhaul
Small fixes for the OSC, seektooltip now enabled by default.

Option-parser now moved to separate package, can be used from
other scripts, see DOCS/man/en/lua.rst.

OSC config file location moved to lua-settings/osc.conf
2014-05-23 13:14:17 +02:00
wm4 cb2e784c07 player: give quit_watch_later an exit code argument like quit
The quit command has an optional argument that is used as exit code.
Extend that to the quit_watch_later command. Actually, unify the
implementations of the two commands.

Requested in #798.
2014-05-22 21:28:20 +02:00
Yomi0 aca4f9f474 tl_mpv_edl: correct misspelling on line 233
Closes #783

Signed-off-by: wm4 <wm4@nowhere>
2014-05-22 20:59:31 +02:00
wm4 d45b68b938 player: fix cover art sometimes "syncing" against audio
Cover art is treated like video, but is not really video. In one case,
the audio sync code was accidentally still active. Fixes cover art
playback with --ao=null. (This is due to ao_null's latency emulation.
Although it's not very clear whether that is actually correct...)
2014-05-22 20:54:50 +02:00
wm4 85a513abdf player: suggest --no-audio-display on cover art 2014-05-22 13:51:31 +02:00
wm4 2f2b3f8d5c video: fix display of cover art with vo_vdpau
vo_vdpau currently has a video queue larger than 1 entry, which causes
the video display code to never queue display the video frame. This is
because we consider cover art an endless stream of frames decoded from
the same source packet, and include special logic to actually only
decode and display 1 frame.

Also, make decode_image() also signal EOF in the cover art case.
2014-05-22 13:50:10 +02:00
wm4 d62dad55ef edl: use start PTS of the source files as default start time 2014-05-22 13:04:36 +02:00
wm4 4664f8b3b7 cache: redo options and default settings
Some options change from percentages to number of kilobytes; there are
no cache options using percentages anymore.

Raise the default values. The cache is now 25000 kilobytes, although if
your connection is slow enough, the maximum is probably never reached.
(Although all the memory will still be used as seekback-cache.)

Remove the separate --audio-file-cache option, and use the cache default
settings for it.
2014-05-20 02:40:22 +02:00
wm4 537ac1a15f client API: add mpv_load_config_file()
This is probably a good idea, because it would make it easier for
software embedding mpv to configure the mpv parts, without requiring the
host program to provide explicit mechanisms for this (other than calling
mpv_load_config_file()).
2014-05-18 19:21:39 +02:00
wm4 caa939aa91 options: unify code for setting string and "raw" options
The code paths for setting options by string and by direct "raw" value
were too different, which resulted in some weird code. Make the code
paths closer to each other.

Also, use this to remove the weirdness in the mpv_set_option()
implementation.
2014-05-18 19:21:39 +02:00
wm4 f47a4fc3d9 threads: use mpv time for mpthread_cond_timedwait wrapper
Use the time as returned by mp_time_us() for mpthread_cond_timedwait(),
instead of calculating the struct timespec value based on a timeout.
This (probably) makes it easier to wait for a specific deadline.
2014-05-18 19:20:32 +02:00
wm4 dbdf7c39e7 player: increase seek accuracy when refreshing display on filter change
When the player is paused, and video filters are changed, an exact seek
is executed to refresh the display. Increase the exactness of the seek
in this case; this reuses the code used for frame backstepping.

It might help in cases where seeking is very imprecise, such as with
transport streams.
2014-05-18 14:08:45 +02:00
wm4 5841685e09 command: add a disc-menu-active property
Returns whether a DVD/BD menu is active. As requested by #788.
2014-05-18 00:03:47 +02:00
wm4 1ef1e8e509 client API: fix "missed" property notifications
If a property is notified as changed, and then again (before the change
notification is returned to the client), and the second change is a
sporadic change (i.e. nothing actually changed) and the change
notification was associated with with a data type, it could happen that
a change was "overlooked", because it would detect no change on the
second notification.

This is actually a pretty annoying corner case, due to the annoying way
we do things, so just store both the previously returned _and_ the newly
obtained property value. then we always compare with the user value to
check for a change, excluding any possibility of a missed change.

Note that we don't (can't/shouldn't) care if a value changes, and then
changes back; it's fine if that doesn't generate a notification. This is
due to how property notifications are supposed to be coalesced.
2014-05-18 00:02:55 +02:00
wm4 ebd5bbd241 x11: replace--[x11-]fstype option with --x11-netwm
Simplifies the code a lot. You can still use --x11-netwm=no to disable
NetWM for whatever reasons.
2014-05-16 00:47:13 +02:00
wm4 2279f718de player: reorganize how lua scripts are loaded
Make loading of scripts independent of Lua. Move some of the loading
code from lua.c to scripting.c, and make it easier to add new scripting
backends.
2014-05-13 02:39:37 +02:00
wm4 9e94de29b7 player: disable hr-seek framedropping during backstepping 2014-05-12 23:24:19 +02:00
wm4 3d530af8ef player: don't assign "false" to pointer
This is legal in theory. "false" expand to 0, and 0 is a valid pointer
value. But I guess this was not really intended.

Found by cppcheck.
2014-05-11 16:41:09 +02:00
wm4 31663beeac input: remove pausing command prefixes
These are now equivalent to combining commands with the "cycle pause" or
"set pause" commands, and thus are not needed anymore. They were also
obscure and undocumented.
2014-05-11 15:41:34 +02:00
wm4 4b367d1602 player: don't complain on too long filenames
mpv supports per-file config files, basically filename+".conf". We use
a static buffer for the new filename, and if that buffer is too small,
we print a warning. This is confusing for e.g. long URLs, so just hide
the warning by default.

Why not dynamically allocate the buffer? Who cares.
2014-05-10 16:08:07 +02:00
wm4 996ab61a6a command: add property that estimates current video FPS
This is done after filters, so things like framerate-doubling
deinterlacing is accounted for.

Unfortunately, framedropping can cause inaccuracies (especially after
precise seeks), and we can't really know when that happens. Even though
we know that the decoder might drop a frame if we request it to do so,
we don't know when the dropped frame will start or stop affecting the
video filter chain. Video filters can have frames buffered, and we
can't tell at which point the dropped frame would have been output.
It's not even possible to mark a discontinuity after seek, because
again we don't know if the filter chain still has the discontinuity
within its buffers.

So we have to live with the fact that the output of this property can
be completely broken after seek, unless --no-hr-seek-framedrop is used.
2014-05-08 01:25:48 +02:00
wm4 c57660fbf7 options: add --hr-seek-framedrop option
This allows disabling of decoder framedrop during hr-seek.

It's basically another useless option, but it will help exploring
whether this framedropping really makes seeking faster, or whether
disabling it helps with precise seeking (especially frame backstepping).
2014-05-07 22:05:30 +02:00
wm4 2a783d7035 player: avoid reconfig during seeking
This probably matters only in extremely corner-case heavy testcases,
such as using mf:// with a bunch of differently sized images.
2014-05-07 21:50:38 +02:00
wm4 f3362e22eb player: remove VO from seeking code path
Until recently, the VO was an unavoidable part of the seeking code path.
This was because vdpau deinterlacing could double the framerate, and hr-
seek and framestepping etc. all had to "see" the additional frames. But
we've removed the frame doubling from the vdpau VO and moved it into a
video filter (vf_vdpaupp), and there's no reason left why the VO should
participate in seeking.

Instead of queuing frames to the VO during seek and skipping them
afterwards, drop the frames early.

This actually might make seeking with vo_vdpau and software decoding
faster, although I haven't measured it.
2014-05-07 21:50:16 +02:00
wm4 bd2bcc4399 player: minor reshuffling of video code 2014-05-07 21:48:36 +02:00
wm4 725e956b11 player: limit max. fallback frame duration
It's calculated from the demuxer reported FPS, which is not very
reliable. Limit the damage a completely insane and broken value could
cause.
2014-05-07 21:41:14 +02:00
wm4 eada87853e player: handle video reconfig slightly different again
Now we avoid calling update_video() twice on reconfig (once to check
whether there are still new frames, and again to actually do the
reconfig). Instead, we check whether there's still something going on
before calling update_video() at all, and depending on that
update_video() will be allowed to reconfig or not.

This will simplify some things later.
2014-05-07 21:39:17 +02:00
wm4 6a8a0e3aa9 player: reset last_frame_duration on init 2014-05-07 21:38:46 +02:00
Andrey Morozov dc8684805b command: rename stream-length to file-size, format file size
Signed-off-by: wm4 <wm4@nowhere>
2014-05-06 20:36:42 +02:00
wm4 73c7938d74 command: remove ifdefs for deint filters
Doesn't have much of a purpose.
2014-05-06 00:47:28 +02:00
wm4 a8b267540e common: change mp_snprintf_append semantics
Make it more suitable for chaining. This means a function formatting a
value to a string using a static buffer can work exactly like
mp_snprintf_append itself.

Also rename it to mp_snprintf_cat, because that's shorter.
2014-05-05 23:56:12 +02:00
wm4 94441ed139 options: merge ---sub-auto-match with --sub-auto
There's no reason why these should be separate.
2014-05-04 10:31:24 +02:00
Martin Herkt 48bd03dd91 options: remove deprecated --identify
Also remove MSGL_SMODE and friends.

Note: The indent in options.rst was added to work around a bug in
ReportLab that causes the PDF manual build to fail.
2014-05-04 02:46:11 +02:00
Martin Herkt b54c963258 options: rename video-related options/properties
Renamed options:
--aspect    → --video-aspect
--fstype    → --x11-fstype
--native-fs → --fs-missioncontrol
--name      → --x11-name

Renamed properties:
aspect → video-aspect
2014-05-04 02:46:11 +02:00
Martin Herkt 2b7bc2dfc9 options: rename audio-related options/properties
Renamed options:
--audiofile       → --audio-file
--audiofile-cache → --audio-file-cache
--channels        → --audio-channels
--format          → --audio-format
--srate           → --audio-samplerate

Renamed properties:
samplerate → audio-samplerate
channels   → audio-channels
2014-05-04 02:46:11 +02:00
Martin Herkt 8d7d6caeaf options: rename subtitle-related options
--ass           → --sub-ass
--autosub       → --sub-auto
--autosub-match → --sub-auto-match
--sub           → --sub-file
--subcp         → --sub-codepage
--subfps        → --sub-fps
2014-05-04 02:46:11 +02:00
wm4 6589c5424e video: remove a corner case by introducing another one
When loading a video, and a script reacts to MPV_EVENT_VIDEO_RECONFIG,
and the script inserts a video filter, the first frame can be skipped.
This happens simply because the first frame is (usually) still queued in
the video filter chain, and changing the filter chain will drop all
queued frames. So this is just a corner case that just happens in a
weird situation.

But it's still annoying when having such a script, and starting
something where the first frame is very visible, and not starting in
paused mode. (All in all, a corner case.) Do this by immediately queuing
1 filtered frame to the VO immediately after reconfig, instead of
leaving it to the video loop doing it as "incremental" work. Simply
fallthrough to the next case. We must not overwrite "r" in this case,
because that contains the current status.

Note that the first frame will not be filtered using the inserted
filter.
2014-05-03 16:33:07 +02:00
wm4 ae4613cd3b video: fix video end condition
This wasn't really fine, and could (perhaps) cause weird corner cases on
reinit or when the player was paused.

Before eb9d20, video_left was also set to true if vo->frame_loaded was
set, and this variable basically indicated whether the previous
update_video() call was successful. This was overlooked when changing
everything. Simply always call update_video(), it should be equivalent.
2014-05-03 15:29:48 +02:00
wm4 c9ed70b666 video: rename a variable
Cosmetic change, reduce the diff of the following commit.
2014-05-03 15:27:17 +02:00
wm4 1279ebf5c5 client API: fix inverted condition
Oops. Sigh.
2014-05-02 17:23:25 +02:00
wm4 33a945cc7e video: removed unused stuff 2014-05-02 14:48:52 +02:00
wm4 d81a374c89 player: remove extremely obscure undefined behavior
Apparently the value of a pointer is "indeterminate" after a free()
call, even if you never dereference the pointer after the free. Since
talloc_free() calls free(), this applies here.
2014-05-02 14:45:56 +02:00
wm4 2386e183fe client API, video: signal reconfig at the right time
Filter reconfig can now happen a few frames before VO reconfig.
2014-05-02 01:28:52 +02:00
wm4 beaa7c7153 lua: remove "lua/" prefix from script names
This affects the return value of mp.script_name, the "client name"
(what's returned by mpv_client_name()) and all associated features, as
well as the mpv terminal output module prefix when scripts print
something.

As discussed in #748.
2014-05-02 01:25:58 +02:00
wm4 eb9d203946 video: change everything
Change how the video decoding loop works. The structure should now be a
bit easier to follow. The interactions on format changes are (probably)
simpler. This also aligns the decoding loop with future planned changes,
such as moving various things to separate threads.
2014-05-02 01:09:58 +02:00
wm4 50ebcf1a43 video: handle colorspace and aspect overrides separately
Now the video filter code handles these explicitly, which should
increase robustness (or at least find bugs earlier).
2014-05-02 01:09:55 +02:00
wm4 90a039a599 command, vo_vdpau: respect vdpau deint sub-option
This is a horrible hack to keep compatibility with the vo_vdpau deint
sub-option.
2014-05-02 01:08:05 +02:00
wm4 3f060a19d8 command: redo deinterlace filter probing
Give up on the deint_filters[] array, and probe using explicit code
instead. Add additional checks to test the pixel format to avoid
annoying warnings when a hardware deinterlacer is inserted when the
current video chain is obviously incompatible.
2014-05-02 01:08:04 +02:00
wm4 c42795f1ea command: make enabling deinterlacing with vdpau work
This restores the capability of enabling deinterlacing with the
'cycle deinterlace' command with vo_vdpau, and also makes it work
with vo_opengl.
2014-05-02 01:08:04 +02:00
wm4 ee574c67ea video: improve error messages 2014-04-30 22:20:08 +02:00
Kevin Mitchell e3e565c194 vf-metadata: fix handling of NULL metadata
lavfi would segfault due to a NULL dereference if it was asked for its
metadata and none had been allocated (oops). This happens for libav
which has no concept of filter metadata.
2014-04-29 08:31:44 -07:00
wm4 f6f8dc7782 video: remove redundant mp_image display_w/_h members
Commit 5e4e248 added a mp_image_params field to mp_image, and moved many
parameters to that struct. display_w/h was left redundant with
mp_image_params.d_w/d_h. These fields were supposed to be always in
sync, but it seems some code forgot to do this correctly, such as
vf_fix_img_params() or mp_image_copy_attributes(). This led to the
problem in github issue #756, because display_w/_h could become
incorrect.

It turns out that most code didn't use the old fields anyway. Just
remove them. Note that mp_image_params.d_w/d_h are supposed to be always
valid, so the additional checks for 0 shouldn't be needed. Remove these
checks as well.

Fixes #756.
2014-04-29 13:31:59 +02:00
wm4 42f65ce108 video: don't drop last frame when deinterlacing with yadif
Or in other words, add support for properly draining remaining frames
from video filters. vf_yadif is buffering at least one frame, and the
buffered frame was not retrieved on EOF.

For most filters, ignore this for now, and just adjust them to the
changed semantics of filter_ext. But for vf_lavfi (used by vf_yadif),
real support is implemented. libavfilter handles this simply by passing
a NULL frame to av_buffersrc_add_frame(), so we just have to make
mp_to_av() handle NULL arguments.

In load_next_vo_frame(), we first try to output a frame buffered in the
VO, then the filter, and then (if EOF is reached and there's still no
new frame) the VO again, with draining enabled. I guess this was
implemented slightly incorrectly before, because the filter chain still
could have had remaining output frames.
2014-04-28 22:23:31 +02:00
wm4 e8a996cede client API: add chapter change event
Also works for mpv_observe_property() on the "chapter" property.
2014-04-27 22:28:07 +02:00
wm4 93de4c81b9 stream: make mp_input_check_interrupt thread-safe
The interrupt callback will can be called from another thread if the
cache is enabled, and the stream disconnects. Then stream_reconnect()
will call this function from within the cache thread.

mp_input_check_interrupt() is not thread-safe due to read_events() not
being thread-safe. It will call input callbacks added with
mp_input_add_fd() - these callbacks lead to code not protected by locks,
such as reading X11 events.

Solve this by adding a stupid hack, which checks whether the calling
thread is the main playback thread (i.e. calling the input callbacks
will be safe). We can remove this hack later, but it requires at least
moving the VO to its own thread first.
2014-04-25 19:13:03 +02:00
wm4 e0cf983e53 stream: remove interrupt callback global variables
This used global variables for the asynchronous interrupt callback.

Pick the simple and dumb solution and stuff the callback into
mpv_global. Do this because interrupt checking should also work in the
connect phase, and currently stream creation equates connecting.
Ideally, this would be passed to the stream on creation instead, or
connecting would be separated from creation. But since I don't know yet
which is better, and since moving stream/demuxer into their own thread
is something that will happen later, go with the mpv_global solution.
2014-04-25 19:12:24 +02:00
wm4 8b7ac6e029 lua: fix stack going out of sync
This broke with recursive tables.
2014-04-24 02:30:19 +02:00
wm4 2b26517ef7 dispatch: move into its own source file
This was part of osdep/threads.c out of laziness. But it doesn't contain
anything OS dependent. Note that the rest of threads.c actually isn't
all that OS dependent either (just some minor ifdeffery to work around
the lack of clock_gettime() on OSX).
2014-04-23 21:16:51 +02:00
wm4 8a74638dc7 video: add a "hwdec" property to enable or disable hw decoding at runtime 2014-04-23 01:58:12 +02:00
wm4 b430c886aa client API: make mpv_set_option set options natively
This should fix some issues, such as not being able to set the
"no-video" option with MPV_FORMAT_FLAG.

Note that this changes semantics a bit. Now setting an option strictly
overwrite it, even if the corresponding command line option does not.
For example, if we change --sub to append by default, then setting the
"sub" option via the client API would still never append. (Oddly, this
also applies to --vf-add, which will overwrite the old value when using
the client API.)

I'm doing this because there's no proper separation between the command
line parser and setting an option using the MPV_FORMAT_STRING format.
Maybe the solution to this mess would be adding format aware code (i.e.
m_option_set_node) to every option type, and falling back to strings
only if needed - but this would mean that you couldn't set e.g. an
integer option using MPV_FORMAT_STRING, which doesn't seem to be ideal
either.

In conclusion, the current approach seems to be most robust, but I'm
open to suggestions should someone find that these semantics are a
problem.
2014-04-22 01:42:57 +02:00
wm4 c57e51097b command: export rotation parameter
For completeness.
2014-04-22 01:42:57 +02:00
wm4 ff9ac83419 video: auto-insert software rotation filter
If the VO can't do rotation, insert a filter to do this. Note that this
doesn't reuse the filter insertion code from command.c (used by "vf"
input command), because that would end up more complicated: we don't
even want to change the user filter option.
2014-04-21 02:57:16 +02:00
wm4 0879db960d encode: don't resume playback when encoding
The previous commit doesn't handle additionally loaded config files,
such as the playback resume mechanism.
2014-04-19 22:31:35 +02:00
wm4 b85983a4a6 encode: don't apply default config options
Often, user configs set options that are not suitable for encoding.
Usually, playback and encoding are pretty different things, so it makes
sense to keep them strictly separate. There are several possible
solutions. The approach taken by this commit is to basically ignore the
default config settings, and switch to an [encoding] config profile
section instead. This also makes it impossible to have --o in a config
file, because --o enables encode mode.

See github issue #727 for discussion.
2014-04-19 22:05:17 +02:00
wm4 0cff5836c3 Remove CPU detection and inline asm handling
Not needed anymore. I'm not opposed to having asm, but inline asm is too
much of a pain, and it was planned long ago to eventually get rid fo all
inline asm uses.

For the note, the inline asm use that was removed with the previous
commits was almost worthless. It was confined to video filters, and most
video filtering is now done with libavfilter. Some mpv filters (like
vf_pullup) actually redirect to libavfilter if possible.

If asm is added in the future, it should happen in the form of external
files.
2014-04-19 17:10:56 +02:00
James Ross-Gowan 78b07c7b60 encode: disable keep-open when encoding 2014-04-19 14:35:57 +02:00
wm4 e6f4c50f46 player: fix audio EOF check on --no-audio
This considered audio to never reach EOF when audio was disabled,
instead of always being EOF.
2014-04-18 00:03:49 +02:00