summaryrefslogtreecommitdiff
path: root/libavdevice/dshow.c
Commit message (Collapse)AuthorAge
* avcodec/packet_internal: Add proper PacketList structAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/raw: Reduce number of avpriv symbolsAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libavcodec currently exports four avpriv symbols that deal with PixelFormatTags: avpriv_get_raw_pix_fmt_tags, avpriv_find_pix_fmt, avpriv_pix_fmt_bps_avi and avpriv_pix_fmt_bps_mov. The latter two are lists of PixelFormatTags, the former returns such a list and the second searches a list for a pixel format that matches a given fourcc; only one of the aforementioned three lists is ever searched. Yet for avpriv_pix_fmt_bps_avi, avpriv_pix_fmt_bps_mov and avpriv_find_pix_fmt the overhead of exporting these functions actually exceeds the size of said objects (at least for ELF; the following numbers are for x64 Ubuntu 20.10): The code size of avpriv_find_pix_fmt is small (GCC 10.2 37B, Clang 11 41B), yet exporting it adds a 20B string for the name alone to the exporting as well as to each importing library; there is more: Four bytes in the exporting libraries .gnu.hash; two bytes each for the exporting as well as each importing libraries .gnu.version; 24B in the exporting as well as each importing libraries .dynsym; 16B+24B for an entry in .plt as well as the accompanying relocation entry in .rela.plt for each importing library. The overhead for the lists is similar: The strings are 23B and the .plt+.rela.plt pair is replaced by 8B+24B for an entry in .got and a relocation entry in .rela.dyn. These lists have a size of 80 resp. 72 bytes. Yet for ff_raw_pix_fmt_tags, exporting it is advantageous compared to duplicating it into libavformat and potentially libavdevice. Therefore this commit replaces all library uses of the four symbols with a single function that is exported for shared builds. It has an enum parameter to choose the desired list besides the parameter for the fourcc. New lists can be supported with new enum values. Unfortunately, avpriv_get_raw_pix_fmt_tags could not be removed, as the fourcc2pixfmt tool uses the table of raw pix fmts. No other user of this function remains. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/dshow: ensure pin's default format is setDiederick Niehorster2022-01-04
| | | | | | | | | | | | Fixes regression in a1c4929f: there apparently are devices out there that expose a pin default format that has parameters outside the capabilities of any of the formats exposed on the pin (sic?). The VirtualCam plugin (v 2.0.5) of OBS-Studio (v 27.1.3) is such a device. Now when a default format was found, but not selected when iterating all formats, fall back to directly setting the default format. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: only set pin format if wantedDiederick Niehorster2022-01-04
| | | | | Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: proper cleanup of queried media typesDiederick Niehorster2022-01-04
| | | | | Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: don't mix declarations and codeJames Almer2021-12-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: remove unused variablesJames Almer2021-12-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: select format with extended color infoDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | | | | | | | | | Some DirectShow devices (Logitech C920 webcam) expose each DirectShow format they support twice, once without and once with extended color information. During format selection, both match, this patch ensures that the format with extended color information is selected if it is available, else it falls back to a matching format without such information. This also necessitated a new code path taken for default formats of a device (when user didn't request any specific video size, etc), because the default format may be one without extended color information when a twin with extended color information is also available. Getting the extended color information when available is important as it allows setting the color space, range, primaries, transfer characteristics and chroma location of the stream provided by dshow, enabling users to get more correct color automatically out of their device. Closes: #9271 Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: discover source color range/space/etcDiederick Niehorster2021-12-24
| | | | | | | | | | Enabled discovering a DirectShow device's color range, space, primaries, transfer characteristics and chroma location, if the device exposes that information. Sets them in the stream's codecpars. Co-authored-by: Valerii Zapodovnikov <val.zapod.vz@gmail.com> Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: add media type info to get_device_listDiederick Niehorster2021-12-24
| | | | | | | | The list returned by get_device_list now contains info about what media type(s), if any, can be provided by each device. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: list_devices: show media type(s) per deviceDiederick Niehorster2021-12-24
| | | | | | | | | | | | the list_devices option of dshow didn't indicate whether a specific device provides audio or video output. This patch iterates through all media formats of all pins exposed by the device to see what types it provides for capture, and prints this to the console for each device. Importantly, this now allows to find devices that provide both audio and video, and devices that provide neither. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: implement get_device_listDiederick Niehorster2021-12-24
| | | | | | | Needed to enable programmatic discovery of DirectShow devices Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: set no-seek flagsDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | | | avdevice/dshow is a realtime device and as such does not support seeking. Therefore, its demuxer format should define the AVFMT_NOBINSEARCH, AVFMT_NOGENSEARCH and AVFMT_NO_BYTE_SEEK flags. With these flags set, attempting to seek (with, e.g., avformat_seek_file()) correctly yields -1 (operation not permitted) instead of -22 (invalid argument). This actually seems to apply to many other devices, at least the gdigrab, v4l2, vfwcap, x11grab, fbdev, kmsgrab and android_camera devices, from reading the source. Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: implement option to use device video timestampsDiederick Niehorster2021-12-24
| | | | | | | | | | | | | | | | | | | | | The dshow avdevice ignores timestamps for video frames provided by the DirectShow device, instead using wallclock time, apparently because the implementer of this code had a device that provided unreliable timestamps. Me (and others) would like to use the device's timestamps. The new use_video_device_timestamps option for dshow device enables them to do so. Since the majority of video devices out there probably provide fine timestamps, this patch sets the default to using the device timestamps, which means best fidelity timestamps are used by default. Using the new option, the user can switch this off and revert to the old behavior, so a fall back remains available in case the device provides broken timestamps. add use_video_device_timestamps to docs. Closes: #8620 Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: prevent NULL accessDiederick Niehorster2021-12-24
| | | | | | | | | list_options true would crash when both a video and an audio device were specified as input. Crash would occur on line 784 because ctx->device_unique_name[otherDevType] would be NULL Signed-off-by: Diederick Niehorster <dcnieho@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
* avdevice/dshow: fix a unused variable warningJames Almer2021-11-13
| | | | | | | Unused if DSHOWDEBUG is not set since commit d9a9b4c877b85fea5a5bad74c3d592a756047f79. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: fix print format for some variablesJames Almer2021-11-13
| | | | | | | WAVEFORMATEX.nChannels and WAVEFORMATEX.wBitsPerSample are of type WORD, aka unsigned short. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: Fix missing PCM sample size option when it is used as the ↵Brad Isbell2021-11-05
| | | | | | | | lone option for DirectShow audio capture Signed-off-by: Brad Isbell <brad@audiopump.co> Reviewed-by: Roger Pack <rogerdpack2@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avdevice/dshow: Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device ↵Brad Isbell2021-11-05
| | | | | | | | capabilities. (Fixes #9420) Signed-off-by: Brad Isbell <brad@audiopump.co> Reviewed-by: Roger Pack <rogerdpack2@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avdevice: Constify all devicesAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/codec, allcodecs: Constify the AVCodec APIAndreas Rheinhardt2021-04-27
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet_internal: make avpriv_packet_list_* functions use an internal ↵James Almer2021-03-17
| | | | | | | | | struct The next pointer is kept at the end for backwards compatability until the major bump, when it should ideally be moved at the front. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/dshow: Add namespace prefix to the remaining global symbolsJames Almer2021-01-25
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavd/dshow: Add namespace prefix to global functionsMark Thompson2021-01-21
|
* avdevice/dshow: Fixed some minor memory leaksOliver Collyer2019-01-03
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Cosmetics: Reindent after last commit.Carl Eugen Hoyos2018-09-19
|
* lavd/dshow: Interpret negative height as bottom-down frame.Carl Eugen Hoyos2018-09-19
| | | | Fixes ticket #7436.
* avdevice: migrate to AVFormatContext->urlMarton Balint2018-01-28
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* dshow: avoid duplicate NULL check before freerogerdpack2016-06-23
| | | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* dshow: don't add two instances of same device to graphsrogerdpack2016-06-23
| | | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avdevice/dshow: Fix frame rateMichael Niedermayer2016-06-07
| | | | | | | | Fixes: Ticket5526 Tested-by: kgp700 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
| | | | | | | | | | | | | | | | * 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>
* libavdevice/dshow.c: Correct CoGetMalloc checkFearThe13372016-02-13
| | | | | | | | Current if statement would always be false due to assigning the value of S_OK which equals 0. Signed-off-by: FearThe1337 <git@fearthe1337.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-27
|
* avdevice/dshow: use AV_OPT_TYPE_BOOLClément Bœsch2015-09-08
|
* Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* dshow: add capture device save and loadMate Sebok2015-04-22
| | | | | | Signed-off-by: Mate Sebok <smfinc.org@gmail.com> Reviewed-by: Roger Pack <rogerdpack2@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* dshow: tweak loggingrogerdpack2015-01-26
| | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: crossbar dialog was frequently being displayed twice, split up option ↵rogerdpack2015-01-26
| | | | | | so it can be just once Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: add properties dialog for tv tunersrogerdpack2015-01-26
| | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: some devices only list themselves under "Video sources" butrogerdpack2015-01-23
| | | | | | | actually have both video and audio output pins, so make the audio pins accessible by video source name. Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: add options for allowing filter popup configuration dialogs to be ↵rogerdpack2015-01-23
| | | | | | presented to the user Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: introduce support for crossbar [multiple input selectable] devicesrogerdpack2015-01-23
| | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: use non deprecated apirogerdpack2015-01-23
| | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: miscellaneous tweaksrogerdpack2015-01-23
| | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* dshow: allow selecting devices by an alternative name (workaround for ↵rogerdpack2015-01-23
| | | | | | devices with symbols in them), allow specifying capture pins by name and alternative (unique) name Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
* avdevice/dshow: Remove unneeded NULL checksMichael Niedermayer2014-12-28
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avdevice/dshow: Use av_freep() to avoid leaving stale pointers in memoryMichael Niedermayer2014-12-28
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avdevice/dshow: fix build, ensure that feature enable #defines are set ↵Michael Niedermayer2014-11-25
| | | | | | | | | | | | before includes dshow_capture.h sets up various flags before including windows headers this must occur before other headers (like os_support.h) include these headers without the setup This could be fixed differently but for now this fixes building on mingw Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavd/dshow: use av_codec_get_id()James Almer2014-08-07
| | | | | | | ff_codec_get_id() is a lavf internal function Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>