summaryrefslogtreecommitdiffstats
path: root/stream/tvi_v4l2.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove classic Linux analog TV support, and DVB runtime controlswm42019-09-131-1786/+0
| | | | | | | | | | | | | | | | | | | | | | | | Linux analog TV support (via tv://) was excessively complex, and whenever I attempted to use it (cameras or loopback devices), it didn't work well, or would have required some major work to update it. It's very much stuck in the analog past (my favorite are the frequency tables in frequencies.c for analog TV channels which don't exist anymore). Especially cameras and such work fine with libavdevice and better than tv://, for example: mpv av://v4l2:/dev/video0 (adding --profile=low-latency --untimed even makes it mostly realtime) Adding a new input layer that targets such "modern" uses would be acceptable, if anyone is interested in it. The old TV code is just too focused on actual analog TV. DVB is rather obscure, but has an active maintainer, so don't remove it. However, the demux/stream ctrl layer must go, so remove controls for channel switching. Most of these could be reimplemented by using the normal method for option runtime changes.
* tv: Recognise v4l2 'JPEG' fourccPhilip Langdale2018-03-041-2/+5
| | | | | | | | | | | | | Naturally, there's more than one fourcc that indicates an mjpeg stream. I have a particular ancient webcam here (Logitech QuickCam Messanger) that only supports the single 'JPEG' format, but there are other devices out there which support both 'JPEG' and 'MJPG' with no visible differences, and others where the streams are slightly different. Regardless of those details, it remains correct to treat 'JPEG' the same as 'MJPG' from a stream consumption perspective.
* Fix undefined preprocessor behaviorwm42018-01-181-1/+5
| | | | | | | | | | | This commit eliminates the following clang warning: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined] Going by the clang commit message, this seems to be explicitly specified as UB by the standard, and they added this warning because MSVC apparently results in different behavior. Whatever, we can just avoid the warning with some small changes.
* Drop/move img_fourcc.hwm42017-06-181-1/+0
| | | | | | | | | | | | | | | This file is an leftover from when img_format.h was changed from using the ancient FourCCs (based on Microsoft multimedia conventions) for pixel formats to a simple enum. The remaining cases still inherently used FourCCs for whatever reasons. Instead of worrying about residual copyrights in this file, just move it into code we don't want to relicense (the ancient Linux TV code). We have to fix some other code depending on it. For the most part, we just replace the MP_FOURCC macro with libavutil's MKTAG (although the macro definition is exactly the same). In demux_raw, we drop some pre-defined FourCCs, but it's not like it matters. (Instead of --demuxer-rawvideo-format use --demuxer-rawvideo-mp-format.)
* tvi_v4l2: fix style in the uninit functionBen Boeckel2016-08-051-4/+6
|
* tvi_v4l2: explicitly brace the codeBen Boeckel2016-08-051-1/+4
| | | | | It's fine either way, but this code is weirdly formatted. Make it more explicit.
* Fix misspellingsstepshal2016-06-261-1/+1
|
* Update license headersMarcin Kurczewski2015-04-131-7/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* Do not call strerror()wm42014-11-261-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | | ...because everything is terrible. strerror() is not documented as having to be thread-safe by POSIX and C11. (Which is pretty much bullshit, because both mandate threads and some form of thread-local storage - so there's no excuse why implementation couldn't implement this in a thread-safe way. Especially with C11 this is ridiculous, because there is no way to use threads and convert error numbers to strings at the same time!) Since we heavily use threads now, we should avoid unsafe functions like strerror(). strerror_r() is in POSIX, but GNU/glibc deliberately fucks it up and gives the function different semantics than the POSIX one. It's a bit of work to convince this piece of shit to expose the POSIX standard function, and not the messed up GNU one. strerror_l() is also in POSIX, but only since the 2008 standard, and thus is not widespread. The solution is using avlibc (libavutil, by its official name), which handles the unportable details for us, mostly. We avoid some pain.
* tv: remove some differences between immediate/normal modewm42014-10-251-38/+23
| | | | | | | | | | | The immediate mode (which is the default) uses a tiny ringbuffer and doesn't grab timestamps. This leads to quite bad behavior due to the fact that there's an additional buffer between playloop and TV code (the demuxer thread, which doesn't exist in MPlayer). Always grab the timestamps and use a decently-sized buffer. I still have no clue what I'm doing, and hacked it until it appeared to work. Report regressions if you experience any.
* tv: reduce waiting loop from 10ms to 1mswm42014-10-251-2/+2
| | | | | | | | | | | | I can't believe how shitty this (MPlayer-derived) code is. Maybe it should be fixed or be replaced with using libavdevice, but that doesn't seem worth the effort. Anyway, for now reduce the time it's blocking to wait for new frames from 10ms to 1ms, because 10ms might be a bit too tight: it could deliver the frame up to 10ms late - now it's only up to 1ms. (And yes, it does that instead of using condition variables. It also abuses volatile variables as atomics. It's hilarious.)
* tv: remove duplicated crapwm42014-10-251-124/+76
| | | | | The logging functions already add a prefix. Original MPlayer devs must have liked code duplication a lot.
* tv: unqueue buffers correctly (maybe, maybe not)wm42014-10-251-5/+7
| | | | | I clue no idea what I'm doing, but at least it doesn't hang anymore when closing a tv:// stream using a v4l2 loopback device.
* stream: change malloc+memset to callocBruno George Moraes2014-09-271-3/+0
| | | | | | | Also removed some memset that were left on some calloc that was already in the code. Signed-off-by: wm4 <wm4@nowhere>
* audio: drop swapped-endian audio formatswm42014-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | Until now, the audio chain could handle both little endian and big endian formats. This actually doesn't make much sense, since the audio API and the HW will most likely prefer native formats. Or at the very least, it should be trivial for audio drivers to do the byte swapping themselves. From now on, the audio chain contains native-endian formats only. All AOs and some filters are adjusted. af_convertsignendian.c is now wrongly named, but the filter name is adjusted. In some cases, the audio infrastructure was reused on the demuxer side, but that is relatively easy to rectify. This is a quite intrusive and radical change. It's possible that it will break some things (especially if they're obscure or not Linux), so watch out for regressions. It's probably still better to do it the bulldozer way, since slow transition and researching foreign platforms would take a lot of time and effort.
* build: include <strings.h> for strcasecmp()wm42014-07-101-0/+1
| | | | | | | It happens to work without strings.h on glibc or with _GNU_SOURCE, but the POSIX standard requires including <strings.h>. Hopefully fixes OSX build.
* tv: if timestamp is unset, return NOPTSwm42014-06-141-4/+4
| | | | | | Well, not sure if this really improves anything, but at least it's less of a WTF to the playback core than always returning the same timestamp for every frame.
* tv: remove some non-sensewm42014-06-141-2/+2
| | | | | | There's really no need to convert this to float and then back. This is mostly of cosmetic nature, double precision was probably enough to avoid rounding.
* tv: fix compilation without clock_gettime, don't claim to be MPlayerwm42014-06-141-1/+1
| | | | mp_msg() doesn't exist anymore in this form. Oops.
* tv: add missing header for clock_gettimewm42014-06-131-0/+1
| | | | | | | Not sure how this symbol becomes visible in glibc (probably accidental or mandatory recursive inclusion via the other standard or Linux- specific headers), but normally this include file is needed to get the symbol.
* tv: fix a hidden static variablewm42014-06-121-9/+9
|
* tv: use correct timestampsiive2014-06-121-12/+48
| | | | | | | | | | | | | | | | | | Squashed from the following mplayer-svn commits. The '#' is removed from the bug ID to prevent github from doing something stupid. Instead of adding the mplayer configure check for clock_gettime(), the POSIX identifiers are used for checking presence of the function. Use correct type of timestamps when recording from v4l2. Fix 2176 Patch by Jarek Czekalski <jarekczek at poczta onet pl>. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@37222 b3059339-0415-0410-9bf9-f77b7e298cf2 Allow building of v4l2 without clock_gettime(). Add overly verbose message in case monotone timestamps are required by the kernel. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@37223 b3059339-0415-0410-9bf9-f77b7e298cf2
* tv: remove printing of useless comment informationwm42014-06-111-2/+0
|
* tv: remove global option variableswm42014-06-111-11/+11
| | | | | | Pretty much nothing changes, but using -tv-scan with suboptions doesn't work anymore (instead of "-tv-scan x" it's "-tv scan-x" now). Flat options ("-tv-scan-x") stay compatible.
* tv: remove sysinfo() usagewm42014-05-301-10/+0
| | | | | | This call was used limited the buffer size if installed RAM was below 16 MB. This stopped being useful a decade ago. The check could also overflow on 32 bit systems. Just get rid of it.
* Kill all tabswm42014-04-131-5/+5
| | | | | | | | | | | 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).
* demux: mp_msg conversionswm42013-12-211-97/+98
| | | | | | | 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-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.
* tvi_v4l2: remove VBI stuffwm42013-11-131-100/+0
| | | | | | | | This used to be needed for teletext support. Teletext commit has been removed (see commit ebaaa41f), and it appears this code is inactive. It was just forgotten with the removal. Get rid of it completely. Untested. (Like all changes to the TV code.)
* tvi_v4l2: let libv4l2 convert to a known pixel formatbugmen0t2013-11-131-47/+58
| | | | | | | | | | | Signed-off-by: wm4 <wm4@nowhere> Significant modifications over the original patch by not overriding syscalls with macros ("#define open v4l2open") for fallback, but the other way around ("#define v4l2open open"). As consequence, the calls have to be replaced throughout the file. Untested, although the original patch probably was tested.
* stream: don't include linux/types.h in some fileswm42013-11-131-1/+0
| | | | | | Apparently this is not portable to FreeBSD. It turns out that we (probably) don't use any symbols defined by this header directly, so the includes are not needed.
* Remove sh_audio->samplesizewm42013-11-091-7/+0
| | | | | | | | | 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.
* configure: uniform the defines to #define HAVE_xxx (0|1)Stefano Pigozzi2013-11-031-4/+4
| | | | | | | | | | | | | | | | | | | | | The configure followed 5 different convetions of defines because the next guy always wanted to introduce a new better way to uniform it[1]. For an hypothetic feature 'hurr' you could have had: * #define HAVE_HURR 1 / #undef HAVE_DURR * #define HAVE_HURR / #undef HAVE_DURR * #define CONFIG_HURR 1 / #undef CONFIG_DURR * #define HAVE_HURR 1 / #define HAVE_DURR 0 * #define CONFIG_HURR 1 / #define CONFIG_DURR 0 All is now uniform and uses: * #define HAVE_HURR 1 * #define HAVE_DURR 0 We like definining to 0 as opposed to `undef` bcause it can help spot typos and is very helpful when doing big reorganizations in the code. [1]: http://xkcd.com/927/ related
* Fix some more -Wshadow warningswm42013-11-011-1/+1
| | | | | | These aren't printed with newer gcc or clang versions for some reason. All of them seem to be about local variables shadowing global functions.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-1/+1
| | | | Followup commit. Fixes all the files references.
* Fix some -Wshadow warningswm42013-07-231-3/+2
| | | | | | 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).
* Fix some cppcheck / scan-build warningswm42013-05-061-27/+0
| | | | | | | | These were found by the cppcheck and scan-build static analyzers. Most of these aren't interesting (the 2 previous commits fix some interesting cases found by these analyzers), and they don't nearly fix all warnings. (Most of the unfixed warnings are spam, things MPlayer never cared about, or false positives.)
* video: decouple internal pixel formats from FourCCswm42013-01-131-49/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mplayer's video chain traditionally used FourCCs for pixel formats. For example, it used IMGFMT_YV12 for 4:2:0 YUV, which was defined to the string 'YV12' interpreted as unsigned int. Additionally, it used to encode information into the numeric values of some formats. The RGB formats had their bit depth and endian encoded into the least significant byte. Extended planar formats (420P10 etc.) had chroma shift, endian, and component bit depth encoded. (This has been removed in recent commits.) Replace the FourCC mess with a simple enum. Remove all the redundant formats like YV12/I420/IYUV. Replace some image format names by something more intuitive, most importantly IMGFMT_YV12 -> IMGFMT_420P. Add img_fourcc.h, which contains the old IDs for code that actually uses FourCCs. Change the way demuxers, that output raw video, identify the video format: they set either MP_FOURCC_RAWVIDEO or MP_FOURCC_IMGFMT to request the rawvideo decoder, and sh_video->imgfmt specifies the pixel format. Like the previous hack, this is supposed to avoid the need for a complete codecs.cfg entry per format, or other lookup tables. (Note that the RGB raw video FourCCs mostly rely on ffmpeg's mappings for NUT raw video, but this is still considered better than adding a raw video decoder - even if trivial, it would be full of annoying lookup tables.) The TV code has not been tested. Some corrective changes regarding endian and other image format flags creep in.
* Rename directories, move files (step 2 of 2)wm42012-11-121-3/+3
| | | | | | | | | | | | 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.)
* libaf: rename af_format.h to format.hwm42012-08-291-1/+1
| | | | | | | | | | af_format.h declares some symbols which are defined in format.c. The fact that af_format.c is a completely unrelated file is rather confusing. Having the header and implementation file use the same base name is more uniform. (af_format.c is the audio conversion filter, while af_format.h and format.c are about audio formats and their properties.) Also fix all source files which include this file.
* Remove teletext supportwm42012-08-031-69/+9
| | | | | | | | Teletext requires special OSD support. Because I can't even test teletext, I can't restore support for it. Since teletext can be considered ancient and obscure, and since it doesn't make sense to keep the remaining teletext code without being able to use it, I'm removing it.
* stream/tvi_v4l[2]: fix calculation of free RAM for buffersiive2011-07-061-8/+5
| | | | | | | | | | | | | | Do a proper calculation of free RAM to be used as V4L buffers. The code uses sysinfo to query the available RAM, however it used ancient form available in some early development 2.3.x kernels. Newer form reports the size in memory units (usually same as page size), as result the code would fall back on 2 buffers even on multi GB system. The commit does: Improve the check in configure to ensure that we do use sysinfo struct with present mem_unit. Use free RAM instead of total RAM (to avoid swapping). Tweak memory constants and simplify code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33732 b3059339-0415-0410-9bf9-f77b7e298cf2
* stream/tvi_v4l2: Add V4L2 support for OpenBSD (and NetBSD)Uoti Urpala2011-06-291-0/+4
| | | | Patch by Brad <brad@comstyle.com>.
* stream/tvi_v4l2.c: simplify by using getfps helper functionreimar2011-01-311-9/+2
| | | | | | | Use getfps helper function everywhere, simplifies code and avoids a possible division by 0. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32755 b3059339-0415-0410-9bf9-f77b7e298cf2
* cleanup: don't check for NULL before free()diego2010-11-081-10/+5
| | | | | | patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32598 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove remaining %lf printf conversionsreimar2010-11-021-4/+4
| | | | | | Most cases are just code in comments. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32438 b3059339-0415-0410-9bf9-f77b7e298cf2
* stream/tv: move new_handle() function from header to tv.cdiego2010-11-021-2/+1
| | | | | | | Move TV input new_handle static function to tv.c and make it non-static. There is no need to duplicate the function in the binary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32225 b3059339-0415-0410-9bf9-f77b7e298cf2
* stream/tv: move free_handle() from header to tv.cdiego2010-11-021-2/+2
| | | | | | | Move TV input free_handle static function to tv.c and make it non-static. There is no need to duplicate the function in the binary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32174 b3059339-0415-0410-9bf9-f77b7e298cf2
* spelling fixessiretart2010-11-021-2/+2
| | | | | | | | | | Found by the Debian QA tool 'lintian' git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31913 b3059339-0415-0410-9bf9-f77b7e298cf2 reintroduce typo in genres.h that was fixed fixed r31913 to match the id3v2 spec git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31920 b3059339-0415-0410-9bf9-f77b7e298cf2
* tv.h: Change function pointer types to proper declarationsreimar2010-11-021-1/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31388 b3059339-0415-0410-9bf9-f77b7e298cf2 Note that the code is still questionable after this commit - the shared data structure has pointers to "struct priv", but different files use different incompatible definitions for that struct.
* 100l, fix check for V4L2 capture capability flag.reimar2009-12-111-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29991 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove CONFIG_TV_TELETEXT.cehoyos2009-11-071-12/+0
| | | | | | | | DVB teletext support is nearly finished, it will be possible to read teletext from file, it will not be depending on reception any more. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29851 b3059339-0415-0410-9bf9-f77b7e298cf2
* Separate teletext from tv support.cehoyos2009-11-071-2/+3
| | | | | | | Path by Francesco Lavra, francescolavra interfree it git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29848 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add MSGT_TELETEXT, rename TVI_CONTROL as VBI_CONTROL and fix some pathscehoyos2009-10-291-1/+1
| | | | | | | | | in comments. Based on a patch by Francesco Lavra, francescolavra interfree it git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29802 b3059339-0415-0410-9bf9-f77b7e298cf2
* Move teletext specific code from stream into libmpcodecs.cehoyos2009-10-291-0/+1
| | | | | | | Patch by Francesco Lavra, francescolavra interfree it git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29801 b3059339-0415-0410-9bf9-f77b7e298cf2
* whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-28/+28
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* Make tvi_v4l2 print -1 as "Current input" if the ioctl to read it failed.reimar2009-04-101-0/+1
| | | | | |