summaryrefslogtreecommitdiffstats
path: root/demux/demux_subreader.c
Commit message (Collapse)AuthorAgeFilesLines
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* player: enable cache and demuxer thread for subtitles toowm42015-02-181-0/+1
| | | | | | | | | Includes some logic for not starting the demuxer thread for fully read subtitles. (Well, the cache will still waste _lots_ of resources, and the cache always has to be created, because we don't know whether it'll be needed _before_ opening the file.) See #1597.
* command: export file format as propertywm42015-01-231-2/+2
| | | | | | | | | | | | Repurpose demuxer->filetype for this. It used to be used to print a human readable format description; change it to a symbolic format name and export it as property. Unfortunately, libavformat has its own weird conventions, which are reflected through the new property, e.g. the .mp4 case mentioned in the manpage. Fixes #1504.
* demux: fix timestamp type for seek callswm42014-07-211-2/+2
| | | | | mpv/mplayer2/MPlayer use double for timestamps, but the demuxer API used float.
* demux: minor simplification to internal APIwm42014-07-051-1/+1
| | | | Also some other unrelated minor changes.
* demux: move packet list functionswm42014-07-051-0/+49
| | | | Move them to the only place where they are used, demux_subreader.c.
* Audit and replace all ctype.h useswm42014-07-011-1/+0
| | | | | | | | | | | | | | | | Something like "char *s = ...; isdigit(s[0]);" triggers undefined behavior, because char can be signed, and thus s[0] can be a negative value. The is*() functions require unsigned char _or_ EOF. EOF is a special value outside of unsigned char range, thus the argument to the is*() functions can't be a char. This undefined behavior can actually trigger crashes if the implementation of these functions e.g. uses lookup tables, which are then indexed with out-of-range values. Replace all <ctype.h> uses with our own custom mp_is*() functions added with misc/ctype.h. As a bonus, these functions are locale-independent. (Although currently, we _require_ C locale for other reasons.)
* demux_subreader: remove support for some subtitle formatswm42014-05-191-629/+4
| | | | | | | | | | | | | | | | Drop: sami, vplayer, rt, pjs, mpsub, aqt, jacosub. None of these seem to be actually in use, except sami. Sami is very complex, and the results subreader produces are not very useful. For all these formats, there are still parsers in FFmpeg. We remove the subreader implementation, because it might contain security relevant bugs and such. (This is old, unmaintained C string parsing code, written in times where absolutely nobody cared about security. The kind of awesome code.) We keep the other formats, because they're (mostly) commonly used and relatively simple, for UTF16 support (still missing in FFmpeg), and for the sake of Libav.
* Kill all tabswm42014-04-131-572/+572
| | | | | | | | | | | I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
* sub: use new FFmpeg API to check MicroDVD FPSwm42014-03-041-1/+1
| | | | | | Before this, it wasn't possible to distinguish MicroDVD subtitles without FPS header, and subtitles with FPS header equal to FFmpeg's fallback FPS.
* demux_subreader: reject file if not opened by --subwm42014-01-041-0/+3
| | | | | | | demux_subreader.c contains the old MPlayer subtitle parser, and I have absolutely no confidence in this (very crappy) code. There might be one or two security risks associated with running that code on arbitrary input.
* subreader: replace some strcpy callswm42013-12-221-2/+3
|
* subreader: remove overlapping strcpywm42013-12-221-1/+2
| | | | Looks like this relied on undefined behavior.
* demux: mp_msg conversionswm42013-12-211-27/+31
| | | | | | | The TV code pretends to be part of stream/, but it's actually demuxer code too. The audio_in code is shared between the TV code and stream_radio.c, so stream_radio.c needs a small hack until stream.c is converted.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-2/+2
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-1/+1
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* demux: make determining seek capability genericwm42013-11-031-0/+2
| | | | | | | | | | | | | | | | 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 unused audio_delay parameter from demux_seek()wm42013-08-221-2/+1
| | | | Used to be needed by demux_avi.
* demux_subreader: report what subtitle format has been foundwm42013-08-121-0/+2
|
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* demux_subreader: make clang happy to fix warningwm42013-07-151-1/+1
| | | | | Clang warns here, probably because it's easy to confuse with the usual ((a=b)) pattern.
* demux: make claiming accurate seek the defaultwm42013-07-121-2/+0
| | | | Enables hr-seek for raw audio/video demuxers.
* demux: assume correct-pts mode by defaultwm42013-07-121-2/+0
| | | | | | | | 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: remove useless author/comment fieldswm42013-07-121-4/+1
| | | | Same deal as with previous commit.
* demux: rewrite probing and demuxer initializationwm42013-07-121-4/+5
| | | | | | | | | | | | | | 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.
* demux: change signature of open functions, cleanupswm42013-07-111-3/+3
| | | | Preparation for redoing the open functions.
* core: don't access demux_stream outside of demux.c, make it privatewm42013-07-111-1/+1
| | | | | | | | | | | | | | | | | | | 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.
* sub: prevent subtitle conversion if subs are known UTF-8wm42013-06-251-0/+1
| | | | | Currently this happens only in an obscure case (reading UTF-16 files with the old subreader).
* demux_subreader: remove iconv/enca codewm42013-06-251-154/+1
| | | | Not needed anymore, done by dec_sub.c instead.
* sub: attempt to use video FPS for frame based subtitle formatswm42013-06-251-0/+1
| | | | | This only affects demux_subreader.c for now. Maybe there is some hope this can be used for libavformat demuxers too, but I'm not sure yet.
* subreader: turn into actual demuxerwm42013-06-251-49/+224
| | | | | | | | | | | | | | | | subreader.c (before this commit renamed to demux_subreader.c) was special cased to the -sub option. The plan is using the normal demuxer codepath for all subtitle formats (so we can prefer libavformat demuxers for most formats). There are some subtle changes. The probe size is restricted to 32 KB (instead of unlimitted + giving up after 100 lines of input). For formats like MicroDVD, the video FPS isn't used anymore, because it's not available on the subtitle demuxer level. Instead, hardcode it to 23.976 FPS (libavformat seems to do the same). The user can probably still use -sub-fps to fix the timing. Checking the file extension for ".utf"/".utf8"/".utf-8" is simply removed (seems worthless, was in the way, and I've never seen this anywhere).
* Move/rename subreader.cwm42013-06-251-0/+1378