Revision 0cd0a224 libavformat/mp3.c

View differences:

libavformat/mp3.c
252 252
}
253 253

  
254 254

  
255
static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
256
{
257
    put_buffer(s->pb, pkt->data, pkt->size);
258
    put_flush_packet(s->pb);
259
    return 0;
260
}
261

  
262
static int mp3_write_trailer(struct AVFormatContext *s)
263
{
264
    uint8_t buf[ID3v1_TAG_SIZE];
265

  
266
    /* write the id3v1 tag */
267
    if (id3v1_create_tag(s, buf) > 0) {
268
        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
269
        put_flush_packet(s->pb);
270
    }
271
    return 0;
272
}
273
#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */
274

  
275
#if CONFIG_MP2_MUXER
276
AVOutputFormat mp2_muxer = {
277
    "mp2",
278
    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
279
    "audio/x-mpeg",
280
    "mp2,m2a",
281
    0,
282
    CODEC_ID_MP2,
283
    CODEC_ID_NONE,
284
    NULL,
285
    mp3_write_packet,
286
    mp3_write_trailer,
287
};
288
#endif
289

  
290
#if CONFIG_MP3_MUXER
255 291
/**
256 292
 * Write an ID3v2.4 header at beginning of stream
257 293
 */
......
312 348
    return 0;
313 349
}
314 350

  
315
static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
316
{
317
    put_buffer(s->pb, pkt->data, pkt->size);
318
    put_flush_packet(s->pb);
319
    return 0;
320
}
321

  
322
static int mp3_write_trailer(struct AVFormatContext *s)
323
{
324
    uint8_t buf[ID3v1_TAG_SIZE];
325

  
326
    /* write the id3v1 tag */
327
    if (id3v1_create_tag(s, buf) > 0) {
328
        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
329
        put_flush_packet(s->pb);
330
    }
331
    return 0;
332
}
333
#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */
334

  
335
#if CONFIG_MP2_MUXER
336
AVOutputFormat mp2_muxer = {
337
    "mp2",
338
    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
339
    "audio/x-mpeg",
340
    "mp2,m2a",
341
    0,
342
    CODEC_ID_MP2,
343
    CODEC_ID_NONE,
344
    NULL,
345
    mp3_write_packet,
346
    mp3_write_trailer,
347
};
348
#endif
349
#if CONFIG_MP3_MUXER
350 351
AVOutputFormat mp3_muxer = {
351 352
    "mp3",
352 353
    NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),

Also available in: Unified diff