~medibuntu-maintainers/mplayer/medibuntu.natty

« back to all changes in this revision

Viewing changes to libavcodec/smacker.c

  • Committer: Gauvain Pocentek
  • Date: 2010-09-25 09:39:02 UTC
  • mfrom: (66.1.6 maverick)
  • Revision ID: gauvain@images-20100925093902-9q2akz3ls3qzhaaw
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* merge from debian, remaining changes:
  - build depend against, lame, x264, xvid
* debian/patches/60eval-api.patch, backport patch from upstream to
  unbreak compilation for eval.h move not yet in 0.6
* gmplayer is gone now, please see smplayer as alternative frontend.
  LP: #503537, #493088, #467534, #467524, #460326, #390399, #285570,
      #208680, #118709, #513065, #459595, #455913, #179918, #65165.
* enable the mencoder package
* sort build depends alphabetically
* enable dvdnav support, Closes: #582508, #488226, LP: #611749
* prepare new upload
* no longer build mplayer-gui, it doesn't build anymore with shared
  swscale
* merge from debian/experimental, remaining changes:
  - build depend against, lame, x264, xvid
  - enable mencoder and mplayer-gui
* ensure that quilt patches are actually applied
* New Upstream Version, LP: #539315
* Build (against) again the System FFmpeg 
* tighten dependency on FFmpeg 0.6
* remove patches merged upstream
* remove 22disable-xscreensaver.patch
* refresh patches
* readd x264, xvid and mp3lame support, LP: #606125
* remove old parallel building mechanism, fixes FTBFS
* New upstream version
* compile against internal ffmpeg for now, LP: #587203, #588097
* recompile for directfb transtion, LP: #587163
* remove patches that were merged upstream
* avoid removing DOCS/html directory. it is included in release
  tarball
* convert to source Format: 3.0 (quilt)
* refreshed patches
* remove files that are included in upstream tarball
* rework debian/rules file
  - support parallel building
  - merge build rules for mplayer and mencoder package
  - remove unreferenced COMMON_CONFIGURE_FLAGS macro
  - rename DEB_BUILD_CONFIGURE -> CONFIGURE_FLAGS
  - don't build documentation - release tarballs have them prebuilt
  - build HTML documentation only if not already avaiable in the build
    tree
  - remove remaining references to debian/strip.sh from debian/rules
