annotate libdiracdec.c @ 9410:f7bd7e90ef9f libavcodec

Add names for 5.0 and 5.1 back speaker channel layouts.
author jbr
date Sun, 12 Apr 2009 03:26:20 +0000
parents 54bc8a2727b0
children fdb318d12314
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
1 /*
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
2 * Dirac decoder support via libdirac library
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
3 * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
4 * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
5 *
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
6 * This file is part of FFmpeg.
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
7 *
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
12 *
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
16 * Lesser General Public License for more details.
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
17 *
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
21 */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
22
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
23 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 8422
diff changeset
24 * @file libavcodec/libdiracdec.c
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
25 * Dirac decoder support via libdirac library; more details about the Dirac
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
26 * project can be found at http://dirac.sourceforge.net/.
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
27 * The libdirac_decoder library implements Dirac specification version 2.2
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
28 * (http://dirac.sourceforge.net/specification.html).
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
29 */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
30
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
31 #include "libdirac.h"
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
32
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
33 #undef NDEBUG
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
34 #include <assert.h>
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
35
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
36 #include <libdirac_decoder/dirac_parser.h>
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
37
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
38 /** contains a single frame returned from Dirac */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
39 typedef struct FfmpegDiracDecoderParams
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
40 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
41 /** decoder handle */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
42 dirac_decoder_t* p_decoder;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
43
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
44 /** buffer to hold decoded frame */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
45 unsigned char* p_out_frame_buf;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
46 } FfmpegDiracDecoderParams;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
47
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
48
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
49 /**
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
50 * returns FFmpeg chroma format
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
51 */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
52 static enum PixelFormat GetFfmpegChromaFormat(dirac_chroma_t dirac_pix_fmt)
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
53 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
54 int num_formats = sizeof(ffmpeg_dirac_pixel_format_map) /
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
55 sizeof(ffmpeg_dirac_pixel_format_map[0]);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
56 int idx;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
57
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
58 for (idx = 0; idx < num_formats; ++idx) {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
59 if (ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt) {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
60 return ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
61 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
62 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
63 return PIX_FMT_NONE;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
64 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
65
9007
043574c5c153 Add missing av_cold in static init/close functions.
stefano
parents: 8718
diff changeset
66 static av_cold int libdirac_decode_init(AVCodecContext *avccontext)
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
67 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
68
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
69 FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data ;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
70 p_dirac_params->p_decoder = dirac_decoder_init(avccontext->debug);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
71
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
72 if (!p_dirac_params->p_decoder)
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
73 return -1;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
74
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
75 return 0 ;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
76 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
77
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
78 static int libdirac_decode_frame(AVCodecContext *avccontext,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
79 void *data, int *data_size,
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9007
diff changeset
80 AVPacket *avpkt)
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
81 {
9355
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9007
diff changeset
82 const uint8_t *buf = avpkt->data;
54bc8a2727b0 Implement avcodec_decode_video2(), _audio3() and _subtitle2() which takes an
rbultje
parents: 9007
diff changeset
83 int buf_size = avpkt->size;
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
84
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
85 FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
86 AVPicture *picture = data;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
87 AVPicture pic;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
88 int pict_size;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
89 unsigned char *buffer[3];
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
90
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
91 *data_size = 0;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
92
8422
e623323d409f Fix incorrectly constructed Dirac parse units that caused A/V sync loss.
diego
parents: 7040
diff changeset
93 if (buf_size>0) {
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
94 /* set data to decode into buffer */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
95 dirac_buffer (p_dirac_params->p_decoder, buf, buf+buf_size);
8422
e623323d409f Fix incorrectly constructed Dirac parse units that caused A/V sync loss.
diego
parents: 7040
diff changeset
96 if ((buf[4] &0x08) == 0x08 && (buf[4] & 0x03))
e623323d409f Fix incorrectly constructed Dirac parse units that caused A/V sync loss.
diego
parents: 7040
diff changeset
97 avccontext->has_b_frames = 1;
e623323d409f Fix incorrectly constructed Dirac parse units that caused A/V sync loss.
diego
parents: 7040
diff changeset
98 }
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
99 while (1) {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
100 /* parse data and process result */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
101 DecoderState state = dirac_parse (p_dirac_params->p_decoder);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
102 switch (state)
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
103 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
104 case STATE_BUFFER:
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
105 return buf_size;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
106
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
107 case STATE_SEQUENCE:
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
108 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
109 /* tell FFmpeg about sequence details */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
110 dirac_sourceparams_t *src_params =
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
111 &p_dirac_params->p_decoder->src_params;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
112
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
113 if (avcodec_check_dimensions(avccontext, src_params->width,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
114 src_params->height) < 0) {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
115 av_log(avccontext, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n",
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
116 src_params->width, src_params->height);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
117 avccontext->height = avccontext->width = 0;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
118 return -1;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
119 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
120
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
121 avccontext->height = src_params->height;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
122 avccontext->width = src_params->width;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
123
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
124 avccontext->pix_fmt = GetFfmpegChromaFormat(src_params->chroma);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
125 if (avccontext->pix_fmt == PIX_FMT_NONE) {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
126 av_log (avccontext, AV_LOG_ERROR,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
127 "Dirac chroma format %d not supported currently\n",
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
128 src_params->chroma);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
129 return -1;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
130 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
131
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
132 avccontext->time_base.den = src_params->frame_rate.numerator;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
133 avccontext->time_base.num = src_params->frame_rate.denominator;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
134
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
135 /* calculate output dimensions */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
136 avpicture_fill(&pic, NULL, avccontext->pix_fmt,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
137 avccontext->width, avccontext->height);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
138
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
139 pict_size = avpicture_get_size(avccontext->pix_fmt,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
140 avccontext->width,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
141 avccontext->height);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
142
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
143 /* allocate output buffer */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
144 if (p_dirac_params->p_out_frame_buf == NULL)
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
145 p_dirac_params->p_out_frame_buf = av_malloc (pict_size);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
146 buffer[0] = p_dirac_params->p_out_frame_buf;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
147 buffer[1] = p_dirac_params->p_out_frame_buf +
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
148 pic.linesize[0] * avccontext->height;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
149 buffer[2] = buffer[1] +
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
150 pic.linesize[1] * src_params->chroma_height;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
151
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
152 /* tell Dirac about output destination */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
153 dirac_set_buf(p_dirac_params->p_decoder, buffer, NULL);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
154 break;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
155 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
156 case STATE_SEQUENCE_END:
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
157 break;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
158
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
159 case STATE_PICTURE_AVAIL:
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
160 /* fill picture with current buffer data from Dirac */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
161 avpicture_fill(picture, p_dirac_params->p_out_frame_buf,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
162 avccontext->pix_fmt,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
163 avccontext->width, avccontext->height);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
164 *data_size = sizeof(AVPicture);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
165 return buf_size;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
166
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
167 case STATE_INVALID:
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
168 return -1;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
169
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
170 default:
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
171 break;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
172 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
173 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
174
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
175 return buf_size;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
176 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
177
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
178
9007
043574c5c153 Add missing av_cold in static init/close functions.
stefano
parents: 8718
diff changeset
179 static av_cold int libdirac_decode_close(AVCodecContext *avccontext)
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
180 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
181 FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
182 dirac_decoder_close (p_dirac_params->p_decoder);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
183
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
184 av_freep(&p_dirac_params->p_out_frame_buf);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
185
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
186 return 0 ;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
187 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
188
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
189 static void libdirac_flush (AVCodecContext *avccontext)
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
190 {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
191 /* Got a seek request. We will need free memory held in the private
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
192 * context and free the current Dirac decoder handle and then open
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
193 * a new decoder handle. */
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
194 libdirac_decode_close (avccontext);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
195 libdirac_decode_init (avccontext);
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
196 return;
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
197 }
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
198
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
199
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
200
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
201 AVCodec libdirac_decoder = {
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
202 "libdirac",
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
203 CODEC_TYPE_VIDEO,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
204 CODEC_ID_DIRAC,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
205 sizeof(FfmpegDiracDecoderParams),
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
206 libdirac_decode_init,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
207 NULL,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
208 libdirac_decode_close,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
209 libdirac_decode_frame,
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
210 CODEC_CAP_DELAY,
6819
43bede126ef6 missing codec long names by Stefano Sabatini, stefano.sabatini-lala poste it
diego
parents: 6734
diff changeset
211 .flush = libdirac_flush,
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6819
diff changeset
212 .long_name = NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"),
6734
df467cebd0d3 Dirac decoding/encoding support via libdirac.
diego
parents:
diff changeset
213 } ;