summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* core: remove dead --vsync leftoverswm42013-04-121-2/+1
|
* mplayer: remove unnecessary variablewm42013-04-101-6/+4
|
* core: add --reset-on-next-file optionwm42013-04-101-0/+11
| | | | | | | This option can be used to selectively reset settings when playing the next file in the playlist (i.e. restore mplayer and mplayer2 behavior). Might remove this option again should it turn out that nobody uses it.
* mplayer: keep volume persistent, even when using --volumewm42013-04-101-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider: mpv --volume 10 file1.mkv file2.mkv Before this commit, the volume was reset to 10 when playing file2.mkv. This was inconsistent to most other options. E.g. --brightness is a rather similar case. In general, settings should never be reset when playing the next file, unless the option was explicitly marked file-local. This commit corrects the behavior of the --volume and --mute options. File local --volume still works as expected: mpv --{ --volume 10 file1.mkv file2.mkv --} This sets the volume always to 10 on playback start. Move the m_config_leave_file_local() call down so that the mixer code in uninit_player() can set the option volume and mute variables without overwriting the global option values. Another subtle issue is that we don't want to set volume if there's no need to, which is why the user_set_volume/mute fields are introduced. This is important because setting the volume might change the system volume depending on other options.
* mplayer: move DVB channel skip codewm42013-04-101-23/+21
| | | | Try not to cause unnecessary special cases.
* mplayer: don't disable term-osd with -vwm42013-04-101-4/+0
| | | | I don't see any reason for doing this.
* mplayer: don't print bogus status when cachingwm42013-04-101-1/+1
| | | | | When streaming from http, this could print a status line indicating paused playback instead of "buffering" sometimes.
* core: remove volstep global variablewm42013-04-091-4/+1
|
* demux_mkv: try to show current subtitle when seekingwm42013-04-041-0/+2
| | | | | | | | | | | | | | | | | Makes sure that seeking to a given time position shows the subtitle at that position. This can fail if the subtitle packet is not close enough to the seek target. Always enabled for hr-seeks, and can be manually enabled for normal seeks with --mkv-subtitle-preroll. This helps displaying subtitles correctly with ordered chapters. When switching ordered chapter segments, a seek is performed. If the subtitle is timed slightly before the start of the segment, it normally won't be demuxed. This is a problem with all seeks, but in this case normal playback is affected. Since switching segments always uses hr-seeks, the code added by this commit is always active in this situation. If no subtitles are selected or the subtitles come from an external file, the demuxer should behave exactly as before this commit.
* core: add --heartbeat-interval optionwm42013-04-041-3/+4
| | | | | | This closely follows MPlayer commit 36099, with some changes. Move a mutable static variable into MPContext.
* mplayer: switch back to video PTS for reporting playback timewm42013-04-041-10/+6
| | | | | | | | | | | | | | | The main problem with video PTS was that it wasn't very useful when playing audio files with cover art. Using the audio time instead was an obvious solution. Unfortunately, this leads to "inexact" reporting of the playback time in paused mode, and audio is always ahead by small, essentially random amounts of time ahead. This is possibly because the times reported by AOs are not entirely accurate when paused (see commit 9b3bf76). Switch back to video PTS, and use a simpler way to deal with the cover art case: if the video has ended, use the audio PTS. Also see commit f9a259e (and the commits referenced from there).
* mplayer: fix framestepping on ordered chapter segment boundarieswm42013-04-041-28/+34
| | | | | | | | | | | | | | | | | | | Trying to step over a segment boundary didn't work, and the video was stuck at the end of the current chapter. At this point, both video and audio of the segment has ended, and the segment switching code is going to call seek() to go to the next segment (the part of the code in run_playloop that uses end_is_chapter). However, this seek() is not called if playback is paused, and the framestepping code always paused before this code is run. Move the framestepping code below the chapter switching code. The added restart_playback condition makes sure the code is called only after at least one video frame has been shown. Also don't reset the framestep counter after seek. It's not needed, and removing it prevents full unpausing when stepping over a segment boundary. This also terminates playback when frame stepping at the end of the file. The --keep-open option can be used to get the old behavior.
* mplayer: fix --step EOF handlingwm42013-04-041-1/+3
|
* osd: draw the OSD bar with ASS vector drawingswm42013-03-301-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | Drawing the bar with vector drawings (instead with characters from the OSD font) offers more flexibility and looks better. This also adds chapter marks to the OSD bar, which are visible as small triangles on the top and bottom inner border of the bar. Change the default position of the OSD bar below the center of the screen. This is less annoying than putting the bar directly into the center of the view, where it obscures the video. The new position is not quite on the bottom of the screen to avoid collisions with subtitles. The old centered position can be forced with ``--osd-bar-align-y=0``. Also make it possible to change the OSD bar width/height with the new --osd-bar-w and --osd-bar-h options. It's possible that the new OSD bar renders much slower than the old one. There are two reasons for this: 1. the character based bar allowed libass to cache each character, while the vector drawing forces it to redraw every time the bar position changes. 2., the bar position is updated at a much higher granularity (the bar position is passed along as float instead of as integer in the range 0-100, so the bar will be updated on every single video frame).
* vo: rename vo_draw_image to vo_queue_imagewm42013-03-281-2/+2
|
* core: always pass data via packet fields to video decoderswm42013-03-281-10/+9
| | | | | | | Makes the code a bit simpler to follow, at least in the "modern" decoding path (update_video_nocorrect_pts() is used with old demuxers, which don't return proper packets and need further parsing, so this code looks less simple now).
* core: output --playing-msg message only after at least one frame is shownwm42013-03-261-6/+8
| | | | | | | | | | | | | | | | This way it's possible to retrieve correct information about video, like actual width/height, which in general are available only after at least one frame has been sent to the video output, such as dwidth/dheight. mpv_identify.sh becomes a bit slower, because we let it decode enough audio and video to fill the audio buffers and to send one frame to the video output. Also, --playing-msg isn't shown anymore with --frames=0 (could be fixed by special-casing it, should this break any use cases). Note that in some corner cases, like when the demuxer for some reason returns lots of audio packets but no video packets at the start, but video actually starts later, the --playing-msg will still be output before video starts.
* mplayer: make --frames=1 work for audiowm42013-03-261-10/+15
| | | | | | | This has the same (useless) definition as frame stepping in audio-only mode: one frame means one playloop iteration. (It's relatively useless, because one playloop iteration has a random duration. But it makes --frames=1 work, which is useful again.)
* mplayer: cosmetics: make some code more readablewm42013-03-261-13/+13
|
* core: remove a number of global variableswm42013-03-081-81/+56
| | | | | | | | | | | Move them into per-instance structs. This should get rid of all global variables in mplayer.c (not counting those referenced by cfg-mplayer.h). In core/input/ar.c, just remove checking the slave_mode variable. I'm not sure what this code was supposed to achieve, but slave mode is broken, slave mode is actually infeasible on OSX (ar.c is completely OSX specific), and the correct way of doing this would be to disable this input device per command line switch.
* vo: Separate vo options from MPOptsAlexander Preisinger2013-03-041-5/+5
| | | | | | | Separate the video output options from the big MPOpts structure and also only pass the new mp_vo_opts structure to the vo backend. Move video_driver_list into mp_vo_opts
* Remove vo_fps global variablewm42013-03-041-3/+12
| | | | | This is needed by the encode stuff for some reason, so we have to explicitly pass it. Functionality shouldn't change.
* vo: remove and cleanup globalsAlexander Preisinger2013-03-041-3/+2
| | | | | | | | Removes almost every global variabel in vo.h and puts them in a special struct in MPOpts for video output related options. Also we completly remove the options/globals pts and refresh rate because they were unused.
* x11_common: fix --cursor-autohide when pausedwm42013-03-031-2/+8
| | | | | | | | When paused, --cursor-autohide worked with a precision of 500ms, which is the main loop's default sleep time when paused. Cursor hiding is polled in x11_common, and the main loop never called the X11 code at the right time. Fix this by allowing the VO to set a time when it should be called next.
* core: fix SEEK_FACTORwm42013-03-011-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Emulate percentage-seeks (SEEK_FACTOR) as normal time-seeks if possible. This fixes some issues with (let's call it) low quality implementations of SEEK_FACTOR (e.g. demux_mkv basically interprets this as byte-seek, and also seeking to 99.9% makes it seek back to the start). For weird MPEG formats the demuxer level SEEK_FACTOR is still used. These formats, which can have timestamp resets, are identified by setting demuxer->ts_resets_possible to true. Also, have get_current_pos_ratio() follow the same rules, and calculate the percentage position with the file position if timestamp resets are possible. This actually fixes percentage-seeks in .ts files with demux_lavf.c. This kind of seek is not really used now, but it will be more important when we add a progress bar. Note: seeking in chained ogg files is still completely broken. The main issue is that ffmpeg doesn't provide a sane API for dealing with timestamp resets, and trying to do byte seeks with ogg confuses demuxer and decoder (or something like this) and just does random things. (Tested with two concatenated flac-in-ogg files).
* core: move X11 specific code to x11_common.cwm42013-03-011-5/+0
| | | | | Nothing changes, because vo_check_events() is called at the same place anyway.
* core: simplify OSD capability handling, remove VFCAP_OSDwm42013-03-011-3/+2
| | | | | | | | | | | | | | | | | | | VFCAP_OSD was used to determine at runtime whether the VO supports OSD rendering. This was mostly unused. vo_direct3d had an option to disable OSD (was supposed to allow to force auto-insertion of vf_ass, but we removed that anyway). vo_opengl_old could disable OSD rendering when a very old OpenGL version was detected, and had an option to explicitly disable it as well. Remove VFCAP_OSD from everything (and some associated logic). Now the vo_driver.draw_osd callback can be set to NULL to indicate missing OSD support (important so that vo_null etc. don't single-step on OSD redraw), and if OSD support depends on runtime support, the VO's draw_osd should just do nothing if OSD is not available. Also, do not access vo->want_redraw directly. Change the want_redraw reset logic for this purpose, too. (Probably unneeded, vo_flip_page resets it already.)
* core: use floats for OSD bar percentage displaywm42013-02-261-15/+16
| | | | | | | Use floats instead of integers in the range 0-100. Currently, the OSD is currently made up of 46 elements so no change should be visible, but rendering of the bar will be changed later to use vector drawings (using pixel coordinates) instead of glyphs. This commit is for preparation.
* core: use playback time to determine playback percent positionwm42013-02-261-6/+16
| | | | | | | | | | | | | The percent position is used for the OSD, the status line, and for the OSD bar (shown on seeks). By default, the PTS of the last demuxed packet was used to calculate it. This led to a "jumpy" display when the percentage value (casted to int) was changing. The reasons for this were the presence of video frame reordering (packet PTS is not monotonic), or getting PTS values from different streams (like audio/subs). Since these rely on PTS values and correct file durations anyway, simplify it by calculating it with the current playback position in mplayer.c instead.
* core: print correct quit message when quitting, simplify codewm42013-02-241-24/+11
| | | | | | | | | "End of file" was printed to the terminal instead of "Quit" when exiting with the "quit" slave command (closing the window and such). Note that it will still print EOF when it exists because the end of the playlist is reached. Do some other (not strictly related) simplifications.
* osd: prevent osd bar from sticking around on seekswm42013-02-201-6/+12
| | | | | | | | | | | | | This was supposed to be fixed in f897138, but there's another corner case. Basically, set_osd_function() reset the OSD time, which is not nice at all and breaks the logic of letting OSD elements disappear when they're not wanted anymore. Fix this by adding a separate timer for this. Additionally, make sure the OSD bar is _really_ always updated when visible. Also, redraw the OSD only if the OSD bar actually changes to prevent redrawing too often (every vo_osd_changed() will flag that the OSD should be redrawn, even if nothing changes).
* mplayer: don't display "-1" as chapter when chapter seek failswm42013-02-201-1/+6
| | | | | | | | | Increase robustness against out of bound chapter numbers. Normally these functions expect that the callers sanitize the chapter number. This went wrong at least in add_seek_osd_messages() (which displayed a chapter "-1" when chapters were not available). Make these functions a bit friendler and add some reasonable checks and fallbacks, which fixes the mentioned chapter seeking case as well.
* osd: use --osd-duration for OSD barwm42013-02-171-2/+4
| | | | | It was hardcoded to 1 second (which is also the default for --osd-duration, so this was probably never noticed).
* mplayer: print "Cache:" instead of "C:" on the status linewm42013-02-171-1/+1
| | | | | Hasn't been done before because there wasn't enough space, but this changed recently.
* osd: show cache state on the playback progression display by defaultwm42013-02-171-0/+3
| | | | | | | This affects the "show_progress" command, by defualt on the 'P' key. If there are complaints, I'll probably remove it again. (It looks relatively annoying, but it also valueable information... sort of.)
* command: add "cache" read-only propertywm42013-02-171-6/+6
|
* osd: add --osd-status-msg option for custom OSD statuswm42013-02-161-5/+12
|
* mplayer: use talloc instead of malloc for status linewm42013-02-161-59/+35
|
* osd: add --no-osd-bar option to disable the OSD barwm42013-02-161-1/+1
| | | | | In addition to disabling the OSD bar physically, also add some fallbacks to OSD text in places the OSD bar would have been used.
* osd: always update already visible OSD bar on seekswm42013-02-161-9/+20
| | | | | | | | | Seeks can be performed with OSD bar invisible (e.g. "osd-msg seek ..." command), and then an already visible bar won't be updated. But the bar will stick around until the OSD text is hidden. This is confusing, so change it that the bar is updated. (Making the bar disappear on such seeks would require much more changes, so we're lazy and go with this commit.)
* mplayer: fix seek display during seeking when playing ordered chapterswm42013-02-131-9/+15
| | | | | | | | | | | | | | | | | The seek bar appeared to be "stuck" to the start of the current chapter. This is a regression from 630a2b1. This commit assumed that hrseek_pts would always contain the hrseek target time (when hrseek_active==true). But this is not always the case: when playing timeline stuff (e.g. ordered chapters), hrseek framedropping is abused to handle an obscure corner case, and then hrseek_pts contains something completely unrelated to the current playback time. See the added comment in mplayer.c and commit c1232c9. Fix this by trying something else to get a correct time "during" hr-seeks. mpctx->restart_playback looks ideal, because it's set while audio is being synced / audio buffers being filled, so we know that the audio time is probably bogus while it is set. Let's hope this is correct.
* demux_lavf: remove code duplicationwm42013-02-101-3/+3
| | | | | | | | | | Also move the lang field into the general stream header. (SH_COMMON is an old hack to "share" code between audio/video/sub headers.) There should be no functional changes, other than not printing stream info in verbose mode or with slave mode. (The frontend already prints stream info, and this is just a leftover when individual demuxers did this, and slave mode remains broken.)
* core: redo how codecs are mapped, remove codecs.confwm42013-02-101-77/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use codec names instead of FourCCs to identify codecs. Rewrite how codecs are selected and initialized. Now each decoder exports a list of decoders (and the codec it supports) via add_decoders(). The order matters, and the first decoder for a given decoder is preferred over the other decoders. E.g. all ad_mpg123 decoders are preferred over ad_lavc, because it comes first in the mpcodecs_ad_drivers array. Likewise, decoders within ad_lavc that are enumerated first by libavcodec (using av_codec_next()) are preferred. (This is actually critical to select h264 software decoding by default instead of vdpau. libavcodec and ffmpeg/avconv use the same method to select decoders by default, so we hope this is sane.) The codec names follow libavcodec's codec names as defined by AVCodecDescriptor.name (see libavcodec/codec_desc.c). Some decoders have names different from the canonical codec name. The AVCodecDescriptor API is relatively new, so we need a compatibility layer for older libavcodec versions for codec names that are referenced internally, and which are different from the decoder name. (Add a configure check for that, because checking versions is getting way too messy.) demux/codec_tags.c is generated from the former codecs.conf (minus "special" decoders like vdpau, and excluding the mappings that are the same as the mappings libavformat's exported RIFF tables). It contains all the mappings from FourCCs to codec name. This is needed for demux_mkv, demux_mpg, demux_avi and demux_asf. demux_lavf will set the codec as determined by libavformat, while the other demuxers have to do this on their own, using the mp_set_audio/video_codec_from_tag() functions. Note that the sh_audio/video->format members don't uniquely identify the codec anymore, and sh->codec takes over this role. Replace the --ac/--vc/--afm/--vfm with new --vd/--ad options, which provide cover the functionality of the removed switched. Note: there's no CODECS_FLAG_FLIP flag anymore. This means some obscure container/video combinations (e.g. the sample Film_200_zygo_pro.mov) are played flipped. ffplay/avplay doesn't handle this properly either, so we don't care and blame ffmeg/libav instead.
* options: change --no-config option, make it apply to input.conf as wellwm42013-02-091-5/+5
| | | | | | | | | | | | | Simplify --no-config and make it a normal flag option, and doesn't take an argument anymore. You can get the same behavior by using --no-config and then --include to explicitly load a certain config file. Make --no-config work for input.conf as well. Make it so that --input:conf=file still works in this case. As a technically unrelated change, the file argument now works as one would expect, instead of making it relatively to "~/.mpv/". This makes for simpler code and easier to understand option semantics. We can also print better error messages.
* mplayer: remove seconds/centiseconds display from terminal status linewm42013-02-091-6/+2
| | | | | | | | | Doesn't have much of a purpose for normal playback. You can get milliseconds display with --osd-fractions. It's also possible to build a custom status line with --status-msg. This gives more space on the status line and, in my opinion, is a bit less annoying.
* core: remove --edlout functionalitywm42013-02-061-14/+0
| | | | | | | | | | | | | | | | This could write .edl files in MPlayer's format. Support for playing these files has been removed from mplayer2 quite a while ago. (mplayer2 can play its own, "new" .edl format, but does not support writing it.) Since this is a rather obscure functionality, and it's not really clear how it should behave (e.g. what should it do if a new file is played), and wasn't all that great to begin with (what if you made a mistake? the "edl_mark" command sucks for editing), get rid of it. Suggestions how to reimplement this in a nicer way are welcome. If it's just about retrieving timecodes, this in input.conf will do: KEY print_text "position: ${=time-pos}"
* mplayer: don't show bogus audio PTS during hr-seekwm42013-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a problem that happened with syncplay.pl [1] when ad_mpg123 was in use, and get_current_time() returning a bogus time position. This only happens during seeking; the reported time is correct after the seek is done. The audio PTS as returned by playing_audio_pts() is simply bogus during hr-seek. With ad_ffmpeg, it was actually set to MP_NOPTS_VALUE during seeking, so get_current_time() did a fallback to the video PTS. However, ad_mpg123 is different and explicitly decodes some audio when resetting on seek (reasons why it does this unknown and uninvestigated; apparently it's to reinit libmpg123). As a result, the audio PTS was set to the start position of the seek (or something similar), which could be very different from the seek target time. This confused syncplay. It got the bogus time because it spams the player with read commands to the "time-pos" property, so this corner case was hit. Fix this by making get_current_time() return the seek target time if hr-seek is active. This should make behavior the same as before commit 3f949cf "mplayer: prefer audio PTS over video PTS for status line". [1] http://syncplay.pl
* mplayer: properly handle framestep when showing last video framewm42013-02-031-10/+12
| | | | | | | | | | | | | | When doing a framestep while there is no more video, nothing happened, and audio continued to play. When advancing to the next file, the player was paused. Fix it so that it always pauses (except on very low frame rate video, which is yet another corner case). We also change the meaning of framestepping a bit: in audio only mode, framstepping unpauses for a single playloop iteration. This is probably not useful at all, but makes the code a bit more simpler/uniform. Just like the previous commit, this matters most for audio files with cover art, for which this special case is the normal case.
* mplayer: reset audio/video delay if there's no next video framewm42013-02-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | |