Commit Graph

268 Commits

Author SHA1 Message Date
wm4 1e3e7bb7f4 command: add a property to indicate core pause state
Currently this is (probably) equivalent to "paused-for-cache", but the
latter is a bit special, while this new property is a bit more general.
One case where they might actually be different is dvdnav menus, but I
haven't checked.

Also add property change notifications for these two properties.
2014-04-14 22:08:33 +02:00
Kevin Mitchell 9ffb35848b command: vf-metadata: minor fixup of return status
Signed-off-by: wm4 <wm4@nowhere>
2014-04-14 09:38:45 +02:00
Kevin Mitchell 9eb061a72b command: add vf-metadata property
This is a read-only property that uses VFCTRL_GET_METADATA
to retrieve mp_tags metadata from a filter specified by label

Signed-off-by: wm4 <wm4@nowhere>
2014-04-13 18:03:01 +02:00
wm4 47972a0077 player: remove ASX, SMIL and NSC playlist parsers
These playlist parsers are all what's left from the old mplayer playlist
parsing code. All of it is old code that does little error checking; the
type of C string parsing code that gives you nightmare.

Some playlist parsers have been rewritten and are located in
demux_playlist.c. The removed formats were not reimplemented. ASX and
SMIL use XML, and since we don't want to depend on a full blown XML
parser, this is not so easy. Possibly these formats could be supported
by writing a very primitive XML-like lexer, which would lead to success
with most real world files, but I haven't attempted that. As for NSC, I
couldn't find any URL that worked with MPlayer, and in general this
formats seems to be more than dead.

Move playlist_parse_file() to playlist.c. It's pretty small now, and
basically just opens a stream and a demuxer. No use keeping
playlist_parser.c just for this.
2014-04-13 15:40:05 +02:00
wm4 62a483f18b player: hack to fix --msgmodule --term-osd-bar
Basically a cheap hack to fix that the --msgmodule prefix will cause an
unwanted linebreak by making the line too long.

Suggested by Hamuko in github issue #710.

Fixes #710.
2014-04-13 13:03:31 +02:00
David Weber 750de181d7 command: add paused-for-cache, total-avsync-change, drop-frame-count properties
This is needed if you want to reimplement the status line in lua

I could only test drop-frame-count because I didn't find an easy way to
trigger paused-for-cache and total-avsync-change

Signed-off-by: wm4 <wm4@nowhere>
2014-04-13 12:32:14 +02:00
wm4 f3c0897b3f lua: make it easier to integrate with foreign event loops
We provide some "official" utility functions for this.
2014-04-12 20:41:12 +02:00
wm4 19abeaf62d lua: wrap mpv_get_wakeup_pipe()
Pretty much experimental for issue #661.
2014-04-12 20:13:53 +02:00
wm4 4e5cea86c2 client API: add mpv_get_wakeup_pipe convenience function
Should make integreating with some event loops easier. Untested.
2014-04-12 20:13:07 +02:00
wm4 86094c2c5a client API: include the reason in MPV_EVENT_END_FILE
Otherwise, the client API user could not know why playback was stopped.

Regarding the fact that 0 is used both for normal EOF and EOF on error:
this is because mplayer traditionally did not distinguish these, and in
general it's hard to tell the real reason. (There are various weird
corner cases which make it hard.)
2014-04-11 01:23:32 +02:00
wm4 55d6e1f98d lua: add helper function for printing a table
Although this is something really basic, Lua's standard library doesn't
provide anything like this. Probably because there are too many ways to
do it right or wrong.

This code tries to be really careful when dealing with mixed
arrays/maps, e.g. when a table has integer keys starting from 1, making
it look like an array, but then also has other keys.
2014-04-11 00:40:09 +02:00
wm4 fb06e30b7b lua: add a minor helper function 2014-04-10 23:56:06 +02:00
wm4 217008be4a client: change equality rules for MPV_FORMAT_NONE 2014-04-09 20:27:26 +02:00
wm4 b23a1edf55 client: add a comment 2014-04-09 19:27:28 +02:00
wm4 5f65a5cfea cache: allow resizing at runtime
The only tricky part is keeping the cache contents, which is made simple
by allocating the new cache while still keeping the old cache around,
and then copying the old data.

To explain the "Don't use this when playing DVD or Bluray." comment: the
cache also associates timestamps to blocks of bytes, but throws away the
timestamps on seek. Thus you will experience strange behavior after
resizing the cache until the old cached region is exhausted.
2014-04-09 19:15:23 +02:00
ChrisK2 4f689258cb osc: fix playlist display 2014-04-09 18:10:51 +02:00
wm4 89d400dc21 client API: avoid redundant property change events if possible
This is done simply by comparing the previous and current values. Do
this only if the requested format is not MPV_FORMAT_NONE.
2014-04-08 22:06:39 +02:00
wm4 d6022f33d6 command: property set commands should send property change notifications
Some of these property implementations already send notifications on
their own, but most don't. This takes care of them.

