Commit Graph

327 Commits

Author SHA1 Message Date
Uoti Urpala 7131fceb0b vd_ffmpeg: fix thread count setting with latest ffmpeg-mt
Recent ffmpeg-mt versions changed the API for setting the number of
decoding threads to use (I'm not sure whether dropping backwards
compatibility was intentional or not). As a result only one thread was
used. Make the thread setting compatible with the new API to restore
proper multithreaded decoding.
2011-03-29 18:54:33 +03:00
Uoti Urpala e1a8392cae fix compilation with old FFmpeg versions
af_lavcac3enc: use old SampleFormat names without AV_ prefix, the
latter were only added in 2010-11

vd_ffmpeg: add ifdef around CODEC_ID_LAGARITH use

demux_real: use ffmpeg_files/intreadwrite.h

stream/http.c, stream/realrtsp/real.c: define AV_BASE64_SIZE macro for
old libavutil versions lacking it
2011-02-08 19:07:10 +02:00
cehoyos 9a021242a9 codecs.conf, vd_ffmpeg: Enable fflagarith video decoder
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32773 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-01-31 16:03:10 +02:00
Uoti Urpala 2bc2399797 vd_ffmpeg: set thread count to number of cores on machine by default
Make "-lavdopts threads=0" mean an autodetected number of threads, and
make that the default value of the option. Also increase the upper
limit of the option from 8 to 16. Add new file osdep/numcores.c which
tries to determine the number of cores available on the machine.

numcores.c is based (heavily modified) on public domain numcpus.c by
Philip Willoughby <pgw99@doc.ic.ac.uk>, downloaded from
http://csgsoft.doc.ic.ac.uk/numcpus/
2010-12-20 05:53:28 +02:00
reimar 8a0f074043 vd_ffmpeg: fix MP_IMGTYPE selection for non-ref non-B frames
Change direct rendering buffer allocation code to treat non-ref frames
like B-frames even if has_b_frames is not set and they are indeed not
B-frames (no reordering). Treating it as an I/P frame would violate
the assumptions of MPlayer's buffering system, which thinks only the
latest previous I/P frame is needed (in addition to one possibly being
decoded). In this case the previous I/P frame will still be needed in
the future, not the non-ref frame being decoded now.

This happens with flv files, as in bug #1079, and this change fixes that
corruption.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32700 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar ad14401720 vd_ffmpeg: Reset ctx->vo_initialized to 0 on a resolution change
Otherwise we might think the filter chain/vo is ready when it
actually is not, leading to a crash.
Fixes crash part of bug 1156.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32690 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:18 +02:00
reimar f1e637b827 vd_ffmpeg: compare IMGFMT instead of PIX_FMT
Use IMGFMT to compare instead of PIX_FMT to avoid issues with the
"JPEG" formats like PIX_FMT_YUVJ422P.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32594 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:11 +02:00
reimar 98a6088a20 video: simplify some tests with a new IMGFMT_IS_HWACCEL macro
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32575 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:03:35 +02:00
reimar 64ab2402e2 vd_ffmpeg: improve aspect ratio handling
Respect container aspect first if available, but change to ratio based
on video codec level information if there's a resolution or pixel
aspect change from the original codec values in the middle of the
video.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32525 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 07:48:40 +02:00
reimar fe6c4fcae2 cleanup: malloc+memset->calloc, sizeof(TYPE)->sizeof(*ptr)
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 b3059339-0415-0410-9bf9-f77b7e298cf2

Replace malloc+memset by calloc.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32206 b3059339-0415-0410-9bf9-f77b7e298cf2

Replace sizeof(BITMAPINFOHEADER)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32207 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:16:46 +02:00
diego f2899d96ee Add central init_avcodec() to avoid duplicated libavcodec init code
Patch by Vlad Seryakov, vseryakov gmail com

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32043 b3059339-0415-0410-9bf9-f77b7e298cf2

Refactor more instances of avcodec_initialized handling into init_avcodec().
This is a leftover from the previous commit.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32044 b3059339-0415-0410-9bf9-f77b7e298cf2

