]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/libnut.c
Skip over unknown extended_content_header tags.
[ffmpeg] / libavformat / libnut.c
index d224d8d5c5b2783acd11f4fd635d3cc9ea7ac4c7..f5423069f10a0a107ad25a900c22f387f21a7a7f 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ * NUT (de)muxing via libnut
+ * copyright (c) 2006 Oded Shimon <ods15@ods15.dyndns.org>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file libnut.c
+ * NUT demuxing and muxing via libnut.
+ * @author Oded Shimon <ods15@ods15.dyndns.org>
+ */
+
 #include "avformat.h"
 #include "riff.h"
 #include <libnut.h>
@@ -27,7 +54,7 @@ static int av_write(void * h, size_t len, const uint8_t * buf) {
 
 static int nut_write_header(AVFormatContext * avf) {
     NUTContext * priv = avf->priv_data;
-    ByteIOContext * bc = &avf->pb;
+    ByteIOContext * bc = avf->pb;
     nut_muxer_opts_t mopts = {
         .output = {
             .priv = bc,
@@ -56,8 +83,8 @@ static int nut_write_header(AVFormatContext * avf) {
         else fourcc = codec_get_tag(nut_tags, codec->codec_id);
 
         if (!fourcc) {
-            if (codec->codec_type == CODEC_TYPE_VIDEO) fourcc = codec_get_bmp_tag(codec->codec_id);
-            if (codec->codec_type == CODEC_TYPE_AUDIO) fourcc = codec_get_wav_tag(codec->codec_id);
+            if (codec->codec_type == CODEC_TYPE_VIDEO) fourcc = codec_get_tag(codec_bmp_tags, codec->codec_id);
+            if (codec->codec_type == CODEC_TYPE_AUDIO) fourcc = codec_get_tag(codec_wav_tags, codec->codec_id);
         }
 
         s[i].fourcc_len = 4;
@@ -110,7 +137,7 @@ static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
 }
 
 static int nut_write_trailer(AVFormatContext * avf) {
-    ByteIOContext * bc = &avf->pb;
+    ByteIOContext * bc = avf->pb;
     NUTContext * priv = avf->priv_data;
     int i;
 
@@ -123,8 +150,8 @@ static int nut_write_trailer(AVFormatContext * avf) {
     return 0;
 }
 
-AVOutputFormat nut_muxer = {
-    "nut",
+AVOutputFormat libnut_muxer = {
+    "libnut",
     "nut format",
     "video/x-nut",
     "nut",
@@ -139,7 +166,7 @@ AVOutputFormat nut_muxer = {
 #endif //CONFIG_MUXERS
 
 static int nut_probe(AVProbeData *p) {
-    if (p->buf_size >= ID_LENGTH && !memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
+    if (!memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
 
     return 0;
 }
@@ -160,7 +187,7 @@ static off_t av_seek(void * h, long long pos, int whence) {
 
 static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
     NUTContext * priv = avf->priv_data;
-    ByteIOContext * bc = &avf->pb;
+    ByteIOContext * bc = avf->pb;
     nut_demuxer_opts_t dopts = {
         .input = {
             .priv = bc,
@@ -208,14 +235,14 @@ static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
         switch(s[i].type) {
         case NUT_AUDIO_CLASS:
             st->codec->codec_type = CODEC_TYPE_AUDIO;
-            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_wav_id(st->codec->codec_tag);
+            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_id(codec_wav_tags, st->codec->codec_tag);
 
             st->codec->channels = s[i].channel_count;
             st->codec->sample_rate = s[i].samplerate_num / s[i].samplerate_denom;
             break;
         case NUT_VIDEO_CLASS:
             st->codec->codec_type = CODEC_TYPE_VIDEO;
-            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_bmp_id(st->codec->codec_tag);
+            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_id(codec_bmp_tags, st->codec->codec_tag);
 
             st->codec->width = s[i].width;
             st->codec->height = s[i].height;
@@ -245,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
     if (pd.flags & NUT_FLAG_KEY) pkt->flags |= PKT_FLAG_KEY;
     pkt->pts = pd.pts;
     pkt->stream_index = pd.stream;
-    pkt->pos = url_ftell(&avf->pb);
+    pkt->pos = url_ftell(avf->pb);
 
     ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
 
@@ -270,8 +297,8 @@ static int nut_read_close(AVFormatContext *s) {
     return 0;
 }
 
-AVInputFormat nut_demuxer = {
-    "nut",
+AVInputFormat libnut_demuxer = {
+    "libnut",
     "nut format",
     sizeof(NUTContext),
     nut_probe,