Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
0d96ec19
Commit
0d96ec19
authored
Jun 04, 2012
by
Clément Bœsch
Committed by
Clément Bœsch
Jun 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mov: parse tref atom.
parent
9fb2e234
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
isom.h
libavformat/isom.h
+3
-0
mov.c
libavformat/mov.c
+26
-1
No files found.
libavformat/isom.h
View file @
0d96ec19
...
...
@@ -123,6 +123,9 @@ typedef struct MOVStreamContext {
unsigned
drefs_count
;
MOVDref
*
drefs
;
int
dref_id
;
unsigned
tref_type
;
unsigned
trefs_count
;
uint32_t
*
trefs
;
int
wrong_dts
;
///< dts are wrong due to huge ctts offset (iMovie files)
int
width
;
///< tkhd width
int
height
;
///< tkhd height
...
...
libavformat/mov.c
View file @
0d96ec19
...
...
@@ -2589,6 +2589,30 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return
0
;
}
static
int
mov_read_tref
(
MOVContext
*
c
,
AVIOContext
*
pb
,
MOVAtom
atom
)
{
uint32_t
i
,
size
;
MOVStreamContext
*
sc
;
if
(
c
->
fc
->
nb_streams
<
1
)
return
AVERROR_INVALIDDATA
;
sc
=
c
->
fc
->
streams
[
c
->
fc
->
nb_streams
-
1
]
->
priv_data
;
size
=
avio_rb32
(
pb
);
if
(
size
<
12
)
return
0
;
sc
->
trefs_count
=
(
size
-
4
)
/
8
;
sc
->
trefs
=
av_malloc
(
sc
->
trefs_count
*
sizeof
(
*
sc
->
trefs
));
if
(
!
sc
->
trefs
)
return
AVERROR
(
ENOMEM
);
sc
->
tref_type
=
avio_rl32
(
pb
);
for
(
i
=
0
;
i
<
sc
->
trefs_count
;
i
++
)
sc
->
trefs
[
i
]
=
avio_rb32
(
pb
);
return
0
;
}
static
const
MOVParseTableEntry
mov_default_parse_table
[]
=
{
{
MKTAG
(
'A'
,
'P'
,
'R'
,
'G'
),
mov_read_aprg
},
{
MKTAG
(
'a'
,
'v'
,
's'
,
's'
),
mov_read_avss
},
...
...
@@ -2633,7 +2657,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
{
MKTAG
(
't'
,
'f'
,
'h'
,
'd'
),
mov_read_tfhd
},
/* track fragment header */
{
MKTAG
(
't'
,
'r'
,
'a'
,
'k'
),
mov_read_trak
},
{
MKTAG
(
't'
,
'r'
,
'a'
,
'f'
),
mov_read_default
},
{
MKTAG
(
't'
,
'r'
,
'e'
,
'f'
),
mov_read_
default
},
{
MKTAG
(
't'
,
'r'
,
'e'
,
'f'
),
mov_read_
tref
},
{
MKTAG
(
'c'
,
'h'
,
'a'
,
'p'
),
mov_read_chap
},
{
MKTAG
(
't'
,
'r'
,
'e'
,
'x'
),
mov_read_trex
},
{
MKTAG
(
't'
,
'r'
,
'u'
,
'n'
),
mov_read_trun
},
...
...
@@ -2822,6 +2846,7 @@ static int mov_read_close(AVFormatContext *s)
av_freep
(
&
sc
->
drefs
[
j
].
dir
);
}
av_freep
(
&
sc
->
drefs
);
av_freep
(
&
sc
->
trefs
);
if
(
sc
->
pb
&&
sc
->
pb
!=
s
->
pb
)
avio_close
(
sc
->
pb
);
sc
->
pb
=
NULL
;
...
...
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