OSDN Git Service

nut: support textual data
authorLuca Barbato <lu_zero@gentoo.org>
Thu, 25 Oct 2012 12:05:40 +0000 (14:05 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 29 Oct 2012 11:03:28 +0000 (12:03 +0100)
Plain text (utf8 encoded) data can be muxed and demuxed in nut.

doc/nut.texi
libavformat/nut.c
libavformat/nut.h
libavformat/nutdec.c

index 1c23934..9b84241 100644 (file)
@@ -66,6 +66,12 @@ PFD[32]   would for example be signed 32 bit little-endian IEEE float
 @item DVBS   @tab DVB subtitles
 @end multitable
 
+@section Raw Data
+
+@multitable @columnfractions .4 .4
+@item UTF8   @tab Raw UTF-8
+@end multitable
+
 @section Codecs
 
 @multitable @columnfractions .4 .4
index e367d1c..85b126b 100644 (file)
@@ -33,6 +33,11 @@ const AVCodecTag ff_nut_subtitle_tags[] = {
     { AV_CODEC_ID_NONE        , 0                         }
 };
 
+const AVCodecTag ff_nut_data_tags[] = {
+    { AV_CODEC_ID_TEXT        , MKTAG('U', 'T', 'F', '8') },
+    { AV_CODEC_ID_NONE        , 0                         }
+};
+
 const AVCodecTag ff_nut_video_tags[] = {
     { AV_CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', 15 ) },
     { AV_CODEC_ID_RAWVIDEO, MKTAG('B', 'G', 'R', 15 ) },
@@ -117,7 +122,7 @@ const AVCodecTag ff_nut_audio_tags[] = {
 
 const AVCodecTag * const ff_nut_codec_tags[] = {
     ff_nut_video_tags, ff_nut_audio_tags, ff_nut_subtitle_tags,
-    ff_codec_bmp_tags, ff_codec_wav_tags, 0
+    ff_codec_bmp_tags, ff_codec_wav_tags, ff_nut_data_tags, 0
 };
 
 void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
index a91a109..5f624eb 100644 (file)
@@ -106,6 +106,7 @@ typedef struct NUTContext {
 extern const AVCodecTag ff_nut_subtitle_tags[];
 extern const AVCodecTag ff_nut_video_tags[];
 extern const AVCodecTag ff_nut_audio_tags[];
+extern const AVCodecTag ff_nut_data_tags[];
 
 extern const AVCodecTag * const ff_nut_codec_tags[];
 
index 9b1891f..9ce0519 100644 (file)
@@ -371,6 +371,7 @@ static int decode_stream_header(NUTContext *nut)
         break;
     case 3:
         st->codec->codec_type = AVMEDIA_TYPE_DATA;
+        st->codec->codec_id   = ff_codec_get_id(ff_nut_data_tags, tmp);
         break;
     default:
         av_log(s, AV_LOG_ERROR, "unknown stream class (%d)\n", class);