| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Maxis XA (.xa) File Demuxer | 2 * Maxis XA (.xa) File Demuxer |
| 3 * Copyright (c) 2008 Robert Marston | 3 * Copyright (c) 2008 Robert Marston |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 ByteIOContext *pb = s->pb; | 99 ByteIOContext *pb = s->pb; |
| 100 unsigned int packet_size; | 100 unsigned int packet_size; |
| 101 int ret; | 101 int ret; |
| 102 | 102 |
| 103 if(xa->sent_bytes > xa->out_size) | 103 if(xa->sent_bytes > xa->out_size) |
| 104 return AVERROR(EIO); | 104 return AVERROR(EIO); |
| 105 /* 1 byte header and 14 bytes worth of samples * number channels per block *
/ | 105 /* 1 byte header and 14 bytes worth of samples * number channels per block *
/ |
| 106 packet_size = 15*st->codec->channels; | 106 packet_size = 15*st->codec->channels; |
| 107 | 107 |
| 108 ret = av_get_packet(pb, pkt, packet_size); | 108 ret = av_get_packet(pb, pkt, packet_size); |
| 109 if(ret != packet_size) | 109 if(ret < 0) |
| 110 return AVERROR(EIO); | 110 return ret; |
| 111 | 111 |
| 112 pkt->stream_index = st->index; | 112 pkt->stream_index = st->index; |
| 113 xa->sent_bytes += packet_size; | 113 xa->sent_bytes += packet_size; |
| 114 pkt->pts = xa->audio_frame_counter; | 114 pkt->pts = xa->audio_frame_counter; |
| 115 /* 14 bytes Samples per channel with 2 samples per byte */ | 115 /* 14 bytes Samples per channel with 2 samples per byte */ |
| 116 xa->audio_frame_counter += 28 * st->codec->channels; | 116 xa->audio_frame_counter += 28 * st->codec->channels; |
| 117 | 117 |
| 118 return ret; | 118 return ret; |
| 119 } | 119 } |
| 120 | 120 |
| 121 AVInputFormat xa_demuxer = { | 121 AVInputFormat xa_demuxer = { |
| 122 "xa", | 122 "xa", |
| 123 NULL_IF_CONFIG_SMALL("Maxis XA File Format"), | 123 NULL_IF_CONFIG_SMALL("Maxis XA File Format"), |
| 124 sizeof(MaxisXADemuxContext), | 124 sizeof(MaxisXADemuxContext), |
| 125 xa_probe, | 125 xa_probe, |
| 126 xa_read_header, | 126 xa_read_header, |
| 127 xa_read_packet, | 127 xa_read_packet, |
| 128 }; | 128 }; |
| OLD | NEW |