make MediaPlayer recognize the video track, plus small cleanup
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6400 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -165,7 +165,8 @@ aviReader::GetStreamInfo(void *_cookie, int64 *frameCount, bigtime_t *duration,
|
|||||||
// a raw PCM format
|
// a raw PCM format
|
||||||
description.family = B_BEOS_FORMAT_FAMILY;
|
description.family = B_BEOS_FORMAT_FAMILY;
|
||||||
description.u.beos.format = B_BEOS_FORMAT_RAW_AUDIO;
|
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.frame_rate = audio_format->frames_per_sec;
|
||||||
format->u.raw_audio.channel_count = audio_format->channels;
|
format->u.raw_audio.channel_count = audio_format->channels;
|
||||||
if (audio_format->bits_per_sample <= 8)
|
if (audio_format->bits_per_sample <= 8)
|
||||||
@@ -187,7 +188,8 @@ aviReader::GetStreamInfo(void *_cookie, int64 *frameCount, bigtime_t *duration,
|
|||||||
// some encoded format
|
// some encoded format
|
||||||
description.family = B_WAV_FORMAT_FAMILY;
|
description.family = B_WAV_FORMAT_FAMILY;
|
||||||
description.u.wav.codec = audio_format->format_tag;
|
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.frame_rate = audio_format->frames_per_sec;
|
||||||
format->u.encoded_audio.output.channel_count = audio_format->channels;
|
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.family = B_AVI_FORMAT_FAMILY;
|
||||||
description.u.avi.codec = 0;
|
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;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ OpenDMLFile::OdmlReadIndexInfo(int stream_index)
|
|||||||
TRACE("base_offset %Ld\n", chunk_index_header.base_offset);
|
TRACE("base_offset %Ld\n", chunk_index_header.base_offset);
|
||||||
|
|
||||||
data->index_base_offset = 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_size = chunk_index_header.longs_per_entry * 4;
|
||||||
data->index_entry_count = chunk_index_header.entries_used;
|
data->index_entry_count = chunk_index_header.entries_used;
|
||||||
data->index_entry_pos = 0;
|
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);
|
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",
|
// 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);
|
// 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_chunk_entry_pos++;
|
||||||
data->index_entry_pos++;
|
data->index_entry_pos++;
|
||||||
|
|
||||||
int real_stream_index = ((entry->chunk_id & 0xff) - '0') * 10 + ((entry->chunk_id >> 8) & 0xff) - '0';
|
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) {
|
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;
|
*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;
|
*size = entry->chunk_length;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user