Commit Graph

44 Commits

Author SHA1 Message Date
Clément Bœsch e3287077ec Merge commit '67deba8a416d818f3d95aef0aa916589090396e2'
* commit '67deba8a416d818f3d95aef0aa916589090396e2':
  Use avpriv_report_missing_feature() where appropriate

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-31 10:40:34 +02:00
Clément Bœsch f6d61eb6f9 Merge commit '5ed4644d6de7f6112431dc2d9a5cfe9a0a75a688'
* commit '5ed4644d6de7f6112431dc2d9a5cfe9a0a75a688':
  x11grab: Rename internal component to "xcbgrab"

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-15 22:19:56 +01:00
Diego Biurrun 67deba8a41 Use avpriv_report_missing_feature() where appropriate 2016-11-08 17:54:34 +01:00
Nicolas George 0bd1be65e8 lavd/xcbgrab: do not try to create refcounted packets.
The framework will allocate a buffer and copy the data to it,
that takes time. But it avoids constently creating and
destroyng the shared memory segment, and that saves more time.

On my setup,
from ~200 to ~300 FPS at full screen (1920×1200),
from ~1400 to ~3300 at smaller size (640×480),
similar to legacy x11grab and confirmed by others.

Plus, shared memory segments are a scarce resource,
allocating potentially many is a bad idea.

Note: if the application were to drop all references to the
buffer before the next call to av_read_frame(), then passing
the shared memory segment as a refcounted buffer would be
even more efficient, but it is hard to guarantee, and it does
not happen with the ffmpeg command-line tool. Using a small
number of preallocated buffers and resorting to a copy when
the pool is exhausted would be a solution to get the better
of both worlds.
2016-11-03 21:23:55 +01:00
Diego Biurrun 5ed4644d6d x11grab: Rename internal component to "xcbgrab" 2016-07-29 19:03:10 +02:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Ganesh Ajjanagadde 6a817ac1e9 avdevice/xcbgrab: fix -Wunused-variable
This patch fixes a -Wunused-variable reported in e.g
http://fate.ffmpeg.org/log.cgi?time=20150918194649&log=compile&slot=x86_64-debian-asan-144800.
av_unused is used as opposed to a header guard for readability.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-19 01:35:43 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Luca Barbato c8b8271379 xcbgrab: Explicitly include xcb/shape.h
Found-By: Cheristheus
2015-07-06 20:00:34 +02:00
Nicolas George 7971fa9ce0 lavd/xcbgrab: fix comparison with screen size.
Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-06 13:33:17 +02:00
Nicolas George 01fdfa51ac xcbgrab: Accept geometries matching the screen size
Introduced in e8c4db0d4d.
2015-05-06 12:25:32 +02:00
Michael Niedermayer f5c5aa968c Merge commit 'e8c4db0d4d07738fed716b1d2f20c85aac944641'
* commit 'e8c4db0d4d07738fed716b1d2f20c85aac944641':
  xcbgrab: Validate the capture area

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-30 22:15:22 +02:00
Michael Niedermayer dc83733f2b Merge commit '82a10225f817b2612fdd2b23af9d4f0a3408df3b'
* commit '82a10225f817b2612fdd2b23af9d4f0a3408df3b':
  xcbgrab: Do not assume the non shm image data is always available

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-30 22:00:10 +02:00
Luca Barbato e8c4db0d4d xcbgrab: Validate the capture area
And notify why the capture is impossible.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-04-30 14:10:13 +02:00
Luca Barbato 82a10225f8 xcbgrab: Do not assume the non shm image data is always available
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-04-30 14:10:13 +02:00
Michael Niedermayer fe25194c58 Merge commit 'c201069fac9a76e6604f9d84d76a172434d62200'
* commit 'c201069fac9a76e6604f9d84d76a172434d62200':
  avdevice: Add missing header for NULL_IF_CONFIG_SMALL

Conflicts:
	libavdevice/alsa-audio-dec.c
	libavdevice/alsa-audio-enc.c
	libavdevice/pulse_audio_dec.c
	libavdevice/sndio_enc.c
	libavdevice/vfwcap.c
	libavdevice/x11grab.c
	libavdevice/xcbgrab.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-09 21:07:24 +02:00
Diego Biurrun c201069fac avdevice: Add missing header for NULL_IF_CONFIG_SMALL
Also reshuffle headers into canonical order where appropriate.
2015-04-09 16:40:12 +02:00
Vittorio Giovara edca1dd552 xcbgrab: Check av_strdup() allocation
Bug-Id: CID 1274038
2015-03-12 15:29:59 +00:00
Michael Niedermayer 3360c6ac0c Merge commit '5f5b78aca35d07c771f5c4c73a984be9fe04a0b8'
* commit '5f5b78aca35d07c771f5c4c73a984be9fe04a0b8':
  xcbgrab: Free the host string after checking the connection

Conflicts:
	libavdevice/xcbgrab.c

No change as the bug was not in FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-08 19:44:09 +01:00
Luca Barbato 5f5b78aca3 xcbgrab: Free the host string after checking the connection
Prevent an use after free in the error message.

Bug-Id: CID 1274040
CC: libav-stable@libav.org
2015-03-08 14:39:01 +01:00
Michael Niedermayer a1b5cf0181 Merge commit '85b3b1c4ba7af9c2658442b0aafd27d613e1854b'
* commit '85b3b1c4ba7af9c2658442b0aafd27d613e1854b':
  xcbgrab: Unbreak parsing filename options

