summaryrefslogtreecommitdiffstats
path: root/libavformat/mmf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/mmf.c')
-rw-r--r--libavformat/mmf.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 06d4a2b..18b69d4 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -2,20 +2,20 @@
* Yamaha SMAF format
* Copyright (c) 2005 Vidar Madsen
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * 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.
*
- * Libav 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 Lesser General Public
- * License along with Libav; 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 "avformat.h"
@@ -68,7 +68,7 @@ static int mmf_write_header(AVFormatContext *s)
rate = mmf_rate_code(s->streams[0]->codec->sample_rate);
if(rate < 0) {
- av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate);
+ av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d, supported are 4000, 8000, 11025, 22050 and 44100\n", s->streams[0]->codec->sample_rate);
return -1;
}
@@ -76,8 +76,8 @@ static int mmf_write_header(AVFormatContext *s)
avio_wb32(pb, 0);
pos = ff_start_tag(pb, "CNTI");
avio_w8(pb, 0); /* class */
- avio_w8(pb, 0); /* type */
- avio_w8(pb, 0); /* code type */
+ avio_w8(pb, 1); /* type */
+ avio_w8(pb, 1); /* code type */
avio_w8(pb, 0); /* status */
avio_w8(pb, 0); /* counts */
avio_write(pb, "VN:libavcodec,", sizeof("VN:libavcodec,") -1); /* metadata ("ST:songtitle,VN:version,...") */
@@ -265,7 +265,7 @@ static int mmf_read_packet(AVFormatContext *s,
MMFContext *mmf = s->priv_data;
int ret, size;
- if (s->pb->eof_reached)
+ if (url_feof(s->pb))
return AVERROR(EIO);
size = MAX_SIZE;
@@ -275,17 +275,13 @@ static int mmf_read_packet(AVFormatContext *s,
if(!size)
return AVERROR(EIO);
- if (av_new_packet(pkt, size))
- return AVERROR(EIO);
- pkt->stream_index = 0;
-
- ret = avio_read(s->pb, pkt->data, pkt->size);
+ ret = av_get_packet(s->pb, pkt, size);
if (ret < 0)
- av_free_packet(pkt);
+ return ret;
+ pkt->stream_index = 0;
mmf->data_size -= ret;
- pkt->size = ret;
return ret;
}
OpenPOWER on IntegriCloud