[FFmpeg-soc] [PATCH 4/9] Add thread.h

Alexander Strange astrange at ithinksw.com
Thu May 29 05:44:50 CEST 2008


---
  libavcodec/thread.h |   68 ++++++++++++++++++++++++++++++++++++++++++ 
+++++++++
  1 files changed, 68 insertions(+), 0 deletions(-)
  create mode 100644 libavcodec/thread.h

diff --git a/libavcodec/thread.h b/libavcodec/thread.h
new file mode 100644
index 0000000..7b78e13
--- /dev/null
+++ b/libavcodec/thread.h
@@ -0,0 +1,68 @@
+/*
+ * Multithreading support
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg 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.
+ *
+ * FFmpeg 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
02110-1301 USA
+ */
+
+#ifndef FFMPEG_THREAD_H
+#define FFMPEG_THREAD_H
+#include "config.h"
+#include "avcodec.h"
+
+#ifdef ENABLE_PTHREADS
+int ff_thread_init(AVCodecContext *, int thread_count);
+void ff_thread_free(AVCodecContext *);
+
+int ff_frame_thread_init(AVCodecContext *);
+void ff_frame_thread_free(AVCodecContext *);
+
+int ff_decode_frame_threaded(AVCodecContext *avctx,
+                        void *data, int *data_size,
+                        const uint8_t *buf, int buf_size);
+
+void ff_report_predecode_done(AVCodecContext *);
+void ff_report_decode_progress(AVFrame *, int progress);
+void ff_await_decode_progress(AVFrame *, int progress);
+
+int ff_mt_get_buffer(AVCodecContext *, AVFrame *f);
+void ff_mt_release_buffer(AVFrame *);
+#else
+static int ff_thread_init(AVCodecContext *) {return 0;}
+static void ff_thread_free(AVCodecContext *) {}
+
+static int ff_frame_thread_init(AVCodecContext *) {return 0;}
+static void ff_frame_thread_free(AVCodecContext *) {}
+
+#define ff_report_predecode_done(c)  {}
+#define ff_report_decode_progress(c) {}
+#define ff_await_decode_progress(c)  {}
+
+static int ff_mt_get_buffer(AVCodecContext *c, AVFrame *f)
+{
+    int ret = c->get_buffer(c, f);
+
+    f->avctx = c;
+    return ret;
+}
+
+static void ff_mt_release_buffer(AVFrame *f)
+{
+    f->avctx->release_buffer(f->avctx, f);
+}
+#endif
+
+#endif /* FFMPEG_FRAMEPTHREAD_H */
-- 
1.5.5.1





More information about the FFmpeg-soc mailing list