~ubuntu-branches/ubuntu/oneiric/libav/oneiric

« back to all changes in this revision

Viewing changes to libavcodec/thread.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2008 Alexander Strange <astrange@ithinksw.com>
 
3
 *
 
4
 * This file is part of Libav.
 
5
 *
 
6
 * Libav is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2.1 of the License, or (at your option) any later version.
 
10
 *
 
11
 * Libav is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with Libav; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
19
 */
 
20
 
 
21
/**
 
22
 * @file
 
23
 * Multithreading support functions
 
24
 * @author Alexander Strange <astrange@ithinksw.com>
 
25
 */
 
26
 
 
27
#ifndef AVCODEC_THREAD_H
 
28
#define AVCODEC_THREAD_H
 
29
 
 
30
#include "config.h"
 
31
#include "avcodec.h"
 
32
 
 
33
/**
 
34
 * Waits for decoding threads to finish and resets internal
 
35
 * state. Called by avcodec_flush_buffers().
 
36
 *
 
37
 * @param avctx The context.
 
38
 */
 
39
void ff_thread_flush(AVCodecContext *avctx);
 
40
 
 
41
/**
 
42
 * Submits a new frame to a decoding thread.
 
43
 * Returns the next available frame in picture. *got_picture_ptr
 
44
 * will be 0 if none is available.
 
45
 *
 
46
 * Parameters are the same as avcodec_decode_video2().
 
47
 */
 
48
int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture,
 
49
                           int *got_picture_ptr, AVPacket *avpkt);
 
50
 
 
51
/**
 
52
 * If the codec defines update_thread_context(), call this
 
53
 * when they are ready for the next thread to start decoding
 
54
 * the next frame. After calling it, do not change any variables
 
55
 * read by the update_thread_context() method, or call ff_thread_get_buffer().
 
56
 *
 
57
 * @param avctx The context.
 
58
 */
 
59
void ff_thread_finish_setup(AVCodecContext *avctx);
 
60
 
 
61
/**
 
62
 * Notifies later decoding threads when part of their reference picture
 
63
 * is ready.
 
64
 * Call this when some part of the picture is finished decoding.
 
65
 * Later calls with lower values of progress have no effect.
 
66
 *
 
67
 * @param f The picture being decoded.
 
68
 * @param progress Value, in arbitrary units, of how much of the picture has decoded.
 
69
 * @param field The field being decoded, for field-picture codecs.
 
70
 * 0 for top field or frame pictures, 1 for bottom field.
 
71
 */
 
72
void ff_thread_report_progress(AVFrame *f, int progress, int field);
 
73
 
 
74
/**
 
75
 * Waits for earlier decoding threads to finish reference pictures
 
76
 * Call this before accessing some part of a picture, with a given
 
77
 * value for progress, and it will return after the responsible decoding
 
78
 * thread calls ff_thread_report_progress() with the same or
 
79
 * higher value for progress.
 
80
 *
 
81
 * @param f The picture being referenced.
 
82
 * @param progress Value, in arbitrary units, to wait for.
 
83
 * @param field The field being referenced, for field-picture codecs.
 
84
 * 0 for top field or frame pictures, 1 for bottom field.
 
85
 */
 
86
void ff_thread_await_progress(AVFrame *f, int progress, int field);
 
87
 
 
88
/**
 
89
 * Wrapper around get_buffer() for frame-multithreaded codecs.
 
90
 * Call this function instead of avctx->get_buffer(f).
 
91
 * Cannot be called after the codec has called ff_thread_finish_setup().
 
92
 *
 
93
 * @param avctx The current context.
 
94
 * @param f The frame to write into.
 
95
 */
 
96
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f);
 
97
 
 
98
/**
 
99
 * Wrapper around release_buffer() frame-for multithreaded codecs.
 
100
 * Call this function instead of avctx->release_buffer(f).
 
101
 * The AVFrame will be copied and the actual release_buffer() call
 
102
 * will be performed later. The contents of data pointed to by the
 
103
 * AVFrame should not be changed until ff_thread_get_buffer() is called
 
104
 * on it.
 
105
 *
 
106
 * @param avctx The current context.
 
107
 * @param f The picture being released.
 
108
 */
 
109
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f);
 
110
 
 
111
int ff_thread_init(AVCodecContext *s);
 
112
void ff_thread_free(AVCodecContext *s);
 
113
 
 
114
#endif /* AVCODEC_THREAD_H */