add h264 and ac3 support in matroska

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David McPaul
2009-04-13 06:14:30 +00:00
parent c1ee694618
commit 4e5a71dd76
@@ -117,7 +117,6 @@ GetAudioFormat(media_format *format, const char *codec, void *private_data, int
}
if (IS_CODEC(codec, "A_MPEG/L3")) {
media_format_description description;
description.family = B_MPEG_FORMAT_FAMILY;
description.u.mpeg.id = B_MPEG_1_AUDIO_LAYER_3;
if (formats.GetFormatFor(description, format) != B_OK)
@@ -125,6 +124,25 @@ GetAudioFormat(media_format *format, const char *codec, void *private_data, int
return B_OK;
}
if (IS_CODEC(codec, "A_AC3")) {
description.family = B_WAV_FORMAT_FAMILY;
description.u.wav.codec = 0x2000;
if (B_OK != formats.GetFormatFor(description, format))
format->type = B_MEDIA_ENCODED_AUDIO;
// Set the DecoderConfigSize (Not that haiku seems to use it)
if (private_size > 0) {
TRACE("AC3 private data found, size is %d\n", private_size);
if (format->SetMetaData(private_data, private_size) != B_OK) {
ERROR("Failed to set Decoder Config\n");
return B_ERROR;
}
}
return B_OK;
}
// The codec name only has to start with A_AAC to be AAC
// The rest is some sort of hint for creating the codec specific data
@@ -179,8 +197,26 @@ GetVideoFormat(media_format *format, const char *codec, void *private_data, int
return B_OK;
}
if (IS_CODEC(codec, "V_MPEG4/ISO/AVC")) {
printf("TODO: MPEG4/AVC a.k.a h264\n");
return B_ERROR;
uint64 codecid = 'avc1';
description.family = B_QUICKTIME_FORMAT_FAMILY;
description.u.quicktime.codec = codecid;
if (B_OK != formats.GetFormatFor(description, format))
format->type = B_MEDIA_ENCODED_VIDEO;
format->user_data_type = B_CODEC_TYPE_INFO;
*(uint32 *)format->user_data = codecid; format->user_data[4] = 0;
// Set the DecoderConfigSize (Not that haiku seems to use it)
if (private_size > 0) {
TRACE("AVC private data found, size is %d\n", private_size);
if (format->SetMetaData(private_data, private_size) != B_OK) {
ERROR("Failed to set Decoder Config\n");
return B_ERROR;
}
}
return B_OK;
}
TRACE("not a codec!\n");