Commit Graph

66 Commits

Author SHA1 Message Date
wm4 ad2199128d path lookup functions: mp_msg conversions
There's a single mp_msg() in path.c, but all path lookup functions seem
to depend on it, so we get a rat-tail of stuff we have to change. This
is probably a good thing though, because we can have the path lookup
functions also access options, so we could allow overriding the default
config path, or ignore the MPV_HOME environment variable, and such
things.

Also take the chance to consistently add talloc_ctx parameters to the
path lookup functions.

Also, this change causes a big mess on configfiles.c. It's the same
issue: everything suddenly needs a (different) context argument. Make it
less wild by providing a mp_load_auto_profiles() function, which
isolates most of it to configfiles.c.
2013-12-21 21:43:17 +01:00
wm4 0335011f11 stream: mp_msg conversions
We also drop some slave mode stuff from stream_vcd.
2013-12-21 21:43:16 +01:00
wm4 eb15151705 Move options/config related files from mpvcore/ to options/
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.
2013-12-17 02:07:57 +01:00
wm4 95cfe58e3d Use O_CLOEXEC when creating FDs
This is needed so that new processes (created with fork+exec) don't
inherit open files, which can be important for a number of reasons.

Since O_CLOEXEC is relatively new (POSIX.1-2008, before that Linux
specific), we #define it to 0 in io.h to prevent compilation errors on
older/crappy systems. At least this is the plan.