Of course this still doesn't handle all propertry changes - this is
impossible without special-casing each property that can change on its
own.
2014-04-08 21:24:14 +02:00
wm4 a94020e25b lua: add API for observing property changes
A low level API was added already earlier, but that was merely a binding
for the raw C API. Add a "proper" one, and document it.
2014-04-08 21:10:00 +02:00
wm4 6f8c5d1f6d lua: add basic mpv_observe_property support
Undocumented and only the most basic functionality for now.
2014-04-06 03:22:49 +02:00
wm4 49d1b42f70 client API: add a way to notify clients of property changes
This turned out ridiculously complex. I think it will have to be
simplified some day. Main reason for the complexity are:
- filtering properties by forcing clients to observe individual
  properties explicitly
  (to avoid spamming clients with changes they don't want)
- optional retrieval of property value with the notification
  (the basic idea was that this is more user friendly)
- allowing to the client to specify a format in which the value
  should be retrieved
  (because if a property changes its type, the client API couldn't
  convert it properly, and compatibility would break)

I don't know yet which of these are important, and everything could
change. In particular, the interface and semantics should be adjusted
to reduce the implementation complexity.

While I consider the API complete, there could (and probably will) be
bugs left. Also while the implementation is complete, it's inefficient.
The complexity of the property matching is O(a*b*c) with a clients,
b observed properties, and c properties changing at once. I threw away
an earlier implementation using bitmasks, because it was too unwieldy.
2014-04-06 03:22:49 +02:00
wm4 14eb233da9 client API: use a manual ringbuffer
Remove the use of mp_ring and use a simple array and a bunch of
variables instead. This is way less awkwad.

The change in reserve_reply fixes incorrect tracking of free events.
2014-04-06 03:22:49 +02:00
Alessandro Ghedini e7977ec875 af: add replaygain_data field to af_stream and af_instance
Closes #664
2014-04-04 18:35:29 +02:00
wm4 e3e9661a33 lua: give more control over timers
Now they can be paused and resumed.

Since pausing and disabling the timer is essentially the same underlying
operation, we also just provide one method for it.

mp.cancel_timer probably still works, but I'm considering this
deprecated, and it's removed from the manpage. (We didn't have a release
with this function yet, so no formal deprecation.)
2014-04-02 17:09:45 +02:00
wm4 3207366daa lua: add mp.unregister_event() function
Someone requested this... I think.
2014-04-01 00:37:50 +02:00
Alessandro Ghedini 01e8a9c9e3 encode_lavc: copy metadata to output file
Closes #684

Signed-off-by: wm4 <wm4@nowhere>

Includes some minor cosmetic changes additional to the original PR.
2014-03-30 20:04:20 +02:00
wm4 239dc2851a command: allow changing filters before video chain initialization
Apparently this is more intuitive.

Somewhat tricky, because of the odd state after loading a file but
before initializing the VO.
2014-03-30 19:59:26 +02:00
wm4 392997fa10 command: change what the metadata property returns
Change the type of the property from a string list (alternating
key/value entries) to a map. Using the client API, this will return
MPV_FORMAT_NODE_MAP, while Lua mp.get_property_native returns a
dictionary-like table.
2014-03-30 19:21:33 +02:00
wm4 3fe6426ae0 command: minor simplification 2014-03-30 18:50:35 +02:00
wm4 5cd20c7320 command: add helper function to split property paths
We've just checked whether a sub-path started with "name/", but that
changes behavior whether the property name has a trailing '/' or not.
Using a helper function to split of path components avoids this problem.
2014-03-30 13:41:03 +02:00
ChrisK2 1a23ca2766 osc: make OSC more responsive when paused
Quick hack to impove situtation until the next major overhaul
comes
2014-03-30 12:24:12 +02:00
Sebastian Morr 9b5cbe4bf0 player: add missing "-" to options in workaround notice on A/V desynchronization
While it technically works, using GNU-style options seems cleaner nowadays.

Signed-off-by: wm4 <wm4@nowhere>
2014-03-30 09:17:24 +02:00
wm4 ae448e198f audio: remove sample rate limit checks
This played the file at a wrong sample rate if the rate was out of
certain bounds.

A comment says this was for the sake of libaf/af_resample.c. This
resampler has been long removed. Our current resampler
(libav/swresample) checks supported sample rates on reconfiguration, and
will error out if a sample rate is not supported. And I think that is
the correct behavior.
2014-03-30 07:34:43 +02:00
wm4 9be2f6b9f8 player: dvdnav: fix start time when entering and leaving menu
Unfortunately, quite a hack, because we have check the nav state
outside of discnav.c.
2014-03-30 07:31:02 +02:00
wm4 8487bb2c54 Merge remote-tracking branch 'mpv/pr/676' 2014-03-30 07:21:25 +02:00
xylosper fb47f2f940 player: rename dvdnav to discnav
Now, navigation works both of DVD and non-BD-J Blu-ray. Therefore,
rename all 'dvdnav' strings which are not DVD specific to 'discnav'
2014-03-30 11:42:49 +09:00
xylosper 8cee8279ad stream_bluray: implement navigation interface for Blu-ray stream
This commit introduces new stream protocols: bdnav(and others).
bdnav stream shares lots of codes with original bluray stream, so
it's not separated in different source file.

