summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* video: decouple internal pixel formats from FourCCswm42013-01-1352-695/+695
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* video: cleanup: replace old mp_image function nameswm42013-01-1315-44/+37
| | | | | mp_image_alloc() also changes argument order compared to alloc_mpi(). The format now comes first, then width/height.
* video: cleanup: move and rename vf_mpi_clear and vf_clone_attributeswm42013-01-137-96/+80
| | | | | | | | These functions weren't specific to video filters and were misplaced in vf.c. Move them to mp_image.c. Fix the big endian test in vf_mpi_clear/mp_image_clear, which has been messed up in 74df1d.
* mp_image: change how palette is handledwm42013-01-1314-91/+19
| | | | | | | | | | | | | | | | | | | | | | | | | According to DOCS/OUTDATED-tech/colorspaces.txt, the following formats are supposed to be palettized: IMGFMT_BGR8 IMGFMT_RGB8, IMGFMT_BGR4_CHAR IMGFMT_RGB4_CHAR IMGFMT_BGR4 IMGFMT_RGB4 Of these, only BGR8 and RGB8 are actually treated as palettized in some way. ffmpeg has only one palettized format (AV_PIX_FMT_PAL8), and IMGFMT_BGR8 was inconsistently mapped to packed non-palettized RGB formats too (AV_PIX_FMT_BGR8). Moreover, vf_scale.c contained messy hacks to generate a palette when AV_PIX_FMT_BGR8 is output. (libswscale does not support AV_PIX_FMT_PAL8 output in the first place.) Get rid of all of this, and introduce IMGFMT_PAL8, which directly maps to AV_PIX_FMT_PAL8. Remove the palette creation code from vf_scale.c. IMGFMT_BGR8 maps to AV_PIX_FMT_RGB8 (don't ask me why it's swapped), without any palette use. Enabling it in vo_x11 or using it as vf_scale input seems to give correct results.
* mp_image: simplify image allocationwm42013-01-134-120/+60
| | | | | | | | | | | | | | | | | | | | | | | | mp_image_alloc_planes() allocated images with minimal stride, even if the resulting stride was unaligned. It was the responsibility of vf_get_image() to set an image's width to something larger than required to get an aligned stride, and then crop it. Always allocate with aligned strides instead. Get rid of IMGFMT_IF09 special handling. This format is not used anymore. (IF09 has 4x4 chroma sub-sampling, and that is what it was mainly used for - this is still supported.) Get rid of swapped chroma plane allocation. This is not used anywhere, and VOs like vo_xv, vo_direct3d and vo_sdl do their own swapping. Always round chroma width/height up instead of down. Consider 4:2:0 and an uneven image size. For luma, the size was left uneven, and the chroma size was rounded down. This doesn't make sense, because chroma would be missing for the bottom/right border. Remove mp_image_new_empty() and mp_image_alloc_planes(), they were not used anymore, except in draw_bmp.c. (It's still allowed to setup mp_images manually, you just can't allocate image data with them anymore - this is also done in draw_bmp.c.)
* video: use libavutil pixel format descriptorswm42013-01-134-264/+307
| | | | | | | Replace the internal pixel format stuff with code that queries the libavutil list of pixel format descriptors. Trying to map IMGFMT_IS_RGB() etc. turned out extremely hacky.
* vf_screenshot: simplifywm42013-01-133-104/+39
| | | | | | | | | | Instead of using a callback to "capture" the image next time the filter function is called, do it the other way around: on every filter invocation, create a reference to the image, and return it if a screenshot is requested. This also fixes the 1-frame delay when taking screenshots with the filter. This also allows simplifying screenshot.c.
* video/out: replace VFCAP_TIMER with vo->untimed, fix vo_image and vo_lavcwm42013-01-135-6/+6
| | | | | | | | VFCAP_TIMER disables any additional waiting done by mpv in the playloop. Remove VFCAP_TIMER, but re-use the idea for vo_image and vo_lavc. This means --untimed doesn't have to be passed when using --vo=image.
* vd_lavc: make non-reference frames writeablewm42013-01-131-1/+18
| | | | | | | | | | | | | This allows avoiding a copy. The logic about using the AVFrame.reference field if buffer hints are not available is similar to mplayer-svn's direct rendering code. This is needed because h264 decoding doesn't set buffer hints. <wm4> michaelni: couldn't it set buffer hints from AVFrame.reference then? <michaelni> i see no reason ATM why that wouldnt be possible OK...
* video: remove things related to old DR codewm42013-01-1314-181/+92
| | | | | | | | | | | | | | | Remove mp_image.width/height. The w/h members are the ones to use. width/height were used internally by vf_get_image(), and sometimes for other purposes. Remove some image flags, most of which are now useless or completely unused. This includes VFCAP_ACCEPT_STRIDE: the vf_expand insertion in vf.c does nothing. Remove some other unused mp_image fields. Some rather messy changes in vo_opengl[_old] to get rid of legacy mp_image flags and fields. This is left from when vo_gl supported DR.
* video/filter: change filter API, use refcounting, remove filter DRwm42013-01-1343-1241/+649
| | | | | | | | | | | | | | | | | | | | Change the entire filter API to use reference counted images instead of vf_get_image(). Remove filter "direct rendering". This was useful for vf_expand and (in rare cases) vf_sub: DR allowed these filters to pass a cropped image to the filters before them. Then, on filtering, the image was "uncropped", so that black bars could be added around the image without copying. This means that in some cases, vf_expand will be slower (-vf gradfun,expand for example). Note that another form of DR used for in-place filters has been replaced by simpler logic. Instead of trying to do DR, filters can check if the image is writeable (with mp_image_is_writeable()), and do true in-place if that's the case. This affects filters like vf_gradfun and vf_sub. Everything has to support strides now. If something doesn't, making a copy of the image data is required.
* vo_caca: accept any stride for output imagewm42013-01-131-3/+10
| | | | Similar to previous commit.
* vo_corevideo: use stridewm42013-01-131-1/+1
| | | | | | The code was entirely correct, as the VO doesn't report VFCAP_ACCEPT_STRIDE in query_format. Add stride capability in preparation for changing the video chain: soon all VOs will have to support arbitrary strides.
* vo_corevideo: correct stride usagewm42013-01-131-5/+6
| | | | | | | | | | The code assumed mp_image_alloc() would allocate an image large enough for corevideo's stride, which doesn't have to be the case. If corevideo's stride was larger than the stride of mp_image, the memcpy() would write beyond the mp_image allocation. This probably didn't actually happen, but fix the code to be more correct anyway.
* mp_image: require using mp_image_set_size() for setting w/hwm42013-01-1314-46/+41
| | | | | | | | | | | | | | Setting the size of a mp_image must be done with mp_image_set_size() now. Do this to guarantee that the redundant fields (like chroma_width) are updated consistently. Replacing the redundant fields by function calls would probably be better, but there are too many uses of them, and is a bit less convenient. Most code actually called mp_image_setfmt(), which did this as well. This commit just makes things a bit more explicit. Warning: the video filter chain still sets up mp_images manually, and vf_get_image() is not updated.
* mp_image_pool: add pool to avoid frequent image reallocationswm42013-01-133-0/+156
| | | | | | | | | | | Refcounting will conceptually allocate and free images all the time when using the filter chain. Add a pool that makes these reallocations cheap. This only affects the image data, not mp_image structs and similar small allocations. Small allocations are always fast with reasonable memory managers, while large image data will trigger mmap/munmap calls each time.
* vd_lavc: use refcountingwm42013-01-133-16/+58
| | | | | | | | | | | | | Note that if the codec doesn't support DR1, the image has to be copied. There is no other way to guarantee that the image will be valid after decoding the next image. The only important codec that doesn't support DR1 yet is rawvideo. It's likely that ffmpeg/Libav will fix this at some time. For now, this decoder uses an evil hack and puts pointers to the packet data into the returned frame. This means the image will actually get invalid as soon as the corresponding video packet is free'd, so copying the image is the only reasonable thing anyway.
* mp_image: refcounting helperswm42013-01-132-25/+265
|
* vd_lavc: add DR1 supportwm42013-01-134-21/+274
| | | | | | | | | | | | | | | | | | | | Replace libavcodec's native buffer allocation with code taken from ffplay/ffmpeg's libavfilter support. The code in lavc_dr1.c is directly copied from cmdutils.c. Note that this is quite arcane code, which contains some workarounds for decoder bugs and the like. This is not really a maintainance burden, since fixes from ffmpeg can be directly applied to the code in lavc_dr1.c. It's unknown why libavcodec doesn't provide such a function directly. avcodec_default_get_buffer() can't be reused for various reasons. There's some hope that the work known as The Evil Plan [1] will make custom get_buffer implementations unneeded. The DR1 support as of this commit does nothing. A future commit will use it to implement ref-counting for mp_image (similar to how AVFrame will be ref-counted with The Evil Plan.) [1] http://lists.libav.org/pipermail/libav-devel/2012-December/039781.html
* video: different way to enable hardware decoding, add software fallbackwm42013-01-137-68/+240
| | | | | | | | | | | | | | Deprecate the hardware specific video codec entries (like ffh264vdpau). Replace them with the --hwdec switch, which requests that a specific hardware decoding API should be used. The codecs.conf entries will be removed at a later time, but for now they are useful for testing and compatibility. Instead of --vc=ffh264vdpau, --hwdec=vdpau should be used. Add a fallback if hardware decoding fails. Most hardware decoders (including vdpau) support only a subset of h264, and having such a fallback is supposed to enable a better user experience.
* vd_lavc: remove codec DRwm42013-01-133-203/+14
| | | | | | | | | | This was buggy and didn't even work in the simplest cases. It was disabled when multithreading was used, and always disabled for h264. A better alternative (reference counting) will be added later. Hardware decoding still uses the ffmpeg DR mechanism, but has been decoupled from mpv's DR in the previous commit.
* video: make vdpau hardware decoding not use DR code pathwm42013-01-135-66/+117
| | | | | | vdpau hardware decoding used the DR (direct rendering) path to let the decoder query a surface from the VO. Special-case the HW decoding path instead, to make it separate from DR.
* vd_lavc: do not mutate global threads optionwm42013-01-131-10/+9
| | | | | | | | | | | This mutated the variable for the thread count option (lavc_param->threads) on decoder initialization. This didn't have any practical relevance, unless formats supporting hardware video decoding and other formats were played in the same mpv instance. In this case, hardware decoding would set threads to 1, and all files played after that would use only one thread as well even with software decoding. Remove XvMC leftover (CODEC_CAP_HWACCEL).
* vd_lavc: cosmetics: move debugging code out of the waywm42013-01-131-75/+82
| | | | | Relatively useless statistics printing code was stuffed directly into the middle of the central decode() function. Move it away.
* video: simplify decoder pixel format handlingwm42013-01-1310-209/+34
| | | | | | | | | | | | | | | | | | | | Simplify the decoder pixel format handling by making it handle only the case vd_lavc needs: a video stream always decodes to a single pixel format. Remove the handling for multiple pixel formats, and remove the codecs.conf pixel format declarations that are left. Remove the handling of "ambiguous" pixel formats like YV12 vs. I420 (via VDCTRL_QUERY_FORMAT etc.). This is only a problem if the video chain supports I420, but not YV12, which doesn't seem to be the case anywhere, and in fact would not have any advantage. Make the "flip" flag a global per-codec flag, rather than a pixel format specific flag. (Some ffmpeg decoders still return a flipped image, so this has to be done manually.) Also fix handling of the flip operation: do not overwrite the global flip option, and make the --flip option invert the codec flip option rather than overriding it.
* vo_direct3d: simplifywm42013-01-131-198/+55
|
* vo_xv: simplifywm42013-01-131-47/+2
| | | | We can do this because slice support has been removed.
* video: remove slice based filtering and video outputwm42013-01-1333-499/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Slices allowed filtering or drawing video in horizontal bands or blocks. This allowed working on the video in smaller units. In theory, this could bring a performance win by lowering cache pressure, as you didn't have to keep the whole video frame in cache while filtering, only the slice. In practice, the slice code path was barely used for the following reasons: - Multithreaded decoding with ffmpeg didn't use slices. The ffmpeg slice callback was disabled, because it can be called from another thread, and the mplayer video chain is not thread-safe. - There was nothing that would turn "full" images into appropriate slices, so slices were rarely used. - Most filters didn't actually support slices. On the other hand, supporting slices lead to code duplication and more complex code in general. I made some experiments and didn't find any actual measurable performance improvements when using slices. Even ffmpeg removed slices based filtering from libavfilter in favor of simpler code. The most broken thing about the slices code path is that slices can't be queued, like it is done for images in vo.c.
* video: make vdpau hardware decoding not use slices code pathwm42013-01-135-9/+25
| | | | | | | | | | | | | | For some reason, libavcodec abuses the slices rendering code path for hardware decoding: in that case, the only purpose of the draw callback is to pass a vdpau video surface object to video output. (It is unclear to me why this had to use the slices code, instead of just returning an AVFrame with the required vdpau state.) Make this code separate within mpv, so that the internal slices code path is not used for hardware decoding. Pass the vdpau state with VOCTRL_HWDEC_DECODER_RENDER instead. Remove the mencoder specific VOCTRLs.
* video/out: replace VOCTRL_QUERY_FORMAT with vo_driver.query_formatwm42013-01-1315-41/+33
|
* video/out: make draw_image mandatory, remove VOCTRL_DRAW_IMAGEwm42013-01-1315-93/+62
| | | | | | | | | | | | | Remove VOCTRL_DRAW_IMAGE and always set vo_driver.draw_image in VOs. Make draw_image mandatory: change some VOs (like vo_x11) to support it, and remove the image-to-slices fallback in vf_vo. Remove vo_driver.is_new. This member indicated whether draw_image is supported unconditionally, which is now always the case. draw_image_pts is a hack until the video filter chain is changed to include the PTS as field in mp_image. Then vo_vdpau and vo_lavc will be changed to use draw_image.
* Remove netstream supportwm42013-01-134-474/+1
| | | | | | | | | | | | | | | | | | | | | | This allowed to move the input stream layer across the network, allowing the user to play anything that mplayer could play remotely. For example, playing a DVD related on a remote server (say, with the host name "remotehost1") could be done by starting the netstream server on that remote server, and then running: mplayer mpst://remotehost1/dvd:// This would open the DVD on the remote host, and transfer the raw DVD sector reads over network. It works the same for other protocols, and all accesses to the stream layer are marshaled over network. It's comparable to the way the cache layer (--cache) works. It has questionable use and most likely was barely used at all. There's lots of potential for breakage, because it doesn't translate the stream CTRLs to network packets. Just get rid of it. The server used to be in TOOLS/netstream.c, and was accidentally removed earlier.
* configure: change libcaca test to pkg-configwm42013-01-131-12/+1
| | | | Caca is important.
* configure: remove references to naswm42013-01-131-4/+2
|
* configure: remove unused check for mkstemp()wm42013-01-131-12/+0
| | | | Was used by the win32 loader to implement a similar win32 API function.
* Replace strsep() useswm42013-01-139-115/+37
| | | | | | This function sucks and apparently is not very portable (at least on mingw, the configure check fails). Also remove the emulation of that function from osdep/strsep*, and remove the configure check.
* windows support: fix _wstat misusagewm42013-01-132-2/+2
| | | | | | | I have no idea when or how this broke, but _wstati64() is the function we want anyway (64 bit filesize). Possibly this was a mingw-w64 bug. It's unknown why "wstat()" just doesn't work in this case, as it's not defined by MSDN and could be defined by mingw as it needs.
* osdep: remove gettimeofday() emulationwm42013-01-132-44/+0
| | | | Guaranteed by POSIX, and mingw provides it as well.
* osdep: remove setenv() emulationwm42013-01-132-44/+0
| | | | | mpv doesn't use setenv() anymore. The configure check was actually removed earlier; maybe it was forgotten to remove this completely.
* osdep: remove broken vsscanf() emulationwm42013-01-133-58/+0
| | | | | | vsscanf() is in POSIX, C99, mingw, etc. Further, the implementation in osdep/vsscanf.c was completely broken, and if it worked, it worked only by chance.
* configure: remove check for .align semanticswm42013-01-135-23/+8
| | | | | | | | | | | | | | | | | | | | | The check determined whether the argument for .align is in bytes, or log2(bytes). Apparently it's always in bytes for ELF i386 systems, and this check is used for x86 inline assembler only. Even if this assumption should be wrong, it likely won't cause much damage: the existing code uses it only in the form ".align 4", which means in the worst case it will try to align to 16 bytes, which doesn't cause any problems (unless the object file format does not support such a high alignment). Update the filters that used this. Quoting the GNU as manual: For other systems, including ppc, i386 using a.out format, arm and strongarm, it is the number of low-order zero bits the location counter must have after advancement. For example `.align 3' advances the location counter until it a multiple of 8. If the location counter is already a multiple of 8, no change is needed.
* configure: remove __builtin_expect checkwm42013-01-132-21/+1
| | | | | | Change the only usage of HAVE_BUILTIN_EXPECT, demux.h, to use an #ifdef instead. In theory, a configure check is better, but nobody does it this way anyway, and we seek to reduce the configure script.
* configure: cleanup: remove unused --datadir switchwm42013-01-131-7/+0
| | | | | Unused. mplayer-svn used it as fallback directory to locate the OSD font, and for the GUI.
* configure: cleanup: remove unused xshape switcheswm42013-01-131-4/+0
| | | | They didn't do anything since the internal GUI was removed years ago.
* mixer: keep fractional part of volume settingUoti Urpala2013-01-131-2/+2
| | | | | | | | mixer_setvolume() accepts float values for volume, but used the integer function av_clip() to limit range, losing the fractional part as a side effect. Change the code to use av_clipf() instead. For most uses this shouldn't make any real difference; actual AO volume settings may not have that much precision anyway.
* af_volnorm: fix output range with float inputUoti Urpala2013-01-131-3/+3
| | | | | | | | | af_volnorm can process either int16_t or float audio data. The float version used 0 to INT_MAX as full value range, when it should be 0 to 1. This effectively disabled the filter (due to all input being considered to fall in the silence range). Fix. Reported by Tobias Jacobi <liquid.acid@gmx.net>.
* demux_mkv: work around bad OutputSamplingFrequency valuesUoti Urpala2013-01-131-0/+8
| | | | | | | | | Something produces corrupt Matroska files with audio tracks that have SamplingFrequency set to 44100 and OutputSamplingFrequency to 96000, when the correct playback rate is 44100. Add a special case for this 44100/96000 combination and override it to 44100/44100; it's unlikely that anyone would ever want to use this 44100/96000 combination for real in valid files.
* core: timeline: prevent inaccurate seeks outside timelineUoti Urpala2013-01-131-2/+3
| | | | | | | | | Ensure that even if a seek is inaccurate it will not show video from outside the defined timeline. Previously, seeking to the beginning of a segment could show frames from before the start of the segment if the seek was done in inaccurate mode and the demuxer seeked to an earlier position. Now hr-seek machinery is used to skip at least the frames that should not be part of playback timeline at all.
* vo_sdl: fix for rename of a function in SDL2's interfaceRudolf Polzer2013-01-121-2/+4
|
* sub: do not apply timeline offset to external subtitleswm42013-01-121-3/+8
| | | | | | | | | | | | Now external subtitles essentially use the playback time, instead of the segment time. This is more useful when using external subtitles with mkv ordered chapters. The previous behavior is not necessarily incorrect, and e.g. makes it easier to use subtitles directly extracted from ordered chapters segments. But we consider the new behavior more useful. Also see commit 06e3dc8.
* Fix lots of bugs in mp_http URL handlingRudolf Polzer2013-01-103-9/+22
| | | | | Many instances of "http" were not changed to "mp_http", which made many aspects of the mp_http protocol handler broken.
* demux_lavf: avio_flush in DEMUXER_CTRL_RESYNCRudolf Polzer2013-01-101-0/+2
| | | | This rules out possible avio buffering issues.
* vo_sdl: add a "sw" flag like in openglRudolf Polzer2013-01-102-36/+78
| | | | | | Als