Conflicts:
	libavdevice/xcbgrab.c

See: db442c8736
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 01:44:49 +01:00
Michael Niedermayer 2fbdf30efe Merge commit 'b31328d008985f87f0a7c83c700847cef1a4f08c'
* commit 'b31328d008985f87f0a7c83c700847cef1a4f08c':
  xcbgrab: Provide better names for the y and x option

Conflicts:
	doc/indevs.texi
	libavdevice/x11grab.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 01:12:50 +01:00
Luca Barbato 85b3b1c4ba xcbgrab: Unbreak parsing filename options
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-24 22:31:20 +01:00
Luca Barbato b31328d008 xcbgrab: Provide better names for the y and x option
Incidentally `-y` also collides with avconv global options.

Update x11grab to match and document the option.

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-24 22:31:20 +01:00
Michael Niedermayer 3171ac209b Merge commit 'd40815a982c36ff9da09ae3edb5e3bd7d97b5d42'
* commit 'd40815a982c36ff9da09ae3edb5e3bd7d97b5d42':
  xcbgrab: Correctly make shm optional

Conflicts:
	libavdevice/xcbgrab.c

See: 8c0ae9015a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-15 20:42:52 +01:00
Luca Barbato d40815a982 xcbgrab: Correctly make shm optional
The segment field in the struct has to be conditionally build
as well.
2015-02-15 18:20:54 +01:00
Daniel Moran 51ca3cb604 xcbgrab: Use the correct geometry for the region highlight
The feature is implemented using a transparent window and drawing
inside it a rectangle filling the whole window to highlight it.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-15 18:20:54 +01:00
Michael Niedermayer c054cff87a Merge commit '9e06327ecb8f73c7904d10af7ad339c57cdaa788'
* commit '9e06327ecb8f73c7904d10af7ad339c57cdaa788':
  xcbgrab: Move NULL check before pointer dereference

Conflicts:
	libavdevice/xcbgrab.c

See: e86df0206f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-19 05:14:38 +01:00
Vittorio Giovara 9e06327ecb xcbgrab: Move NULL check before pointer dereference
Bug-Id: CID 1254668
2014-12-18 23:27:14 +01:00
Michael Niedermayer 81a045fe17 Merge commit '2c3f29c4894ee50635b846f202296ad79a7c0d33'
* commit '2c3f29c4894ee50635b846f202296ad79a7c0d33':
  xcbgrab: Support empty filename string correctly

Conflicts:
	libavdevice/xcbgrab.c

See: 62eca2f827
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-10 12:33:37 +01:00
Luca Barbato 2c3f29c489 xcbgrab: Support empty filename string correctly
Bug-Id: CID 1254664
CC: libav-stable@libav.org
2014-12-10 01:45:50 +01:00
Michael Niedermayer e86df0206f avdevice/xcbgrab: check xcb_query_pointer_reply_t pointer before use
Fixes CID1254668

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 01:54:51 +01:00
Carl Eugen Hoyos 7502e1a3b7 Fix xcb 32bit pix_fmts: There is no screen transparency. 2014-12-08 00:31:01 +01:00
Daniel Moran 0ae37e460c avdevice/xcbgrab: Fix show_region rectangle
Fixes trac ticket #4164

This is to address an error when using show_region, which would cause part of the captured area to become static.
It looks like the rectangle specifying the capture area was relative to the capture window.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-07 16:13:30 +01:00
Boris Reisig 54170a33c2 avdevice/xcbgrab: fix undefined reference to xcb_shape_rectangles in xcbgrab.c
works with (--enable-libxcb-shape)  and without (--disable-libxcb-shape) now.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-24 16:57:47 +01:00
Michael Niedermayer 62eca2f827 avdevice/xcbgrab: Fix/remove unneeded NULL checks
Fixes CID1254664

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-16 19:01:10 +01:00
Michael Niedermayer db442c8736 avdevice/xcbgrab: Fix offset support
Found-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 14:34:07 +01:00
Carl Eugen Hoyos 792f0f2045 Fix compilation of xcbgrab if xcb/shape.h is not available.
Old versions of libxcb do not provide xcb_shape_rectangles().
The issue can be fixed differently but this small change fixes
some fate platforms and a user reported compilation problem.

Reported and tested by trac user kevmitch.
Fixes ticket #4067.
2014-10-30 10:22:34 +01:00
Carl Eugen Hoyos 8c0ae9015a Fix xcbgrab build if shm is not available. 2014-10-30 10:05:45 +01:00
Michael Niedermayer 280da99a8f avdevice/xcbgrab: set avclass category
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-28 12:07:20 +01:00
Michael Niedermayer a38a1d516f Merge commit 'a6674d2e7771dbf7a4a5556f5e126be83cadac96'
* commit 'a6674d2e7771dbf7a4a5556f5e126be83cadac96':
  xcbgrab: XCB-based screen capture

Conflicts:
	Changelog
	configure
	libavdevice/Makefile
	libavdevice/alldevices.c
	libavdevice/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-27 21:26:51 +01:00
Luca Barbato a6674d2e77 xcbgrab: XCB-based screen capture
Matches the x11grab screen capture by features.
2014-10-26 08:47:41 +01:00