Le 2015-12-20 21:59, Anton Khirnov a écrit :
diff --git a/libavutil/hwframe.h b/libavutil/hwframe.h
new file mode 100644
index 0000000..3e33aa5
--- /dev/null
+++ b/libavutil/hwframe.h
@@ -0,0 +1,97 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later
version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+ */
+
+#ifndef AVUTIL_HWFRAME_H
+#define AVUTIL_HWFRAME_H
+
+#include "buffer.h"
+#include "frame.h"
+#include "log.h"
+#include "pixfmt.h"
+
+typedef struct AVHWFramesInternal AVHWFramesInternal;
+
+/**
+ * This struct aggregates any state necessary for handling
"hardware" frames
+ * (i.e. those with data not located in normal system memory).
+ *
+ * This struct is reference-counted with the AVBuffer mechanism. The
+ * av_hwframe_ctx_alloc() constructor yields a reference, whose data
field
+ * points to the actual AVHWFramesContext struct.
+ */
+typedef struct AVHWFramesContext {
+ /**
+ * A class for logging.
+ */
+ const AVClass *av_class;
+
+ /**
+ * The pixel format identifying the underlying HW surface type.
+ *
+ * Must be a hwaccel format, i.e. the corresponding descriptor
must have the
+ * AV_PIX_FMT_FLAG_HWACCEL flag set.
+ *
+ * This field is set when this struct is allocated and never
changed
+ * afterwards.
+ */
+ enum AVPixelFormat format;
+
+ /**
+ * The format-specific data, allocated and freed automatically
along with
+ * this context.
+ *
+ * Should be cast by the user to the format-specific context
defined in the
+ * corresponding header (hwframe_*.h) and filled as described in
the
+ * documentation before creating any frames using this context.
+ *
+ * After any frames using this context are created, the contents
of this
+ * struct should not be modified by the caller.
+ */
+ void *hwctx;
+
+ /**
+ * Private data used internally by libavutil. Must not be
accessed in any
+ * way by the caller.
+ */
+ AVHWFramesInternal *internal;
+
+ /**
+ * This field may be set by the caller immediately after
allocating this
+ * context.
+ *
+ * If non-NULL, this callback will be called when the last
reference to
+ * this context is unreferences, immediately before it is freed.
Nit: unreferenced.
+ */
+ void (*free)(struct AVHWFramesContext *ctx);
+
+ /**
+ * Arbitrary user data, to be used e.g. by the free() callback.
+ */
+ void *user_opaque;
+} AVHWFramesContext;
+
+AVBufferRef *av_hwframe_ctx_alloc(enum AVPixelFormat format);
+
+int av_hwframe_ctx_init(AVBufferRef *ref);
+
+int av_hwframe_get_target_formats(const AVFrame *frame,
+ enum AVPixelFormat **formats);
+
+int av_hwframe_retrieve_data(AVFrame *dst, const AVFrame *src);
+
+#endif /* AVUTIL_HWFRAME_H */
--
Rémi Denis-Courmont
http://www.remlab.net/
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel