summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* core: move contents to mpvcore (1/2)Stefano Pigozzi2013-08-061-4747/+0
| | | | | | | | | | core is used in many unix systems for core dumps. For that reason some tools work under the assumption that the file is indeed a core dump (for example autoconf does this). This commit just renames the files. The following one will change all the includes to fix compilation. This is done this way because git has a easier time tracing file changes if there is a pure rename commit.
* core: change speed option/property to doublewm42013-08-051-1/+1
| | | | | | | | | | | | | The --speed option and the speed property used float. Change them to double. Change the commands that manipulate the property (speed_mult/add) to double as well. Since the cycle command shares code with the add command, we change that as well. The reason for this change is that this allows better control over speed, such as stepping by semitones. Using floats is also just plain unnecessary.
* options: don't make options set during playback file local (e.g. --vf)wm42013-08-021-16/+16
| | | | | | | | | | | | | | | | Refactor file local options handling: instead of making all options implicitly file local between loading a file and terminating playback, explicitly make options file local which are required to be file local. Or in other words, introduce a M_SETOPT_BACKUP flag, which forces file local-ness when setting an option, and use this for file local command line options, per-file config files, and per-protocol/extension/vo/ao profiles. In particular, this changes the "vf" input command such that video filters stay permanent even when going to the next file in the playlist. The underlying reason for this is that the "vf" command uses the option setting command. This influences the "af" command as well.
* mplayer: add more verbose exit codesAndre D2013-08-021-13/+51
|
* audio/out: add support for new logging APIStefano Pigozzi2013-08-011-2/+3
|
* video/out: use new mp_msg stuff for vo.c and vo_openglwm42013-07-311-1/+1
| | | | The first step; also serves as example.
* mp_msg: introduce new log functions and macroswm42013-07-311-6/+15
| | | | | | | | | | | | | | | | | | | | | | | This has two goals: 1. Getting rid of global variables to make the core library-safe. 2. Getting rid of all the MSGT_* constants and the inconsistent prefixes spread throughout the source code. Both goals are not immediately reached with this commit. It's a huge transition that will take time. There are over >2500 mp_msg calls in the source, which all have to be replaced for this to work. The inconsistent prefixes are in particular annoying. Lots of code manually prefixes messages, e.g. mp_msg(MSGT_VO, MSGL_V, "[vo] ..."). Sometimes the prefixes don't even follow this convention (for example vo_direct3d.c uses "<vo_direct3d>" as prefix). This commit allows automatically adding prefixes on request, so consistency will hopefully improve. For now, this commit adds unused stuff, and behavior should not change. In mplayer.c, move the GetCpuCaps() call, because that used mp_msg() before mp_msg_init() was run.
* options: handle presets directly in m_configwm42013-07-311-1/+1
| | | | | This means that "mpv -vo opengl-hq:help" will actually show the correct defaults, instead those of plain vo_opengl.
* vdpau: split off decoder parts, use "new" libavcodec vdpau hwaccel APIwm42013-07-281-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the decoder parts from vo_vdpau.c to a new file vdpau_old.c. This file is named so because because it's written against the "old" libavcodec vdpau pseudo-decoder (e.g. "h264_vdpau"). Add support for the "new" libavcodec vdpau support. This was recently added and replaces the "old" vdpau parts. (In fact, Libav is about to deprecate and remove the "old" API without deprecation grace period, so we have to support it now. Moreover, there will probably be no Libav release which supports both, so the transition is even less smooth than we could hope, and we have to support both the old and new API.) Whether the old or new API is used is checked by a configure test: if the new API is found, it is used, otherwise the old API is assumed. Some details might be handled differently. Especially display preemption is a bit problematic with the "new" libavcodec vdpau support: it wants to keep a pointer to a specific vdpau API function (which can be driver specific, because preemption might switch drivers). Also, surface IDs are now directly stored in AVFrames (and mp_images), so they can't be forced to VDP_INVALID_HANDLE on preemption. (This changes even with older libavcodec versions, because mp_image always uses the newer representation to make vo_vdpau.c simpler.) Decoder initialization in the new code tries to deal with codec profiles, while the old code always uses the highest profile per codec. Surface allocation changes. Since the decoder won't call config() in vo_vdpau.c on video size change anymore, we allow allocating surfaces of arbitrary size instead of locking it to what the VO was configured. The non-hwdec code also has slightly different allocation behavior now. Enabling the old vdpau special decoders via e.g. --vd=lavc:h264_vdpau doesn't work anymore (a warning suggesting the --hwdec option is printed instead).
* m_config: refactor some thingswm42013-07-281-15/+12
| | | | | | | | | | | | | | Change how m_config is initialized. Make it more uniform; now all m_config structs are intialized in exactly the same way. Make sure there's only a single m_option[] array defining the options, and keep around the pointer to the optstruct default value, and the optstruct size as well. This will allow reconstructing the option default values in the following commit. In particular, stop pretending that the handling of some special options (like --profile, --v, and some others) is in any way elegant, and make them explicit hacks. This is really more readable and easier to understand than what was before, and simplifies the code.
* core: make mpctx->opts a pointerwm42013-07-281-98/+99
| | | | | | | | Prevents some awkwardness in a later commit, and makes the code more uniform with other places where MPOpts is accessed. This is a pretty annoying commit (touches tons of lines all over the place), but it hurts only once.
* options: simplify --correct-pts handlingwm42013-07-261-8/+0
| | | | | | Remove the (now unused) code for determining correct-pts mode based on the demuxer in use. Change its description in the manpage to reflect what this option does now.
* getch2, mplayer: Always call load_termcapDiogo Franco (Kovensky)2013-07-251-2/+0
| | | | | getch2 now deals with the cases where we don't have termcap. Add a dummy load_termcap to getch2-win so we don't get linking errors on mingw.
* mplayer: remove dead codewm42013-07-241-2/+0
| | | | | Attached pictures are now handled specially and on a separate codepath, so this hack is not needed anymore. Remove it from the normal codepath.
* Fix some -Wshadow warningswm42013-07-231-16/+16
| | | | | | In general, this warning can hint to actual bugs. We don't enable it yet, because it would conflict with some unmerged code, and we should check with clang too (this commit was done by testing with gcc).
* mplayer: cosmetics: move functionwm42013-07-221-32/+25
| | | | Also get rid of the useless comment.
* core: make --demuxer not affect external subtitleswm42013-07-221-1/+1
| | | | | | This also affects --audiofile. The previous behavior wasn't really useful. There are even separate switches for that: --audio-demuxer and --sub-demuxer.
* audio/filter: use new option APIwm42013-07-221-33/+52
| | | | | | | | | | | | | Make the VF/VO/AO option parser available to audio filters. No audio filter uses this yet, but it's still a quite intrusive change. In particular, the commands for manipulating filters at runtime completely change. We delete the old code, and use the same infrastructure as for video filters. (This forces complete reinitialization of the filter chain, which hopefully isn't a problem for any use cases. The old code forced reinitialization too, but it could potentially allow a filter to cache things; e.g. consider loaded ladspa plugins and such.)
* options: use new option code for --aowm42013-07-211-13/+4
| | | | This requires completely refactoring the AO creation code too.
* mplayer: simplify AO creationwm42013-07-211-13/+22
| | | | | | The AO creation part was split into two separate parts (one calling ao_create and one calling ao_init). This didn't really have good reasons, and obfuscates how AO creation works. Put them together.
* options: use new code for parsing --vowm42013-07-211-6/+4
| | | | | | | | | Nothing should change from user perspective. mpv --vo=opengl:help now works. Remove the vo_opengl inline help text. The new code can list option names for you, but that's it. Refer to the manpage if you have trouble.
* video: redo how colorspaces are handledwm42013-07-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of handling colorspaces with VFCTRLs/VOCTRLs, make them part of the normal video format negotiation. The colorspace is passed down like other video params with config/reconfig calls. Forcing colorspaces (via the --colormatrix options and properties) is handled differently too: if it's changed, completely reinit the video chain. This is slower and requires a precise seek to the same position to perform an update, but it's simpler and less bug-prone. Considering switching the colorspace at runtime by user-interaction is a rather obscure feature, this is a good change. The colorspace VFCTRLs and VOCTRLs are still kept. The VOs rely on it, and would have to be changed to get rid of them. We'll do that later, and convert them incrementally instead of in one go. Note that controlling the output range now always works on VO level. Basically, this means you can't get vf_scale to output full-range YUV for whatever reason. If that is really wanted, it should be a vf_scale option. the previous behavior didn't make too much sense anyway. This commit fixes a few bugs (such as playing RGB video and converting that to YUV with vf_scale - a recent commit broke this and forced the VO to display YUV as RGB if possible), and might introduce some new ones.
* core: move video refresh function to mplayer.cwm42013-07-161-0/+10
|
* Fix build on Libavwm42013-07-151-0/+1
| | | | Sigh, why does this happen all the time...
* sd_add: add terrible hack for (xy-)vsfilter compatibilitywm42013-07-151-0/+6
| | | | | | Much has been said about this topic, we don't need to say even more. See additions to options.rst.
* Merge branch 'remove_old_demuxers'wm42013-07-141-235/+174
|\ | | | | | | | | | | | | | | The merged branch doesn't actually just remove old demuxers, but also includes a branch of cleanups and some refactoring. Conflicts: stream/stream.c
| * mplayer: remove generic duration calculationwm42013-07-121-11/+1
| | | | | | | | | | | | | | | | | | | | | | This was useless for anything but the raw demuxers. In most cases, this would most likely lead to display of bogus duration values, because the bitrates used are per-track, not the total file bitrate. There was actually no case left where this code was helpful. Note that demux_lavf has its own code for this using the total file bitrate. Also, mplayer.c can calculate the playback percentage from current file position / current file size. This is not removed.
| * demux: assume correct-pts mode by defaultwm42013-07-121-3/+3
| | | | | | | | | | | | | | | | All demuxers make a reasonable effort to set packet timestamps, and thus support correct-pts mode. This commit also implicitly switches demux_rawvideo to correct-pts mode. We still allow demuxers to disable correct-pts mode in theory.
| * demux: rewrite probing and demuxer initializationwm42013-07-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Get rid of the strange and messy reliance on DEMUXER_TYPE_ constants. Instead of having two open functions for the demuxer callbacks (which somehow are both optional, but you can also decide to implement both...), just have one function. This function takes a parameter that tells the demuxer how strictly it should check for the file headers. This is a nice simplification and allows more flexibility. Remove the file extension code. This literally did nothing (anymore). Change demux_lavf so that we check our other builtin demuxers first before libavformat tries to guess by file extension.
| * mplayer: minor memory leak in error handling codewm42013-07-121-0/+1
| |
| * core: change open_stream and demux_open signaturewm42013-07-121-30/+4
| | | | | | | | | | | | | | | | | | | | | | This removes the dependency on DEMUXER_TYPE_* and the file_format parameter from the stream open functions. Remove some of the playlist handling code. It looks like this was needed only for loading linked mov files with demux_mov (which was removed long ago). Delete a minor bit of dead network-related code from stream.c as well.
| * core: completely change handling of attached picture pseudo videowm42013-07-111-16/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, we tried to play along with libavformat and tried to pretend that attached pictures are video streams with a single frame, and that the frame magically appeared at the seek position when seeking. The playback core would then switch to a mode where the video has ended, and the "remaining" audio is played. This didn't work very well: - we needed a hack in demux.c, because we tried to read more packets in order to find the "next" video frame (libavformat doesn't tell us if a stream has ended) - switching the video stream didn't work, because we can't tell libavformat to send the packet again - seeking and resuming after was hacky (for some reason libavformat sets the returned packet's PTS to that of the previously returned audio packet in generic code not related to attached pictures, and this happened to work) - if the user did something stupid and e.g. inserted a deinterlacer by default, a picture was never displayed, only an inactive VO window) - same when using a command that reconfigured the VO (like switching aspect or video filters) - hr-seek didn't work For this reason, handle attached pictures as separate case with a separate video decoding function, which doesn't read packets. Also, do not synchronize audio to video start in this case.
| * demux: improve DVD sub auto-selection hackwm42013-07-111-18/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code touched by this commit makes sure that DVD subtitle tracks known by libdvdread but not known by demux_lavf can be selected and displayed properly. These subtitle tracks have the first packet some time late in the packet stream, so that libavformat won't immediately recognize them, and will add the track as soon as the first packet is seen during normal demuxing. demux_mpg used to handle this elegantly: you just set the MPEG ID of the stream you wanted. demux_lavf couldn't do this, so it was emulated with a DEMUXER_CTRL. This commit changes it so that new streams are selected by default (if autoselect is enabled), and the playloop simply can take appropriate action before the lower layer throws away the first packet. This also changes the demux_lavf behavior that subtitle packets are always demuxed, even if not needed. (They were immediately thrown away, so there was no advantage to this.) Further, this adds the ability to demux.c to deal with demuxing more than one stream of a kind at once. (Though currently it's not useful.)
| * video: eliminate frametime variablewm42013-07-111-13/+9
| |
| * core: don't access demux_stream outside of demux.c, make it privatewm42013-07-111-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generally remove all accesses to demux_stream from all the code, except inside of demux.c. Make it completely private to demux.c. This simplifies the code because it removes an extra concept. In demux.c it is reduced to a simple packet queue. There were other uses of demux_stream, but they were removed or are removed with this commit. Remove the extra "ds" argument to demux fill_buffer callback. It was used by demux_avi and the TV pseudo-demuxer only. Remove usage of d_video->last_pts from the no-correct-pts code. This field contains the last PTS retrieved after a packet that is not NOPTS. We can easily get this value manually because we read the packets ourselves. Reuse sh_video->last_pts to store the packet PTS values. It was used only by the correct-pts code before, and like d_video->last_pts, it is reset on seek. The behavior should be exactly the same.
| * mplayer: invert negated boolean variablewm42013-07-111-10/+10
| | | | | | | | | | Boolean variables shouldn't carry a negated meaning, so rename non_interleaved to interleaved.
| * mplayer: fix incorrect audio sync after format changeswm42013-07-111-2/+6
| | | | | | | | | | | | | | | | | | | | | | This is not directly related to the handling of format changes itself, but playing audio normally after the change. This was broken: the output byte rate was not recalculated, so audio-video sync was simply broken. Fix this by calculating the byte rate on the fly, instead of storing it in sh_audio. Format changes are relatively common (switches between stereo and 5.1 in TV recordings), so this fixes a somewhat critical bug.
| * mplayer: remove "old" audio PTS calculation codewm42013-07-111-27/+9
| | | | | | | | | | | | | | | | Removing this code doesn't change anything. All remaining audio decoders are well-behaved enough to not overwrite sh_audio->pts if they don't know the PTS. And if they don't know the PTS, the d_audio->last_pts field can't contain any usable value either, because both fields contain theame value: the last known valid PTS found in an audio packet.
| * mplayer: don't set bogus video pts after seek resetwm42013-07-111-5/+2
| | | | | | | | | | | | As the comment n the removed code says, this was once needed for something subtitle related. This code has been cleaned up long ago, so at least the original reason for it is gone.
| * demux: remove facility for partial packet readswm42013-07-111-56/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partial packet reads were needed because the video/audio parsers were working on top of them. So it could happen that a parser read a part of a packet, and returned that to the decoder. With libavformat/libavcodec, packets are already parsed, and everything is much simpler. Most of the simplifications in ad_spdif could have been done earlier. Remove some other stuff as well, like the questionable slave mode start time reporting (could be replaced by proper code, but we don't bother). Remove the unused skip_audio_frame() functionality as well (it was used by old demuxers). Some functions become private to demux.c, like demux_fill_buffer(). Introduce new packet read functions, which have simpler semantics. Packets returned from them are owned by the caller, and all packets in the demux.c packet queue are considered unread. Remove special code that dropped subtitle packets with size 0. This used to be needed because it caused special cases in the old code.
| * core: remove demux_mpg subtitle PTS hackwm42013-07-101-23/+4
| | | | | | | | | | | | | | | | | | This code used to be part of the demux_mpg and vobsub specific code path. Then (just recently) the different code paths for subtitles were merged, so this code became active even for demux_lavf and demux_mkv. As far as I can tell, this code won't help much, and at least sd_lavc (which will be used for DVD subs and other potentially weird things) can deal with NOPTS values.
| * core: simplify some no-correct-pts codewm42013-07-101-33/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the special handling for mng/mkv. These don't profit at all from no-correct-pts mode, and even removing the mkv specific code makes mkv work better (wow!). Don't check for (int)fps == 1000. I don't know where this value comes from. Maybe it was once a special value which triggered certain behavior, but the code for that must have gone away. The only way to trigger this value would be by coincidence if two frames are 1 ms apart. Otherwise, the behavior should be exactly the same, except for some removed messages.
| * core: move code from demux/video.c to mplayer.cwm42013-07-101-0/+63
| | | | | | | | | | Although I don't like putting even more crap into mplayer.c, this is a bit better, especially with coming cleanups in mind.
| * audio: remove decoder input bufferwm42013-07-101-4/+2
| | | | | | | | This was unused.
| * options: remove --ignore-startwm42013-07-081-9/+0
| | | | | | | | This was used only with demux_avi.
| * demux: simplify demux_open() callswm42013-07-081-10/+1
|</