summaryrefslogtreecommitdiffstats
path: root/mplayer.c
<
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: define ROUND() macro in mpcommon.hcboesch2011-01-311-2/+0
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32751 b3059339-0415-0410-9bf9-f77b7e298cf2
* core: timing: fix overflow with extreme playback speedUoti Urpala2011-01-281-1/+5
| | | | | | | | With extreme playback speed changes it was possible to trigger an overflow in code calculating frame timing. This could break the VDPAU frame scheduling mechanism and lead to the shown picture not changing until reset by events such as seeking. Add an extra check to prevent the overflow.
* Merge branch 'sub'Uoti Urpala2011-01-261-49/+342
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sub: sub/OSD: move some related files to sub/ subtitles: options: enable -ass by default subtitles: change default libass rendering style demux_mkv, chapters: change millisecond arithmetic to ns cleanup: rename ass_* functions to mp_ass_* subs: use correct font aspect ratio for libass + converted subs cleanup: some random minor code simplification and cleanup vf_vo: fix EOSD change detection bug sd_ass: remove subreader use, support plaintext markup subtitles: style support for common SubRip tags and MicroDVD core: ordered chapters: fix bad subtitle parameter subs/demux: don't try to enable sub track when creating it subtitles/demux: store duration instead of endpts in demux packets subtitles: add framework for subtitle decoders options: add special -leak-report option subtitles: remove code trying to handle text subs with libavcodec cleanup: move MP_NOPTS_VALUE definition to mpcommon.h subtitles: move global ass_track to struct osd_state core: move most mpcommon.c contents to mplayer.c core: move global "subdata" and "vo_sub_last" to mpctx subtitles: remove sub_last_pts hack options: move -noconfig to option struct, simplify
| * sub/OSD: move some related files to sub/Uoti Urpala2011-01-261-7/+7
| |
| * demux_mkv, chapters: change millisecond arithmetic to nsUoti Urpala2011-01-261-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | demux_mkv kept various integer timestamps in millisecond units. Matroska timestamp arithmetic is however specified in nanoseconds (even though files typically use 1 ms precision), and using ms units instead of that only made things more complex. Based on the demux_mkv example the general demuxer-level chapter structure also used ms units. Change the demux_mkv arithmetic and demuxer chapter structures to use nanoseconds instead. This also fixes a seeking problem in demux_mkv with files using a TimecodeScale other than the usual 1000000 (confusion between ms and TimecodeScale*ns units).
| * cleanup: rename ass_* functions to mp_ass_*Uoti Urpala2011-01-261-4/+4
| | | | | | | | | | | | | | | | The various ass_* functions were created when libass was part of the MPlayer tree and the distinction between MPlayer-specific and other functions was less clear. Now that libass is a clearly separate library, using the same ass_* namespace for player functions is ugly. Rename the functions to use mp_ass_ prefix instead.
| * subs: use correct font aspect ratio for libass + converted subsUoti Urpala2011-01-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rendering of ASS subtitles tries to be bug compatible with VSFilter and stretches fonts when the video is anamorphic (some scripts try to compensate for this VSFilter behavior, so trying to render them "correctly" would give the wrong result). However this behavior is not appropriate for subtitles we converted to ASS format ourselves for libass rendering, as they certainly don't have VSFilter bug workarounds. Change the code to use different behavior for "native" ASS tracks and converted ones. It's questionable whether the VSFilter-compatible behavior is appropriate for external .ass files either, as there could be anamorphic and non-anamorphic versions of the same video and the bug-compatible behavior can only be correct for one alternative at most. However it's probably better to keep it as a default at least, so that extracting a muxed subtitle track and using that does not give behavior different from the original muxed one. The aspect ratio setting is per ASS_Renderer, and changing it resets libass caches. For that reason this commit adds separate renderer instances to use for the "correct" and "VSFilter bug compatible" cases.
| * cleanup: some random minor code simplification and cleanupUoti Urpala2011-01-261-6/+3
| |
| * subtitles: style support for common SubRip tags and MicroDVDUoti Urpala2011-01-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | SubRip subtitles have no "official" spec for any styling support, but various tags are in common use; previous code filtered out text between <> to remove HTML-style tags. Add support for those tags and for MicroDVD subtitle styling. The style display is implemented by converting the subtitles to the ASS subtitle format and displaying them with libass, so libass needs to be enabled. Original patch by Clément Bœsch <ubitux@gmail.com>.
| * core: ordered chapters: fix bad subtitle parameterUoti Urpala2011-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | mp_property_do() takes the value to set a property to through a pointer. The calling code used '&mpctx->global_sub_pos' as the pointer; however that variable could be changed during the mp_property_do() call. Use a pointer to a copy of the original value instead. I think this only caused problems if you switched subtitle tracks from a real one to "disabled" and then switched to a timeline part from another source.
| * subtitles/demux: store duration instead of endpts in demux packetsUoti Urpala2011-01-181-6/+6
| |
| * subtitles: add framework for subtitle decodersUoti Urpala2011-01-181-30/+30
| | | | | | | | | | | | | | | | | | | | Add a framework for subtitle decoder modules that work more like audio/video decoders do, and change libass rendering of demuxed subtitles to use the new framework. The old subtitle code is messy, with details specific to handling particular subtitle types spread over high-level code. This should make it easier to clean things up and fix some bugs/limitations.
| * options: add special -leak-report optionUoti Urpala2011-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Add a special option "-leak-report" that enables talloc leak reporting. It only works if it's given as the first argument. The code abuses the CONF_TYPE_PRINT option type to make main option parsing ignore the option. The parser incorrectly consumed the following commandline argument as a "parameter" for options of this type when they had the flag to not exit after printing the message. Fix this. It makes no difference for any previously existing option I think.
| * subtitles: remove code trying to handle text subs with libavcodecUoti Urpala2011-01-151-5/+2
| | | | | | | | | | | | | | | | | | | | The avsub implementation tries to fall back to MPlayer's other text subtitle decoding if libavcodec returns text as the 'decoded' subtitle. The code implementing this is buggy, and as far as I can see it should not be triggered normally (libavcodec decoding is only used for xvid, pgs and dvb subtitles, and for those libavcodec should return bitmaps). Remove the buggy code (don't try to support non-bitmap results) and simplify things a bit.
| * subtitles: move global ass_track to struct osd_stateUoti Urpala2011-01-151-9/+6
| |
| * core: move most mpcommon.c contents to mplayer.cUoti Urpala2011-01-151-9/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The contents of mpcommon.c were quite arbitrary; the most common reason to place some functions in this file had been "MEncoder happens to need similar code as MPlayer and we want to share some parts, but we have no clue whatsoever how to organize things in a sensible way, so we'll just dump those parts we want to share in mpcommon.c". As a result of containing an essentially random subset of top-level player functionality the mpcommon.h header required access to central structs and was unsuitable for inclusion in lower-level code, but was nonetheless included there for the mplayer_version symbol. Move almost all contents from mpcommon.c to mplayer.c. mplayer.c is already big and should perhaps be split further, but keeping a few random functions in mpcommon.c would not be an improvement.
| * core: move global "subdata" and "vo_sub_last" to mpctxUoti Urpala2011-01-111-9/+9
| |
| * options: move -noconfig to option struct, simplifyUoti Urpala2011-01-111-2/+3
| |
* | mp_msg: Remove uses of MSGT_MENCODERClément Bœsch2011-01-251-2/+2
| | | | | | | | | | Some of the code that could run outside MEcoder used MSGT_MENCODER. Replace those with appropriate MSGT_ types.
* | cleanup: remove unused MEncoder-related codeClément Bœsch2011-01-251-1/+0
| | | | | | | | | | Remove some code and variables that were no longer used after MEncoder removal. Also remove some MEncoder references in comments.
* | cleanup: mplayer.c: use VFCAP_ names instead of numeric valuesUoti Urpala2011-01-171-2/+2
|/
* core: add timing workaround for PulseAudio misbehaviorUoti Urpala2011-01-011-0/+3
| | | | | | | PulseAudio could keep reporting high delay values after a reset of playing audio. This broke playback after seeking in some cases. Add a workaround that should make things more robust against such misbehavior.
* core: fix audio-only + framestep weird behaviorUoti Urpala2010-12-201-0/+5
| | | | | | | Trying to do a framestep while playing an audio-only file would play the file until the end, then start the next file in paused state. Make framestep state enter pause again immediately if there is no video. Also reset framestep state when switching files.
* Merge branch 'hr-seek'Uoti Urpala2010-12-201-364/+465
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hr-seek: input: add default keybindings Shift+[arrow] for small exact seeks input: support bindings with modifier keys for X input core: audio: make ogg missing audio timing workaround more complex core: add support for precise non-keyframe-limited seeks core: add struct for queued seek info commands: add generic option -> property wrapper options: add "choice" option type, use for -pts-association-mode core: remove looping in update_video(), modify command handling a bit core: seek: use accurate seek mode with audio-only files core: avoid using sh_video->pts as "current pts" libvo: register X11 connection fd in input event system core: timing: add special handling of long frame intervals core: move central play loop to a separate function Conflicts: DOCS/tech/slave.txt
| * core: audio: make ogg missing audio timing workaround more complexUoti Urpala2010-12-201-2/+15
| | | | | | | | | | | | | | | | | | | | | | After the addition of exact seeking the code to work around missing audio timestamps with ogg/ogm needs improvement. Now it's normal to need adjustment at stream start time 0 (seeking to a position after start of video but before second keyframe) with any video format, and for exact seeks with ogg it's now more important not to skip the sync. Make the check to detect the problem case more precise to avoid affecting most other formats, and try to decode a second of audio (hoping to get timestamps for those packets) before giving up.
| * core: add support for precise non-keyframe-limited seeksUoti Urpala2010-12-201-10/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Add support for seeking to an arbitrary non-keyframe position by decoding video starting from the previous keyframe. Whether to use this functionality when seeking is controlled by the new option -hr-seek and a new third argument to the "seek" command. The default is to use it for absolute seeks (like chapter seeks) but not for relative ones. Because there's currently no support for cutting encoded audio some desync is expected if encoded audio passthrough is used. Currently precise seeks always go to the first frame with timestamp equal to or greater than the target position; there's no support for "matching or earlier" backwards seeks at frame level.
| * core: add struct for queued seek infoUoti Urpala2010-12-201-39/+83
| | | | | | | | | | | | | | | | To prepare for the addition of exact seek support, add a struct for queued seek state and a helper function to update its state. It would have been cumbersome to update additional state (showing whether the seek is forced to be exact or non-exact) manually at every point that handles seeks.
| * core: remove looping in update_video(), modify command handling a bitUoti Urpala2010-12-161-27/+44
| | | | | | | | | | | | | | | | | | Let higher-level code call update_video() again instead of looping inside it until there's a frame ready to show. Change the conditions for running user commands somewhat. Overall effect shouldn't be that big. Now other commands can be executed after a seek before a video frame is decoded; in this case the seek target time may be used as the "current position".
| * core: seek: use accurate seek mode with audio-only filesUoti Urpala2010-12-141-1/+1
| | | | | | | | Allow more accurate absolute-only seeks even if there is no video.
| * core: avoid using sh_video->pts as "current pts"Uoti Urpala2010-12-141-8/+11
| | | | | | | | | | | | Add a new field "video_pts" to mpctx. It records the time of the last frame flipped visible on VO. Change various code which used sh_video->pts to use either the new field or get_current_time(mpctx).
| * core: timing: add special handling of long frame intervalsUoti Urpala2010-12-141-35/+36
| | | | | | | | | | | | | | | | | | Add separate handling for the case where the time to flip the next frame on the VO is more than 50 ms away. In that case don't update OSD contents yet, but wait for possible changes until 50 ms before the frame. Sleep until that time in mp_input_get_cmd(), so the sleep is done in select() and input events can be responded to immediately. Also raise the limit on audio out delay used to limit sleep.
| * core: move central play loop to a separate functionUoti Urpala2010-12-131-289/+287
| |
* | cosmetics: remove unused code, small formatting tweaksUoti Urpala2010-12-201-2/+1
| |
* | commands: clean up get_metadata() and related codeUoti Urpala2010-12-201-73/+40
| | | | | | | | | | | | | | Code in get_metadata() allocated too small a buffer for the text it wrote (noticed by Clément Bœsch). Make the code cleaner and more robust by changing it to use talloc_asprintf(). Also make it always return non-NULL and remove checks on caller side.
* | Change some filename-handling code to use mp_basename()cboesch2010-12-161-22/+3
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32675 b3059339-0415-0410-9bf9-f77b7e298cf2
* | core: avoid using build_afilter_chain() directlyreimar2010-12-161-1/+2
| | | | | | | | | | | | | | | | | | | | build_afilter_chain is not safe to use directly, thus make it static and instead use reinit_audio_chain which should have better error handling. Fixes a crash with -af hrtf and changing speed, audio will still stop playing though. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32648 b3059339-0415-0410-9bf9-f77b7e298cf2
* | path.c: add function for mp_basename, remove duplicated macroscboesch2010-12-161-7/+4
|/ | | | | | | | | | | | | | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32630 b3059339-0415-0410-9bf9-f77b7e298cf2 Fix crash on path without directories. Regression introduced in r32630. Patch by Yuriy Kaminskiy yumkam at mail ru. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32631 b3059339-0415-0410-9bf9-f77b7e298cf2 Handle correctly paths with mixed '/' and '\' in it. Patch by Yuriy Kaminskiy (yumkam at mail ru) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32632 b3059339-0415-0410-9bf9-f77b7e298cf2 Handle ':' on systems with DOS paths: it allows paths like C:foo.avi. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32642 b3059339-0415-0410-9bf9-f77b7e298cf2
* core: ordered chapters: add heuristic for merging inaccurate chaptersUoti Urpala2010-11-261-6/+18
| | | | | | | | | | Some Matroska files have inaccurate ordered chapter endpoints, and so parts where one chapter should end and the next begin at the same timestamp were not merged. This resulted in an unnecessary seek over a minimal distance. Add a heuristic to merge parts with a minimal gap or overlap between them. Based on patch by Hector Martin <hector@marcansoft.com>.
* core: make initial audio sync more robust against bad demuxersUoti Urpala2010-11-211-41/+45
| | | | | | | | | | | | | | | | | ogg/ogm demuxers can give first audio packets without timestamp after a seek. Due to some backwards compatibility code this results in the sync code getting audio timestamp 0. In this case a lot of audio was dropped unnecessarily when seeking to a position later in the file, as the code saw audio starting from 0, video from something larger. Make the code more robust in two ways. First, add a special case to not try syncing if we get audio timestamp <= 0 (hopefully there aren't many files where we'd really get audio starting from 0 and video from a later timestamp). Second, when throwing audio away, make the code recalculate from scratch the amount of bytes that still need to be thrown away after every decode call. This limits the amount of damage initial too-small timestamps can do, as the code will see the better timestamps after a while.
* cleanup: remove NULL checks before free() all over the codecboesch2010-11-141-2/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
* demux_lavf: mark AVI timestamps non-pts to avoid messagesUoti Urpala2010-11-141-1/+2
| | | | | | | | Playing AVI files containing B-frames with demux_lavf printed two "decreasing pts" info messages at the start of the file. We know the timestamps from AVI won't be valid pts, so add a demuxer field to convey that information to the timing code and make that not even try to use the timestamps as valid pts.
* options: more mplayer.c options moved to option structClément Bœsch2010-11-141-32/+26
| | | | | | Following options were moved: autoq, benchmark, [no]term-osd, term-osd-esc, playing-msg, [no]idle, [no]consolecontrols, list-properties.
* options: move various mplayer.c options to option structClément Bœsch2010-11-131-19/+11
| | | | | Following options were moved: [no]quiet, [no]autosync, softsleep, [no]rtc, rtc-device.
* core: do initial A-V sync by modifying audio streamUoti Urpala2010-11-131-12/+91
| | | | | | | Add code to enforce matching pts with video when (re)starting the audio stream, by either cutting away the first samples or inserting silence at the beginning. New option -noinitial-audio-sync can be used to disable this and return to old behavior.
* core: give pts as parameter to demuxer_get_current_chapter()Uoti Urpala2010-11-131-4/+4
| | | | | | | | | demuxer_get_current_chapter() accessed sh_video/sh_audio pts fields to determine playback position. demux layer shouldn't access those and the values used weren't quite correct anyway. Give the playback position as a parameter to the demux layer function instead. Also change the top-level get_current_chapter() to use get_current_time() in the timeline case where it didn't refer to demux layer.
* audio: add -gapless-audio optionUoti Urpala2010-11-121-12/+20
| | | | | | | | | If the option is enabled and all audio has been buffered to the AO, then the player will move to the next file without waiting for the buffered audio to drain, while leaving the AO initialized. If the playback of the next file starts quickly enough (before the AO buffer empties) then it should continue writing audio to the same AO with no gap in between.
* audio: don't try to send partial samples to AO at EOFUoti Urpala2010-11-121-1/+2
| | | | | | | | | | At least with PCM it's possible to get an audio stream that doesn't end at a multiple of whole sample per channel. At least ao_alsa refuses to accept that part of input, and so EOF detection in fill_audio_out_buffers didn't trigger until the 0.04 second sanity check (as there "was still audio not sent to AO left"). Change the logic to detect EOF if there's less than one sample per channel of unsent data left.
* options: move -cache-min and cache-seek-min to option structClément Bœsch2010-11-111-4/+2