diff --git a/src/add-ons/media/plugins/avi_reader/avi_reader.cpp b/src/add-ons/media/plugins/avi_reader/avi_reader.cpp index 9e9e40eef5..b9feccf9ad 100644 --- a/src/add-ons/media/plugins/avi_reader/avi_reader.cpp +++ b/src/add-ons/media/plugins/avi_reader/avi_reader.cpp @@ -165,7 +165,8 @@ aviReader::GetStreamInfo(void *_cookie, int64 *frameCount, bigtime_t *duration, // a raw PCM format description.family = B_BEOS_FORMAT_FAMILY; description.u.beos.format = B_BEOS_FORMAT_RAW_AUDIO; - formats.GetFormatFor(description, format); + if (B_OK != formats.GetFormatFor(description, format)) + format->type = B_MEDIA_RAW_AUDIO; format->u.raw_audio.frame_rate = audio_format->frames_per_sec; format->u.raw_audio.channel_count = audio_format->channels; if (audio_format->bits_per_sample <= 8) @@ -187,7 +188,8 @@ aviReader::GetStreamInfo(void *_cookie, int64 *frameCount, bigtime_t *duration, // some encoded format description.family = B_WAV_FORMAT_FAMILY; description.u.wav.codec = audio_format->format_tag; - formats.GetFormatFor(description, format); + if (B_OK != formats.GetFormatFor(description, format)) + format->type = B_MEDIA_ENCODED_AUDIO; format->u.encoded_audio.output.frame_rate = audio_format->frames_per_sec; format->u.encoded_audio.output.channel_count = audio_format->channels; } @@ -209,7 +211,10 @@ aviReader::GetStreamInfo(void *_cookie, int64 *frameCount, bigtime_t *duration, description.family = B_AVI_FORMAT_FAMILY; description.u.avi.codec = 0; - formats.GetFormatFor(description, format); + if (B_OK != formats.GetFormatFor(description, format)) + format->type = B_MEDIA_ENCODED_VIDEO; + format->user_data_type = B_CODEC_TYPE_INFO; + strncpy((char*)format->user_data, "DivX", 4); return B_OK; } diff --git a/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp b/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp index 2dd7f5cf36..67a03d4a4e 100644 --- a/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp +++ b/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp @@ -228,7 +228,7 @@ OpenDMLFile::OdmlReadIndexInfo(int stream_index) TRACE("base_offset %Ld\n", chunk_index_header.base_offset); data->index_base_offset = chunk_index_header.base_offset; - data->index_entry_start = entry->start + sizeof(chunk_index_header) + 8; + data->index_entry_start = entry->start + sizeof(chunk_index_header) + 8; // skip 8 bytes (chunk id + chunk size) data->index_entry_size = chunk_index_header.longs_per_entry * 4; data->index_entry_count = chunk_index_header.entries_used; data->index_entry_pos = 0; @@ -312,19 +312,23 @@ OpenDMLFile::AviGetNextChunkInfo(int stream_index, int64 *start, uint32 *size, b avi_standard_index_entry *entry = (avi_standard_index_entry *)(data->index_chunk + data->index_chunk_entry_pos * data->index_entry_size); - TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, chunk_id "FOURCC_FORMAT" (0x%08x), flags 0x%x, offset %lu, length %lu\n", - stream_index, FOURCC_PARAM(entry->chunk_id), entry->chunk_id, entry->flags, entry->chunk_offset, entry->chunk_length); +// TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, chunk_id "FOURCC_FORMAT" (0x%08x), flags 0x%x, offset %lu, length %lu\n", +// stream_index, FOURCC_PARAM(entry->chunk_id), entry->chunk_id, entry->flags, entry->chunk_offset, entry->chunk_length); data->index_chunk_entry_pos++; data->index_entry_pos++; int real_stream_index = ((entry->chunk_id & 0xff) - '0') * 10 + ((entry->chunk_id >> 8) & 0xff) - '0'; - TRACE("OpenDMLFile::AviGetNextChunkInfo: real_stream_index %d %d %d\n", real_stream_index, ((entry->chunk_id & 0xff) - '0'), ((entry->chunk_id >> 8) & 0xff) - '0'); +// TRACE("OpenDMLFile::AviGetNextChunkInfo: real_stream_index %d %d %d\n", real_stream_index, ((entry->chunk_id & 0xff) - '0'), ((entry->chunk_id >> 8) & 0xff) - '0'); if (real_stream_index == stream_index) { + + TRACE("OpenDMLFile::AviGetNextChunkInfo: stream %d, chunk_id "FOURCC_FORMAT" (0x%08x), flags 0x%x, offset %lu, length %lu\n", + stream_index, FOURCC_PARAM(entry->chunk_id), entry->chunk_id, entry->flags, entry->chunk_offset, entry->chunk_length); + *keyframe = entry->flags & AVIIF_KEYFRAME; - *start = data->index_base_offset + entry->chunk_offset + 8; + *start = data->index_base_offset + entry->chunk_offset + 8; // skip 8 bytes (chunk id + chunk size) *size = entry->chunk_length; return true; }