Browse Source

Merge remote-tracking branch 'lukaszmluki/master'

* lukaszmluki/master:
  lavd/avdevice: add device iterators
  lavd: add categories to device implementations
  lavu/log: add device categories

Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.3
Michael Niedermayer 12 years ago
parent
commit
f34cceb1fc
35 changed files with 166 additions and 3 deletions
  1. +6
    -0
      doc/APIchanges
  2. +1
    -0
      libavdevice/alsa-audio-dec.c
  3. +8
    -0
      libavdevice/alsa-audio-enc.c
  4. +46
    -0
      libavdevice/avdevice.c
  5. +36
    -0
      libavdevice/avdevice.h
  6. +1
    -0
      libavdevice/bktr.c
  7. +1
    -0
      libavdevice/caca.c
  8. +1
    -0
      libavdevice/decklink_enc_c.c
  9. +1
    -0
      libavdevice/dshow.c
  10. +1
    -0
      libavdevice/dv1394.c
  11. +1
    -0
      libavdevice/fbdev_dec.c
  12. +1
    -0
      libavdevice/fbdev_enc.c
  13. +1
    -0
      libavdevice/iec61883.c
  14. +1
    -0
      libavdevice/jack_audio.c
  15. +1
    -0
      libavdevice/lavfi.c
  16. +1
    -0
      libavdevice/libcdio.c
  17. +1
    -0
      libavdevice/libdc1394.c
  18. +2
    -1
      libavdevice/openal-dec.c
  19. +1
    -0
      libavdevice/opengl_enc.c
  20. +9
    -0
      libavdevice/oss_audio.c
  21. +1
    -0
      libavdevice/pulse_audio_dec.c
  22. +1
    -0
      libavdevice/pulse_audio_enc.c
  23. +1
    -0
      libavdevice/sdl.c
  24. +1
    -0
      libavdevice/sndio_dec.c
  25. +8
    -0
      libavdevice/sndio_enc.c
  26. +1
    -0
      libavdevice/v4l.c
  27. +1
    -0
      libavdevice/v4l2.c
  28. +8
    -0
      libavdevice/v4l2enc.c
  29. +1
    -1
      libavdevice/version.h
  30. +1
    -0
      libavdevice/vfwcap.c
  31. +1
    -0
      libavdevice/x11grab.c
  32. +1
    -0
      libavdevice/xv.c
  33. +12
    -0
      libavutil/log.c
  34. +6
    -0
      libavutil/log.h
  35. +1
    -1
      libavutil/version.h

+ 6
- 0
doc/APIchanges View File

@@ -15,6 +15,12 @@ libavutil: 2012-10-22

API changes, most recent first:

2014-xx-xx - xxxxxx - lavd 55.11.100 - avdevice.h
Add av_input_audio_device_next().
Add av_input_video_device_next().
Add av_output_audio_device_next().
Add av_output_video_device_next().

2014-xx-xx - xxxxxxx - lavu 53.05.0 - frame.h
Add av_frame_copy() for copying the frame data.



+ 1
- 0
libavdevice/alsa-audio-dec.c View File

@@ -143,6 +143,7 @@ static const AVClass alsa_demuxer_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_alsa_demuxer = {


+ 8
- 0
libavdevice/alsa-audio-enc.c View File

@@ -142,6 +142,13 @@ audio_get_output_timestamp(AVFormatContext *s1, int stream,
*dts = s->timestamp - delay;
}

static const AVClass alsa_muxer_class = {
.class_name = "ALSA muxer",
.item_name = av_default_item_name,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
};

AVOutputFormat ff_alsa_muxer = {
.name = "alsa",
.long_name = NULL_IF_CONFIG_SMALL("ALSA audio output"),
@@ -154,4 +161,5 @@ AVOutputFormat ff_alsa_muxer = {
.write_uncoded_frame = audio_write_frame,
.get_output_timestamp = audio_get_output_timestamp,
.flags = AVFMT_NOFILE,
.priv_class = &alsa_muxer_class,
};

+ 46
- 0
libavdevice/avdevice.c View File

@@ -37,6 +37,52 @@ const char * avdevice_license(void)
return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}

static void *av_device_next(void *prev, int output,
AVClassCategory c1, AVClassCategory c2)
{
const AVClass *pc;
AVClassCategory category = AV_CLASS_CATEGORY_NA;
do {
if (output) {
if (!(prev = av_oformat_next(prev)))
break;
pc = ((AVOutputFormat *)prev)->priv_class;
} else {
if (!(prev = av_iformat_next(prev)))
break;
pc = ((AVInputFormat *)prev)->priv_class;
}
if (!pc)
continue;
category = pc->category;
} while (category != c1 && category != c2);
return prev;
}

AVInputFormat *av_input_audio_device_next(AVInputFormat *d)
{
return av_device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
AV_CLASS_CATEGORY_DEVICE_INPUT);
}

AVInputFormat *av_input_video_device_next(AVInputFormat *d)
{
return av_device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
AV_CLASS_CATEGORY_DEVICE_INPUT);
}

AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d)
{
return av_device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
AV_CLASS_CATEGORY_DEVICE_OUTPUT);
}

AVOutputFormat *av_output_video_device_next(AVOutputFormat *d)
{
return av_device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
AV_CLASS_CATEGORY_DEVICE_OUTPUT);
}

int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type,
void *data, size_t data_size)
{


+ 36
- 0
libavdevice/avdevice.h View File

@@ -66,6 +66,42 @@ const char *avdevice_license(void);
*/
void avdevice_register_all(void);

/**
* Audio input devices iterator.
*
* If d is NULL, returns the first registered input audio/video device,
* if d is non-NULL, returns the next registered input audio/video device after d
* or NULL if d is the last one.
*/
AVInputFormat *av_input_audio_device_next(AVInputFormat *d);

/**
* Video input devices iterator.
*
* If d is NULL, returns the first registered input audio/video device,
* if d is non-NULL, returns the next registered input audio/video device after d
* or NULL if d is the last one.
*/
AVInputFormat *av_input_video_device_next(AVInputFormat *d);

/**
* Audio output devices iterator.
*
* If d is NULL, returns the first registered output audio/video device,
* if d is non-NULL, returns the next registered output audio/video device after d
* or NULL if d is the last one.
*/
AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d);

/**
* Video output devices iterator.
*
* If d is NULL, returns the first registered output audio/video device,
* if d is non-NULL, returns the next registered output audio/video device after d
* or NULL if d is the last one.
*/
AVOutputFormat *av_output_video_device_next(AVOutputFormat *d);

