Revision cff87f04

View differences:

libavformat/rmenc.c
60 60
    }
61 61
}
62 62

  
63
static void rv10_write_header(AVFormatContext *ctx,
63
static int rv10_write_header(AVFormatContext *ctx,
64 64
                              int data_size, int index_pos)
65 65
{
66 66
    RMMuxContext *rm = ctx->priv_data;
......
225 225
            put_be32(s, 0x10); /* unknown */
226 226
            put_be16(s, stream->enc->channels);
227 227
            put_str8(s, "Int0"); /* codec name */
228
            put_str8(s, "dnet"); /* codec name */
228
            if (stream->enc->codec_tag) {
229
                put_byte(s, 4); /* tag length */
230
                put_le32(s, stream->enc->codec_tag);
231
            } else {
232
                av_log(ctx, AV_LOG_ERROR, "Invalid codec tag\n");
233
                return -1;
234
            }
229 235
            put_be16(s, 0); /* title length */
230 236
            put_be16(s, 0); /* author length */
231 237
            put_be16(s, 0); /* copyright length */
......
270 276

  
271 277
    put_be32(s, nb_packets); /* number of packets */
272 278
    put_be32(s,0); /* next data header */
279
    return 0;
273 280
}
274 281

  
275 282
static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
......
330 337
        }
331 338
    }
332 339

  
333
    rv10_write_header(s, 0, 0);
340
    if (rv10_write_header(s, 0, 0))
341
        return AVERROR_INVALIDDATA;
334 342
    put_flush_packet(s->pb);
335 343
    return 0;
336 344
}
......
348 356

  
349 357
    write_packet_header(s, stream, size, !!(flags & AV_PKT_FLAG_KEY));
350 358

  
359
    if (stream->enc->codec_id == CODEC_ID_AC3) {
351 360
    /* for AC-3, the words seem to be reversed */
352 361
    for(i=0;i<size;i+=2) {
353 362
        buf1[i] = buf[i+1];
354 363
        buf1[i+1] = buf[i];
355 364
    }
356 365
    put_buffer(pb, buf1, size);
366
    } else {
367
        put_buffer(pb, buf, size);
368
    }
357 369
    put_flush_packet(pb);
358 370
    stream->nb_frames++;
359 371
    av_free(buf1);
......
456 468
    rm_write_header,
457 469
    rm_write_packet,
458 470
    rm_write_trailer,
471
    .codec_tag= (const AVCodecTag* const []){ff_rm_codec_tags, 0},
459 472
};

Also available in: Unified diff