Major difference from bluray is that bdnav does not support longest
title because there is no way to query that information.
bdnav://menu and bdnav://first correspond to top menu title and
first play title respectively, though they often point same title.

Also, binary position based seeking has been removed, because it
didn't have no point.
2014-03-29 23:31:46 +09:00
wm4 bd0618f01f video/out: remove legacy colorspace stuff
Reduce most dependencies on struct mp_csp_details, which was a bad first
attempt at dealing with colorspace stuff. Instead, consistently use
mp_image_params.

Code which retrieves colorspace matrices from csputils.c still uses this
type, though.
2014-03-29 00:25:08 +01:00
wm4 5afef03a70 player: fix unchecked access for chapter metadata
It's possible that MPContext has a chapter list, but the demuxer
doesn't. In this case, accesing the chapter-metadata property would
lead to invalid accesses.

(This fixes the out of bound access, but in theory, the returned data
can still be incorrect, since MPContext chapters don't need to map
directly to demuxer chapters.)
2014-03-26 17:07:53 +01:00
wm4 b342b1a30e dvdnav: fix minor memory leak
This was usually handled at the end of the switch statement, so if
something returns from the function before that, the event has to be
freed explicitly.
2014-03-25 15:44:47 +01:00
xylosper b5fe3e9a82 dvdnav: check and update video resolution whenever rendering
Previous implementation updated video resolution when highlight
event was given. However, this may not work if highlight event
is given before video size is queried.
This commit adds checking routine into rendering function, too.
2014-03-25 15:37:14 +01:00
xylosper 448b535d48 dvdnav: make MP_NAV_EVENT_RESET_ALL handled properly
dvdnav.c did not handle event in regular sequence. Usually this
does not make any trouble except around MP_NAV_EVENT_RESET_ALL.
Those events should be handled in regular sequence. If they're
mixed, it can make wrong result.
For instance, MP_NAV_EVENT_HIGHLIGHT right after
MP_NAV_EVENT_RESET_ALL should not be ignored but it might be
because MP_NAV_EVENT_RESET_ALL makes the demuxer reloaded and osd
hidden.
2014-03-25 15:37:14 +01:00
xylosper cb7cf1cfb1 dvdnav: prevent reallocation of fake highlight buffer
Since subsizes were never updated, the bitmap buffer was always
reallocated whenever mp_nav_get_highlight() called.
2014-03-25 22:25:29 +09:00
wm4 d2e4938c78 player: use MP_NOPTS_VALUE as rel_time_to_abs() error value
And consistently use MP_NOPTS_VALUE as error value for the users of this
function. This is better than using -1, especially because negative
values can be valid timestamps.
2014-03-25 02:32:24 +01:00
wm4 6c2cd08aff player: handle chapter range like --start/--end
Instead of comparing the current chapter every time, set the playback
end timestamp to the chapter end. Likewise, don't execute an extra seek
for the start chapter.

Maybe we could also use the timeline facility to restrict playback to
the given chapter range, but this would be strange when using
--chapter=N to start playback at a given chapter. Then you couldn't seek
back, which is possibly not what the user wants.
2014-03-25 02:27:22 +01:00
wm4 c19c777061 player: let chapter_start_time() return MP_NOPTS_VALUE for unknown times 2014-03-25 02:18:12 +01:00
wm4 5cae4a807c player: remove weird separation between no chapters and 0 chapters
For some reason, it mattered whether mpctx->chapters was NULL or not,
even if mpctx->num_chapters was 0. Remove this separation; it serves no
purpose.
2014-03-25 02:10:24 +01:00
wm4 92d7dc9e88 player: remove demuxer chapoter API wrappers
Instead, always use the mpctx->chapters array. Before this commit, this
array was used only for ordered chapters and such, but now it's always
populated if there are chapters.
2014-03-25 02:05:48 +01:00
wm4 2c693a4732 stream: remove old chapter handling code
Stream-level chapters (like DVD etc.) did potentially not have
timestamps for each chapter, so STREAM_CTRL_SEEK_TO_CHAPTER and
STREAM_CTRL_GET_CURRENT_CHAPTER were needed to navigate chapters. We've
switched everything to use timestamps and that seems to work, so we can
simplify the code and remove this old mechanism.
2014-03-25 01:38:18 +01:00
wm4 bb1b0a9f42 player: remove confusing argc/argv adjustment
It's better if argc/argv always mean the same thing.
2014-03-23 21:46:29 +01:00