mirror of https://git.ffmpeg.org/ffmpeg.git
fix support for avis with sample_size > packet size
Originally committed as revision 7110 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f24d50e5fc
commit
2b70eb2bed
|
@ -145,10 +145,10 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
|
||||||
if(last_pos == pos || pos == base - 8)
|
if(last_pos == pos || pos == base - 8)
|
||||||
avi->non_interleaved= 1;
|
avi->non_interleaved= 1;
|
||||||
else
|
else
|
||||||
av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0);
|
av_add_index_entry(st, pos, ast->cum_len / FFMAX(1, ast->sample_size), len, 0, key ? AVINDEX_KEYFRAME : 0);
|
||||||
|
|
||||||
if(ast->sample_size)
|
if(ast->sample_size)
|
||||||
ast->cum_len += len / ast->sample_size;
|
ast->cum_len += len;
|
||||||
else
|
else
|
||||||
ast->cum_len ++;
|
ast->cum_len ++;
|
||||||
last_pos= pos;
|
last_pos= pos;
|
||||||
|
@ -355,6 +355,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||||
get_le32(pb); /* buffer size */
|
get_le32(pb); /* buffer size */
|
||||||
get_le32(pb); /* quality */
|
get_le32(pb); /* quality */
|
||||||
ast->sample_size = get_le32(pb); /* sample ssize */
|
ast->sample_size = get_le32(pb); /* sample ssize */
|
||||||
|
ast->cum_len *= FFMAX(1, ast->sample_size);
|
||||||
// av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
|
// av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
|
||||||
|
|
||||||
switch(tag1) {
|
switch(tag1) {
|
||||||
|
@ -378,7 +379,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
|
||||||
av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
|
av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ast->frame_offset= ast->cum_len * FFMAX(ast->sample_size, 1);
|
ast->frame_offset= ast->cum_len;
|
||||||
url_fskip(pb, size - 12 * 4);
|
url_fskip(pb, size - 12 * 4);
|
||||||
break;
|
break;
|
||||||
case MKTAG('s', 't', 'r', 'f'):
|
case MKTAG('s', 't', 'r', 'f'):
|
||||||
|
@ -805,9 +806,9 @@ static int avi_read_idx1(AVFormatContext *s, int size)
|
||||||
if(last_pos == pos)
|
if(last_pos == pos)
|
||||||
avi->non_interleaved= 1;
|
avi->non_interleaved= 1;
|
||||||
else
|
else
|
||||||
av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
|
av_add_index_entry(st, pos, ast->cum_len / FFMAX(1, ast->sample_size), len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
|
||||||
if(ast->sample_size)
|
if(ast->sample_size)
|
||||||
ast->cum_len += len / ast->sample_size;
|
ast->cum_len += len;
|
||||||
else
|
else
|
||||||
ast->cum_len ++;
|
ast->cum_len ++;
|
||||||
last_pos= pos;
|
last_pos= pos;
|
||||||
|
|
Loading…
Reference in New Issue