Add missing #include for vd_ffmpeg.h; fixes the warning:
libmpcodecs/vf_zrmjpeg.c:472: warning: implicit declaration of function 'init_avcodec'

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32176 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:51 +02:00
reimar 039574d8d4 vd_ffmpeg: Set avctx->coded_width/coded_height instead of width/height
That's how it is supposed to be done.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32037 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:49 +02:00
diego 740c927976 ad_ffmpeg, vd_ffmpeg: remove pointless casts
Remove pointless casts of avcodec_find_decoder_by_name() return value.
avcodec_find_decoder_by_name() already returns AVCodec*, so there is
no need to cast the return value to this type.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32007 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:49 +02:00
diego e2dea75e4a vd_ffmpeg: add av_unused attribute to swap_palette()
Only used on bigendian machines.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31586 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:11:43 +02:00
reimar 368d11d4cc vf_ffmpeg: make VP8 decoder work by disabling dr
Allow the FFmpeg VP8 decoder to work by disabling dr for it (thus we do not
need edge emulation).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31560 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:11:43 +02:00
reimar f604df4f76 vd_ffmpeg: Minor code simplification.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31336 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-10-27 20:27:39 +03:00
Uoti Urpala 96312757c5 vd_ffmpeg: fix aspect ratio problems with recent FFmpeg
The code left ctx->last_sample_aspect_ratio at 0/0 when allocating a
context. In older FFmpeg versions av_cmp_q() against 0/0 always said
the numbers are equal; but this changed recently, triggering incorrect
overwrite of container aspect ratio. The logic looks like it'd need
further fixes, but for now just initialize last_sample_aspect_ratio to
0/1; this should restore the previous behavior from before FFmpeg
changes, which worked well enough for the most common cases.
2010-10-16 05:14:25 +03:00
Uoti Urpala 266e0341ba vd_ffmpeg: fix calloc/av_free mixup
avctx->palctrl was allocated with calloc() but freed with av_freep().
Free it with free() instead. Also change the main decoder context
allocation to use talloc.
2010-10-16 04:38:20 +03:00
Uoti Urpala 1888e57af7 cosmetics: "struct vf_instance* vf" -> "struct vf_instance *vf"
Change 'struct vf_instance' pointer arguments to more standard style
as in the subject. Also some other minor formatting fixes.

Patch by Diego Biurrun.
2010-05-29 17:20:44 +03:00
Uoti Urpala 5266b5de98 vd_ffmpeg: remove #ifdef for old FFmpeg-mt versions
The #ifdef is obsolete since trying to compile against the relevant
old versions will fail for other reasons.
2010-05-07 22:15:19 +03:00
Uoti Urpala bc767c2a98 vd_ffmpeg: use skip_frame instead of deprecated hurry_up field 2010-05-04 04:50:57 +03: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
Uoti Urpala c37f09693d Merge svn changes up to r30643 2010-03-10 00:00:06 +02:00
Uoti Urpala b0986b3760 Merge svn changes up to r30463
Note that r30455 is wrong, that commit does not in fact change the
default behavior as claimed in the commit message. It only breaks
"-af-adv force=0", which was already pretty much useless though.
2010-03-09 18:59:15 +02:00
reimar 84da7d44ef Handle negative height in draw_slice from FFmpeg in vd_ffmpeg.c, since at
least vo_xv and vo_sdl can not handle it and the scale filter seems
to work fine either way.
The FFmpeg vp3/Theora decoder produces such slices.
Fixes bug #1646.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30630 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-17 23:46:57 +00:00
diego a6207aaa68 libmpcodecs: Mark functions not used outside of their files as static.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30597 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-16 16:16:42 +00:00
diego 92e3238508 Mark all ad_info_t/vd_info_t structure declarations as const.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30546 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-12 16:29:34 +00:00
diego 23db422c3d Add missing license headers to all files in the libmpcodecs directory.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30463 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-30 16:57:40 +00:00
Uoti Urpala ffc3db2239 vd_ffmpeg: fix compilation with neither VDPAU nor XvMC enabled
The get_format() function was defined under
 #if CONFIG_XVMC || CONFIG_VDPAU
but recent commit ca217f4557 added an
unconditional reference to it, causing linking to fail with an
undefined reference if neither feature was enabled. Fix by removing
the #if, there's no reason reason why it would be needed.
2010-01-21 01:09:28 +02:00
Uoti Urpala 1ef8d887d4 vd_ffmpeg: FFmpeg-mt changed has_b_frames API, update 2010-01-20 20:32:00 +02:00
Uoti Urpala d4159a7d88 vd_ffmpeg: move redundant info messages to MSGL_V level
Move two messages printed when using VDPAU/XvMC to MSGL_V level:
"[VD_FFMPEG] XVMC-accelerated MPEG-2.\n"
"[VD_FFMPEG] Trying pixfmt=%d.\n"

The first is redundant because this info is normally visible from the
decoder name, and it was also incorrectly printed in the VDPAU case
too. Add a different MSGL_V message for VDPAU.

Also make all these messages not translatable.
2010-01-20 17:21:39 +02:00
Uoti Urpala ca217f4557 vd_ffmpeg: disable callbacks for threaded decoding
MPlayer's slice and direct rendering related callbacks are not safe to
call from other threads, so disable those features if more than one
decoding thread is specified. This should fix some issues when using
threaded decoding with formats other than h264 (in the h264 case the
callbacks were already disabled for other reasons).

