*
* 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
static int mm_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- MmDemuxContext *mm = (MmDemuxContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ MmDemuxContext *mm = s->priv_data;
+ ByteIOContext *pb = s->pb;
AVStream *st;
unsigned int type, length;
/* video stream */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_MMVIDEO;
st->codec->codec_tag = 0; /* no fourcc */
if (length == MM_HEADER_LEN_AV) {
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
st->codec->codec_type = CODEC_TYPE_AUDIO;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->codec_id = CODEC_ID_PCM_U8;
static int mm_read_packet(AVFormatContext *s,
AVPacket *pkt)
{
- MmDemuxContext *mm = (MmDemuxContext *)s->priv_data;
- ByteIOContext *pb = &s->pb;
+ MmDemuxContext *mm = s->priv_data;
+ ByteIOContext *pb = s->pb;
unsigned char preamble[MM_PREAMBLE_SIZE];
unsigned char pal[MM_PALETTE_SIZE];
unsigned int type, length;
while(1) {
if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
- return AVERROR_IO;
+ return AVERROR(EIO);
}
type = AV_RL16(&preamble[0]);
case MM_TYPE_PALETTE :
url_fseek(pb, 4, SEEK_CUR); /* unknown data */
if (get_buffer(pb, pal, MM_PALETTE_SIZE) != MM_PALETTE_SIZE)
- return AVERROR_IO;
+ return AVERROR(EIO);
url_fseek(pb, length - (4 + MM_PALETTE_SIZE), SEEK_CUR);
for (i=0; i<MM_PALETTE_COUNT; i++) {
case MM_TYPE_INTER_HHV :
/* output preamble + data */
if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
- return AVERROR_IO;
+ return AVERROR(EIO);
pkt->size = length + MM_PREAMBLE_SIZE;
pkt->stream_index = 0;
pkt->pts = mm->video_pts++;
return 0;
case MM_TYPE_AUDIO :
- if (av_get_packet(&s->pb, pkt, length)<0)
- return AVERROR_NOMEM;
+ if (av_get_packet(s->pb, pkt, length)<0)
+ return AVERROR(ENOMEM);
pkt->size = length;
pkt->stream_index = 1;
pkt->pts = mm->audio_pts++;