~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/dvdsubenc.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc, Andrew Starr-Bochicchio, Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081226001006-2040ls9680bd1blt
Tags: 1.1.7-0.2ubuntu1
[ Andrew Starr-Bochicchio ]
* Merge from debian-multimedia (LP: #298547), Ubuntu Changes:
 - For ffmpeg-related build-deps, fix versionized dependencies
   as the ubuntu versioning is different than debian-multimedia's.

[ Lionel Le Folgoc ]
* LP: #311412 is fixed since the 1.1.7~rc1-0.1 revision.
* debian/patches/03_ffmpeg.diff: updated to fix FTBFS due to libswscale API
  change (cherry-pick from Gentoo #234383).

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
#include "avcodec.h"
 
22
#include "bytestream.h"
22
23
 
23
24
#undef NDEBUG
24
25
#include <assert.h>
85
86
    *pq = q;
86
87
}
87
88
 
88
 
static inline void putbe16(uint8_t **pq, uint16_t v)
89
 
{
90
 
    uint8_t *q = *pq;
91
 
    *q++ = v >> 8;
92
 
    *q++ = v;
93
 
    *pq = q;
94
 
}
95
 
 
96
89
static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size,
97
90
                                const AVSubtitle *h)
98
91
{
163
156
 
164
157
    // set data packet size
165
158
    qq = outbuf + 2;
166
 
    putbe16(&qq, q - outbuf);
 
159
    bytestream_put_be16(&qq, q - outbuf);
167
160
 
168
161
    // send start display command
169
 
    putbe16(&q, (h->start_display_time*90) >> 10);
170
 
    putbe16(&q, (q - outbuf) /*- 2 */ + 8 + 12*rects + 2);
 
162
    bytestream_put_be16(&q, (h->start_display_time*90) >> 10);
 
163
    bytestream_put_be16(&q, (q - outbuf) /*- 2 */ + 8 + 12*rects + 2);
171
164
    *q++ = 0x03; // palette - 4 nibbles
172
165
    *q++ = 0x03; *q++ = 0x7f;
173
166
    *q++ = 0x04; // alpha - 4 nibbles
192
185
 
193
186
        *q++ = 0x06;
194
187
        // offset1, offset2
195
 
        putbe16(&q, offset1[object_id]);
196
 
        putbe16(&q, offset2[object_id]);
 
188
        bytestream_put_be16(&q, offset1[object_id]);
 
189
        bytestream_put_be16(&q, offset2[object_id]);
197
190
    }
198
191
    *q++ = 0x01; // start command
199
192
    *q++ = 0xff; // terminating command
200
193
 
201
194
    // send stop display command last
202
 
    putbe16(&q, (h->end_display_time*90) >> 10);
203
 
    putbe16(&q, (q - outbuf) - 2 /*+ 4*/);
 
195
    bytestream_put_be16(&q, (h->end_display_time*90) >> 10);
 
196
    bytestream_put_be16(&q, (q - outbuf) - 2 /*+ 4*/);
204
197
    *q++ = 0x02; // set end
205
198
    *q++ = 0xff; // terminating command
206
199
 
207
200
    qq = outbuf;
208
 
    putbe16(&qq, q - outbuf);
 
201
    bytestream_put_be16(&qq, q - outbuf);
209
202
 
210
203
    av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%td\n", q - outbuf);
211
204
    return q - outbuf;
212
205
}
213
206
 
214
 
static int dvdsub_init_encoder(AVCodecContext *avctx)
215
 
{
216
 
    return 0;
217
 
}
218
 
 
219
 
static int dvdsub_close_encoder(AVCodecContext *avctx)
220
 
{
221
 
    return 0;
222
 
}
223
 
 
224
207
static int dvdsub_encode(AVCodecContext *avctx,
225
208
                         unsigned char *buf, int buf_size, void *data)
226
209
{
237
220
    CODEC_TYPE_SUBTITLE,
238
221
    CODEC_ID_DVD_SUBTITLE,
239
222
    0,
240
 
    dvdsub_init_encoder,
 
223
    NULL,
241
224
    dvdsub_encode,
242
 
    dvdsub_close_encoder,
 
225
    .long_name = "DVD subtitles",
243
226
};
244
 
 
245
 
/* Local Variables: */
246
 
/* c-basic-offset:4 */
247
 
/* End: */