This commit moves most of the code that sets special avctx parameters
for VDPAU and XvMC. Before that was done after avcodec_open() based on
the selected output image format; now it's done before avcodec_open()
based on the capabilities of the selected decoder. At least the code
selecting the thread count must be before avcodec_open(), and I think
there is no reason to try to keep the previous structure otherwise
either. The image format-based approach was implemented by Reimar
with the intended goal of eventually selecting between software and
VDPAU decoders under one FFmpeg decoder type. I consider that goal to
be questionable, and the approach certainly made the existing code
significantly messier for no functionality benefit.
2010-01-20 16:31:13 +02:00
Uoti Urpala 819b8f08a2 Merge svn changes up to r30236 2010-01-08 02:44:37 +02:00
Uoti Urpala 231b33a02f Merge svn changes up to r30165 2010-01-08 01:05:30 +02:00
zuxy 554231067d Avoid the error message "Unsupported PixelFormat -1" for ffh264 decoding
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30233 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-07 04:59:50 +00:00
reimar c07dec1a4a Also pass the 4th plane for planar formats on to libavcodec.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30156 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-31 23:39:21 +00:00
Uoti Urpala d46b86bc7c Merge svn changes up to r30136
Ignore another broken correct-pts change in 30134.
2009-12-30 00:56:10 +02:00
reimar afc5a627d8 Support mp_image with allocated palette.
Fixes playback and a memory leak for FFmpeg codecs which use reget_buffer
with paletted data, e.g. cdgraphics.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30116 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-26 11:51:19 +00:00
Uoti Urpala 5995bc175a Merge svn changes up to r29962 2009-11-23 01:56:21 +02:00
reimar 2959f9e032 Add const to draw_slice argument to match what FFmpeg expects for draw_horiz_band.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29956 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-22 13:18:12 +00:00
Uoti Urpala 74b7dcc5f4 core: Add support for decoder reordering of pts values
Add a mode where libavcodec's reordered_opaque feature is used to
associate container packet timestamps with decoded frames. This should
improve behavior at least for MPEG files with interlaced h264; the
previous code does not cope well with the libavformat demuxer
producing two field packets with separate timestamps but the
libavcodec h264 decoder only producing a single output frame for those
two packets (so half the timestamps have no associated output frame).

The current libavformat mpeg demuxer seems to finally work with
interlaced h264 files and produce valid timestamps which are useful
with a mode like this.

By default MPlayer now selects between this new mode and the old one
automatically based on the number of timestamp problems they cause; by
default the new mode is used if both seem to work. The new option
-pts-association-mode can be used to force a particular mode. If
correct-pts mode is disabled this has no effect on timing.

Also remove the "EXPERIMENTAL" marker from the manpage description of
-correct-pts.
2009-11-21 20:53:10 +02:00
reimar a98091b77b Use avcodec_align_dimensions to appropriately align width and height in
get_buffer instead of reimplementing it badly.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29921 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-17 13:56:34 +00:00
diego a63e8dce21 Map AV_LOG_VERBOSE to MSGL_V in order to avoid spurious log output.
based on a patch by On2


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29884 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-10 18:10:16 +00:00
Uoti Urpala 8bbb79c03a av_log callback handling overhaul
Move av_log callback handling from vd_ffmpeg.c to a new file
av_log.c and install the callback immediately when starting the
program. Main functionality improvements of the new code:

 - The old version only installed the callback when opening an FFmpeg
   video decoder. If nothing had triggered that then av_log() messages
   from other sources (libavformat, audio decoding, swscale usage)
   bypassed MPlayer's output system completely. Now the callback is
   always installed.

 - Current av_log message severity levels are handled correctly. The
   old code used MSGL_ERR for some messages that should be MSGL_V.

 - Message type is now set for libavformat contexts
   (MSGT_DEMUXER / MSGT_MUXER).

 - The old code did "mp_msg_test(type, mp_level)" before actually
   determining the type, so that it always used MSGT_FIXME. This led
   to some messages being incorrectly dropped in case the user
   had specified module-specific verbosity levels. The old check in
   question was originally motivated by performance problems when
   there were a lot of callbacks; however it's not clear whether the
   part about it skipping the type determination was intentional (most
   of the performance problems must have come from the way the
   original code used snprintf) and in my tests current FFmpeg
   libraries have not generated unreasonable amounts of callbacks
   anyway.
2009-10-31 23:59:16 +02:00
Uoti Urpala 7fd3eb0f74 Merge svn changes up to r29752
As part of merging subtitle-in-terminal changes make
update_subtitles() only clear existing subtitles if called with the
reset argument, and not try to set new ones. Later calls should set
the needed new subtitles, and this change avoids some problems with
trying to set subtitles when mp_property_sub() in command.c gets
called from initialization code before full initialization.
2009-10-06 04:48:00 +03:00
reimar 4834e21162 Make sure avctx->codec_type and codec_id are set, since libavcodec
currently requires that.
That probably is an unintended API change and should be fixed/reverted
in lavc but it hurts little to workaround here.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29709 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-23 19:21:38 +00:00
Uoti Urpala 4a36b51ea6 Merge svn changes up to r29455 2009-07-29 01:32:03 +03:00
diego e5751ced4f Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29443 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-07-26 19:53:00 +00:00
Uoti Urpala d6c410b54c Replace libavutil internal header #includes with MPlayer copies
Change #include lines for libavutil/intreadwrite.h, libavutil/bswap.h
and libavutil/x86_cpu.h to use the MPlayer file under ffmpeg_files/
instead.
2009-07-26 06:16:43 +03:00
Uoti Urpala a2037a2eff Merge svn changes up to r29412 2009-07-07 02:56:01 +03:00