input.c creates a pipe. For that, add a mp_set_cloexec() function (which
is based on Weston's code in vo_wayland.c, but more correct). We could
use pipe2() instead, but that is Linux specific. Technically, we have a
race condition, but it won't matter.
2013-11-30 22:40:51 +01:00
wm4 03f93dc7a2 stream_dvb: remove bogus free calls
The priv struct is now allocated by talloc in stream.c. It doesn't need
to be manually freed, and using free() instead of talloc_free() probably
crashes.
2013-11-18 14:21:01 +01:00
wm4 a550731209 Copyright, LICENSE: switch to GPL version 2 or later
Now that talloc has been removed, the license can be switched back to
GPLv2+. Actually, there never was a GPLv2+ licensed MPlayer (fork or
not) until now, but removal of some GPLv2-only code makes this possible
now. Rewrite the Copyright file to explain the reasons for the licenses
MPlayer and forks use. The old Copyright file didn't contain anything
interesting anymore, and all information it contained is available at
other places in the source tree.

The reason for the license change itself is that it should improve
interoperability with differently licensed code in general.

This essentially reverts commit 1752808.
2013-10-13 01:36:10 +02:00
wm4 971e8456fc stream: fix url_options field, make protocols field not fixed length
The way the url_options field was handled was not entirely sane: it's
actually a flexible array member, so it points to garbage for streams
which do not initialize this member (it just points to the data right
after the struct, which is garbage in theory and practice). This was
not actually a problem, since the field is only used if priv_size is
set (due to how this stuff is used). But it doesn't allow setting
priv_size only, which might be useful in some cases.

Also, make the protocols array not a fixed size array. Most stream
implementations have only 1 protocol prefix, but stream_lavf.c has
over 10 (whitelists ffmpeg protocols). The high size of the fixed
size protocol array wastes space, and it is _still_ annoying to
add new prefixes to stream_lavf (have to bump the maximum length),
so make it arbitrary length.

The two changes (plus some more cosmetic changes) arte conflated into
one, because it was annoying going over all the stream implementations.
2013-08-26 10:09:45 +02:00
Stefano Pigozzi 406241005e core: move contents to mpvcore (2/2)
Followup commit. Fixes all the files references.
2013-08-06 22:52:31 +02:00
wm4 bc1d61cf42 stream: redo URL parsing, replace m_struct usage with m_config
Move the URL parsing code from m_option.c to stream.c, and simplify it
dramatically. This code originates from times when http code used this,
but now it's just relict from other stream implementations reusing this
code. Remove the unused bits and simplify the rest.

stream_vcd is insane, and the priv struct is different on every
platform, so drop the URL parsing. This means you can't specify a track
anymore, only the device. (Does anyone use stream_vcd? Not like this
couldn't be fixed, but it doesn't seem worth the effort, especially
because it'd require potentially touching platform specific code.)
2013-08-02 17:02:34 +02:00
wm4 1848be363e stream: remove inactive URL option fields
The URL option parser only accesses certain fields. Remove the fields
that are not accessed, and thus are completely unused and inaccessible.

Historically, these fields were supposed to be settable using an extra
list of options passed to open_stream(). Commit f518cf7 removed these
extra options. Apparently nothing ever actually used this facility.
2013-07-30 16:15:36 +02:00
wm4 f406482d84 stream: remove useless author/comment fields
These were printed only with -v. Most streams had them set to useless
or redundant values, so it's just badly maintained bloat.

Since we remove the "author" field too, and since this may have
copyright implications, we add the contents of the author fields to
the file headers, except if the name is already part of the file header.
2013-07-12 22:16:27 +02:00
wm4 f63193f58f stream: remove fd member
Stream implementations could set this to a unix file descriptor. The
generic stream code could use it as fallback for a few things. This
was confusing and insane. In most cases, the stream implementations
defined all callbacks, so setting the fd member didn't have any
advantages, other than avoiding defining a private struct to store it.

It appears that even if the stream implementation used close() on the
fd (or something equivalent), stream.c would close() it a second time
(and on windows, even would call closesocket()), which should be proof
for the insanity of this code.

For stream_file.c, additionally make sure we don't close stdin or
stdout if "-" is used as filename.

For stream_vcd.c, remove the control() code. This code most likely
didn't make the slightest sense, because it used a different type
for stream->priv. It also leaked memory. Maybe it worked, but it's
incorrect and insignificant anyway, so kill it. This code was added
with commit 9521c19 (svn commit 31019).

Untested for all protocols other than stream_file.c.
2013-07-12 22:16:26 +02:00
wm4 cb45b1c65b Cleanup some include statements 2013-07-12 22:16:26 +02:00
wm4 3269bd1780 demux: rewrite probing and demuxer initialization
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.
2013-07-12 22:16:26 +02:00
wm4 52c3eb6976 core: change open_stream and demux_open signature
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.
2013-07-12 21:56:40 +02:00
wm4 af0c41e162 Remove old demuxers
Delete demux_avi, demux_asf, demux_mpg, demux_ts. libavformat does
better than them (except in rare corner cases), and the demuxers have
a bad influence on the rest of the code. Often they don't output
proper packets, and require additional audio and video parsing. Most
work only in --no-correct-pts mode.

Remove them to facilitate further cleanups.
2013-07-07 23:54:11 +02:00
wm4 0d5e6084ae stream: don't set EOF flag in stream implementations
EOF should be set when reading more data fails. The stream
implementations have nothing to say here and should behave correctly
when trying to read when EOF was actually read.

Even when seeking, a correct EOF flag should be guaranteed. stream_seek()
(or actually stream_seek_long()) calls stream_fill_buffer() at least
once, which also updates the EOF flag.
2013-06-16 22:05:10 +02:00
wm4 c1ddfb5907 Check return values of some mp_find_..._config_file function calls for NULL 2013-02-09 00:21:18 +01:00
Stefano Pigozzi fab9febdc3 path: add mp_find_config_file and reorganize some of the code
Add `mp_find_config_file` to search different known paths and use that in
ass_mp to look for the fontconfig configuration file.

Some incidental changes spawned by this feature where:

 * Buffer allocation for the strings containing the paths is now performed
   with talloc. All of the allocations are done on a NULL context, but it still
   improves readability of the code.
 * Move the OSX function for lookup inside of a bundle: this code path was
   currently not used by the bundle generated with `make osxbundle`. The plan
   is to use it again in a future commit to get a fontconfig config file.
2012-12-15 17:38:00 +01:00
wm4 4873b32c59 Rename directories, move files (step 2 of 2)
Finish renaming directories and moving files. Adjust all include
statements to make the previous commit compile.

The two commits are separate, because git is bad at tracking renames
and content changes at the same time.

Also take this as an opportunity to remove the separation between
"common" and "mplayer" sources in the Makefile. ("common" used to be
shared between mplayer and mencoder.)
2012-11-12 20:08:18 +01:00
diego 12d3e0df99 cleanup: don't check for NULL before free()
patch by Clément Bœsch, ubitux gmail com

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32598 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:12 +02:00
diego da1135a96d stream_dvb.c: avoid compiler warning by adding initialization
Initialize conf_file variable to kill the warning:
stream/stream_dvb.c:755: warning: 'conf_file' may be used uninitialized in this function
Blessed and suggested by Nico Sabbi.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31877 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:46 +02:00
Uoti Urpala 4785c2617e Merge svn changes up to r30967 2010-04-26 17:42:20 +03:00
diego 70c66c0476 Rename get_path.[ch] --> path.[ch].
These files now contain different functions related to path handling.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30943 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-20 23:38:27 +00:00
Uoti Urpala 00323c06e2 Delete things related to old translation system
Remove the help/ subdirectory, configure code to create toplevel
help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
2010-03-10 03:47:14 +02:00
diego c106fe7751 Drop support for old-style DVB code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30818 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-02 19:57:17 +00:00
reimar 908f8c91e7 Replace misuse of stream_reset to set stream pos to 0 by more appropriate code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30667 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-20 18:39:26 +00:00
cehoyos 88397d63f1 Support ISDB-Tb tunning in Brazil
Patch by Sérgio Fortier, sergiofortier A yahoo com br 


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29803 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-10-30 10:03:54 +00:00
diego 6e9cbdc104 whitespace cosmetics: Remove all trailing whitespace.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-05-13 02:58:57 +00:00
diego 0864f92e7a Get rid of pointless 'extern' keywords.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28085 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-03 23:01:03 +00:00
nicodvb e3d5eacec3 set to -1 fds that were closed; handle the sec_fd only if CONFIG_DVB_HEAD isn't defined; patch by Reimar
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27897 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-11-05 23:37:52 +00:00
reimar 2808f340cd Fix condition broken in r27401 which incorrectly caused stdin to be closed after playing DVB.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27892 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-11-04 18:42:46 +00:00
diego 511729a3a2 Use '#include <poll.h>' instead of '#include <sys/poll.h>'.
It is the standard location as defined by the Open Group.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27463 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-08-14 15:54:53 +00:00
diego 02135001b4 Change a bunch of video/audio-output-specific preprocessor directives from
a HAVE_ prefix to a CONFIG_ prefix.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27402 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-08-03 15:21:40 +00:00
nicodvb cc5373d7ca removed useless parameter :type from -dvbin (the frontend type is reported by the card)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26423 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-04-12 20:36:57 +00:00
nicodvb e23c244ee7 removed defunct options :vid and :aid from -dvbin (they were useless from the start)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26422 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-04-12 20:30:36 +00:00
nicodvb b867e95584 search channels.conf in mplayer's instdir if all other searches fail; patch by foxcore gmail com
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26155 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-03-03 22:28:07 +00:00
reimar 8c63f24152 Remove some unused extern variables
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25720 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-01-13 12:37:30 +00:00
reimar 6f616c316d stream_opts should be const
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25719 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-01-13 12:34:42 +00:00
nicodvb 1fd25fed63 10l, in dvb_free_config() channels' names must be free individually
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25417 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 21:06:58 +00:00
nicodvb 22d9f6ea0c removed the obscene priv->stream entry. Someone must have injected vodka in my milk when I wrote it
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25408 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 13:37:41 +00:00
nicodvb a9d2f4db42 get rid of the file-static dvb_config and free the config at close() . Patch by Andrew Calkin and me
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25407 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 13:30:44 +00:00
nicodvb c5ad15d8c0 dvb cleanup: call dvb_(set|step)_channel() without dereferencing stream->priv (1000l to me)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25405 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-15 13:05:06 +00:00
nicodvb bcf142a30f fix memleaks; patch by andrew calkin from gmail com
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25383 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-12 22:54:20 +00:00
reimar dd2fcb4370 stream_opts arrays should be const
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25270 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-02 21:37:08 +00:00
reimar b8a403f124 Make m_option_t arrays referenced by cfg-common.h const
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25269 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-02 21:26:23 +00:00
reimar cd3d3369e1 Mark all stream_info_t as const
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25239 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-02 13:22:53 +00:00
nicodvb 3d1e0439ea removed unused variables and parameters
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24903 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-10-30 22:30:15 +00:00
diego 01d92a32ad cosmetics: typo fix UNSUPORTED --> UNSUPPORTED
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24277 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-08-28 22:38:45 +00:00
diego 84157efa5a Clean up the way get_path is handled: Compile get_path.c to an object to link
against instead of directly #including the C file and replace the many extern
declarations by a proper header file.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24262 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-08-28 11:20:24 +00:00