| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Register all the grabbing devices. | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include "libavutil/attributes.h" | ||
| 22 | #include "libavutil/attributes_internal.h" | ||
| 23 | #include "libavformat/avformat_internal.h" | ||
| 24 | #include "libavformat/demux.h" | ||
| 25 | #include "libavformat/mux.h" | ||
| 26 | #include "avdevice.h" | ||
| 27 | |||
| 28 | FF_VISIBILITY_PUSH_HIDDEN | ||
| 29 | /* devices */ | ||
| 30 | extern const FFInputFormat ff_alsa_demuxer; | ||
| 31 | extern const FFOutputFormat ff_alsa_muxer; | ||
| 32 | extern const FFInputFormat ff_android_camera_demuxer; | ||
| 33 | extern const FFOutputFormat ff_audiotoolbox_muxer; | ||
| 34 | extern const FFInputFormat ff_avfoundation_demuxer; | ||
| 35 | extern const FFOutputFormat ff_caca_muxer; | ||
| 36 | extern const FFInputFormat ff_decklink_demuxer; | ||
| 37 | extern const FFOutputFormat ff_decklink_muxer; | ||
| 38 | extern const FFInputFormat ff_dshow_demuxer; | ||
| 39 | extern const FFInputFormat ff_fbdev_demuxer; | ||
| 40 | extern const FFOutputFormat ff_fbdev_muxer; | ||
| 41 | extern const FFInputFormat ff_gdigrab_demuxer; | ||
| 42 | extern const FFInputFormat ff_iec61883_demuxer; | ||
| 43 | extern const FFInputFormat ff_jack_demuxer; | ||
| 44 | extern const FFInputFormat ff_kmsgrab_demuxer; | ||
| 45 | extern const FFInputFormat ff_lavfi_demuxer; | ||
| 46 | extern const FFInputFormat ff_openal_demuxer; | ||
| 47 | extern const FFInputFormat ff_oss_demuxer; | ||
| 48 | extern const FFOutputFormat ff_oss_muxer; | ||
| 49 | extern const FFInputFormat ff_pulse_demuxer; | ||
| 50 | extern const FFOutputFormat ff_pulse_muxer; | ||
| 51 | extern const FFInputFormat ff_sndio_demuxer; | ||
| 52 | extern const FFOutputFormat ff_sndio_muxer; | ||
| 53 | extern const FFInputFormat ff_v4l2_demuxer; | ||
| 54 | extern const FFOutputFormat ff_v4l2_muxer; | ||
| 55 | extern const FFInputFormat ff_vfwcap_demuxer; | ||
| 56 | extern const FFInputFormat ff_xcbgrab_demuxer; | ||
| 57 | extern const FFOutputFormat ff_xv_muxer; | ||
| 58 | |||
| 59 | /* external libraries */ | ||
| 60 | extern const FFInputFormat ff_libcdio_demuxer; | ||
| 61 | extern const FFInputFormat ff_libdc1394_demuxer; | ||
| 62 | FF_VISIBILITY_POP_HIDDEN | ||
| 63 | |||
| 64 | #include "libavdevice/outdev_list.c" | ||
| 65 | #include "libavdevice/indev_list.c" | ||
| 66 | |||
| 67 | 8738 | av_cold void avdevice_register_all(void) | |
| 68 | { | ||
| 69 | 8738 | avpriv_register_devices(outdev_list, indev_list); | |
| 70 | 8738 | } | |
| 71 | |||
| 72 | 10 | static av_cold const void *next_input(const AVInputFormat *prev, AVClassCategory c2) | |
| 73 | { | ||
| 74 | const AVClass *pc; | ||
| 75 | 10 | const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT; | |
| 76 | 10 | AVClassCategory category = AV_CLASS_CATEGORY_NA; | |
| 77 | 10 | const FFInputFormat *fmt = NULL; | |
| 78 | 10 | int i = 0; | |
| 79 | |||
| 80 |
3/4✓ Branch 0 taken 32 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 32 times.
✗ Branch 3 not taken.
|
34 | while (prev && (fmt = indev_list[i])) { |
| 81 | 32 | i++; | |
| 82 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 24 times.
|
32 | if (prev == &fmt->p) |
| 83 | 8 | break; | |
| 84 | } | ||
| 85 | |||
| 86 | do { | ||
| 87 | 16 | fmt = indev_list[i++]; | |
| 88 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 14 times.
|
16 | if (!fmt) |
| 89 | 2 | break; | |
| 90 | 14 | pc = fmt->p.priv_class; | |
| 91 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if (!pc) |
| 92 | ✗ | continue; | |
| 93 | 14 | category = pc->category; | |
| 94 |
4/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 6 times.
|
14 | } while (category != c1 && category != c2); |
| 95 | 10 | return fmt; | |
| 96 | } | ||
| 97 | |||
| 98 | ✗ | static av_cold const void *next_output(const AVOutputFormat *prev, AVClassCategory c2) | |
| 99 | { | ||
| 100 | const AVClass *pc; | ||
| 101 | ✗ | const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_OUTPUT; | |
| 102 | ✗ | AVClassCategory category = AV_CLASS_CATEGORY_NA; | |
| 103 | ✗ | const FFOutputFormat *fmt = NULL; | |
| 104 | ✗ | int i = 0; | |
| 105 | |||
| 106 | ✗ | while (prev && (fmt = outdev_list[i])) { | |
| 107 | ✗ | i++; | |
| 108 | ✗ | if (prev == &fmt->p) | |
| 109 | ✗ | break; | |
| 110 | } | ||
| 111 | |||
| 112 | do { | ||
| 113 | ✗ | fmt = outdev_list[i++]; | |
| 114 | ✗ | if (!fmt) | |
| 115 | ✗ | break; | |
| 116 | ✗ | pc = fmt->p.priv_class; | |
| 117 | ✗ | if (!pc) | |
| 118 | ✗ | continue; | |
| 119 | ✗ | category = pc->category; | |
| 120 | ✗ | } while (category != c1 && category != c2); | |
| 121 | ✗ | return fmt; | |
| 122 | } | ||
| 123 | |||
| 124 | 4 | av_cold const AVInputFormat *av_input_audio_device_next(const AVInputFormat *d) | |
| 125 | { | ||
| 126 | 4 | return next_input(d, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT); | |
| 127 | } | ||
| 128 | |||
| 129 | 6 | av_cold const AVInputFormat *av_input_video_device_next(const AVInputFormat *d) | |
| 130 | { | ||
| 131 | 6 | return next_input(d, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT); | |
| 132 | } | ||
| 133 | |||
| 134 | ✗ | av_cold const AVOutputFormat *av_output_audio_device_next(const AVOutputFormat *d) | |
| 135 | { | ||
| 136 | ✗ | return next_output(d, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT); | |
| 137 | } | ||
| 138 | |||
| 139 | ✗ | av_cold const AVOutputFormat *av_output_video_device_next(const AVOutputFormat *d) | |
| 140 | { | ||
| 141 | ✗ | return next_output(d, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT); | |
| 142 | } | ||
| 143 |