* remove copied vdpau headers
* copy in mencoder.c from upstream
* enable mplayer-gui (Closes: #579925) and mencoder packages. 
  (Closes: #396954, #400940, #580168)
* Fix rtsp vulnerability. Patch applied by DSA. Closes: #581245
* Fix another integer overflow, Closes: #524805
* prepare new upload
* sync libao2/ao_pulse.c with svn r30062, Closes: #558196, #580113
* make configure use pkg-config for fribidi checks. Closes: #582784,
  LP: #556200
* document 23mplayer-debug-printf.patch
* avoid mentioning of GTK frontend in mplayer description
* improve package descriptions of mplayer-doc and mplayer-dbg
* medium urgency because of fixed security issue
* fix SVN_VERION regex in debian rules to unbreak get-orig-source
  target. Closes: #582369
* forcefully disable arts support. Closes: #581225
* Remove mencoder from Depends in mplayer-dbg package.
* new upstream snapshot from rc3 branch.
* remove patches applied upstream:
  
  - 24_enable_fontconfig_by_default.diff
  - 30_add_gmplayer_man_rules.diff
  - 40_improve_desktop_file.patch
  - 41_fix_forcedsubsonly.patch
  - 50_fix_crashes_with_invalid_SDPs.patch
  - 50_fix_initial_volume_setting_pulse_output.patch
  - 61-malloc-bsd.patch
  - 62-disable-vidix-on-kfreebsd-amd64.patch
  - 63-sys-kd-include.patch
* don't install apport hook
* gross hack to avoid building mplayer-nogui and mplayer-gui packages
* add md5sum to remove to avoid spurious conffile prompt, Closes: #568272
* Make mplayer build on kFreeBSD (backports from upstream), Closes: #578622
  - Revert obscure hack that disables the malloc.h check on certain BSD
    platforms. 
  - disable vidix on kFreeBSD-amd64
  - rename 'struct keypad' -> 'struct m_keypad' to avoid FTBFS on
    kFreeBSD/amd64
* enable fontconfig by default. (Closes: #573257)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
/**
23
 
 * @file libavcodec/smacker.c
 
23
 * @file
24
24
 * Smacker decoder
25
25
 */
26
26
 
34
34
#include "avcodec.h"
35
35
 
36
36
#define ALT_BITSTREAM_READER_LE
37
 
#include "bitstream.h"
 
37
#include "get_bits.h"
38
38
#include "bytestream.h"
39
39
 
40
40
#define SMKTREE_BITS 9
345
345
    return v;
346
346
}
347
347
 
348
 
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
 
348
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
349
349
{
 
350
    const uint8_t *buf = avpkt->data;
 
351
    int buf_size = avpkt->size;
350
352
    SmackVContext * const smk = avctx->priv_data;
351
353
    uint8_t *out;
352
354
    uint32_t *pal;
512
514
 
513
515
    c->avctx = avctx;
514
516
 
515
 
    c->pic.data[0] = NULL;
516
 
 
517
 
    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
518
 
        return 1;
519
 
    }
520
 
 
521
517
    avctx->pix_fmt = PIX_FMT_PAL8;
522
518
 
523
519
 
558
554
 
559
555
static av_cold int smka_decode_init(AVCodecContext *avctx)
560
556
{
561
 
    avctx->sample_fmt = SAMPLE_FMT_S16;
562
557
    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
 
558
    avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? SAMPLE_FMT_U8 : SAMPLE_FMT_S16;
563
559
    return 0;
564
560
}
565
561
 
566
562
/**
567
563
 * Decode Smacker audio data
568
564
 */
569
 
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
 
565
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
570
566
{
 
567
    const uint8_t *buf = avpkt->data;
 
568
    int buf_size = avpkt->size;
571
569
    GetBitContext gb;
572
570
    HuffContext h[4];
573
571
    VLC vlc[4];
574
572
    int16_t *samples = data;
 
573
    int8_t *samples8 = data;
575
574
    int val;
576
575
    int i, res;
577
576
    int unp_size;
589
588
    }
590
589
    stereo = get_bits1(&gb);
591
590
    bits = get_bits1(&gb);
592
 
    if (unp_size & 0xC0000000 || (unp_size << !bits) > *data_size) {
 
591
    if (unp_size & 0xC0000000 || unp_size > *data_size) {
593
592
        av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
594
593
        return -1;
595
594
    }
655
654
        for(i = stereo; i >= 0; i--)
656
655
            pred[i] = get_bits(&gb, 8);
657
656
        for(i = 0; i < stereo; i++)
658
 
            *samples++ = (pred[i] - 0x80) << 8;
 
657
            *samples8++ = pred[i];
659
658
        for(i = 0; i < unp_size; i++) {
660
659
            if(i & stereo){
661
660
                if(vlc[1].table)
663
662
                else
664
663
                    res = 0;
665
664
                pred[1] += (int8_t)h[1].values[res];
666
 
                *samples++ = (pred[1] - 0x80) << 8;
 
665
                *samples8++ = pred[1];
667
666
            } else {
668
667
                if(vlc[0].table)
669
668
                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);
670
669
                else
671
670
                    res = 0;
672
671
                pred[0] += (int8_t)h[0].values[res];
673
 
                *samples++ = (pred[0] - 0x80) << 8;
 
672
                *samples8++ = pred[0];
674
673
            }
675
674
        }
676
 
        unp_size *= 2;
677
675
    }
678
676
 
679
677
    for(i = 0; i < 4; i++) {
693
691
 
694
692
AVCodec smacker_decoder = {
695
693
    "smackvid",
696
 
    CODEC_TYPE_VIDEO,
 
694
    AVMEDIA_TYPE_VIDEO,
697
695
    CODEC_ID_SMACKVIDEO,
698
696
    sizeof(SmackVContext),
699
697
    decode_init,
700
698
    NULL,
701
699
    decode_end,
702
700
    decode_frame,
 
701
    CODEC_CAP_DR1,
703
702
    .long_name = NULL_IF_CONFIG_SMALL("Smacker video"),
704
703
};
705
704
 
706
705
AVCodec smackaud_decoder = {
707
706
    "smackaud",
708
 
    CODEC_TYPE_AUDIO,
 
707
    AVMEDIA_TYPE_AUDIO,
709
708
    CODEC_ID_SMACKAUDIO,
710
709
    0,
711
710
    smka_decode_init,