-/*
+/*
* AU encoder and decoder
* Copyright (c) 2001 Fabrice Bellard.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
*/
#include "avformat.h"
-#include "avi.h"
+#include "allformats.h"
+#include "riff.h"
/* if we don't know the size in advance */
#define AU_UNKOWN_SIZE ((uint32_t)(~0))
{ 0, 0 },
};
-#ifdef CONFIG_ENCODERS
+#ifdef CONFIG_MUXERS
/* AUDIO_FILE header */
static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
{
s->priv_data = NULL;
/* format header */
- if (put_au_header(pb, &s->streams[0]->codec) < 0) {
+ if (put_au_header(pb, s->streams[0]->codec) < 0) {
return -1;
}
return 0;
}
-#endif //CONFIG_ENCODERS
+#endif //CONFIG_MUXERS
static int au_probe(AVProbeData *p)
{
return -1;
size = get_be32(pb); /* header size */
get_be32(pb); /* data size */
-
+
id = get_be32(pb);
rate = get_be32(pb);
channels = get_be32(pb);
-
+
codec = codec_get_id(codec_au_tags, id);
if (size >= 24) {
st = av_new_stream(s, 0);
if (!st)
return -1;
- st->codec.codec_type = CODEC_TYPE_AUDIO;
- st->codec.codec_tag = id;
- st->codec.codec_id = codec;
- st->codec.channels = channels;
- st->codec.sample_rate = rate;
+ st->codec->codec_type = CODEC_TYPE_AUDIO;
+ st->codec->codec_tag = id;
+ st->codec->codec_id = codec;
+ st->codec->channels = channels;
+ st->codec->sample_rate = rate;
av_set_pts_info(st, 64, 1, rate);
return 0;
}
if (url_feof(&s->pb))
return AVERROR_IO;
- if (av_new_packet(pkt, MAX_SIZE))
+ ret= av_get_packet(&s->pb, pkt, MAX_SIZE);
+ if (ret < 0)
return AVERROR_IO;
pkt->stream_index = 0;
- pkt->flags |= PKT_FLAG_KEY;
- ret = get_buffer(&s->pb, pkt->data, pkt->size);
- if (ret < 0)
- av_free_packet(pkt);
/* note: we need to modify the packet size here to handle the last
packet */
pkt->size = ret;
return 0;
}
-static AVInputFormat au_iformat = {
+#ifdef CONFIG_AU_DEMUXER
+AVInputFormat au_demuxer = {
"au",
"SUN AU Format",
0,
au_read_close,
pcm_read_seek,
};
+#endif
-#ifdef CONFIG_ENCODERS
-static AVOutputFormat au_oformat = {
+#ifdef CONFIG_AU_MUXER
+AVOutputFormat au_muxer = {
"au",
"SUN AU Format",
"audio/basic",
au_write_packet,
au_write_trailer,
};
-#endif //CONFIG_ENCODERS
-
-int au_init(void)
-{
- av_register_input_format(&au_iformat);
-#ifdef CONFIG_ENCODERS
- av_register_output_format(&au_oformat);
-#endif //CONFIG_ENCODERS
- return 0;
-}
+#endif //CONFIG_AU_MUXER