typedef struct AVDeviceRect {
int x; /**< x coordinate of top left corner */
int y; /**< y coordinate of top left corner */


+ 1
- 0
libavdevice/bktr.c View File

@@ -334,6 +334,7 @@ static const AVClass bktr_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_bktr_demuxer = {


+ 1
- 0
libavdevice/caca.c View File

@@ -224,6 +224,7 @@ static const AVClass caca_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_caca_muxer = {


+ 1
- 0
libavdevice/decklink_enc_c.c View File

@@ -38,6 +38,7 @@ static const AVClass decklink_muxer_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_decklink_muxer = {


+ 1
- 0
libavdevice/dshow.c View File

@@ -1081,6 +1081,7 @@ static const AVClass dshow_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_dshow_demuxer = {


+ 1
- 0
libavdevice/dv1394.c View File

@@ -224,6 +224,7 @@ static const AVClass dv1394_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_dv1394_demuxer = {


+ 1
- 0
libavdevice/fbdev_dec.c View File

@@ -217,6 +217,7 @@ static const AVClass fbdev_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_fbdev_demuxer = {


+ 1
- 0
libavdevice/fbdev_enc.c View File

@@ -196,6 +196,7 @@ static const AVClass fbdev_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_fbdev_muxer = {


+ 1
- 0
libavdevice/iec61883.c View File

@@ -483,6 +483,7 @@ static const AVClass iec61883_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_iec61883_demuxer = {


+ 1
- 0
libavdevice/jack_audio.c View File

@@ -333,6 +333,7 @@ static const AVClass jack_indev_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_jack_demuxer = {


+ 1
- 0
libavdevice/lavfi.c View File

@@ -425,6 +425,7 @@ static const AVClass lavfi_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_INPUT,
};

AVInputFormat ff_lavfi_demuxer = {


+ 1
- 0
libavdevice/libcdio.c View File

@@ -177,6 +177,7 @@ static const AVClass libcdio_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_libcdio_demuxer = {


+ 1
- 0
libavdevice/libdc1394.c View File

@@ -112,6 +112,7 @@ static const AVClass libdc1394_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};




+ 2
- 1
libavdevice/openal-dec.c View File

@@ -236,7 +236,8 @@ static const AVClass class = {
.class_name = "openal",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_openal_demuxer = {


+ 1
- 0
libavdevice/opengl_enc.c View File

@@ -1272,6 +1272,7 @@ static const AVClass opengl_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_opengl_muxer = {


+ 9
- 0
libavdevice/oss_audio.c View File

@@ -296,6 +296,7 @@ static const AVClass oss_demuxer_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_oss_demuxer = {
@@ -311,6 +312,13 @@ AVInputFormat ff_oss_demuxer = {
#endif

#if CONFIG_OSS_OUTDEV
static const AVClass oss_muxer_class = {
.class_name = "OSS muxer",
.item_name = av_default_item_name,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
};

AVOutputFormat ff_oss_muxer = {
.name = "oss",
.long_name = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) playback"),
@@ -324,5 +332,6 @@ AVOutputFormat ff_oss_muxer = {
.write_packet = audio_write_packet,
.write_trailer = audio_write_trailer,
.flags = AVFMT_NOFILE,
.priv_class = &oss_muxer_class,
};
#endif

+ 1
- 0
libavdevice/pulse_audio_dec.c View File

@@ -166,6 +166,7 @@ static const AVClass pulse_demuxer_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_pulse_demuxer = {


+ 1
- 0
libavdevice/pulse_audio_enc.c View File

@@ -167,6 +167,7 @@ static const AVClass pulse_muxer_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
};

AVOutputFormat ff_pulse_muxer = {


+ 1
- 0
libavdevice/sdl.c View File

@@ -358,6 +358,7 @@ static const AVClass sdl_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_sdl_muxer = {


+ 1
- 0
libavdevice/sndio_dec.c View File

@@ -104,6 +104,7 @@ static const AVClass sndio_demuxer_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
};

AVInputFormat ff_sndio_demuxer = {


+ 8
- 0
libavdevice/sndio_enc.c View File

@@ -76,6 +76,13 @@ static int audio_write_trailer(AVFormatContext *s1)
return 0;
}

static const AVClass sndio_muxer_class = {
.class_name = "sndio outdev",
.item_name = av_default_item_name,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
};

AVOutputFormat ff_sndio_muxer = {
.name = "sndio",
.long_name = NULL_IF_CONFIG_SMALL("sndio audio playback"),
@@ -89,4 +96,5 @@ AVOutputFormat ff_sndio_muxer = {
.write_packet = audio_write_packet,
.write_trailer = audio_write_trailer,
.flags = AVFMT_NOFILE,
.priv_class = &sndio_muxer_class,
};

+ 1
- 0
libavdevice/v4l.c View File

@@ -348,6 +348,7 @@ static const AVClass v4l_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_v4l_demuxer = {


+ 1
- 0
libavdevice/v4l2.c View File

@@ -1023,6 +1023,7 @@ static const AVClass v4l2_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

AVInputFormat ff_v4l2_demuxer = {


+ 8
- 0
libavdevice/v4l2enc.c View File

@@ -97,6 +97,13 @@ static int write_trailer(AVFormatContext *s1)
return 0;
}

static const AVClass v4l2_class = {
.class_name = "V4L2 outdev",
.item_name = av_default_item_name,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_v4l2_muxer = {
.name = "v4l2",
.long_name = NULL_IF_CONFIG_SMALL("Video4Linux2 output device"),
@@ -107,4 +114,5 @@ AVOutputFormat ff_v4l2_muxer = {
.write_packet = write_packet,
.write_trailer = write_trailer,
.flags = AVFMT_NOFILE,
.priv_class = &v4l2_class,
};

+ 1
- 1
libavdevice/version.h View File

@@ -28,7 +28,7 @@
#include "libavutil/version.h"

#define LIBAVDEVICE_VERSION_MAJOR 55
#define LIBAVDEVICE_VERSION_MINOR 10
#define LIBAVDEVICE_VERSION_MINOR 11
#define LIBAVDEVICE_VERSION_MICRO 100

#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \


+ 1
- 0
libavdevice/vfwcap.c View File

@@ -469,6 +469,7 @@ static const AVClass vfw_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
};

AVInputFormat ff_vfwcap_demuxer = {


+ 1
- 0
libavdevice/x11grab.c View File

@@ -633,6 +633,7 @@ static const AVClass x11_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};

/** x11 grabber device demuxer declaration */


+ 1
- 0
libavdevice/xv.c View File

@@ -255,6 +255,7 @@ static const AVClass xv_class = {
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
};

AVOutputFormat ff_xv_muxer = {


+ 12
- 0
libavutil/log.c View File

@@ -71,6 +71,12 @@ static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
[16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 9,
[16+AV_CLASS_CATEGORY_SWSCALER ] = 7,
[16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 7,
[16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 13,
[16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 5,
[16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 13,
[16+AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT ] = 5,
[16+AV_CLASS_CATEGORY_DEVICE_OUTPUT ] = 13,
[16+AV_CLASS_CATEGORY_DEVICE_INPUT ] = 5,
};

static int16_t background, attr_orig;
@@ -96,6 +102,12 @@ static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
[16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 192 << 8 | 0x14,
[16+AV_CLASS_CATEGORY_SWSCALER ] = 153 << 8 | 0x14,
[16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 147 << 8 | 0x14,
[16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 213 << 8 | 0x15,
[16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 207 << 8 | 0x05,
[16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 213 << 8 | 0x15,
[16+AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT ] = 207 << 8 | 0x05,
[16+AV_CLASS_CATEGORY_DEVICE_OUTPUT ] = 213 << 8 | 0x15,
[16+AV_CLASS_CATEGORY_DEVICE_INPUT ] = 207 << 8 | 0x05,
};

#endif


+ 6
- 0
libavutil/log.h View File

@@ -37,6 +37,12 @@ typedef enum {
AV_CLASS_CATEGORY_BITSTREAM_FILTER,
AV_CLASS_CATEGORY_SWSCALER,
AV_CLASS_CATEGORY_SWRESAMPLER,
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40,
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT,
AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
AV_CLASS_CATEGORY_DEVICE_OUTPUT,
AV_CLASS_CATEGORY_DEVICE_INPUT,
AV_CLASS_CATEGORY_NB, ///< not part of ABI/API
}AVClassCategory;



+ 1
- 1
libavutil/version.h View File

@@ -57,7 +57,7 @@

#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 66
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_MICRO 101

#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \


Loading…
Cancel
Save