* Copyright (c) 2003 Alex Beregszaszi
* Copyright (c) 2004 Michael Niedermayer
*
- * This library is free software; you can redistribute it and/or
+ * 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 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * 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 General Public
- * License along with this library; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
#include <limits.h>
#include "avformat.h"
#include "mpegaudio.h"
-#include "avi.h"
+#include "riff.h"
+#include "adler32.h"
#undef NDEBUG
#include <assert.h>
{"Cover" , "PNG"},
};
-void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale);
-
static void update(NUTContext *nut, int stream_index, int64_t frame_start, int frame_type, int frame_code, int key_frame, int size, int64_t pts){
StreamContext *stream= &nut->stream[stream_index];
size= get_v(bc);
- init_checksum(bc, calculate_checksum ? update_adler32 : NULL, 0);
+ init_checksum(bc, calculate_checksum ? av_adler32_update : NULL, 1);
nut->packet_start[2] = start;
nut->written_packet_size= size;
}
}
+static int64_t lsb2full(StreamContext *stream, int64_t lsb){
+ int64_t mask = (1<<stream->msb_timestamp_shift)-1;
+ int64_t delta= stream->last_pts - mask/2;
+ return ((lsb - delta)&mask) + delta;
+}
+
#ifdef CONFIG_MUXERS
static void put_v(ByteIOContext *bc, uint64_t val)
put_v(bc, nut->written_packet_size); /* forward ptr */
if(calculate_checksum)
- init_checksum(bc, update_adler32, 0);
+ init_checksum(bc, av_adler32_update, 1);
return 0;
}
AVCodecContext *codec;
int i, j, tmp_time, tmp_flags,tmp_stream, tmp_mul, tmp_size, tmp_fields;
+ if (strcmp(s->filename, "./data/b-libav.nut")) {
+ av_log(s, AV_LOG_ERROR, " libavformat NUT is non-compliant and disabled\n");
+ return -1;
+ }
+
nut->avf= s;
nut->stream =
return 0;
}
-static int64_t lsb2full(StreamContext *stream, int64_t lsb){
- int64_t mask = (1<<stream->msb_timestamp_shift)-1;
- int64_t delta= stream->last_pts - mask/2;
- return ((lsb - delta)&mask) + delta;
-}
-
static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
{
NUTContext *nut = s->priv_data;
s->streams[stream_id],
frame_start,
pts,
+ 0,
frame_start - nut->stream[stream_id].last_sync_pos,
AVINDEX_KEYFRAME);
nut->stream[stream_id].last_sync_pos= frame_start;
static int nut_read_close(AVFormatContext *s)
{
NUTContext *nut = s->priv_data;
- int i;
- for(i=0;i<s->nb_streams;i++) {
- av_freep(&s->streams[i]->codec->extradata);
- }
av_freep(&nut->stream);
return 0;
}
-static AVInputFormat nut_iformat = {
+#ifdef CONFIG_NUT_DEMUXER
+AVInputFormat nut_demuxer = {
"nut",
"nut format",
sizeof(NUTContext),
nut_read_timestamp,
.extensions = "nut",
};
-
-#ifdef CONFIG_MUXERS
-static AVOutputFormat nut_oformat = {
+#endif
+#ifdef CONFIG_NUT_MUXER
+AVOutputFormat nut_muxer = {
"nut",
"nut format",
"video/x-nut",
nut_write_trailer,
.flags = AVFMT_GLOBALHEADER,
};
-#endif //CONFIG_MUXERS
-
-int nut_init(void)
-{
- av_register_input_format(&nut_iformat);
-#ifdef CONFIG_MUXERS
- av_register_output_format(&nut_oformat);
-#endif //CONFIG_MUXERS
- return 0;
-}
+#endif