Revision 4a15f3ee

View differences:

libavformat/mxfenc.c
1101 1101
    return NULL;
1102 1102
}
1103 1103

  
1104
static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt)
1104
static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt, int *flags)
1105 1105
{
1106
    MXFContext *mxf = s->priv_data;
1107 1106
    MXFStreamContext *sc = st->priv_data;
1108 1107
    uint32_t c = -1;
1109 1108
    int i;
1110 1109

  
1111
    mxf->index_entries[mxf->edit_units_count].flags = 0;
1110
    *flags = 0;
1112 1111

  
1113 1112
    for(i = 0; i < pkt->size - 4; i++) {
1114 1113
        c = (c<<8) + pkt->data[i];
......
1122 1121
            }
1123 1122
        } else if (c == 0x1b8) { // gop
1124 1123
            if (i + 4 < pkt->size && pkt->data[i+4]>>6 & 0x01) // closed
1125
                mxf->index_entries[mxf->edit_units_count].flags |= 0x80; // random access
1124
                *flags |= 0x80; // random access
1126 1125
        } else if (c == 0x1b3) { // seq
1127
            mxf->index_entries[mxf->edit_units_count].flags |= 0x40;
1126
            *flags |= 0x40;
1128 1127
        } else if (c == 0x100) { // pic
1129 1128
            int pict_type = (pkt->data[i+2]>>3) & 0x07;
1130 1129
            if (pict_type == 2) { // P frame
1131
                mxf->index_entries[mxf->edit_units_count].flags |= 0x22;
1130
                *flags |= 0x22;
1132 1131
                st->codec->gop_size = 1;
1133 1132
            } else if (pict_type == 3) { // B frame
1134
                mxf->index_entries[mxf->edit_units_count].flags |= 0x33;
1133
                *flags |= 0x33;
1135 1134
                sc->temporal_reordering = -1;
1136 1135
            } else if (!pict_type) {
1137 1136
                av_log(s, AV_LOG_ERROR, "error parsing mpeg2 frame\n");
......
1306 1305
    ByteIOContext *pb = s->pb;
1307 1306
    AVStream *st = s->streams[pkt->stream_index];
1308 1307
    MXFStreamContext *sc = st->priv_data;
1308
    int flags = 0;
1309 1309

  
1310 1310
    if (!(mxf->edit_units_count % MXF_INDEX_CLUSTER_SIZE)) {
1311 1311
        mxf->index_entries = av_realloc(mxf->index_entries,
......
1318 1318
    }
1319 1319

  
1320 1320
    if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
1321
        if (!mxf_parse_mpeg2_frame(s, st, pkt)) {
1321
        if (!mxf_parse_mpeg2_frame(s, st, pkt, &flags)) {
1322 1322
            av_log(s, AV_LOG_ERROR, "could not get mpeg2 profile and level\n");
1323 1323
            return -1;
1324 1324
        }
......
1332 1332
    if (st->index == 0) {
1333 1333
        mxf_write_klv_fill(s);
1334 1334
        mxf->index_entries[mxf->edit_units_count].offset = url_ftell(pb);
1335
        mxf->index_entries[mxf->edit_units_count].flags = flags;
1335 1336
        mxf_write_system_item(s);
1336 1337

  
1337 1338
        mxf->edit_units_count++;

Also available in: Unified diff