On 10/29/12 1:09 AM, Janne Grunau wrote:
On 2012-10-25 14:05:40 +0200, Luca Barbato wrote:
Plain text (utf8 encoded) data can be muxed and demuxed in nut.
---
  libavformat/nut.c    | 7 ++++++-
  libavformat/nut.h    | 1 +
  libavformat/nutdec.c | 1 +
  3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/nut.c b/libavformat/nut.c
index e367d1c..85b126b 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -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){
diff --git a/libavformat/nut.h b/libavformat/nut.h
index a91a109..5f624eb 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -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[];

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 9b1891f..30b82ec 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -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_subtitle_tags, tmp);

what did you mean by stray? Did you remove the whole line or did you
replace ff_nut_subtitle_tags with ff_nut_data_tags?

replaced with ff_nut_data_tags

In the second case it feels a little strange to use the same codec_id for 
subtitles and data.

The main difference is that pure text subtitles are supposed to be rendered on screen, pure text data is supposed to be otherwise processed (my specific case they are either metrics or other data fed to a completely different system)

I would also expect support for raw binary data.

We don't have a codec tag for it and if text data is within the underspecification of nut, binary data isn't exactly defined anyhow.

Care to extend doc/nut.texi?

Sure.

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to