Revision f6421e0b libavcodec/crystalhd.c

View differences:

libavcodec/crystalhd.c
84 84
#include <libcrystalhd/libcrystalhd_if.h>
85 85

  
86 86
#include "avcodec.h"
87
#include "h264.h"
87 88
#include "libavutil/imgutils.h"
88 89
#include "libavutil/intreadwrite.h"
89 90

  
......
120 121
    AVFrame pic;
121 122
    HANDLE dev;
122 123

  
124
    AVCodecParserContext *parser;
125

  
123 126
    uint8_t is_70012;
124 127
    uint8_t *sps_pps_buf;
125 128
    uint32_t sps_pps_size;
......
316 319
    DtsCloseDecoder(device);
317 320
    DtsDeviceClose(device);
318 321

  
322
    av_parser_close(priv->parser);
323

  
319 324
    av_free(priv->sps_pps_buf);
320 325

  
321 326
    if (priv->pic.data[0])
......
478 483
        goto fail;
479 484
    }
480 485

  
486
    if (avctx->codec->id == CODEC_ID_H264) {
487
        priv->parser = av_parser_init(avctx->codec->id);
488
        if (!priv->parser)
489
            av_log(avctx, AV_LOG_WARNING,
490
                   "Cannot open the h.264 parser! Interlaced h.264 content "
491
                   "will not be detected reliably.\n");
492
    }
481 493
    av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Init complete.\n");
482 494

  
483 495
    return 0;
......
737 749
    CHDContext *priv   = avctx->priv_data;
738 750
    HANDLE dev         = priv->dev;
739 751
    int len            = avpkt->size;
752
    uint8_t pic_type   = 0;
740 753

  
741 754
    av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_frame\n");
742 755

  
743 756
    if (len) {
744 757
        int32_t tx_free = (int32_t)DtsTxFreeSize(dev);
758

  
759
        if (priv->parser) {
760
            uint8_t *pout;
761
            int psize = len;
762
            H264Context *h = priv->parser->priv_data;
763

  
764
            while (psize)
765
                ret = av_parser_parse2(priv->parser, avctx, &pout, &psize,
766
                                       avpkt->data, len, avctx->pkt->pts,
767
                                       avctx->pkt->dts, len - psize);
768
            av_log(avctx, AV_LOG_VERBOSE,
769
                   "CrystalHD: parser picture type %d\n",
770
                   h->s.picture_structure);
771
            pic_type = h->s.picture_structure;
772
        }
773

  
745 774
        if (len < tx_free - 1024) {
746 775
            /*
747 776
             * Despite being notionally opaque, either libcrystalhd or

Also available in: Unified diff