FFmpeg
alldevices.c
Go to the documentation of this file.
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"
23 #include "libavformat/demux.h"
24 #include "libavformat/internal.h"
25 #include "libavformat/mux.h"
26 #include "avdevice.h"
27 
29 /* devices */
30 extern const FFInputFormat ff_alsa_demuxer;
31 extern const FFOutputFormat ff_alsa_muxer;
35 extern const FFInputFormat ff_bktr_demuxer;
36 extern const FFOutputFormat ff_caca_muxer;
39 extern const FFInputFormat ff_dshow_demuxer;
40 extern const FFInputFormat ff_fbdev_demuxer;
41 extern const FFOutputFormat ff_fbdev_muxer;
44 extern const FFInputFormat ff_jack_demuxer;
46 extern const FFInputFormat ff_lavfi_demuxer;
47 extern const FFInputFormat ff_openal_demuxer;
48 extern const FFOutputFormat ff_opengl_muxer;
49 extern const FFInputFormat ff_oss_demuxer;
50 extern const FFOutputFormat ff_oss_muxer;
51 extern const FFInputFormat ff_pulse_demuxer;
52 extern const FFOutputFormat ff_pulse_muxer;
53 extern const FFOutputFormat ff_sdl2_muxer;
54 extern const FFInputFormat ff_sndio_demuxer;
55 extern const FFOutputFormat ff_sndio_muxer;
56 extern const FFInputFormat ff_v4l2_demuxer;
57 extern const FFOutputFormat ff_v4l2_muxer;
58 extern const FFInputFormat ff_vfwcap_demuxer;
60 extern const FFOutputFormat ff_xv_muxer;
61 
62 /* external libraries */
66 
67 #include "libavdevice/outdev_list.c"
68 #include "libavdevice/indev_list.c"
69 
71 {
72  avpriv_register_devices(outdev_list, indev_list);
73 }
74 
75 static av_cold const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
76 {
77  const AVClass *pc;
80  const FFInputFormat *fmt = NULL;
81  int i = 0;
82 
83  while (prev && (fmt = indev_list[i])) {
84  i++;
85  if (prev == &fmt->p)
86  break;
87  }
88 
89  do {
90  fmt = indev_list[i++];
91  if (!fmt)
92  break;
93  pc = fmt->p.priv_class;
94  if (!pc)
95  continue;
96  category = pc->category;
97  } while (category != c1 && category != c2);
98  return fmt;
99 }
100 
101 static av_cold const void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
102 {
103  const AVClass *pc;
106  const FFOutputFormat *fmt = NULL;
107  int i = 0;
108 
109  while (prev && (fmt = outdev_list[i])) {
110  i++;
111  if (prev == &fmt->p)
112  break;
113  }
114 
115  do {
116  fmt = outdev_list[i++];
117  if (!fmt)
118  break;
119  pc = fmt->p.priv_class;
120  if (!pc)
121  continue;
122  category = pc->category;
123  } while (category != c1 && category != c2);
124  return fmt;
125 }
126 
128 {
130 }
131 
133 {
135 }
136 
138 {
140 }
141 
143 {
145 }
FF_VISIBILITY_PUSH_HIDDEN
#define FF_VISIBILITY_PUSH_HIDDEN
Definition: attributes_internal.h:30
ff_pulse_muxer
const FFOutputFormat ff_pulse_muxer
Definition: pulse_audio_enc.c:786
AV_CLASS_CATEGORY_NA
@ AV_CLASS_CATEGORY_NA
Definition: log.h:29
ff_decklink_muxer
const FFOutputFormat ff_decklink_muxer
Definition: decklink_enc_c.c:76
ff_sndio_demuxer
const FFInputFormat ff_sndio_demuxer
Definition: sndio_dec.c:113
category
category
Definition: openal-dec.c:249
c1
static const uint64_t c1
Definition: murmur3.c:52
FFOutputFormat::p
AVOutputFormat p
The public AVOutputFormat.
Definition: mux.h:65
av_input_audio_device_next
const av_cold AVInputFormat * av_input_audio_device_next(const AVInputFormat *d)
Audio input devices iterator.
Definition: alldevices.c:127
ff_xv_muxer
const FFOutputFormat ff_xv_muxer
Definition: xv.c:381
ff_vfwcap_demuxer
const FFInputFormat ff_vfwcap_demuxer
Definition: vfwcap.c:487
next_output
static const av_cold void * next_output(const AVOutputFormat *prev, AVClassCategory c2)
Definition: alldevices.c:101
ff_gdigrab_demuxer
const FFInputFormat ff_gdigrab_demuxer
gdi grabber device demuxer declaration
Definition: gdigrab.c:682
AV_CLASS_CATEGORY_DEVICE_INPUT
@ AV_CLASS_CATEGORY_DEVICE_INPUT
Definition: log.h:45
ff_bktr_demuxer
const FFInputFormat ff_bktr_demuxer
Definition: bktr.c:357
ff_oss_muxer
const FFOutputFormat ff_oss_muxer
Definition: oss_enc.c:98
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT
Definition: log.h:43
ff_lavfi_demuxer
const FFInputFormat ff_lavfi_demuxer
Definition: lavfi.c:503
AVInputFormat
Definition: avformat.h:548
av_cold
#define av_cold
Definition: attributes.h:90
ff_dshow_demuxer
const FFInputFormat ff_dshow_demuxer
Definition: dshow.c:1931
ff_xcbgrab_demuxer
const FFInputFormat ff_xcbgrab_demuxer
Definition: xcbgrab.c:908
attributes_internal.h
ff_opengl_muxer
const FFOutputFormat ff_opengl_muxer
Definition: opengl_enc.c:1312
ff_sdl2_muxer
const FFOutputFormat ff_sdl2_muxer
Definition: sdl2.c:366
ff_v4l2_muxer
const FFOutputFormat ff_v4l2_muxer
Definition: v4l2enc.c:115
ff_sndio_muxer
const FFOutputFormat ff_sndio_muxer
Definition: sndio_enc.c:90
ff_iec61883_demuxer
const FFInputFormat ff_iec61883_demuxer
Definition: iec61883.c:507
internal.h
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
Definition: log.h:40
FFOutputFormat
Definition: mux.h:61
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:41
AVOutputFormat::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:538
ff_fbdev_muxer
const FFOutputFormat ff_fbdev_muxer
Definition: fbdev_enc.c:210
ff_alsa_muxer
const FFOutputFormat ff_alsa_muxer
Definition: alsa_enc.c:162
AVClass::category
AVClassCategory category
Category used for visualization (like color).
Definition: log.h:132
av_output_video_device_next
const av_cold AVOutputFormat * av_output_video_device_next(const AVOutputFormat *d)
Video output devices iterator.
Definition: alldevices.c:142
next_input
static const av_cold void * next_input(const AVInputFormat *prev, AVClassCategory c2)
Definition: alldevices.c:75
avdevice.h
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
attributes.h
avpriv_register_devices
void avpriv_register_devices(const FFOutputFormat *const o[], const FFInputFormat *const i[])
Definition: allformats.c:627
FF_VISIBILITY_POP_HIDDEN
#define FF_VISIBILITY_POP_HIDDEN
Definition: attributes_internal.h:31
AVClassCategory
AVClassCategory
Definition: log.h:28
AVOutputFormat
Definition: avformat.h:509
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT
Definition: log.h:42
demux.h
ff_caca_muxer
const FFOutputFormat ff_caca_muxer
Definition: caca.c:225
c2
static const uint64_t c2
Definition: murmur3.c:53
ff_fbdev_demuxer
const FFInputFormat ff_fbdev_demuxer
Definition: fbdev_dec.c:236
ff_libdc1394_demuxer
const FFInputFormat ff_libdc1394_demuxer
Definition: libdc1394.c:292
ff_v4l2_demuxer
const FFInputFormat ff_v4l2_demuxer
Definition: v4l2.c:1175
ff_libcdio_demuxer
const FFInputFormat ff_libcdio_demuxer
Definition: libcdio.c:183
AV_CLASS_CATEGORY_DEVICE_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_OUTPUT
Definition: log.h:44
ff_alsa_demuxer
const FF_VISIBILITY_PUSH_HIDDEN FFInputFormat ff_alsa_demuxer
Definition: alsa_dec.c:161
ff_openal_demuxer
const FFInputFormat ff_openal_demuxer
Definition: openal-dec.c:252
av_output_audio_device_next
const av_cold AVOutputFormat * av_output_audio_device_next(const AVOutputFormat *d)
Audio output devices iterator.
Definition: alldevices.c:137
ff_oss_demuxer
const FFInputFormat ff_oss_demuxer
Definition: oss_dec.c:134
ff_decklink_demuxer
const FFInputFormat ff_decklink_demuxer
Definition: decklink_dec_c.c:119
ff_avfoundation_demuxer
const FFInputFormat ff_avfoundation_demuxer
Definition: avfoundation.m:1298
FFInputFormat
Definition: demux.h:37
ff_kmsgrab_demuxer
const FFInputFormat ff_kmsgrab_demuxer
Definition: kmsgrab.c:713
av_input_video_device_next
const av_cold AVInputFormat * av_input_video_device_next(const AVInputFormat *d)
Video input devices iterator.
Definition: alldevices.c:132
ff_jack_demuxer
const FFInputFormat ff_jack_demuxer
Definition: jack.c:344
ff_android_camera_demuxer
const FFInputFormat ff_android_camera_demuxer
Definition: android_camera.c:865
ff_audiotoolbox_muxer
const FFOutputFormat ff_audiotoolbox_muxer
Definition: audiotoolbox.m:303
ff_pulse_demuxer
const FFInputFormat ff_pulse_demuxer
Definition: pulse_audio_dec.c:397
AVInputFormat::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:578
avdevice_register_all
FF_VISIBILITY_POP_HIDDEN av_cold void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
Definition: alldevices.c:70
mux.h