summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_lavf.c
Commit message (Collapse)AuthorAgeFilesLines
* video, audio: use lavc decoders without codecs.conf entriesUoti Urpala2012-07-241-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for using libavcodec decoders that do not have entries in codecs.conf. This is currently only used with demux_lavf, and the codec selection is based on codec_id returned by libavformat. Also modify codec-related terminal output somewhat to make it use information from libavcodec and avoid excessively long default output. The new any-lavc-codec support is implemented with codecs.conf entries that invoke vd_ffmpeg/ad_ffmpeg without directly specifying any libavcodec codec name. In this mode, the decoders now instead select the libavcodec codec based on codec_id previously set by demux_lavf (if any). These new "generic" codecs.conf entries specify "status buggy", so that they're tried after any specific entries with higher-priority status. Add new directive "anyinput" to codecs.conf syntax. This means the entry will always match regardless of fourcc. This is used for the above new codecs.conf entries (so the driver always gets to decide whether to accept the input, and will fail init() if it can't find a suitable codec in libavcodec). Remove parsing support for the obsolete codecs.conf directive "cpuflags". This directive has not had any effect and has not been used in default codecs.conf since many years ago. Shorten codec-related terminal output. When using libavcodec decoders, show the libavcodec long_name field rather than codecs.conf "info" field as the name of the codec. Stop showing the codecs.conf entry name and "vfm/afm" name by default, as these are rarely needed; they're now in verbose output only. Show "VIDEO:" line at VO initialization rather than at demuxer open. This didn't really belong in demuxer code; the new location may show more accurate values (known after decoder has been opened) and works right if video track is changed after initial demuxer open. The vd.c changes (primarily done for terminal output changes) remove round-to-even behavior from code setting dimensions based on aspect ratio. I hope nothing depended on this; at least the even values were not consistently guaranteed anyway, as the rounding code did not run if the video file did not specify a nonzero aspect value.
* demux_lavf: try harder to make up a frame rateUoti Urpala2012-04-141-2/+16
| | | | | | | | | | | | Frame rate information is mostly irrelevant for playback, but it's needed at least to convert frame numbers used in some subtitle formats (like MicroDVD) into timestamps. Libavformat stopped making up a frame rate if no "reliable" information is available (commit 7929e22bd "lavf: don't guess r_frame_rate from either stream or codec timebase", 1.5 months ago). This caused a regression with AVI files and MicroDVD subtitles. Add a heuristic similar to what libavformat used to have, to make up FPS values which should work at least for the AVI+MicroDVD use case.
* cosmetics: misc minor cleanupsUoti Urpala2012-03-251-1/+1
| | | | | The deleted ZRM* things were only relevant to vo_zr, which was deleted earlier.
* demux_lavf: update growing file size info for AVSEEK_SIZEUoti Urpala2012-02-261-2/+5
| | | | | | | | demux_lavf was returning a static size value when libavformat queried file size with AVSEEK_SIZE. Add code to query the stream for possibly changed value first. This at least improves seeking with growing MPEG files; before seeks would never go beyond the part of the file that existed when the stream was first opened.
* demux_lavf: use Libav RIFF tag lists directlyUoti Urpala2012-02-011-6/+3
| | | | | | Change demux_lavf to use CodecID -> RIFF tag mappings that are now available through the public Libav API. Previously it used a copy in ffmpeg_files/taglists.c. That can now be deleted.
* Update Libav API usesUoti Urpala2012-02-011-17/+14
| | | | | | | | | | | | | | | | | | | Change various code to use the latest Libav API. The libavcodec error_recognition setting has been removed and replaced with different semantics. I removed the "--lavdopts=er=<value>" option accordingly, as I don't think it's widely enough used to be worth attempting to emulate the old option semantics using the new API. A new option with the new semantics can be added later if needed. Libav dropped APIs that were necessary with all Libav versions until quite recently (like setting avctx->age), and it would thus not be possible to keep compatibility with previous Libav versions without adding workarounds. The new APIs also had some bugs/limitations in the recent Libav release 0.8, and it would not work fully (at least some avcodec options would not be set correctly). Because of those issues, this commit makes no attempt to maintain compatibility with anything but the latest Libav git head. Hopefully the required fixes and improvements will be included in a following Libav point release.
* Libav API updates (remove most deprecated-in-0.7 uses)Uoti Urpala2011-12-221-23/+19
| | | | | | | | Update various code using Libav libraries to remove use of API features that were deprecated at Libav release 0.7. I think this removes them all with the exception of URLContext functions still used in stream_ffmpeg.c (at least other uses that generated deprecation warnings with libraries from 0.7 are removed).
* configure, build: require at least Libav 0.7Uoti Urpala2011-12-221-22/+0
| | | | | | | | | | | | | | | | Require versions of the Libav libraries corresponding to Libav release 0.7. These are: libavutil 51.7.0 libavcodec 53.5.0 libavformat 53.2.0 libswscale 2.0.0 libpostproc 52.0.0 Also disable the fallback to simple header check if these libraries could not be found with pkg-config; now compiling without pkg-config support for these always requires explicitly setting --enable-libav and any needed compiler/linker flags. The simple check would have let compilation proceed even if a version mismatch was detected.
* demux_lavf: set rawvideo codec_tag based on pix_fmtUoti Urpala2011-10-181-0/+2
| | | | | | | | | | | | Libav stopped automatically filling missing codec_tag field for raw codecs based on pix_fmt in libav commit bb416bd68c ("lavf: do not set codec_tag for rawvideo"). This broke demux_lavf for raw video in formats like YUV4MPEG, as the video format was not exported from demux_lavf in any form (the information only existed in the pix_fmt field of the struct AVCodecContext from libavformat, and that is not exported). Add an explicit call to avcodec_pix_fmt_to_codec_tag() to set the codec tag again so that selecting the correct raw decoder based on the tag works.
* demux_lavf: Adding av_dup_packet() missing from recent 6e8d420a41Uoti Urpala2011-08-211-0/+5
| | | | | | | | | Commit 6e8d420a41 ("demux: avoid a copy of demux packets with lavf, reduce padding") was missing an av_dup_packet() line. As a result at least formats that use parsing on the lavf side could fail (with parsing the packet may contain pointers to temporary fields that will be overwritten/freed when reading further packets, and av_dup_packet() is required to allocate permanent storage).
* demux: avoid a copy of demux packets with lavf, reduce paddingUoti Urpala2011-08-191-23/+20
| | | | | | | | | | | | | When demux_lavf read a new packet it used to copy the data from libavformat's struct AVPacket to struct demux_packet and then free the lavf packet. Change it to instead keep the AVPacket allocated and point demux_packet fields to the buffer in that. Also change MP_INPUT_BUFFER_PADDING_SIZE to 8 which matches FF_INPUT_BUFFER_PADDING SIZE; demux_lavf packets won't have more padding now anyway (it was increased from 8 earlier when FF_INPUT_BUFFER_PADDING_SIZE was increased in libavcodec, but that change was reverted).
* demux_lavf: don't interpret MPEG codec tags as generic tagsUoti Urpala2011-08-101-3/+8
| | | | | | | | Don't interpret native MPEG codec tags using our generic format-agnostic codec tag tables. MPEG may use tag 3 for MP3, whereas the generic tables map 3 to uncompressed PCM. Make the code ignore the codec_tag field for the "mpeg" and "mpegts" libavformat demuxers and rely on the codec_id value provided by lavf only.
* bstr: rename BSTR() -> bstr()Uoti Urpala2011-07-271-3/+3
| | | | | | Rename the BSTR() function to bstr(). The former caused a conflict with some Windows OS name, and it's no longer a macro so uppercase naming is less appropriate.
* cleanup: do libav* initialization on startupUoti Urpala2011-07-181-2/+0
| | | | | | | Do the global initialization of libavcodec and libavformat (avcodec_register_all(), av_register_all()) immediately on program startup and remove the initialization calls from various individual modules that use libavcodec/libavformat functionality.
* cleanup: silence most of the clang warningsClément Bœsch2011-07-091-1/+1
|
* Merge branch 'mplayer1_changes'Uoti Urpala2011-07-061-7/+9
|\
| * demux_lavf: Do not set AVIOContext for AVFMT_NOFILE formatsreimar2011-07-061-5/+7
| | | | | | | | | | | | | | | | Setting AVIOContext for AVFMT_NOFILE formats now triggers a warning from libavformat (and triggered an error for a while), so add a check to avoid setting AVIOContext when not necessary. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33695 b3059339-0415-0410-9bf9-f77b7e298cf2
| * demux_lavf: fix code printing subtitle typereimar2011-07-061-2/+2
| | | | | | | | | | | | | | Fix printing of subtitle type, the wrong index was used to look up the type. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33664 b3059339-0415-0410-9bf9-f77b7e298cf2
* | demux_lavf: add missing #include <libavutil/mathematics.h>Uoti Urpala2011-07-061-0/+1
|/ | | | Not included by avutil.h any more in recent Libav versions.
* OSD: when switching sub/audio tracks show title of new trackUoti Urpala2011-07-031-3/+9
| | | | | | If the played file has per-track titles for audio and subtitles show those on the OSD when switching tracks. This changes the OSD message from 'Audio: (2) eng' to 'Audio: (2) eng ("Director's commentary")'.
* cosmetics: reformat demux_lavf.c, m_option.[ch] and m_property.cUoti Urpala2011-07-031-480/+513
|
* demux: use talloc for sh_* structs and "lang" fieldUoti Urpala2011-07-031-2/+2
|
* Update libav API usesUoti Urpala2011-04-201-11/+14
| | | | | | | | | | | Update various code to use newer alternatives instead of deprecated functions/fields that are being dropped at libav API bump. An exception is avcodec_thread_init() which is being dropped even though it's still _necessary_ with fairly recent libav versions, so there's no good alternative which would work with both those recent versions and latest libavcodec. I think there are grounds to consider the drop premature and revert it for now; if that doesn't happen I'll add a version-test #if check around it later.
* demux_lavf: disable support for byte-based seekingUoti Urpala2011-04-081-0/+4
| | | | | | | | | | | | libavformat returns nonsense per-stream bitrate values for some MPEG files (0 or many times higher than the overall bitrate of the file), which triggered the heuristic to enable byte-based seeking in demux_lavf and then made the byte-based seeks wildly inaccurate. Disable the support for byte-based seeks. This will avoid problems with files that have consistent timestamps, but on the other hand will completely break seeking in MPEG files that have timestamp resets. I'll probably add at least an option to manually enable byte-based seeking later.
* demux_mkv, demux_lavf: don't select initial audio trackUoti Urpala2011-04-021-8/+2
| | | | | | | | | | | | | Remove code that tries to select audio track during demuxer initialization from demux_mkv and demux_lavf. Just leave audio disabled at that point; the higher-level select_audio() function will call the demuxer to switch track later anyway. Removing this unneeded code also fixes use of these demuxers as the main demuxer with -audiofile. Before the automatic track selection would have enabled an audio track (if the file had any); as the main demuxer was not used for audio the unused packets from this enabled track would accumulate until they reached queue size limits.
* demux_lavf: fix initial "-vid"-based video selectionUoti Urpala2011-03-311-1/+2
| | | | | | In 59058b54a73809866476b243d8bee82174fb4de8 (from svn r31129) Aurelien changed demux_lavf -vid indexing, but failed to change the initial video stream selection based on -vid to match. Fix.
* demux_lavf: fix stream switch returned index for no sound/videoUoti Urpala2011-03-311-12/+8
| | | | | | | | If the argument given to demux_lavf audio/video switch code is not one of -2, -1, or valid audio/video ID the code will treat it the same as -2 (switch to no sound / no video). However the returned index was not set to -2 in this case. Fix. Also change the returned index from -1 to -2 when staying at no sound / video.
* Merge branch 'sub'Uoti Urpala2011-01-261-5/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sub: sub/OSD: move some related files to sub/ subtitles: options: enable -ass by default subtitles: change default libass rendering style demux_mkv, chapters: change millisecond arithmetic to ns cleanup: rename ass_* functions to mp_ass_* subs: use correct font aspect ratio for libass + converted subs cleanup: some random minor code simplification and cleanup vf_vo: fix EOSD change detection bug sd_ass: remove subreader use, support plaintext markup subtitles: style support for common SubRip tags and MicroDVD core: ordered chapters: fix bad subtitle parameter subs/demux: don't try to enable sub track when creating it subtitles/demux: store duration instead of endpts in demux packets subtitles: add framework for subtitle decoders options: add special -leak-report option subtitles: remove code trying to handle text subs with libavcodec cleanup: move MP_NOPTS_VALUE definition to mpcommon.h subtitles: move global ass_track to struct osd_state core: move most mpcommon.c contents to mplayer.c core: move global "subdata" and "vo_sub_last" to mpctx subtitles: remove sub_last_pts hack options: move -noconfig to option struct, simplify
| * sub/OSD: move some related files to sub/Uoti Urpala2011-01-261-1/+1
| |
| * demux_mkv, chapters: change millisecond arithmetic to nsUoti Urpala2011-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | demux_mkv kept various integer timestamps in millisecond units. Matroska timestamp arithmetic is however specified in nanoseconds (even though files typically use 1 ms precision), and using ms units instead of that only made things more complex. Based on the demux_mkv example the general demuxer-level chapter structure also used ms units. Change the demux_mkv arithmetic and demuxer chapter structures to use nanoseconds instead. This also fixes a seeking problem in demux_mkv with files using a TimecodeScale other than the usual 1000000 (confusion between ms and TimecodeScale*ns units).
| * subtitles/demux: store duration instead of endpts in demux packetsUoti Urpala2011-01-181-2/+2
| |
* | demux_lavf: reject format probe matches with low scoreUoti Urpala2011-01-211-1/+1
|/ | | | | | | | When trying to determine the format of an input stream, demux_lavf retries the probe with a larger buffer size up to some limit if the match score is low, but when reaching the size limit it accepted the best match (if any) regardless of its score. Change it to require a score of at least AVPROBE_SCORE_MAX/4 to accept a match at all.
* demux_lavf: Add support for uncompressed BGR24 pixfmtreimar2010-12-161-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32659 b3059339-0415-0410-9bf9-f77b7e298cf2
* audio: FLAC: support new libavcodec parser, use lavf to demuxUoti Urpala2010-12-091-1/+5
| | | | | Parse FLAC data with new libavcodec parser if needed. Use libavformat demuxer for raw FLAC files by default.
* demux_lavf: fix check for files lavf doesn't recognizeUoti Urpala2010-11-171-1/+2
| | | | | | | Commit 91ea30c585 ("demux_lavf: use lavf for all formats except those listed") broke handling of files whose type libavformat couldn't recognize at all. Fix the demux_lavf probe function to correctly return failure in that case.
* demux_lavf: mark AVI timestamps non-pts to avoid messagesUoti Urpala2010-11-141-0/+1
| | | | | | | | Playing AVI files containing B-frames with demux_lavf printed two "decreasing pts" info messages at the start of the file. We know the timestamps from AVI won't be valid pts, so add a demuxer field to convey that information to the timing code and make that not even try to use the timestamps as valid pts.
* demux_lavf: use lavf for all formats except those listedAnton Khirnov2010-11-131-18/+12
| | | | | | | | lavf demuxers are mostly better and receive more maintenance, therefore it makes sense to prefer them in most cases. Change the "preferred" logic from listing all formats for which lavf is preferred to listing exceptions for which it isn't. Currently there are 3 exceptions: Matroska, FLAC and RealMedia (.rm).
* demux: change "%s file format detected" messageUoti Urpala2010-11-101-0/+4
| | | | | | | | | "libavformat file format detected" wasn't a very useful message due to the many file formats supported to libavformat. Change the message so that for demux_lavf it says something like "Detected file format: QuickTime/MPEG-4/Motion JPEG 2000 format (libavformat)" (using long name from FFmpeg), and for non-lavf something like "Detected file format: Matroska".
* demux_lavf: add simple seek-by-bytes mode for MPEGUoti Urpala2010-11-101-3/+39
| | | | | | | | | Seeking in MPEG files with pts resets could fail completely, as it was always done by timestamps and those of course don't unambiguously specify a file position in such files. Add basic functionality for byte-based seeking and playback position reporting, and decide whether to use that functionality based on a simple heuristic (could be improved).
* demux_lavf: Fix program switchingreimar2010-11-081-0/+12
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32580 b3059339-0415-0410-9bf9-f77b7e298cf2
* demux_lavf: Print PROGRAM_ID -identify output similar to demux_tsreimar2010-11-081-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32579 b3059339-0415-0410-9bf9-f77b7e298cf2
* demux_lavf: for avi, use packet .dts instead of .ptsUoti Urpala2010-11-061-4/+12
| | | | | | | | | | | | When playing avi files take timestamps from the .dts field of the packet instead of .pts. For avi libavformat returns the original avi timestamps in .dts; without GENPTS set .pts is sometimes unset, with GENPTS set it'll contain some made up values which are not correct pts. Current libavformat also has a bug take makes it loop over the whole avi file if you use GENPTS with video streams disabled. The timing code can cope with the avi timestamps even though they're not really pts.
* demux_lavf: avoid deprecated "first_iformat" by using newer APIUoti Urpala2010-11-061-2/+2
|
* demux_lavf: add hack for stream-changing ogg input (internet radio)Uoti Urpala2010-11-061-1/+56
| | | | | | | | | | | | | | | Some internet radio streams are ogg/vorbis with a new stream for each track (and the previous stream stops receiving data). Add a hack to ignore the stream number in packets when input seems to match this case; all packets will be effectively regarded as parts of the same audio stream. This workaround can't work perfectly with current lavf because it will keep adding streams and then hit its 20 stream maximum; at that point playback will likely fail. Print a warning about this problem and mention "-demuxer ogg" as a possible workaround. Currently there's no check that the vorbis extradata is actually compatible between the streams.
* demux_lavf: more future proof AVInputFormat name comparisonUoti Urpala2010-11-061-6/+20
| | | | | | | | AVInputFormat name fields consist of comma-separated components, more of which may be added in backwards-compatible versions. demux_lavf did a strcmp against the whole field at once; this would break if a component was added. Change the code to search for individual component matches within the field instead.
* demux_lavf: handle new streams appearing during playbackreimar2010-11-021-0/+8
| | | | | | Based on patch by KS Ng - dmbth [hk.dmbth gmail com] git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32439 b3059339-0415-0410-9bf9-f77b7e298cf2
* cleanup: malloc+memset->calloc, sizeof(TYPE)->sizeof(*ptr)reimar2010-11-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32181 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32182 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32183 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace some sizeof(type) by sizeof(*pointer) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32184 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32186 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32187 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32188 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizoef(type) by sizeof(*ptrvar). Besides being consistent with FFmpeg style, this reduces the size of a patch to rename these types to not conflict with the windows.h definitions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32189 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32191 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32192 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(type) by sizeof(*ptrvar) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32193 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a useless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32194 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(type) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32195 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a useless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32196 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace several sizeof(WAVEFORMATEX) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32197 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace one more instance of sizeof(WAVEFORMATEX); fix compilation. patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32199 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid some pointless uses of sizeof() and one related cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32200 b3059339-0415-0410-9bf9-f77b7e298cf2 Merge one malloc() + memset() invocation into calloc(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32202 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32203 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(WAVEFORMATEX) occurrences. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32205 b3059