mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Remove support for libdc1394 < 2.0.
Versions >= 2.0 have been around for a very long time now.
This commit is contained in:
parent
87ababd7c5
commit
ea7e318fb2
12
configure
vendored
12
configure
vendored
@ -1076,8 +1076,6 @@ HAVE_LIST="
|
||||
isatty
|
||||
kbhit
|
||||
ldbrx
|
||||
libdc1394_1
|
||||
libdc1394_2
|
||||
llrint
|
||||
llrintf
|
||||
local_aligned_16
|
||||
@ -2911,6 +2909,7 @@ check_mathfunc truncf
|
||||
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
|
||||
enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0
|
||||
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
|
||||
enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
|
||||
enabled libdirac && require_pkg_config dirac \
|
||||
"libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
|
||||
"dirac_decoder_init dirac_encoder_init"
|
||||
@ -2942,15 +2941,6 @@ enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
|
||||
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
|
||||
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
|
||||
|
||||
# libdc1394 check
|
||||
if enabled libdc1394; then
|
||||
{ check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
|
||||
enable libdc1394_2; } ||
|
||||
{ check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
|
||||
enable libdc1394_1; } ||
|
||||
die "ERROR: No version of libdc1394 found "
|
||||
fi
|
||||
|
||||
SDL_CONFIG="${cross_prefix}sdl-config"
|
||||
if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
|
||||
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
|
||||
|
@ -25,38 +25,15 @@
|
||||
#include "libavutil/opt.h"
|
||||
#include "avdevice.h"
|
||||
|
||||
#if HAVE_LIBDC1394_2
|
||||
#include <dc1394/dc1394.h>
|
||||
#elif HAVE_LIBDC1394_1
|
||||
#include <libraw1394/raw1394.h>
|
||||
#include <libdc1394/dc1394_control.h>
|
||||
|
||||
#define DC1394_VIDEO_MODE_320x240_YUV422 MODE_320x240_YUV422
|
||||
#define DC1394_VIDEO_MODE_640x480_YUV411 MODE_640x480_YUV411
|
||||
#define DC1394_VIDEO_MODE_640x480_YUV422 MODE_640x480_YUV422
|
||||
#define DC1394_FRAMERATE_1_875 FRAMERATE_1_875
|
||||
#define DC1394_FRAMERATE_3_75 FRAMERATE_3_75
|
||||
#define DC1394_FRAMERATE_7_5 FRAMERATE_7_5
|
||||
#define DC1394_FRAMERATE_15 FRAMERATE_15
|
||||
#define DC1394_FRAMERATE_30 FRAMERATE_30
|
||||
#define DC1394_FRAMERATE_60 FRAMERATE_60
|
||||
#define DC1394_FRAMERATE_120 FRAMERATE_120
|
||||
#define DC1394_FRAMERATE_240 FRAMERATE_240
|
||||
#endif
|
||||
|
||||
#undef free
|
||||
|
||||
typedef struct dc1394_data {
|
||||
AVClass *class;
|
||||
#if HAVE_LIBDC1394_1
|
||||
raw1394handle_t handle;
|
||||
dc1394_cameracapture camera;
|
||||
int channel;
|
||||
#elif HAVE_LIBDC1394_2
|
||||
dc1394_t *d;
|
||||
dc1394camera_t *camera;
|
||||
dc1394video_frame_t *frame;
|
||||
#endif
|
||||
int current_frame;
|
||||
int fps;
|
||||
|
||||
@ -161,107 +138,7 @@ out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if HAVE_LIBDC1394_1
|
||||
static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
|
||||
{
|
||||
dc1394_data* dc1394 = c->priv_data;
|
||||
AVStream* vst;
|
||||
nodeid_t* camera_nodes;
|
||||
int res;
|
||||
struct dc1394_frame_format *fmt = NULL;
|
||||
struct dc1394_frame_rate *fps = NULL;
|
||||
|
||||
if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
|
||||
return -1;
|
||||
|
||||
#if FF_API_FORMAT_PARAMETERS
|
||||
if (ap->channel)
|
||||
dc1394->channel = ap->channel;
|
||||
#endif
|
||||
|
||||
/* Now let us prep the hardware. */
|
||||
dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
|
||||
if (!dc1394->handle) {
|
||||
av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
|
||||
goto out;
|
||||
}
|
||||
camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
|
||||
if (!camera_nodes || camera_nodes[dc1394->channel] == DC1394_NO_CAMERA) {
|
||||
av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", dc1394->channel);
|
||||
goto out_handle;
|
||||
}
|
||||
res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[dc1394->channel],
|
||||
0,
|
||||
FORMAT_VGA_NONCOMPRESSED,
|
||||
fmt->frame_size_id,
|
||||
SPEED_400,
|
||||
fps->frame_rate_id, 8, 1,
|
||||
c->filename,
|
||||
&dc1394->camera);
|
||||
dc1394_free_camera_nodes(camera_nodes);
|
||||
if (res != DC1394_SUCCESS) {
|
||||
av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
|
||||
goto out_handle;
|
||||
}
|
||||
|
||||
res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
|
||||
if (res != DC1394_SUCCESS) {
|
||||
av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
|
||||
goto out_handle_dma;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out_handle_dma:
|
||||
dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
|
||||
dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
|
||||
out_handle:
|
||||
dc1394_destroy_handle(dc1394->handle);
|
||||
out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int dc1394_v1_read_packet(AVFormatContext *c, AVPacket *pkt)
|
||||
{
|
||||
struct dc1394_data *dc1394 = c->priv_data;
|
||||
int res;
|
||||
|
||||
/* discard stale frame */
|
||||
if (dc1394->current_frame++) {
|
||||
if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
|
||||
av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
|
||||
}
|
||||
|
||||
res = dc1394_dma_single_capture(&dc1394->camera);
|
||||
|
||||
if (res == DC1394_SUCCESS) {
|
||||
dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
|
||||
dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps;
|
||||
res = dc1394->packet.size;
|
||||
} else {
|
||||
av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
|
||||
dc1394->packet.data = NULL;
|
||||
res = -1;
|
||||
}
|
||||
|
||||
*pkt = dc1394->packet;
|
||||
return res;
|
||||
}
|
||||
|
||||
static int dc1394_v1_close(AVFormatContext * context)
|
||||
{
|
||||
struct dc1394_data *dc1394 = context->priv_data;
|
||||
|
||||
dc1394_stop_iso_transmission(dc1394->handle, dc1394->camera.node);
|
||||
dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
|
||||
dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
|
||||
dc1394_destroy_handle(dc1394->handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif HAVE_LIBDC1394_2
|
||||
static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
|
||||
static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
|
||||
{
|
||||
dc1394_data* dc1394 = c->priv_data;
|
||||
dc1394camera_list_t *list;
|
||||
@ -334,7 +211,7 @@ out:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int dc1394_v2_read_packet(AVFormatContext *c, AVPacket *pkt)
|
||||
static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
|
||||
{
|
||||
struct dc1394_data *dc1394 = c->priv_data;
|
||||
int res;
|
||||
@ -360,7 +237,7 @@ static int dc1394_v2_read_packet(AVFormatContext *c, AVPacket *pkt)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int dc1394_v2_close(AVFormatContext * context)
|
||||
static int dc1394_close(AVFormatContext * context)
|
||||
{
|
||||
struct dc1394_data *dc1394 = context->priv_data;
|
||||
|
||||
@ -374,25 +251,11 @@ static int dc1394_v2_close(AVFormatContext * context)
|
||||
|
||||
AVInputFormat ff_libdc1394_demuxer = {
|
||||
.name = "libdc1394",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"),
|
||||
.long_name = NULL_IF_CONFIG_SMALL("dc1394 A/V grab"),
|
||||
.priv_data_size = sizeof(struct dc1394_data),
|
||||
.read_header = dc1394_v2_read_header,
|
||||
.read_packet = dc1394_v2_read_packet,
|
||||
.read_close = dc1394_v2_close,
|
||||
.flags = AVFMT_NOFILE,
|
||||
.read_header = dc1394_read_header,
|
||||
.read_packet = dc1394_read_packet,
|
||||
.read_close = dc1394_close,
|
||||
.flags = AVFMT_NOFILE
|
||||
.priv_class = &libdc1394_class,
|
||||
};
|
||||
|
||||
#endif
|
||||
#if HAVE_LIBDC1394_1
|
||||
AVInputFormat ff_libdc1394_demuxer = {
|
||||
.name = "libdc1394",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("dc1394 v.1 A/V grab"),
|
||||
.priv_data_size = sizeof(struct dc1394_data),
|
||||
.read_header = dc1394_v1_read_header,
|
||||
.read_packet = dc1394_v1_read_packet,
|
||||
.read_close = dc1394_v1_close,
|
||||
.flags = AVFMT_NOFILE,
|
||||
.priv_class = &libdc1394_class,
|
||||
};
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user