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

« back to all changes in this revision

Viewing changes to libavcodec/g726.c

  • 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:
5
5
 * This is a very straightforward rendition of the G.726
6
6
 * Section 4 "Computational Details".
7
7
 *
8
 
 * This file is part of FFmpeg.
 
8
 * This file is part of Libav.
9
9
 *
10
 
 * FFmpeg is free software; you can redistribute it and/or
 
10
 * Libav is free software; you can redistribute it and/or
11
11
 * modify it under the terms of the GNU Lesser General Public
12
12
 * License as published by the Free Software Foundation; either
13
13
 * version 2.1 of the License, or (at your option) any later version.
14
14
 *
15
 
 * FFmpeg is distributed in the hope that it will be useful,
 
15
 * Libav is distributed in the hope that it will be useful,
16
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
18
 * Lesser General Public License for more details.
19
19
 *
20
20
 * You should have received a copy of the GNU Lesser General Public
21
 
 * License along with FFmpeg; if not, write to the Free Software
 
21
 * License along with Libav; if not, write to the Free Software
22
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
23
 */
24
24
#include <limits.h>
332
332
    avctx->coded_frame->key_frame = 1;
333
333
 
334
334
    if (avctx->codec->decode)
335
 
        avctx->sample_fmt = SAMPLE_FMT_S16;
 
335
        avctx->sample_fmt = AV_SAMPLE_FMT_S16;
 
336
 
 
337
    /* select a frame size that will end on a byte boundary and have a size of
 
338
       approximately 1024 bytes */
 
339
    if (avctx->codec->encode)
 
340
        avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[index];
336
341
 
337
342
    return 0;
338
343
}
348
353
                            uint8_t *dst, int buf_size, void *data)
349
354
{
350
355
    G726Context *c = avctx->priv_data;
351
 
    short *samples = data;
 
356
    const short *samples = data;
352
357
    PutBitContext pb;
 
358
    int i;
353
359
 
354
360
    init_put_bits(&pb, dst, 1024*1024);
355
361
 
356
 
    for (; buf_size; buf_size--)
 
362
    for (i = 0; i < avctx->frame_size; i++)
357
363
        put_bits(&pb, c->code_size, g726_encode(c, *samples++));
358
364
 
359
365
    flush_put_bits(&pb);
385
391
}
386
392
 
387
393
#if CONFIG_ADPCM_G726_ENCODER
388
 
AVCodec adpcm_g726_encoder = {
 
394
AVCodec ff_adpcm_g726_encoder = {
389
395
    "g726",
390
396
    AVMEDIA_TYPE_AUDIO,
391
397
    CODEC_ID_ADPCM_G726,
394
400
    g726_encode_frame,
395
401
    g726_close,
396
402
    NULL,
397
 
    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
 
403
    .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
 
404
    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
398
405
    .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
399
406
};
400
407
#endif
401
408
 
402
 
AVCodec adpcm_g726_decoder = {
 
409
AVCodec ff_adpcm_g726_decoder = {
403
410
    "g726",
404
411
    AVMEDIA_TYPE_AUDIO,
405
412
    CODEC_ID_ADPCM_G726,