Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
490c6bda
Unverified
Commit
490c6bda
authored
Jan 08, 2016
by
Rodger Combs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/mov: reindent
Reviewed-By:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
697400ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
78 deletions
+78
-78
mov.c
libavformat/mov.c
+78
-78
No files found.
libavformat/mov.c
View file @
490c6bda
...
...
@@ -5075,94 +5075,94 @@ static void mov_read_chapters(AVFormatContext *s)
int
chapter_track
;
for
(
j
=
0
;
j
<
mov
->
nb_chapter_tracks
;
j
++
)
{
chapter_track
=
mov
->
chapter_tracks
[
j
];
st
=
NULL
;
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
if
(
s
->
streams
[
i
]
->
id
==
chapter_track
)
{
st
=
s
->
streams
[
i
];
break
;
chapter_track
=
mov
->
chapter_tracks
[
j
];
st
=
NULL
;
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
if
(
s
->
streams
[
i
]
->
id
==
chapter_track
)
{
st
=
s
->
streams
[
i
];
break
;
}
if
(
!
st
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Referenced QT chapter track not found
\n
"
);
continue
;
}
if
(
!
st
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Referenced QT chapter track not found
\n
"
);
continue
;
}
sc
=
st
->
priv_data
;
cur_pos
=
avio_tell
(
sc
->
pb
);
sc
=
st
->
priv_data
;
cur_pos
=
avio_tell
(
sc
->
pb
);
if
(
st
->
codecpar
->
codec_type
==
AVMEDIA_TYPE_VIDEO
)
{
st
->
disposition
|=
AV_DISPOSITION_ATTACHED_PIC
|
AV_DISPOSITION_TIMED_THUMBNAILS
;
if
(
st
->
nb_index_entries
)
{
// Retrieve the first frame, if possible
AVPacket
pkt
;
AVIndexEntry
*
sample
=
&
st
->
index_entries
[
0
];
if
(
avio_seek
(
sc
->
pb
,
sample
->
pos
,
SEEK_SET
)
!=
sample
->
pos
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Failed to retrieve first frame
\n
"
);
goto
finish
;
}
if
(
st
->
codecpar
->
codec_type
==
AVMEDIA_TYPE_VIDEO
)
{
st
->
disposition
|=
AV_DISPOSITION_ATTACHED_PIC
|
AV_DISPOSITION_TIMED_THUMBNAILS
;
if
(
st
->
nb_index_entries
)
{
// Retrieve the first frame, if possible
AVPacket
pkt
;
AVIndexEntry
*
sample
=
&
st
->
index_entries
[
0
];
if
(
avio_seek
(
sc
->
pb
,
sample
->
pos
,
SEEK_SET
)
!=
sample
->
pos
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Failed to retrieve first frame
\n
"
);
goto
finish
;
}
if
(
av_get_packet
(
sc
->
pb
,
&
pkt
,
sample
->
size
)
<
0
)
goto
finish
;
if
(
av_get_packet
(
sc
->
pb
,
&
pkt
,
sample
->
size
)
<
0
)
goto
finish
;
st
->
attached_pic
=
pkt
;
st
->
attached_pic
.
stream_index
=
st
->
index
;
st
->
attached_pic
.
flags
|=
AV_PKT_FLAG_KEY
;
}
}
else
{
st
->
codecpar
->
codec_type
=
AVMEDIA_TYPE_DATA
;
st
->
codecpar
->
codec_id
=
AV_CODEC_ID_BIN_DATA
;
st
->
discard
=
AVDISCARD_ALL
;
for
(
i
=
0
;
i
<
st
->
nb_index_entries
;
i
++
)
{
AVIndexEntry
*
sample
=
&
st
->
index_entries
[
i
];
int64_t
end
=
i
+
1
<
st
->
nb_index_entries
?
st
->
index_entries
[
i
+
1
].
timestamp
:
st
->
duration
;
uint8_t
*
title
;
uint16_t
ch
;
int
len
,
title_len
;
if
(
end
<
sample
->
timestamp
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"ignoring stream duration which is shorter than chapters
\n
"
);
end
=
AV_NOPTS_VALUE
;
}
st
->
attached_pic
=
pkt
;
st
->
attached_pic
.
stream_index
=
st
->
index
;
st
->
attached_pic
.
flags
|=
AV_PKT_FLAG_KEY
;
}
}
else
{
st
->
codecpar
->
codec_type
=
AVMEDIA_TYPE_DATA
;
st
->
codecpar
->
codec_id
=
AV_CODEC_ID_BIN_DATA
;
st
->
discard
=
AVDISCARD_ALL
;
for
(
i
=
0
;
i
<
st
->
nb_index_entries
;
i
++
)
{
AVIndexEntry
*
sample
=
&
st
->
index_entries
[
i
];
int64_t
end
=
i
+
1
<
st
->
nb_index_entries
?
st
->
index_entries
[
i
+
1
].
timestamp
:
st
->
duration
;
uint8_t
*
title
;
uint16_t
ch
;
int
len
,
title_len
;
if
(
end
<
sample
->
timestamp
)
{
av_log
(
s
,
AV_LOG_WARNING
,
"ignoring stream duration which is shorter than chapters
\n
"
);
end
=
AV_NOPTS_VALUE
;
}
if
(
avio_seek
(
sc
->
pb
,
sample
->
pos
,
SEEK_SET
)
!=
sample
->
pos
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Chapter %d not found in file
\n
"
,
i
);
goto
finish
;
}
if
(
avio_seek
(
sc
->
pb
,
sample
->
pos
,
SEEK_SET
)
!=
sample
->
pos
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Chapter %d not found in file
\n
"
,
i
);
goto
finish
;
}
// the first two bytes are the length of the title
len
=
avio_rb16
(
sc
->
pb
);
if
(
len
>
sample
->
size
-
2
)
continue
;
title_len
=
2
*
len
+
1
;
if
(
!
(
title
=
av_mallocz
(
title_len
)))
goto
finish
;
// The samples could theoretically be in any encoding if there's an encd
// atom following, but in practice are only utf-8 or utf-16, distinguished
// instead by the presence of a BOM
if
(
!
len
)
{
title
[
0
]
=
0
;
}
else
{
ch
=
avio_rb16
(
sc
->
pb
);
if
(
ch
==
0xfeff
)
avio_get_str16be
(
sc
->
pb
,
len
,
title
,
title_len
);
else
if
(
ch
==
0xfffe
)
avio_get_str16le
(
sc
->
pb
,
len
,
title
,
title_len
);
else
{
AV_WB16
(
title
,
ch
);
if
(
len
==
1
||
len
==
2
)
title
[
len
]
=
0
;
else
avio_get_str
(
sc
->
pb
,
INT_MAX
,
title
+
2
,
len
-
1
);
}
}
// the first two bytes are the length of the title
len
=
avio_rb16
(
sc
->
pb
);
if
(
len
>
sample
->
size
-
2
)
continue
;
title_len
=
2
*
len
+
1
;
if
(
!
(
title
=
av_mallocz
(
title_len
)))
goto
finish
;
// The samples could theoretically be in any encoding if there's an encd
// atom following, but in practice are only utf-8 or utf-16, distinguished
// instead by the presence of a BOM
if
(
!
len
)
{
title
[
0
]
=
0
;
}
else
{
ch
=
avio_rb16
(
sc
->
pb
);
if
(
ch
==
0xfeff
)
avio_get_str16be
(
sc
->
pb
,
len
,
title
,
title_len
);
else
if
(
ch
==
0xfffe
)
avio_get_str16le
(
sc
->
pb
,
len
,
title
,
title_len
);
else
{
AV_WB16
(
title
,
ch
);
if
(
len
==
1
||
len
==
2
)
title
[
len
]
=
0
;
else
avio_get_str
(
sc
->
pb
,
INT_MAX
,
title
+
2
,
len
-
1
);
avpriv_new_chapter
(
s
,
i
,
st
->
time_base
,
sample
->
timestamp
,
end
,
title
);
av_freep
(
&
title
);
}
}
avpriv_new_chapter
(
s
,
i
,
st
->
time_base
,
sample
->
timestamp
,
end
,
title
);
av_freep
(
&
title
);
}
}
finish:
avio_seek
(
sc
->
pb
,
cur_pos
,
SEEK_SET
);
avio_seek
(
sc
->
pb
,
cur_pos
,
SEEK_SET
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment