Opened 17 years ago
Closed 17 years ago
#716 closed defect (fixed)
demuxer_mov.c: be2me_32() cannot work properly
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Component: | demuxer |
Version: | 1.0rc1 | Severity: | normal |
Keywords: | Cc: | liyiadam@… | |
Blocked By: | Blocking: | ||
Reproduced by developer: | no | Analyzed by developer: | no |
Description
In libmpdemux/demuxer_mov.c:
static int mov_check_file(demuxer_t* demuxer){
<snip>
List all compatible brands
for(i = 0; i < ((len-16)/4); i++) {
tmp = be2me_32(stream_read_dword(demuxer->stream));
mp_msg(MSGT_DEMUX,MSGL_V,"ISO: File Type Compatible Brand #%d: %.4s\n",i,(char *)&tmp);
skipped += 4;
}
<snip>
I am working on an LE arch (ADI-Blackfin), and in
"tmp = be2me_32(stream_read_dword(demuxer->stream)); "
be2me_32() will be resolved to:
tmp = ((((stream_read_dword(demuxer->stream)) & 0xff000000) >> 24) | (((stream_read_dword(demuxer->stream)) & 0x00ff0000) >> 8) | (((stream_read_dword(demuxer->stream)) & 0x0000ff00) << 8) | (((stream_read_dword(demuxer->stream)) & 0x000000ff) << 24));
So here stream_read_dwoard() is called FOUR times.
bsap.h:
"#define bswap_32(x) \
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
"
It looks to me if the above code is changed to:
<snip>
List all compatible brands
for(i = 0; i < ((len-16)/4); i++) {
tmp = stream_read_dword(demuxer->stream);
tmp = be2me_32(tmp);
mp_msg(MSGT_DEMUX,MSGL_V,"ISO: File Type Compatible Brand #%d: %.4s\n",i,(char *)&tmp);
skipped += 4;
}
<snip>
Or may change:
static inline int bswap_32(x)
{
return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) |
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24));
|
Change History (2)
comment:1 by , 17 years ago
Summary: | demuxer_mov.c: be2 → demuxer_mov.c: be2me_32() cannot work properly |
---|
comment:2 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This does problem does not exist in SVN versions since quite some time (at least since r21523).