Revision 316d6c15

View differences:

Changelog
4 4

  
5 5
version <next>:
6 6

  
7
- WebM support in Matroska demuxer
7
- WebM support in Matroska de/muxer
8 8
- low overhead Ogg muxing
9 9
- MMS-TCP support
10 10
- VP8 de/encoding via libvpx
doc/general.texi
236 236
@item VC-1 test bitstream       @tab X @tab X
237 237
@item WAV                       @tab X @tab X
238 238
@item WavPack                   @tab   @tab X
239
@item WebM                      @tab   @tab X
239
@item WebM                      @tab X @tab X
240 240
@item Wing Commander III movie  @tab   @tab X
241 241
    @tab Multimedia format used in Origin's Wing Commander III computer game.
242 242
@item Westwood Studios audio    @tab   @tab X
libavcodec/Makefile
512 512
                                          dirac.o mpeg12data.o
513 513
OBJS-$(CONFIG_OGG_MUXER)               += xiph.o flacdec.o flacdata.o flac.o
514 514
OBJS-$(CONFIG_RTP_MUXER)               += mpegvideo.o
515
OBJS-$(CONFIG_WEBM_MUXER)              += xiph.o mpeg4audio.o \
516
                                          flacdec.o flacdata.o flac.o
515 517

  
516 518
# external codec libraries
517 519
OBJS-$(CONFIG_LIBDIRAC_DECODER)           += libdiracdec.o
libavformat/Makefile
258 258
OBJS-$(CONFIG_WAV_DEMUXER)               += wav.o riff.o raw.o
259 259
OBJS-$(CONFIG_WAV_MUXER)                 += wav.o riff.o
260 260
OBJS-$(CONFIG_WC3_DEMUXER)               += wc3movie.o
261
OBJS-$(CONFIG_WEBM_MUXER)                += matroskaenc.o matroska.o \
262
                                            riff.o isom.o avc.o \
263
                                            flacenc_header.o
261 264
OBJS-$(CONFIG_WSAUD_DEMUXER)             += westwood.o
262 265
OBJS-$(CONFIG_WSVQA_DEMUXER)             += westwood.o
263 266
OBJS-$(CONFIG_WV_DEMUXER)                += wv.o apetag.o id3v1.o
libavformat/allformats.c
206 206
    REGISTER_DEMUXER  (W64, w64);
207 207
    REGISTER_MUXDEMUX (WAV, wav);
208 208
    REGISTER_DEMUXER  (WC3, wc3);
209
    REGISTER_MUXER    (WEBM, webm);
209 210
    REGISTER_DEMUXER  (WSAUD, wsaud);
210 211
    REGISTER_DEMUXER  (WSVQA, wsvqa);
211 212
    REGISTER_DEMUXER  (WV, wv);
libavformat/avformat.h
22 22
#define AVFORMAT_AVFORMAT_H
23 23

  
24 24
#define LIBAVFORMAT_VERSION_MAJOR 52
25
#define LIBAVFORMAT_VERSION_MINOR 67
25
#define LIBAVFORMAT_VERSION_MINOR 68
26 26
#define LIBAVFORMAT_VERSION_MICRO  0
27 27

  
28 28
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
libavformat/matroskaenc.c
65 65
    int             write_dts;
66 66
} mkv_track;
67 67

  
68
#define MODE_MATROSKAv2 0x01
69
#define MODE_WEBM       0x02
70

  
68 71
typedef struct MatroskaMuxContext {
72
    int             mode;
69 73
    ByteIOContext   *dyn_bc;
70 74
    ebml_master     segment;
71 75
    int64_t         segment_offset;
......
565 569
            }
566 570
        }
567 571

  
572
        if (mkv->mode == MODE_WEBM && !(codec->codec_id == CODEC_ID_VP8 ||
573
                                        codec->codec_id == CODEC_ID_VORBIS)) {
574
            av_log(s, AV_LOG_ERROR,
575
                   "Only VP8 video and Vorbis audio are supported for WebM.\n");
576
            return AVERROR(EINVAL);
577
        }
578

  
568 579
        switch (codec->codec_type) {
569 580
            case AVMEDIA_TYPE_VIDEO:
570 581
                put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
......
686 697
    AVMetadataTag *tag;
687 698
    int ret;
688 699

  
700
    if (!strcmp(s->oformat->name, "webm")) mkv->mode = MODE_WEBM;
701
    else                                   mkv->mode = MODE_MATROSKAv2;
702

  
689 703
    mkv->md5_ctx = av_mallocz(av_md5_size);
690 704
    av_md5_init(mkv->md5_ctx);
691 705
    mkv->tracks = av_mallocz(s->nb_streams * sizeof(*mkv->tracks));
......
695 709
    put_ebml_uint   (pb, EBML_ID_EBMLREADVERSION    ,           1);
696 710
    put_ebml_uint   (pb, EBML_ID_EBMLMAXIDLENGTH    ,           4);
697 711
    put_ebml_uint   (pb, EBML_ID_EBMLMAXSIZELENGTH  ,           8);
698
    put_ebml_string (pb, EBML_ID_DOCTYPE            ,  "matroska");
712
    put_ebml_string (pb, EBML_ID_DOCTYPE            , s->oformat->name);
699 713
    put_ebml_uint   (pb, EBML_ID_DOCTYPEVERSION     ,           2);
700 714
    put_ebml_uint   (pb, EBML_ID_DOCTYPEREADVERSION ,           2);
701 715
    end_ebml_master(pb, ebml_header);
......
738 752
    ret = mkv_write_tracks(s);
739 753
    if (ret < 0) return ret;
740 754

  
741
    ret = mkv_write_chapters(s);
742
    if (ret < 0) return ret;
755
    if (mkv->mode != MODE_WEBM) {
756
        ret = mkv_write_chapters(s);
757
        if (ret < 0) return ret;
758
    }
743 759

  
744 760
    if (url_is_streamed(s->pb))
745 761
        mkv_write_seekhead(pb, mkv->main_seekhead);
......
1035 1051
    return 0;
1036 1052
}
1037 1053

  
1054
#if CONFIG_MATROSKA_MUXER
1038 1055
AVOutputFormat matroska_muxer = {
1039 1056
    "matroska",
1040 1057
    NULL_IF_CONFIG_SMALL("Matroska file format"),
......
1050 1067
    .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
1051 1068
    .subtitle_codec = CODEC_ID_TEXT,
1052 1069
};
1070
#endif
1071

  
1072
#if CONFIG_WEBM_MUXER
1073
AVOutputFormat webm_muxer = {
1074
    "webm",
1075
    NULL_IF_CONFIG_SMALL("WebM file format"),
1076
    "video/webm",
1077
    "webm",
1078
    sizeof(MatroskaMuxContext),
1079
    CODEC_ID_VORBIS,
1080
    CODEC_ID_VP8,
1081
    mkv_write_header,
1082
    mkv_write_packet,
1083
    mkv_write_trailer,
1084
    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
1085
};
1086
#endif
1053 1087

  
1088
#if CONFIG_MATROSKA_AUDIO_MUXER
1054 1089
AVOutputFormat matroska_audio_muxer = {
1055 1090
    "matroska",
1056 1091
    NULL_IF_CONFIG_SMALL("Matroska file format"),
......
1065 1100
    .flags = AVFMT_GLOBALHEADER,
1066 1101
    .codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
1067 1102
};
1103
#endif

Also available in: Unified diff