]> git.sesse.net Git - ffmpeg/blobdiff - libavdevice/libdc1394.c
Remove pointless #undefs of previously forbidden functions.
[ffmpeg] / libavdevice / libdc1394.c
index bca014fe3c9213547e9ee42a9e93d3a9a841add9..f030e3e31d2f5070898a5156946f903730ebfe06 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "config.h"
 #include "libavformat/avformat.h"
+#include "libavformat/internal.h"
 #include "libavutil/log.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
@@ -47,8 +48,6 @@
 #define DC1394_FRAMERATE_240   FRAMERATE_240
 #endif
 
-#undef free
-
 typedef struct dc1394_data {
     AVClass *class;
 #if HAVE_LIBDC1394_1
@@ -72,12 +71,12 @@ typedef struct dc1394_data {
 struct dc1394_frame_format {
     int width;
     int height;
-    enum PixelFormat pix_fmt;
+    enum AVPixelFormat pix_fmt;
     int frame_size_id;
 } dc1394_frame_formats[] = {
-    { 320, 240, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 },
-    { 640, 480, PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
-    { 640, 480, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 },
+    { 320, 240, AV_PIX_FMT_UYVY422,   DC1394_VIDEO_MODE_320x240_YUV422 },
+    { 640, 480, AV_PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
+    { 640, 480, AV_PIX_FMT_UYVY422,   DC1394_VIDEO_MODE_640x480_YUV422 },
     { 0, 0, 0, 0 } /* gotta be the last one */
 };
 
@@ -100,7 +99,7 @@ struct dc1394_frame_rate {
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
 #if HAVE_LIBDC1394_1
-    { "channel", "", offsetof(dc1394_data, channel), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
+    { "channel", "", offsetof(dc1394_data, channel), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
 #endif
     { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "qvga"}, 0, 0, DEC },
     { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = "uyvy422"}, 0, 0, DEC },
@@ -116,19 +115,19 @@ static const AVClass libdc1394_class = {
 };
 
 
-static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
+static inline int dc1394_read_common(AVFormatContext *c,
                                      struct dc1394_frame_format **select_fmt, struct dc1394_frame_rate **select_fps)
 {
     dc1394_data* dc1394 = c->priv_data;
     AVStream* vst;
     struct dc1394_frame_format *fmt;
     struct dc1394_frame_rate *fps;
-    enum PixelFormat pix_fmt;
+    enum AVPixelFormat pix_fmt;
     int width, height;
     AVRational framerate;
     int ret = 0;
 
-    if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == PIX_FMT_NONE) {
+    if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == AV_PIX_FMT_NONE) {
         av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", dc1394->pixel_format);
         ret = AVERROR(EINVAL);
         goto out;
@@ -165,9 +164,9 @@ static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
         ret = AVERROR(ENOMEM);
         goto out;
     }
-    av_set_pts_info(vst, 64, 1, 1000);
+    avpriv_set_pts_info(vst, 64, 1, 1000);
     vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id = CODEC_ID_RAWVIDEO;
+    vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
     vst->codec->time_base.den = framerate.num;
     vst->codec->time_base.num = framerate.den;
     vst->codec->width = fmt->width;
@@ -190,7 +189,7 @@ out:
 }
 
 #if HAVE_LIBDC1394_1
-static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
+static int dc1394_v1_read_header(AVFormatContext *c)
 {
     dc1394_data* dc1394 = c->priv_data;
     AVStream* vst;
@@ -199,7 +198,7 @@ static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
     struct dc1394_frame_format *fmt = NULL;
     struct dc1394_frame_rate *fps = NULL;
 
-    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
+    if (dc1394_read_common(c, &fmt, &fps) != 0)
         return -1;
 
     /* Now let us prep the hardware. */
@@ -284,7 +283,7 @@ static int dc1394_v1_close(AVFormatContext * context)
 }
 
 #elif HAVE_LIBDC1394_2
-static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
+static int dc1394_v2_read_header(AVFormatContext *c)
 {
     dc1394_data* dc1394 = c->priv_data;
     dc1394camera_list_t *list;
@@ -292,7 +291,7 @@ static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
     struct dc1394_frame_format *fmt = NULL;
     struct dc1394_frame_rate *fps = NULL;
 
-    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
+    if (dc1394_read_common(c, &fmt, &fps) != 0)
        return -1;
 
     /* Now let us prep the hardware. */
@@ -370,8 +369,8 @@ static int dc1394_v2_read_packet(AVFormatContext *c, AVPacket *pkt)
 
     res = dc1394_capture_dequeue(dc1394->camera, DC1394_CAPTURE_POLICY_WAIT, &dc1394->frame);
     if (res == DC1394_SUCCESS) {
-        dc1394->packet.data = (uint8_t *)(dc1394->frame->image);
-        dc1394->packet.pts = (dc1394->current_frame  * 1000000) / (dc1394->frame_rate);
+        dc1394->packet.data = (uint8_t *) dc1394->frame->image;
+        dc1394->packet.pts  = dc1394->current_frame * 1000000 / dc1394->frame_rate;
         res = dc1394->frame->image_bytes;
     } else {
         av_log(c, AV_LOG_ERROR, "DMA capture failed\n");