Browse code

lavf/movenc: add F4V flavor.

Clément Bœsch authored on 2012/09/17 23:16:16
Showing 5 changed files
... ...
@@ -61,6 +61,7 @@ version next:
61 61
 - decimate filter ported from MPlayer
62 62
 - RTP depacketization of JPEG
63 63
 - Smooth Streaming live segmenter muxer
64
+- F4V muxer
64 65
 
65 66
 
66 67
 version 0.11:
... ...
@@ -1793,6 +1793,7 @@ asf_stream_muxer_select="asf_muxer"
1793 1793
 avisynth_demuxer_deps="avisynth"
1794 1794
 dirac_demuxer_select="dirac_parser"
1795 1795
 eac3_demuxer_select="ac3_parser"
1796
+f4v_muxer_select="mov_muxer"
1796 1797
 flac_demuxer_select="flac_parser"
1797 1798
 ipod_muxer_select="mov_muxer"
1798 1799
 libnut_demuxer_deps="libnut"
... ...
@@ -93,6 +93,7 @@ void av_register_all(void)
93 93
     REGISTER_DEMUXER  (EA, ea);
94 94
     REGISTER_DEMUXER  (EA_CDATA, ea_cdata);
95 95
     REGISTER_MUXDEMUX (EAC3, eac3);
96
+    REGISTER_MUXER    (F4V, f4v);
96 97
     REGISTER_MUXDEMUX (FFM, ffm);
97 98
     REGISTER_MUXDEMUX (FFMETADATA, ffmetadata);
98 99
     REGISTER_MUXDEMUX (FILMSTRIP, filmstrip);
... ...
@@ -933,6 +933,14 @@ static const AVCodecTag codec_3gp_tags[] = {
933 933
     { AV_CODEC_ID_NONE, 0 },
934 934
 };
935 935
 
936
+static const AVCodecTag codec_f4v_tags[] = { // XXX: add GIF/PNG/JPEG?
937
+    { AV_CODEC_ID_MP3,    MKTAG('.','m','p','3') },
938
+    { AV_CODEC_ID_AAC,    MKTAG('m','p','4','a') },
939
+    { AV_CODEC_ID_H264,   MKTAG('a','v','c','1') },
940
+    { AV_CODEC_ID_VP6F,   MKTAG('V','P','6','F') },
941
+    { AV_CODEC_ID_NONE, 0 },
942
+};
943
+
936 944
 static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
937 945
 {
938 946
     int tag;
... ...
@@ -947,6 +955,8 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
947 947
         tag = ipod_get_codec_tag(s, track);
948 948
     else if (track->mode & MODE_3GP)
949 949
         tag = ff_codec_get_tag(codec_3gp_tags, track->enc->codec_id);
950
+    else if (track->mode & MODE_F4V)
951
+        tag = ff_codec_get_tag(codec_f4v_tags, track->enc->codec_id);
950 952
     else
951 953
         tag = mov_get_codec_tag(s, track);
952 954
 
... ...
@@ -2697,6 +2707,8 @@ static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
2697 2697
         ffio_wfourcc(pb, has_video ? "M4V ":"M4A ");
2698 2698
     else if (mov->mode == MODE_ISM)
2699 2699
         ffio_wfourcc(pb, "isml");
2700
+    else if (mov->mode == MODE_F4V)
2701
+        ffio_wfourcc(pb, "f4v ");
2700 2702
     else
2701 2703
         ffio_wfourcc(pb, "qt  ");
2702 2704
 
... ...
@@ -3388,6 +3400,7 @@ static int mov_write_header(AVFormatContext *s)
3388 3388
         else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
3389 3389
         else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD;
3390 3390
         else if (!strcmp("ismv",s->oformat->name)) mov->mode = MODE_ISM;
3391
+        else if (!strcmp("f4v", s->oformat->name)) mov->mode = MODE_F4V;
3391 3392
 
3392 3393
         mov_write_ftyp_tag(pb,s);
3393 3394
         if (mov->mode == MODE_PSP) {
... ...
@@ -3814,3 +3827,21 @@ AVOutputFormat ff_ismv_muxer = {
3814 3814
     .priv_class        = &ismv_muxer_class,
3815 3815
 };
3816 3816
 #endif
3817
+#if CONFIG_F4V_MUXER
3818
+MOV_CLASS(f4v)
3819
+AVOutputFormat ff_f4v_muxer = {
3820
+    .name              = "f4v",
3821
+    .long_name         = NULL_IF_CONFIG_SMALL("F4V Adobe Flash Video"),
3822
+    .mime_type         = "application/f4v",
3823
+    .extensions        = "f4v",
3824
+    .priv_data_size    = sizeof(MOVMuxContext),
3825
+    .audio_codec       = AV_CODEC_ID_AAC,
3826
+    .video_codec       = AV_CODEC_ID_H264,
3827
+    .write_header      = mov_write_header,
3828
+    .write_packet      = mov_write_packet,
3829
+    .write_trailer     = mov_write_trailer,
3830
+    .flags             = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH,
3831
+    .codec_tag         = (const AVCodecTag* const []){ codec_f4v_tags, 0 },
3832
+    .priv_class        = &f4v_muxer_class,
3833
+};
3834
+#endif
... ...
@@ -39,6 +39,7 @@
39 39
 #define MODE_3G2  0x10
40 40
 #define MODE_IPOD 0x20
41 41
 #define MODE_ISM  0x40
42
+#define MODE_F4V  0x80
42 43
 
43 44
 typedef struct MOVIentry {
44 45
     uint64_t     pos;