changeset 3112:88e032ac11e7 libavformat

Subtitle support. (untested)
author michael
date Wed, 05 Mar 2008 13:06:49 +0000
parents 6f505b24ed57
children f1aecf52bac5
files nut.c nut.h nutdec.c nutenc.c
diffstat 4 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nut.c	Wed Mar 05 12:06:57 2008 +0000
+++ b/nut.c	Wed Mar 05 13:06:49 2008 +0000
@@ -22,6 +22,14 @@
 #include "nut.h"
 #include "tree.h"
 
+const AVCodecTag ff_nut_subtitle_tags[] = {
+    { CODEC_ID_TEXT        , MKTAG('U', 'T', 'F', '8') },
+    { CODEC_ID_SSA         , MKTAG('S', 'S', 'A',  0 ) },
+    { CODEC_ID_DVD_SUBTITLE, MKTAG('D', 'V', 'D', 'S') },
+    { CODEC_ID_DVB_SUBTITLE, MKTAG('D', 'V', 'B', 'S') },
+    { CODEC_ID_NONE        , 0                         }
+};
+
 void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
     int i;
     for(i=0; i<nut->avf->nb_streams; i++){
--- a/nut.h	Wed Mar 05 12:06:57 2008 +0000
+++ b/nut.h	Wed Mar 05 13:06:49 2008 +0000
@@ -97,6 +97,8 @@
     struct AVTreeNode *syncpoints;
 } NUTContext;
 
+extern const AVCodecTag ff_nut_subtitle_tags[];
+
 void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val);
 int64_t ff_lsb2full(StreamContext *stream, int64_t lsb);
 int ff_nut_sp_pos_cmp(syncpoint_t *a, syncpoint_t *b);
--- a/nutdec.c	Wed Mar 05 12:06:57 2008 +0000
+++ b/nutdec.c	Wed Mar 05 13:06:49 2008 +0000
@@ -322,7 +322,7 @@
             break;
         case 2:
             st->codec->codec_type = CODEC_TYPE_SUBTITLE;
-//            st->codec->codec_id = codec_get_id(codec_wav_tags, tmp); FIXME
+            st->codec->codec_id = codec_get_id(ff_nut_subtitle_tags, tmp);
             break;
         case 3:
             st->codec->codec_type = CODEC_TYPE_DATA;
--- a/nutenc.c	Wed Mar 05 12:06:57 2008 +0000
+++ b/nutenc.c	Wed Mar 05 13:06:49 2008 +0000
@@ -771,5 +771,5 @@
     write_packet,
     write_trailer,
     .flags = AVFMT_GLOBALHEADER,
-    .codec_tag= (const AVCodecTag*[]){codec_bmp_tags, codec_wav_tags, 0},
+    .codec_tag= (const AVCodecTag*[]){codec_bmp_tags, codec_wav_tags, ff_nut_subtitle_tags, 0},
 };