provide zero media_header, and let reader or decoder set up missing values
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6538 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ffaa002659
commit
f2ca77a1b1
@ -41,6 +41,7 @@ BMediaTrack::GetCodecInfo(media_codec_info *mci) const
|
|||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
*mci = fMCI;
|
*mci = fMCI;
|
||||||
|
snprintf(mci->pretty_name, sizeof(mci->pretty_name), "OpenBeOS Media Kit:\n%s", fMCI.pretty_name);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@ -126,21 +127,20 @@ BMediaTrack::ReadFrames(void *out_buffer,
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
status_t result;
|
status_t result;
|
||||||
|
media_header header;
|
||||||
|
|
||||||
media_header temp_header;
|
memset(&header, 0, sizeof(header)); // always clear it first, as the decoder doesn't set all fields
|
||||||
if (!mh)
|
|
||||||
mh = &temp_header;
|
|
||||||
else
|
|
||||||
memset(mh, 0, sizeof(*mh)); // clear it first, as the decoder doesn't set all fields
|
|
||||||
|
|
||||||
result = fDecoder->Decode(out_buffer, out_frameCount, mh, info);
|
result = fDecoder->Decode(out_buffer, out_frameCount, &header, info);
|
||||||
if (result == B_OK) {
|
if (result == B_OK) {
|
||||||
fCurFrame += *out_frameCount;
|
fCurFrame += *out_frameCount;
|
||||||
fCurTime = mh->start_time;
|
fCurTime = header.start_time;
|
||||||
} else {
|
} else {
|
||||||
printf("BMediaTrack::ReadFrames: decoder returned error 0x%08lx (%s)\n", result, strerror(result));
|
printf("BMediaTrack::ReadFrames: decoder returned error 0x%08lx (%s)\n", result, strerror(result));
|
||||||
*out_frameCount = 0;
|
*out_frameCount = 0;
|
||||||
}
|
}
|
||||||
|
if (mh)
|
||||||
|
*mh = header;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,13 +274,15 @@ BMediaTrack::ReadChunk(char **out_buffer,
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
status_t result;
|
status_t result;
|
||||||
media_header temp_header;
|
media_header header;
|
||||||
if (!mh)
|
|
||||||
mh = &temp_header;
|
|
||||||
|
|
||||||
result = fExtractor->GetNextChunk(fStream, (void **)out_buffer, out_size, mh);
|
memset(&header, 0, sizeof(header)); // always clear it first, as the reader doesn't set all fields
|
||||||
|
|
||||||
fCurTime = mh->start_time;
|
result = fExtractor->GetNextChunk(fStream, (void **)out_buffer, out_size, &header);
|
||||||
|
|
||||||
|
fCurTime = header.start_time;
|
||||||
|
if (mh)
|
||||||
|
*mh = header;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user