Revision c53d2d90

View differences:

libavcodec/avcodec.h
2981 2981
    int (*parser_init)(AVCodecParserContext *s);
2982 2982
    int (*parser_parse)(AVCodecParserContext *s,
2983 2983
                        AVCodecContext *avctx,
2984
                        uint8_t **poutbuf, int *poutbuf_size,
2984
                        const uint8_t **poutbuf, int *poutbuf_size,
2985 2985
                        const uint8_t *buf, int buf_size);
2986 2986
    void (*parser_close)(AVCodecParserContext *s);
2987 2987
    int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
libavcodec/cavs.c
1506 1506

  
1507 1507
static int cavsvideo_parse(AVCodecParserContext *s,
1508 1508
                           AVCodecContext *avctx,
1509
                           uint8_t **poutbuf, int *poutbuf_size,
1509
                           const uint8_t **poutbuf, int *poutbuf_size,
1510 1510
                           const uint8_t *buf, int buf_size)
1511 1511
{
1512 1512
    ParseContext *pc = s->priv_data;
......
1517 1517
    }else{
1518 1518
        next= cavs_find_frame_end(pc, buf, buf_size);
1519 1519

  
1520
        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
1520
        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
1521 1521
            *poutbuf = NULL;
1522 1522
            *poutbuf_size = 0;
1523 1523
            return buf_size;
1524 1524
        }
1525 1525
    }
1526
    *poutbuf = (uint8_t *)buf;
1526
    *poutbuf = buf;
1527 1527
    *poutbuf_size = buf_size;
1528 1528
    return next;
1529 1529
}
libavcodec/dca_parser.c
94 94

  
95 95
static int dca_parse(AVCodecParserContext * s,
96 96
                     AVCodecContext * avctx,
97
                     uint8_t ** poutbuf, int *poutbuf_size,
97
                     const uint8_t ** poutbuf, int *poutbuf_size,
98 98
                     const uint8_t * buf, int buf_size)
99 99
{
100 100
    DCAParseContext *pc1 = s->priv_data;
......
106 106
    } else {
107 107
        next = dca_find_frame_end(pc1, buf, buf_size);
108 108

  
109
        if (ff_combine_frame(pc, next, (uint8_t **) & buf, &buf_size) < 0) {
109
        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
110 110
            *poutbuf = NULL;
111 111
            *poutbuf_size = 0;
112 112
            return buf_size;
113 113
        }
114 114
    }
115
    *poutbuf = (uint8_t *) buf;
115
    *poutbuf = buf;
116 116
    *poutbuf_size = buf_size;
117 117
    return next;
118 118
}
libavcodec/dvbsub_parser.c
48 48

  
49 49
static int dvbsub_parse(AVCodecParserContext *s,
50 50
                        AVCodecContext *avctx,
51
                        uint8_t **poutbuf, int *poutbuf_size,
51
                        const uint8_t **poutbuf, int *poutbuf_size,
52 52
                        const uint8_t *buf, int buf_size)
53 53
{
54 54
    DVBSubParseContext *pc = s->priv_data;
libavcodec/dvdsub_parser.c
34 34

  
35 35
static int dvdsub_parse(AVCodecParserContext *s,
36 36
                        AVCodecContext *avctx,
37
                        uint8_t **poutbuf, int *poutbuf_size,
37
                        const uint8_t **poutbuf, int *poutbuf_size,
38 38
                        const uint8_t *buf, int buf_size)
39 39
{
40 40
    DVDSubParseContext *pc = s->priv_data;
libavcodec/h261_parser.c
64 64

  
65 65
static int h261_parse(AVCodecParserContext *s,
66 66
                      AVCodecContext *avctx,
67
                      uint8_t **poutbuf, int *poutbuf_size,
67
                      const uint8_t **poutbuf, int *poutbuf_size,
68 68
                      const uint8_t *buf, int buf_size)
69 69
{
70 70
    ParseContext *pc = s->priv_data;
71 71
    int next;
72 72

  
73 73
    next= h261_find_frame_end(pc,avctx, buf, buf_size);
74
    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
74
    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
75 75
        *poutbuf = NULL;
76 76
        *poutbuf_size = 0;
77 77
        return buf_size;
78 78
    }
79
    *poutbuf = (uint8_t *)buf;
79
    *poutbuf = buf;
80 80
    *poutbuf_size = buf_size;
81 81
    return next;
82 82
}
libavcodec/h263dec.c
396 396
#ifdef CONFIG_H263_PARSER
397 397
static int h263_parse(AVCodecParserContext *s,
398 398
                           AVCodecContext *avctx,
399
                           uint8_t **poutbuf, int *poutbuf_size,
399
                           const uint8_t **poutbuf, int *poutbuf_size,
400 400
                           const uint8_t *buf, int buf_size)
401 401
{
402 402
    ParseContext *pc = s->priv_data;
......
404 404

  
405 405
    next= h263_find_frame_end(pc, buf, buf_size);
406 406

  
407
    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
407
    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
408 408
        *poutbuf = NULL;
409 409
        *poutbuf_size = 0;
410 410
        return buf_size;
411 411
    }
412 412

  
413
    *poutbuf = (uint8_t *)buf;
413
    *poutbuf = buf;
414 414
    *poutbuf_size = buf_size;
415 415
    return next;
416 416
}
......
460 460
            return -1;
461 461
        }
462 462

  
463
        if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 )
463
        if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
464 464
            return buf_size;
465 465
    }
466 466

  
libavcodec/h264.c
8039 8039
#ifdef CONFIG_H264_PARSER
8040 8040
static int h264_parse(AVCodecParserContext *s,
8041 8041
                      AVCodecContext *avctx,
8042
                      uint8_t **poutbuf, int *poutbuf_size,
8042
                      const uint8_t **poutbuf, int *poutbuf_size,
8043 8043
                      const uint8_t *buf, int buf_size)
8044 8044
{
8045 8045
    H264Context *h = s->priv_data;
......
8051 8051
    }else{
8052 8052
        next= find_frame_end(h, buf, buf_size);
8053 8053

  
8054
        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
8054
        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
8055 8055
            *poutbuf = NULL;
8056 8056
            *poutbuf_size = 0;
8057 8057
            return buf_size;
......
8063 8063
        }
8064 8064
    }
8065 8065

  
8066
    *poutbuf = (uint8_t *)buf;
8066
    *poutbuf = buf;
8067 8067
    *poutbuf_size = buf_size;
8068 8068
    return next;
8069 8069
}
......
8303 8303
    if(s->flags&CODEC_FLAG_TRUNCATED){
8304 8304
        int next= find_frame_end(h, buf, buf_size);
8305 8305

  
8306
        if( ff_combine_frame(&s->parse_context, next, &buf, &buf_size) < 0 )
8306
        if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
8307 8307
            return buf_size;
8308 8308
//printf("next:%d buf_size:%d last_index:%d\n", next, buf_size, s->parse_context.last_index);
8309 8309
    }
libavcodec/mjpeg.c
1005 1005

  
1006 1006
static int jpeg_parse(AVCodecParserContext *s,
1007 1007
                           AVCodecContext *avctx,
1008
                           uint8_t **poutbuf, int *poutbuf_size,
1008
                           const uint8_t **poutbuf, int *poutbuf_size,
1009 1009
                           const uint8_t *buf, int buf_size)
1010 1010
{
1011 1011
    ParseContext *pc = s->priv_data;
......
1013 1013

  
1014 1014
    next= find_frame_end(pc, buf, buf_size);
1015 1015

  
1016
    if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
1016
    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
1017 1017
        *poutbuf = NULL;
1018 1018
        *poutbuf_size = 0;
1019 1019
        return buf_size;
1020 1020
    }
1021 1021

  
1022
    *poutbuf = (uint8_t *)buf;
1022
    *poutbuf = buf;
1023 1023
    *poutbuf_size = buf_size;
1024 1024
    return next;
1025 1025
}
libavcodec/mpeg12.c
3096 3096
    if(s2->flags&CODEC_FLAG_TRUNCATED){
3097 3097
        int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size);
3098 3098

  
3099
        if( ff_combine_frame(&s2->parse_context, next, &buf, &buf_size) < 0 )
3099
        if( ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
3100 3100
            return buf_size;
3101 3101
    }
3102 3102

  
libavcodec/mpeg4video_parser.c
65 65

  
66 66
static int mpeg4video_parse(AVCodecParserContext *s,
67 67
                           AVCodecContext *avctx,
68
                           uint8_t **poutbuf, int *poutbuf_size,
68
                           const uint8_t **poutbuf, int *poutbuf_size,
69 69
                           const uint8_t *buf, int buf_size)
70 70
{
71 71
    ParseContext *pc = s->priv_data;
......
76 76
    }else{
77 77
        next= ff_mpeg4_find_frame_end(pc, buf, buf_size);
78 78

  
79
        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
79
        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
80 80
            *poutbuf = NULL;
81 81
            *poutbuf_size = 0;
82 82
            return buf_size;
......
84 84
    }
85 85
    av_mpeg4_decode_header(s, avctx, buf, buf_size);
86 86

  
87
    *poutbuf = (uint8_t *)buf;
87
    *poutbuf = buf;
88 88
    *poutbuf_size = buf_size;
89 89
    return next;
90 90
}
libavcodec/mpegaudio_parser.c
50 50

  
51 51
static int mpegaudio_parse(AVCodecParserContext *s1,
52 52
                           AVCodecContext *avctx,
53
                           uint8_t **poutbuf, int *poutbuf_size,
53
                           const uint8_t **poutbuf, int *poutbuf_size,
54 54
                           const uint8_t *buf, int buf_size)
55 55
{
56 56
    MpegAudioParseContext *s = s1->priv_data;
......
186 186
        if(s->frame_size > 0 && buf_ptr - buf == s->inbuf_ptr - s->inbuf
187 187
           && buf_size + buf_ptr - buf >= s->frame_size){
188 188
            if(s->header_count > 0){
189
                *poutbuf = (uint8_t *)buf;
189
                *poutbuf = buf;
190 190
                *poutbuf_size = s->frame_size;
191 191
            }
192 192
            buf_ptr = buf + s->frame_size;
libavcodec/mpegvideo_parser.c
128 128

  
129 129
static int mpegvideo_parse(AVCodecParserContext *s,
130 130
                           AVCodecContext *avctx,
131
                           uint8_t **poutbuf, int *poutbuf_size,
131
                           const uint8_t **poutbuf, int *poutbuf_size,
132 132
                           const uint8_t *buf, int buf_size)
133 133
{
134 134
    ParseContext1 *pc1 = s->priv_data;
......
140 140
    }else{
141 141
        next= ff_mpeg1_find_frame_end(pc, buf, buf_size);
142 142

  
143
        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
143
        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
144 144
            *poutbuf = NULL;
145 145
            *poutbuf_size = 0;
146 146
            return buf_size;
......
156 156
           s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict);
157 157
#endif
158 158

  
159
    *poutbuf = (uint8_t *)buf;
159
    *poutbuf = buf;
160 160
    *poutbuf_size = buf_size;
161 161
    return next;
162 162
}
libavcodec/parser.c
130 130
    }
131 131

  
132 132
    /* WARNING: the returned index can be negative */
133
    index = s->parser->parser_parse(s, avctx, poutbuf, poutbuf_size, buf, buf_size);
133
    index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size);
134 134
//av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id);
135 135
    /* update the file pointer */
136 136
    if (*poutbuf_size) {
......
223 223
 * combines the (truncated) bitstream to a complete frame
224 224
 * @returns -1 if no complete frame could be created
225 225
 */
226
int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size)
226
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
227 227
{
228 228
#if 0
229 229
    if(pc->overread){
......
525 525
/* also used for ADTS AAC */
526 526
static int ac3_parse(AVCodecParserContext *s1,
527 527
                     AVCodecContext *avctx,
528
                     uint8_t **poutbuf, int *poutbuf_size,
528
                     const uint8_t **poutbuf, int *poutbuf_size,
529 529
                     const uint8_t *buf, int buf_size)
530 530
{
531 531
    AC3ParseContext *s = s1->priv_data;
libavcodec/parser.h
54 54

  
55 55
#define END_NOT_FOUND (-100)
56 56

  
57
int ff_combine_frame(ParseContext *pc, int next, uint8_t **buf, int *buf_size);
57
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size);
58 58
int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
59 59
                        int buf_size);
60 60
void ff_parse_close(AVCodecParserContext *s);
libavcodec/pnm.c
489 489
#ifdef CONFIG_PNM_PARSER
490 490
static int pnm_parse(AVCodecParserContext *s,
491 491
                           AVCodecContext *avctx,
492
                           uint8_t **poutbuf, int *poutbuf_size,
492
                           const uint8_t **poutbuf, int *poutbuf_size,
493 493
                           const uint8_t *buf, int buf_size)
494 494
{
495 495
    ParseContext *pc = s->priv_data;
......
538 538
            next= END_NOT_FOUND;
539 539
    }
540 540

  
541
    if(ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size)<0){
541
    if(ff_combine_frame(pc, next, &buf, &buf_size)<0){
542 542
        *poutbuf = NULL;
543 543
        *poutbuf_size = 0;
544 544
        return buf_size;
545 545
    }
546
    *poutbuf = (uint8_t *)buf;
546
    *poutbuf = buf;
547 547
    *poutbuf_size = buf_size;
548 548
    return next;
549 549
}
libavcodec/vc1_parser.c
72 72

  
73 73
static int vc1_parse(AVCodecParserContext *s,
74 74
                           AVCodecContext *avctx,
75
                           uint8_t **poutbuf, int *poutbuf_size,
75
                           const uint8_t **poutbuf, int *poutbuf_size,
76 76
                           const uint8_t *buf, int buf_size)
77 77
{
78 78
    ParseContext *pc = s->priv_data;
......
83 83
    }else{
84 84
        next= vc1_find_frame_end(pc, buf, buf_size);
85 85

  
86
        if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) {
86
        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
87 87
            *poutbuf = NULL;
88 88
            *poutbuf_size = 0;
89 89
            return buf_size;
90 90
        }
91 91
    }
92
    *poutbuf = (uint8_t *)buf;
92
    *poutbuf = buf;
93 93
    *poutbuf_size = buf_size;
94 94
    return next;
95 95
}

Also available in: Unified diff