Revision aec8f88a

View differences:

libavformat/nut.c
25 25

  
26 26
/*
27 27
 * TODO:
28
 * - seeking
29 28
 * - index writing
30 29
 * - index packet reading support
31 30
*/
......
59 58
#define FLAG_PTS            16
60 59
#define FLAG_FULL_PTS        4
61 60
#define FLAG_KEY_FRAME      32
62
#define FLAG_PRED_KEY_FRAME 64
63 61

  
64 62
typedef struct {
65 63
    uint8_t flags;
......
478 476
    put_packetheader(nut, bc, 120+5*256, 1);
479 477
    put_v(bc, 1); /* version */
480 478
    put_v(bc, s->nb_streams);
481
    put_v(bc, 3);
482 479
    
483 480
    build_frame_code(s);
484 481
    assert(nut->frame_code['N'].flags == 1);
......
671 668
    frame_code= -1;
672 669
    for(i=0; i<256; i++){
673 670
        int stream_id_plus1= nut->frame_code[i].stream_id_plus1;
674
        int fc_key_frame= stream->last_key_frame;
671
        int fc_key_frame;
675 672
        int length=0;
676 673
        size_mul= nut->frame_code[i].size_mul;
677 674
        size_lsb= nut->frame_code[i].size_lsb;
......
680 677
        if(stream_id_plus1 == 0) length+= get_length(stream_index);
681 678
        else if(stream_id_plus1 - 1 != stream_index)
682 679
            continue;
683
        if(flags & FLAG_PRED_KEY_FRAME){
684
            if(flags & FLAG_KEY_FRAME)
685
                fc_key_frame= !fc_key_frame;
686
        }else{
687
            fc_key_frame= !!(flags & FLAG_KEY_FRAME);
688
        }
680
        fc_key_frame= !!(flags & FLAG_KEY_FRAME);
681

  
689 682
        assert(key_frame==0 || key_frame==1);
690 683
        if(fc_key_frame != key_frame)
691 684
            continue;
......
832 825
    }
833 826
    
834 827
    nut->stream_count = get_v(bc);
835
    get_v(bc); //checksum threshold
836 828

  
837 829
    for(i=0; i<256;){
838 830
        int tmp_flags = get_v(bc);
......
847 839
        }
848 840

  
849 841
        if((tmp_flags & FLAG_FRAME_TYPE) && tmp_flags != 1){
850
            if(tmp_flags & FLAG_PRED_KEY_FRAME){
851
                av_log(s, AV_LOG_ERROR, "keyframe prediction in non 0 frame type\n");
852
                return -1;
853
            }
854 842
            if(!(tmp_flags & FLAG_PTS) || !(tmp_flags & FLAG_FULL_PTS) ){
855 843
                av_log(s, AV_LOG_ERROR, "no full pts in non 0 frame type\n");
856 844
                return -1;
......
1112 1100

  
1113 1101
//    av_log(s, AV_LOG_DEBUG, "ft:%d ppts:%d %d %d\n", frame_type, stream->lru_pts_delta[0], stream->lru_pts_delta[1], stream->lru_pts_delta[2]);
1114 1102
    
1115
    if(flags & FLAG_PRED_KEY_FRAME){
1116
        if(flags & FLAG_KEY_FRAME)
1117
            key_frame= !stream->last_key_frame;
1118
        else
1119
            key_frame= stream->last_key_frame;
1120
    }else{
1121
        key_frame= !!(flags & FLAG_KEY_FRAME);
1122
    }
1103
    key_frame= !!(flags & FLAG_KEY_FRAME);
1123 1104

  
1124 1105
    if(flags & FLAG_PTS){
1125 1106
        if(flags & FLAG_FULL_PTS){

Also available in: Unified diff