summaryrefslogtreecommitdiffstats
path: root/mpvcore
Commit message (Collapse)AuthorAgeFilesLines
* Reduce stheader.h includes, move stream types to mp_common.hwm42013-11-235-2/+11
|
* audio: respect --end/--length with spdif passthroughwm42013-11-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | In theory, we can't really do this, because we don't know when a spdif frame ends. Spdif transports compressed audio through audio setups that were originally designed for PCM only (which includes the audio filter chain, the AO API, most audio output APIs, etc.), and to reach this goal, spdif pretends to be PCM. Compressed data frames are padded with zeros, until a certain data rate is reached, which corresponds to a pseudo-PCM format with 2 bytes per sample and 2 channels at 48000 Hz. Of course an actual spdif frame is significantly larger than a frame of the PCM format it pretends to be, so cutting audio data on frame boundaries (as according to the pseudo-PCM format) merely yields an incomplete and broken frame, not audio that plays for the desired duration. However, sending an incomplete frame might still be much better than the current behavior, which simply ignores --end/--length (but still lets the video end at the exact end time). Should this result in trouble with real spdif receivers, this commit probably has to be reverted.
* video: don't overwrite demuxer FPS valuewm42013-11-233-25/+17
| | | | | | | | | | | | | | | | If the --fps option was given (MPOpts->force_fps), the demuxer FPS value was overwritten with the forced value. This was fine, since the demuxer value wasn't needed anymore. But with the recent changes not to write to the demuxer stream headers, we don't want to do this anymore. So maintain the (forced/updated) FPS value in dec_video->fps. The removed code in loadfile.c is probably redundant, and an artifact from past refactorings. Note that sub.c will now always use the demuxer FPS value, instead of the user override value. I think this is fine, because it used the demuxer's video size values too. (And it's rare that these values are used at all.)
* dec_video: make vf_input and hwdec_info statically allocatedwm42013-11-233-11/+9
| | | | | | | | | | | The only reason why these structs were dynamically allocated was to avoid recursive includes in stheader.h, which is (or was) a very central file included by almost all other files. (If a struct is referenced via a pointer type only, it can be forward referenced, and the definition of the struct is not needed.) Now that they're out of stheader.h, this difference doesn't matter anymore, and the code can be simplified. Also sneak in some sanity checks.
* dec_video: remove "initialized" fieldwm42013-11-231-3/+1
| | | | It's redundant.
* demux: remove gsh field from sh_audio/sh_video/sh_subwm42013-11-231-1/+1
| | | | | | | | | This used to be needed to access the generic stream header from the specific headers, which in turn was needed because the decoders had access only to the specific headers. This is not the case anymore, so this can finally be removed again. Also move the "format" field from the specific headers to sh_stream.
* player: rearrange how subtitle context and stream headers are usedwm42013-11-233-39/+40
| | | | | | | | | | | | Use sh_stream over sh_sub. Use dec_sub (and mpctx->d_sub) instead of the stream header. This aligns the subtitle code with the recent audio and video refactoring. sh_sub still has the decoder context, though. This is because we want to avoid reinit when switching segments with ordered chapters. (Reinit is fast, except for creating the ASS_Renderer, which in turn triggers fontconfig.) Not sure how much this matters, though, because the initial segment switch will lazily initialize the decoder anyway.
* video: move decoder context from sh_video into new structwm42013-11-2310-177/+186
| | | | | | | | | | This is similar to the sh_audio commit. This is mostly cosmetic in nature, except that it also adds automatical freeing of the decoder driver's state struct (which was in sh_video->context, now in dec_video->priv). Also remove all the stheader.h fields that are not needed anymore.
* options: don't prefix sub-options with "--" in help outputwm42013-11-233-1/+4
| | | | | Commit 0cb9227a added this to the option list help output, but it looks strange with sub-options.
* options: implement --pphelp differentlywm42013-11-231-5/+0
| | | | Make it work via --vf=pp:help instead.
* video: remove vf_pp auto-insertionwm42013-11-232-3/+0
| | | | | | | | | | This drops the --pp option, which was probably broken for a while. The option automatically inserted the "pp" filter. The value passed to it was ignored (which is probably broken, it always selected maximal quality). Inserting this filter can be done simply with --vf=pp, so this is not needed anymore.
* options: provide a way for --vf to print custom helpwm42013-11-232-13/+18
| | | | Useful in rather special situations. See following commits.
* video: move struct mp_hwdec_info into its own header filewm42013-11-231-0/+1
| | | | | | | | This means most code accessing this struct must now include hwdec.h instead of dec_video.h. I just put it into dec_video.h at first because I thought a separate file would be a waste, but it's more proper to do it this way, as there are too many files which include dec_video.h only to get the mp_hwdec_info definition.
* player: remove printing of barely correct slave mode stream infowm42013-11-231-35/+0
| | | | | | | | | | | | | | This was printed before something was decoded, and thus was not really correct. Also, this code is hilariously broken: /* Assume FOURCC if all bytes >= 0x20 (' ') */ if (sh_audio->format >= 0x20202020) mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_FORMAT=%.4s\n", (char *)&sh_audio->format); Time to kill it. This information can be accessed through properties instead.
* audio: don't write decoded audio format to sh_audiowm42013-11-231-7/+13
| | | | | | | | sh_audio is supposed to contain file headers, not whatever was decoded. Fix this, and write the decoded format to separate fields in the decoder context, the dec_audio.decoded field. (Note that this field is really only needed to communicate the audio format from decoder driver to the generic code, so no other code accesses it.)
* audio: move decoder context from sh_audio into new structwm42013-11-238-95/+108
| | | | | | | | | Move all state that basically changes during decoding or is needed in order to manage decoding itself into a new struct (dec_audio). sh_audio (defined in stheader.h) is supposed to be the audio stream header. This should reflect the file headers for the stream. Putting the decoder context there is strange design, to say the least.
* mp_ring: fix comment typoStefano Pigozzi2013-11-221-1/+1
|
* options: prefix options with "--" in help outputwm42013-11-211-1/+1
| | | | This is Better(tm).
* timeline: reject mplayer2 EDL files, change EDL headerwm42013-11-212-6/+2
| | | | | | | | | | | This was forgotten when the parser for mplayer2 EDL files was removed. Change the header of the mpv EDL format to include a '#', so a naive parser could skip the header as comment. (Maybe this is questionable; on the other hand, if it can be simpler, why not.) Also, strip the header in demux_edl.c before passing on the data, so the header check doesn't need to be duplicated in tl_mpv_edl.c.
* mplayer: fix passing size_t as %d to printf()wm42013-11-201-1/+1
|
* timeline: remove support for the mplayer2 EDL formatwm42013-11-192-400/+1
| | | | | It was a bit too complicated and inconvenient, and I doubt anyone actively used it. The mpv EDL format should cover all use cases.
* player: add --merge-files optionwm42013-11-195-0/+29
|
* timeline: add edl:// URIswm42013-11-192-3/+6
| | | | | Questionable change from user perspective, but internally needed to implement the next commit. Also useful for testing timeline stuff.
* timeline: add new EDL formatwm42013-11-193-0/+281
| | | | | | | | | | Edit Decision Lists (EDL) allow combining parts from multiple source files into one virtual file. MPlayer had an EDL format (which sucked), which mplayer2 tried to improve with its own format (which sucked). As logic demands, mpv introduces its very own format (which sucks). The new format should actually be much simpler and easier to use, and its implementation is simpler and smaller too.
* player: select fallback stream in timeline code for better EDL handlingwm42013-11-191-0/+23
| | | | | | | The intention of the existing code was trying to match demuxer-reported stream IDs, instead of using possibly arbitrary ordering of the frontend track list. But EDL files can consist of quite different files, for which trying to match the stream IDs doesn't always make sense.
* player: deselect video track if initialization failswm42013-11-191-0/+1
| | | | | | This didn't have any consequences, other than suddenly reinitializing video when it works again (such as with EDL timeline mixing video and audio-only files).
* demux: rename demux_packet.h to packet.hwm42013-11-181-1/+1
| | | | This always bothered me.
* audio: drop buffered filter data when seekingwm42013-11-181-0/+2
| | | | | This could lead to (barely) audible artifacts with --af=scaletempo and modified playback speed.
* audio/filter: remove unneeded AF_CONTROLs, convert to enumwm42013-11-181-2/+1
| | | | | | | | The AF control commands used an elaborate and unnecessary organization for the command constants. Get rid of all that and convert the definitions to a simple enum. Also remove the control commands that were not really needed, because they were not used outside of the filters that implemented them.
* player: simplify audio reset when seekingwm42013-11-181-15/+10
| | | | | | | | | | Some decoders used to read packets and decode data when calling resync_audio_stream(). This required a special case in mp_seek() for audio. (A comment mentions liba52, which is long gone; but until recently ad_mpg123.c actually exposed this behavior.) No decoder does this anymore, and resync_audio_stream() works similar as resync_video_stream(). Remove the special case.
* audio: use the decoder buffer's format, not sh_audiowm42013-11-181-6/+19
| | | | | | | | | | | | | | | | | | When the decoder detects a format change, it overwrites the values stored in sh_audio (this affects the members sample_format, samplerate, channels). In the case when the old audio data still needs to be played/filtered, the audio format as identified by sh_audio and the format used for the decoder buffer can mismatch. In particular, they will mismatch in the very unlikely but possible case the audio chain is reinitialized while old data is draining during a format change. Or in other words, sh_audio might contain the new format, while the audio chain is still configured to use the old format. Currently, the audio code (player/audio.c and init_audio_filters) access sh_audio to get the current format. This is in theory incorrect for the reasons mentioned above. Use the decoder buffer's format instead, which should be correct at any point.
* player: write final audo chunk only if there is audio leftwm42013-11-171-4/+6
| | | | | Don't call ao_play() if there's nothing left. Of course this still asks the AO to play internally buffered audio by setting drain=true.
* player: don't remove playback status when reinitializing DVBwm42013-11-171-1/+3
| | | | Also break that line a bit.
* demux: simplify handling of filepos fieldwm42013-11-161-1/+1
| | | | | | | | | | | | demuxer->filepos contains the byte offset of the last read packet. This is so that the player can estimate the current playback position, if no proper timestamps are available. Simplify it to use demux_packet->pos in the generic demuxer code, instead of bothering every demuxer implementation about it. (Note that this is still a bit incorrect: it relfects the position of the last packet read by the demuxer, not that returned to the user. But that was already broken, and is not that trivial to fix.)
* encode_lavc: add missing newline in error messagewm42013-11-161-1/+1
|
* mp_ring: remove unused functionwm42013-11-152-47/+0
| | | | This was needed for ao_jack.c., but not anymore.
* m_option: handle audio/filter filters with old option parsingwm42013-11-131-3/+9
| | | | | | | | | These use the _oldargs_ hack, which failed in combination with playback resume. Make it work. It would be better to port all filters to new option parsing, but that's obviously too much work, and most filters will probably be deleted and replaced by libavfilter in the long run.
* audio: add support for using non-interleaved audio from decoders directlywm42013-11-121-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Most libavcodec decoders output non-interleaved audio. Add direct support for this, and remove the hack that repacked non-interleaved audio back to packed audio. Remove the minlen argument from the decoder callback. Instead of forcing every decoder to have its own decode loop to fill the buffer until minlen is reached, leave this to the caller. So if a decoder doesn't return enough data, it's simply called again. (In future, I even want to change it so that decoders don't read packets directly, but instead the caller has to pass packets to the decoders. This fits well with this change, because now the decoder callback typically decodes at most one packet.) ad_mpg123.c receives some heavy refactoring. The main problem is that it wanted to handle format changes when there was no data in the decode output buffer yet. This sounds reasonable, but actually it would write data into a buffer prepared for old data, since the caller doesn't know about the format change yet. (I.e. the best place for a format change would be _after_ writing the last sample to the output buffer.) It's possible that this code was not perfectly sane before this commit, and perhaps lost one frame of data after a format change, but I didn't confirm this. Trying to fix this, I ended up rewriting the decoding and also the probing.
* audio/filter: fix mul/delay scale and valueswm42013-11-121-1/+1
| | | | | | | | | | | | | Before this commit, the af_instance->mul/delay values were in bytes. Using bytes is confusing for non-interleaved audio, so switch mul to samples, and delay to seconds. For delay, seconds are more intuitive than bytes or samples, because it's used for the latency calculation. We also might want to replace the delay mechanism with real PTS tracking inside the filter chain some time in the future, and PTS will also require time-adjustments to be done in seconds. For most filters, we just remove the redundant mul=1 initialization. (Setting this used to be required, but not anymore.)
* audio: switch output to mp_audio_bufferwm42013-11-122-66/+80
| | | | | | Replace the code that used a single buffer with mp_audio_buffer. This also enables non-interleaved output operation, although it's still disabled, and no AO supports it yet.
* player: set PulseAudio stream title to window titlewm42013-11-105-10/+24
| | | | | | | Set the PulseAudio stream title, just like the VO window title is set. Refactor update_vo_window_title() so that we can use it for AOs too. The ao_pulse.c bit is stolen from MPlayer.
* Remove sh_audio->samplesizewm42013-11-091-1/+1
| | | | | | | | | This member was redundant. sh_audio->sample_format indicates the sample size already. The TV code is a bit strange: the redundant sample size was part of the internal TV interface. Assume it's really redundant and not something else. The PCM decoder ignores the sample size anyway.
* player: factor audio buffer clearing codewm42013-11-084-13/+25
| | | | | | | Note that the change in seek_reset is not entirely equivalent: we even drop the remainder of buffered audio when seeking. This should be more correct, because the whole point of the reset_ao parameter is to control whether audio queued for output should be dropped or not.
* audio: don't let ao_lavc access frontend internals, change gapless audiowm42013-11-083-11/+44
| | | | | | | | | | | | | | | | | | | | | | | ao_lavc.c accesses ao->buffer, which I consider internal. The access was done in ao_lavc.c/uninit(), which tried to get the left-over audio in order to write the last (possibly partial) audio frame. The play() function didn't accept partial frames, because the AOPLAY_FINAL_CHUNK flag was not correctly set, and handling it otherwise would require an internal FIFO. Fix this by making sure that with gapless audio (used with encoding), the AOPLAY_FINAL_CHUNK is set only once, instead when each file ends. Basically, move the hack in ao_lavc's uninit to uninit_player. One thing can not be entirely correctly handled: if gapless audio is active, we don't know really whether the AO is closed because the file ended playing (i.e. we want to send the buffered remainder of the audio to the AO), or whether the user is quitting the player. (The stop_play flag is overwritten, fixing that is perhaps not worth it.) Handle this by adding additional code to drain the AO and the buffers when playback is quit (see play_current_file() change). Test case: mpv avdevice://lavfi:sine=441 avdevice://lavfi:sine=441 -length 0.2267 -gapless-audio
* sd_lavc, sd_spu: make dvdsub stretching conditional on --stretch-dvd-subs.Rudolf Polzer2013-11-072-0/+2
| | | | | | | | | | | | We found that the stretching - although it usually improves the looks of the fonts - is incorrect. On DVD, subtitles can cover the full area of the picture, and they have the same pixel aspect as the movie itself. Too bad many commercially released DVDs use bitmap fonts made with the wrong pixel aspect (i.e. assuming 1:1) - --stretch-dvd-subs will make these more pretty then.
* vd_lavc: remove explicit crystalhd supportwm42013-11-061-1/+0
| | | | | | | | | | | | | | | | This removes "--hwdec=crystalhd". I doubt anyone even tried to use this. But even if someone wants to use it, the decoders can still be explicitly invoked with e.g.: --vd=lavc:h264_crystalhd The only advantage our special code provided was fallback to software decoding. (But I'm not sure how the ffmpeg crystalhd pseudo-decoder actually behaves.) Removing this will allow some simplifications as soon as we don't need vdpau_old.c anymore.
* input: remove unused key_down_event commandwm42013-11-063-6/+0
| | | | | There's no real use-case for this, and is wasn't documented (didn't even appear on the "undocumented commands" list).
* input: disallow autorepeat by default for most commandswm42013-11-062-13/+25
| | | | | | | | | | This drops autorepeated key events for a number of commands. This should help with slow situations accidentally triggering too many repeats. (I'm not sure if this actually happened to users - maybe.) It's not clear whether MP_CMD_COMMAND_LIST (multiple commands on one binding separated by ';') should be repeated, or whether it should try to do something clever. For now, disallow autorepeat with it.
* playlist: rewrite PLS parserwm42013-11-041-140/+0
| | | | | | | | | | | | Somehow the new parser ends up much smaller. Much of it is because we don't parse some additional information. We just skip it, instead of parsing it and then throwing it away. More importantly, we use the physical order of entries, instead of trying to sort them by entry number. Each "File" entry is followed by a number that is supposed to be the entry number, and "File1" is first. (Should it turn out that this is really needed, an additional field should be added to playlist_entry, and then qsort().)
* Merge branch 'master' into have_configurewm42013-11-042-15/+22
|\ | | | | | | | | Conflicts: configure
| * Fix -Wshadow warning about seek function in playloop.cPaweł Forysiuk2013-11-041-11/+11
| | | | | | | | | | | | | | | | | | | | | | mpvcore/player/playloop.c: In function 'seek': mpvcore/player/playloop.c:209:54: warning: declaration of 'seek' shadows a global declaration [-Wshadow] mpvcore/player/playloop.c:209:12: warning: shadowed declaration is here [-Wshadow] mpvcore/player/playloop.c: In function 'queue_seek': mpvcore/player/playloop.c:360:25: warning: declaration of 'seek' shadows a global declaration [-Wshadow] mpvcore/player/playloop.c:209:12: warning: shadowed declaration is here [-Wshadow] Signed-off-by: wm4 <wm4@nowhere>
| * player: fix quvi 0.9 playlist loadingwm42013-11-031-2/+3
| | | | | | | | The code made no sense at all.
| * demux: make determining seek capability genericwm42013-11-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of having each demuxer do it (only demux_mkv actually did...), let generic code determine whether the file is seekable. This requires adding exceptions to demuxers where the stream is not seekable, but the demuxer is. Sort-of try to improve handling of unseekable files in the player. Exit early if the file is determined to be unseekable, instead of resetting all decoders and then performing a pointless seek. Add an exception to allow seeking if the file is not seekable, but the stream cache is enabled. Print a warning in this case, because seeking outside the cache (which we can't prevent since the demuxer is not aware of this problem) still messes everything up.
| * demux: remove movi_start/movi_end fieldswm42013-11-031-2/+3
| | | | | | | | | | | | | | Pointless, using stream->start_pos/end_pos instead. demux_mf was the only place where this was used specially, but we can rely on timestamps instead for this case.
* | configure: uniform the defines to #define HAVE_xxx (0|1)Stefano Pigozzi2013-11-0314-132/+132
|/ | | | | | | | | | | | | | | | | | | | | The configure followed 5 different convetions of defines because the next guy always wanted to introduce a new better way to uniform it[1].