Mercurial > libavcodec.hg
annotate libdirac_libschro.h @ 11636:a9e758788a12 libavcodec
vp3: More buffer length checks
.5% slower to fix some crashes on invalid streams
author | conrad |
---|---|
date | Fri, 16 Apr 2010 12:21:44 +0000 |
parents | 965220ebc611 |
children | 7dd2a45249a9 |
rev | line source |
---|---|
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
1 /* |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
2 * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
3 * |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
4 * This file is part of FFmpeg. |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
5 * |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
10 * |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
15 * |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
19 */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
20 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
21 /** |
8718
e9d9d946f213
Use full internal pathname in doxygen @file directives.
diego
parents:
7760
diff
changeset
|
22 * @file libavcodec/libdirac_libschro.h |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
23 * data structures common to libdirac and libschroedinger |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
24 */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
25 |
7760 | 26 #ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H |
27 #define AVCODEC_LIBDIRAC_LIBSCHRO_H | |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
28 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
29 #include "avcodec.h" |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
30 |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
31 typedef struct { |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
32 uint16_t width; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
33 uint16_t height; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
34 uint16_t frame_rate_num; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
35 uint16_t frame_rate_denom; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
36 } FfmpegDiracSchroVideoFormatInfo; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
37 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
38 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
39 * Returns the index into the Dirac Schro common video format info table |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
40 */ |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
41 unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext); |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
42 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
43 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
44 * contains a single encoded frame returned from Dirac or Schroedinger |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
45 */ |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
46 typedef struct FfmpegDiracSchroEncodedFrame { |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
47 /** encoded frame data */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
48 uint8_t *p_encbuf; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
49 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
50 /** encoded frame size */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
51 uint32_t size; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
52 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
53 /** encoded frame number. Will be used as pts */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
54 uint32_t frame_num; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
55 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
56 /** key frame flag. 1 : is key frame , 0 : in not key frame */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
57 uint16_t key_frame; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
58 } FfmpegDiracSchroEncodedFrame; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
59 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
60 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
61 * queue element |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
62 */ |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
63 typedef struct FfmpegDiracSchroQueueElement { |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
64 /** Data to be stored in queue*/ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
65 void *data; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
66 /** Pointer to next element queue */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
67 struct FfmpegDiracSchroQueueElement *next; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
68 } FfmpegDiracSchroQueueElement; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
69 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
70 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
71 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
72 * A simple queue implementation used in libdirac and libschroedinger |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
73 */ |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
74 typedef struct FfmpegDiracSchroQueue { |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
75 /** Pointer to head of queue */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
76 FfmpegDiracSchroQueueElement *p_head; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
77 /** Pointer to tail of queue */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
78 FfmpegDiracSchroQueueElement *p_tail; |
7233 | 79 /** Queue size*/ |
80 int size; | |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
81 } FfmpegDiracSchroQueue; |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
82 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
83 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
84 * Initialise the queue |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
85 */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
86 void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue); |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
87 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
88 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
89 * Add an element to the end of the queue |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
90 */ |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
91 int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data); |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
92 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
93 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
94 * Return the first element in the queue |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
95 */ |
10060
965220ebc611
cosmetics: indentation, prettyprinting, K&R coding style
diego
parents:
8718
diff
changeset
|
96 void *ff_dirac_schro_queue_pop(FfmpegDiracSchroQueue *queue); |
6662
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
97 |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
98 /** |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
99 * Free the queue resources. free_func is a function supplied by the caller to |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
100 * free any resources allocated by the caller. The data field of the queue |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
101 * element is passed to it. |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
102 */ |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
103 void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue, |
c5432b7e7bc1
libdirac and libschro common code, patch from Anuradha Suraparaju anuradhaAtrdDoTbbcDoTcoDotuk
lu_zero
parents:
diff
changeset
|
104 void (*free_func)(void *)); |
7760 | 105 #endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */ |