summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
Commit message (Collapse)AuthorAgeFilesLines
* sub, demux: identify subtitle types with the codec namewm42013-04-201-14/+21
| | | | | | | | | Get rid of the 1-char subtitle type field. Use sh_stream->codec instead just like audio and video do. Use codec names as defined by libavcodec for simplicity, even if they're somewhat verbose and annoying. Note that ffmpeg might switch to "ass" as codec name for ASS, so we don't bother with the current silly "ssa" name.
* Prefix CODEC_ID_ with AV_wm42013-03-131-5/+5
| | | | | | | | | The old names have been deprecated a while ago, but were needed for supporting older ffmpeg/libav versions. The deprecated identifiers have been removed from recent Libav and FFmpeg git. This change breaks compatibility with Libav 0.8.x and equivalent FFmpeg releases.
* sd_lavc: keep subs on subtitle track switchingwm42012-12-121-1/+7
| | | | | | | | | | | | | Keep the currently displayed subtitles even when the user cycles through subtitle tracks, and the subtitle is decoded by libavcodec (such as vobsubs). Do this by not clearing the subtitles on reset(). reset() is also called on seek, so check the start PTS whether the subtitle should really be displayed (there's already an end PTS). Note that sd_ass does essentially something similar. The existing code has checks for whether the PTS reported by the demuxer is invalid (MP_NOPTS_VALUE). I don't know under what circumstances this can happens, so fall back to the old behavior if the PTS is invalid.
* Rename directories, move files (step 2 of 2)wm42012-11-121-2/+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.)
* VO, sub: refactorwm42012-10-241-8/+7
| | | | | | | | | | | | | | | | | | Remove VFCTRL_DRAW_OSD, VFCAP_EOSD_FILTER, VFCAP_EOSD_RGBA, VFCAP_EOSD, VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT. Remove draw_osd_with_eosd(), which rendered the OSD by calling VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which takes a callback as argument. (This basically works like the old OSD API, except multiple OSD bitmap formats are supported and caching is possible.) Remove all mentions of "eosd". It's simply "osd" now. Make OSD size per-OSD-object, as they can be different when using vf_sub. Include display_par/video_par in resolution change detection. Fix the issue with margin borders in vo_corevideo.
* sub: fix and simplify some change detection detailswm42012-10-161-8/+4
| | | | | | | | | | | | | | Fix spudec change detection. The internal changed-flag was not reset when retrieving indexed bitmaps, and subtitles were rescaled every frame, even if they were not changing. Simplify subtitle decoders by not requiring them to check whether the passed-in screen size has changed. sd_lavc did this, and spudec would have needed to do the same. Instead, leave this to the osd_object force_redraw flag. Subtitle decoders (such as libass) can still signal that only the positions of subtitles have changed, but making _all_ subtitle decoders do this just to deal with screen size changes is worthless.
* sub: never decode subs to old OSD formatwm42012-10-161-68/+22
| | | | | | | | | | | | | | | | | | | | | | | | | Instead, sd_lavc.c and spudec.c (the two image sub decoders) always output indexed/paletted images. For this purpose, add SUBBITMAP_INDEXED, and convert the subs to RGBA in img_convert.c instead. If a VO is used that supports the old OSD format only, the indexed bitmaps are converted to the old OSD format by abusing spudec.c in a similar way sd_lavc.c used to do. The main reason why spudec.c is used is because the images must not only be converted to the old format, but also properly scaled, cropped, and aligned (the asm code in libvo/osd.c requires this alignment). Remove support for the old format (packed variant) from the OpenGL VOs. (The packed formats were how the actual OSD format was handled in some GPU-driven VOs for a while.) Remove all conversions from old to new formats. Now all subtitle decoders and OSD renderers produce the new formats only. Add an evil hack to convert the new format (scaled+indexed bitmaps) to the old format. It creates a new spudec instance to convert images to grayscale and to scale them. This is temporary for VOs which don't support new OSD formats yet (vo_xv, vo_x11, vo_lavc).
* sub: cosmetics: move things aroundwm42012-10-161-0/+1
| | | | | | | | | | | | | | | | | | Move sub-bitmap definitions from dec_sub.h to sub.h. While it's a bit odd that OSD data structures are in a file named sub.h, it's definitely way too strange to have them in a file about subtitle decoding. (Maybe sub.h/.c and the sub/ directory should be split out and renamed "osd" at a later point.) Remove including ass_mp.h (and the libass headers) where possible. Remove typedefs for mp_eosd_res and sub_bitmaps structs. Store a mp_eosd_res struct in osd_state instead of just w/h. Note that sbtitles might be rendered using different sizes/margins when filters are involved (the subtitle renderer is not supposed to use the OSD res directly, and the "dim" member removed in the previous commit is something different).
* sub: cleanup: don't pass parameters via global variableswm42012-10-161-4/+5
| | | | | | | | | | | Passing parameters from caller to subtitle renderer was done by temporarily setting certain members in the osd_state struct (which for all practical purposes are as good as global variables). This was the only purpose of these members. Rather than using such a messy way to pass parameter, put these into a struct sub_render_params. The struct was already introduced in earlier commits, and this commit just removes the parameter passing hack.
* sub: make it easier to set DVD sub decoding with sd_lavcwm42012-10-161-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this commit, the player will still use spudec.c (the "old" DVD sub decoder), rather than ffmpeg. But it brings the changes needed to enable this down to a single line change: --- a/mplayer.c +++ b/mplayer.c @@ -1988,7 +1988,7 @@ static void reinit_subs(struct MPContext *mpctx) #endif vo_osd_changed(OSDTYPE_SUBTITLE); } else if (track->stream) { - if (mpctx->sh_sub->type == 'v') + if (mpctx->sh_sub->type == 'v' && false) init_vo_spudec(mpctx); else sub_init(mpctx->sh_sub, mpctx->osd); Also, copy the DVD resolution heuristics from spudec.c (from the spudec_new_scaled() function). I'm not sure if this is correct or even needed, but the sd_lavc codd explicitly reverted back to spudec with code carrying this comment: // Assume resolution heuristics only work for PGS and DVB so it seems likely that the required heuristics were missing, and that the spudec heuristics may make the DVD compatibility situation at least as good as with spudec. Note that it's unlikely that we enable sd_lavc for DVD subs by default, as there are other problems in combination with direct DVD playback.
* sub: create sub_bitmap array even when using libasswm42012-10-161-2/+3
| | | | | | | | | | | | | | One sub_bitmaps struct could contain either a libass ASS_Image list, or a mplayer native list of sub-bitmaps. This caused code duplication in vo_vdpau.c and bitmap_packer.c. Avoid this by creating such a sub_bitmap array even with libass. This basically copies the list and recreates it in mplayer's native format. It gets rid of the code duplication, and will make implementing extended subtitle and OSD rendering in other VOs easier. Also do some cosmetic changes and other preparations for the following commits.
* subs, vo_vdpau: support RGBA color for PGS subtitlesUoti Urpala2012-09-181-11/+120
| | | | | | | | | | | | | | | | | | | | | | Support passing bitmap subtitles to VOs in full RGBA color, and implement this for libavcodec-decoded subtitle formats on decoding side and vo_vdpau on display side. Currently this is enabled for PGS (blu-ray) and DVB subtitles. VDPAU seems to have sampling issues similar to known GL ones when drawing a sub-rectangle from a larger texture with scaling, where adjacent pixels outside the specified source rectangle affect the result. As the bitmap subtitles may be scaled, add padding support to the bitmap packer code. In principle, this could be used for colored DVD subtitles too. However, the libavcodec DVD decoder lacks parts of the resolution and palette handling that are present in spudec.c. Conflicts: libvo/vo_gl.c sub/dec_sub.h sub/sd_lavc.c
* sd_lavc: use subtitle framework for former av_sub.c codeUoti Urpala2012-09-181-0/+162
Change libavcodec subtitle decoding code (used for some bitmap subtitle types) to use the same decoding framework as sd_ass. The functionality that was previously in av_sub.c and was directly called from mplayer.c is now in sd_lavc.c. Conflicts: mplayer.c sub/av_sub.h sub/sd_lavc.c Merged from mplayer2. The remaining use of is_av_sub() is replaced by a check whether a subtitle decoder is active, which should give the same results.