summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvdnav.c
Commit message (Collapse)AuthorAgeFilesLines
* various: use static assertions where appropriatesfan52024-03-171-1/+1
|
* stream, demux: redo origin policy thingwm42019-12-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mpv has a very weak and very annoying policy that determines whether a playlist should be used or not. For example, if you play a remote playlist, you usually don't want it to be able to read local filesystem entries. (Although for a media player the impact is small I guess.) It's weak and annoying as in that it does not prevent certain cases which could be interpreted as bad in some cases, such as allowing playlists on the local filesystem to reference remote URLs. It probably barely makes sense, but we just want to exclude some other "definitely not a good idea" things, all while playlists generally just work, so whatever. The policy is: - from the command line anything is played - local playlists can reference anything except "unsafe" streams ("unsafe" means special stream inputs like libavfilter graphs) - remote playlists can reference only remote URLs - things like "memory://" and archives are "transparent" to this This commit does... something. It replaces the weird stream flags with a slightly clearer "origin" value, which is now consequently passed down and used everywhere. It fixes some deviations from the described policy. I wanted to force archives to reference only content within them, but this would probably have been more complicated (or required different abstractions), and I'm too lazy to figure it out, so archives are now "transparent" (playlists within archives behave the same outside). There may be a lot of bugs in this. This is unfortunately a very noisy commit because: - every stream open call now needs to pass the origin - so does every demuxer open call (=> params param. gets mandatory) - most stream were changed to provide the "origin" value - the origin value needed to be passed along in a lot of places - I was too lazy to split the commit Fixes: #7274
* build: add -Wimplicit-fallthroughwm42019-12-111-0/+1
| | | | | | | | | | This warning seems to be designed well. It doesn't seem to warn on fallthrough-only case statements, so it's compatible to well written code. stream_dvdnav.c had an obscure bug in inactive code, fix it. stream_dvb.c is the only place where it intentionally falls through, I guess I'll just leave it alone.
* stream_dvdnav: ok, this makes no sense at allwm42019-11-071-1/+4
| | | | | | | | | | | | | | | | | The dvdnav API reads in 2K blocks (dvdnav_get_next_block()). The mpv wrapper (fill_buffer() in this file) expects that the read size done by the mpv core is at least 2K for this reason. If not, it returns an error. This used to be OK, because there was a thing called section alignment in the core code. This was removed because the core shouldn't suffer from optical disc idiosyncrasies. Which means that ever since, it has been working only by coincidence, or maybe not at all. Fixing this would require keeping a buffer in the priv struct, and returning it piece by piece if the core makes smaller reads. I have no intention of writing such code, so add an error message asking for a patch. If anyone actually cares about DVD, maybe it'll get fixed.
* stream: change buffer argument types from char* to void*wm42019-11-071-1/+1
| | | | | | | This is slightly better, although not much, and ultimately doesn't matter. The public API in stream_cb.h also uses char*, but can't change that.
* demux: restore some of the DVD/BD/CDDA interaction layerswm42019-10-031-3/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit a9d83eac40c94f44d19fab7b6955331f10efe301 ("Remove optical disc fancification layers"). Mostly due to the timestamp crap, this was never really going to work. The playback layer is sensitive to timestamps, and derives the playback time directly from the low level packet timestamps. DVD/BD works differently, and libdvdnav/libbluray do not make it easy at all to compensate for this. Which is why it never worked well, but not doing it at all is even more awful. demux_disc.c tried this and rewrote packet timestamps from low level TS to playback time. So restore demux_disc.c, which should bring behavior back to the old often non-working but slightly better state. I did not revert anything that affects components above the demuxer layer. For example, the properties for switching DVD angles or listing disc titles are still gone. (Disc titles could be reimplemented as editions. But not by me.) This commit modifies the reverted code a bit; this can't be avoided, because the internal API changed quite a bit. The old seek resync in demux_lavf.c (which was a hack) is replaced with a hack. SEEK_FORCE and demux_params.external_stream are new additions. Some of this could/should be further cleaned up. If you don't want "proper" DVD/BD support to disappear, you should probably volunteer. Now why am I wasting my time for this? Just because some idiot users are too lazy to rip their ever-wearing out shitty physical discs? Then why should I not be lazy and drop support completely? They won't even be thankful for me maintaining this horrible garbage for no compensation.
* stream: remove BD/DVD/CDDA sector size alignmentwm42019-09-131-1/+0
| | | | | | This was possibly needed by libdvdread, and/or old CD drivers on some system. It still works with on-filesystem DVD and BD test images, so this can go.
* Remove optical disc fancification layerswm42019-09-131-203/+2
| | | | | | | | | | | | | | | | | This removes anything related to DVD/BD/CD that negatively affected the core code. It includes trying to rewrite timestamps (since DVDs and Blurays do not set packet stream timestamps to playback time, and can even have resets mid-stream), export of chapters, stream languages, export of title/track lists, and all that. Only basic seeking is supported. It is very much possible that seeking completely fails on some discs (on some parts of the timeline), because timestamp rewriting was removed. Note that I don't give a shit about optical media. If you want to watch them, rip them. Keeping some bare support for DVD/BD is the most I'm going to do to appease the type of lazy, obnoxious users who will care. There are other players which are better at optical discs.
* stream_dvdnav: merge stream_dvd_commonwm42019-09-131-3/+106
| | | | Isolate icky DVD garbage into a single file.
* demux, stream: rip out the classic stream cachewm42018-08-311-1/+0
| | | | | | The demuxer cache is the only cache now. Might need another change to combat seeking failures in mp4 etc. The only bad thing is the loss of cache-speed, which was sort of nice to have.
* Add checks for HAVE_GPL to various GPL-only source fileswm42017-10-101-0/+4
| | | | | | | | This should actually cover all of them, if you take into account that some unchanged GPL source files include header files with such checks. Also this was done already for the libaf derived code. This is only for "safety" and to avoid misunderstandings.
* stream/stream_dvdnav: show list of titles on verboseRicardo Constantino2017-03-291-0/+7
| | | | Same as stream_bluray, but only if no title is selected already.
* stream/stream_dvdnav: don't ignore setting titleRicardo Constantino2017-03-291-1/+1
| | | | | Probably a typo in 5e30e7a04. Fixes #4283
* stream: get rid of streamtype enumwm42017-02-021-2/+1
| | | | | | | | | Because it's kind of dumb. (But not sure if it was worth the trouble.) For stream_file.c, we add new explicit fields. The rest are rather special uses and can be killed by comparing the stream impl. name. The changes to DVD/BD/CD/TV are entirely untested.
* demux, stream: add option to prevent opening referenced fileswm42016-12-041-0/+3
| | | | Quite irresponsibly hacked together. Sue me.
* stream_dvd, stream_dvdnav: remove weird option parsing stuffwm42016-09-081-30/+42
| | | | | | Same deal as with stream_bluray. Untested because I don't give a fuck about your shitty DVDs.
* demux: remove relative seekingwm42016-02-281-33/+4
| | | | | | | | | | | | | | | | | | | Ever since a change in mplayer2 or so, relative seeks were translated to absolute seeks before sending them to the demuxer in most cases. The only exception in current mpv is DVD seeking. Remove the SEEK_ABSOLUTE flag; it's not the implied default. SEEK_FACTOR is kept, because it's sometimes slightly useful for seeking in things like transport streams. (And maybe mkv files without duration set?) DVD seeking is terrible because DVD and libdvdnav are terrible, but mostly because libdvdnav is terrible. libdvdnav does not expose seeking with seek tables. (Although I know xbmc/kodi use an undocumented API that is not declared in the headers by dladdr()ing it - I think the function is dvdnav_jump_to_sector_by_time().) With the current mpv policy if not giving a shit about DVD, just revert our half-working seek hacks and always use dvdnav_time_search(). Relative seeking might get stuck sometimes; in this case --hr-seek=always is recommended.
* stream_dvdnav: rip out lower-level menu implementationwm42015-08-031-255/+7
| | | | Separate because it might cause regressions.
* Disable DVD and BD menu support (to be removed)wm42015-06-261-0/+2
| | | | | | | | | | | | | | | | | | DVD/BD menu support never worked right, and are a pain to maintain. In particular, DVD menus never actually worked correctly, because highlights were not rendered correctly. Fixing this requires major effort, which I'm not interested to spend. Most importantly, the requirement to switch streams without losing the DVD/BD state caused major weirdness in the playback core. It was implemented by somehow syncing the playback state to the DVD/BD implementation (in stream_dvdnav.c etc.), and then reloading the demuxer without destroying and recreating the stream. This caused a bunch of special-cases which I'm looking forward to remove. For now, don't just remove everything related to menu support and just disable it. If someone volunteers, it can be restored (i.e. rewritten) in a reasonable way. If nobody volunteers soon, it goes.
* path: make mp_path_join accept normal C stringswm42015-05-091-2/+2
| | | | | Instead of bstr. Most callers of this function do not need bstr. The bstr version of this function is now mp_path_join_bstr().
* command: disc-mouse-on-button propertyxylosper2015-04-211-4/+5
| | | | | This property indicates whether mouse cursor is located on button or not for disc naviation.
* Update license headersMarcin Kurczewski2015-04-131-5/+5
| | | | Signed-off-by: wm4 <wm4@nowhere>
* dvd: try to improve seekingwm42015-01-191-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | libdvdnav is garbage. Seeking by time is incredibly inexact, which is in part due to the fact that it does not use the DVD seek tables. Instead, it assumes CBR for certain ranges within the DVD, which makes especially small seeks unreliable. I have no good fix for this, other than hacking libdvdnav (I'd rather prefer to remove mpv DVD support completely than doing this). So here's a shitty hack that tries to workaround these problems. A basic observation is that seeking in VLC seems to work quite well; however it seems to be based on seeking by blocks (unless there is a subtle "trick" I didn't see in the source code). mpv usually seeks by timestamps, so this is not an option for us. However, we can pretend we are doing this in the DVD layer. The previous commit added a way to pass through relative seeks. This commit uses the relative seek. STREAM_CTRL_SEEK_TO_TIME is backwards compatible (there's still dvdread and bluray), so most code is about extracing the relative seek information and turning it into a block seek. (Another way would have been using SEEK_FACTOR stuff, but that would probably make for a less reliable way to handle this situation.) Additionally, if a hr-seek is done, add an offset by 10 seconds. As long as the error done by libdvdnav is not worse, this should help with hr- seeks - although it makes them much slower.
* dvd: add the last chapterwm42014-12-161-1/+1
| | | | | | | | | | | | As suggested in issue #1251. I think the main point is that it acts as a hack to return to the DVD menu when jumping past the last chapter, because it will reach title-EOF, instead of explicitly jumping to the next file (which usually exits the player). This basically reverts commit 8b7418d, except it doesn't include an off-by-1 error (apparently). Closes #1251.
* command, dvd: add property which returns list of DVD titleswm42014-12-131-0/+16
| | | | | | | | | This was requested. It seems libdvdread can't get the duration for titlesets other than the currently opened title. The data structures contain dangling pointers for these, and MPlayer works this around by opening every title separately for the purpose of dumping the title list.
* dvd: drop last chapterwm42014-12-131-2/+2
| | | | | | | Apparently, libdvdnav always reports a last chapter that points to the exact end of the title. This is useless for us. Again, same possible caveats as with the previous commit.
* dvd: add an extra chapter at position 0wm42014-12-131-2/+2
| | | | | | | This way, chapter 0 will always point to the start of the title. At least this is the intention; it's likely that DVDs as well as libdvdnav do random things that lead to random results.
* stream_dvdnav: allow opening DVD directories directlywm42014-09-261-0/+52
| | | | | | | | Same hack as with stream_dvd.c. VIDEO_TS.IFO files are now opened via stream_dvdnav.c. Directories containing a VIDEO_TS.IFO or VIDEO_TS/VIDEO_TS.IFO file are also opened with it.
* Revert "Remove DVD and Bluray support"wm42014-07-151-0/+755
| | | | | | This reverts commit 4b93210e0c244a65ef10a566abed2ad25ecaf9a1. *shrug*
* Remove DVD and Bluray supportwm42014-07-141-755/+0
| | | | It never worked well. Just remux your DVD and BD images to mkv.
* stream_dvdnav: suspend read on vts change even if the requested title is not ↵Alessandro Ghedini2014-07-131-1/+0
| | | | found
* stream_dvdnav: more debugging outputwm42014-07-061-2/+5
|
* dvd, bluray, cdda: add demux_disc containing all related hackswm42014-07-051-3/+1
| | | | | | | | | | | | DVD and Bluray (and to some extent cdda) require awful hacks all over the codebase to make them work. The main reason is that they act like container, but are entirely implemented on the stream layer. The raw mpeg data resulting from these streams must be "extended" with the container-like metadata transported via STREAM_CTRLs. The result were hacks all over demux.c and some higher-level parts. Add a "disc" pseudo-demuxer, and move all these hacks and special-cases to it.
* stream_dvdnav: check the length of all titles with dvdnav://longesttholin2014-07-041-1/+1
| | | | | | | | The last title was ignored before. CC: @mpv-player/stable Signed-off-by: wm4 <wm4@nowhere>
* stream_dvdnav: free pointer to priv->filename on closetholin2014-07-041-0/+2
| | | | | | CC: @mpv-player/stable Signed-off-by: wm4 <wm4@nowhere>
* stream_dvdnav: make sure seeking bounds are within rangetholin2014-07-041-1/+5
| | | | | | | | libdvdnav returns an error is the seek position is out of range. CC: @mpv-player/stable Signed-off-by: wm4 <wm4@nowhere>
* stream_dvd, stream_dvdnav: map dvd:// to dvdnavwm42014-06-201-1/+1
| | | | The old stream_dvd.c implementation is still available under dvdread://.
* Add more constwm42014-06-111-5/+5
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* stream_dvd, stream_dvdnav, stream_bluray: remove global option variableswm42014-06-111-7/+11
|
* stream: remove chaos related to writeable streamswm42014-05-241-1/+1
| | | | | | | | | | For some reason, we support writeable streams. (Only encoding uses that, and the use of it looks messy enough that I want to replace it with FILE or avio today.) It's a chaos: most streams do not actually check the mode parameter like they should. Simplify it, and let streams signal availability of write mode by setting a flag in the stream info struct.
* stream: don't use end_poswm42014-05-241-1/+0
| | | | | | | | | | | | | | | | | | | Stop using it in most places, and prefer STREAM_CTRL_GET_SIZE. The advantage is that always the correct size will be used. There can be no doubt anymore whether the end_pos value is outdated (as it happens often with files that are being downloaded). Some streams still use end_pos. They don't change size, and it's easier to emulate STREAM_CTRL_GET_SIZE using end_pos, instead of adding a STREAM_CTRL_GET_SIZE implementation to these streams. Make sure int64_t is always used for STREAM_CTRL_GET_SIZE (it was uint64_t before). Remove the seek flags mess, and replace them with a seekable flag. Every stream must set it consistently now, and an assertion in stream.c checks this. Don't distinguish between streams that can only be forward or backwards seeked, since we have no such stream types.
* options: remove deprecated --identifyMartin Herkt2014-05-041-3/+1
| | | | | | | Also remove MSGL_SMODE and friends. Note: The indent in options.rst was added to work around a bug in ReportLab that causes the PDF manual build to fail.
* stream_dvdnav: print more debugging infowm42014-04-171-1/+6
|
* player: rename dvdnav to discnavxylosper2014-03-301-1/+1
| | | | | Now, navigation works both of DVD and non-BD-J Blu-ray. Therefore, rename all 'dvdnav' strings which are not DVD specific to 'discnav'
* dvdnav: make MP_NAV_EVENT_RESET_ALL handled properlyxylosper2014-03-251-30/+37
| | | | | | | | | | | dvdnav.c did not handle event in regular sequence. Usually this does not make any trouble except around MP_NAV_EVENT_RESET_ALL. Those events should be handled in regular sequence. If they're mixed, it can make wrong result. For instance, MP_NAV_EVENT_HIGHLIGHT right after MP_NAV_EVENT_RESET_ALL should not be ignored but it might be because MP_NAV_EVENT_RESET_ALL makes the demuxer reloaded and osd hidden.
* stream: remove old chapter handling codewm42014-03-251-17/+0
| | | | | | | | Stream-level chapters (like DVD etc.) did potentially not have timestamps for each chapter, so STREAM_CTRL_SEEK_TO_CHAPTER and STREAM_CTRL_GET_CURRENT_CHAPTER were needed to navigate chapters. We've switched everything to use timestamps and that seems to work, so we can simplify the code and remove this old mechanism.
* stream_dvd/stream_dvdnav: make disc-title for DVDs start from 0xylosper2014-03-171-10/+18
| | | | | | | | This commit makes 'disc-title' properties for DVDs start from 0. There was an inconsistency around 'disc-title' property between DVDs (from 1) and Blu-rays (from 0). This fixes #648. Signed-off-by: wm4 <wm4@nowhere>
* stream_dvdnav: implement STREAM_CTRL_GET_NUM_TITLES for dvdnavxylosper2014-03-151-0/+7
| | | | | | This commit provides impelmentation of STREAM_CTRL_GET_NUM_TITLES for dvdnav stream. Other streams for DVD or Blu-ray are already provide STREAM_CTRL_GET_NUM_TITLES.
* command: set 'media-title' property for bluray disc with meta-dataxylosper2014-03-131-1/+1
|
* dvd: treat missing volume ID as "unsupported", not errorwm42014-02-231-2/+2
| | | | | This is probably better and more consistent with the rest of the code, although it doesn't change any currently existing behavior in this case.
* dvd: check for empty DVD volume IDwm42014-02-231-1/+3
| | | | | The only DVD sample I have just returns an empty string for this. Let command.c use the filename if the ID is empty.
* command: use DVD volume ID for media-title propertyxylosper2014-02-231-0/+7
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Closes #582.
* stream: mp_msg conversionswm42013-12-211-24/+22
| | | | We also drop some slave mode stuff from stream_vcd.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-1/+1
|
* Move options/config related files from mpvcore/ to options/wm42013-12-171-2/+2
| | | | | | | | | 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.
* Move mpvcore/input/ to input/wm42013-12-171-1/+1
|
* Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsgwm42013-12-161-1/+1
| | | | | | | | | The tmsg stuff was for the internal gettext() based translation system, which nobody ever attempted to use and thus was removed. mp_gtext() and set_osd_tmsg() were also for this. mp_dbg was once enabled in debug mode only, but since we have log level for enabling debug messages, it seems utterly useless.
* dvdnav: select longest title by defaultwm42013-12-141-6/+26
| | | | This way we probably do the right thing, and avoid all the menu shit.
* dvdnav: crappy hack to respect timed still frameswm42013-12-141-18/+10