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
01775c88
Commit
01775c88
authored
Mar 19, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/avienc: factor out update_odml_entry()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
c3a6d179
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
24 deletions
+35
-24
avienc.c
libavformat/avienc.c
+35
-24
No files found.
libavformat/avienc.c
View file @
01775c88
...
...
@@ -469,6 +469,39 @@ static int avi_write_header(AVFormatContext *s)
return
0
;
}
static
void
update_odml_entry
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
ix
)
{
AVIOContext
*
pb
=
s
->
pb
;
AVIContext
*
avi
=
s
->
priv_data
;
AVIStream
*
avist
=
s
->
streams
[
stream_index
]
->
priv_data
;
int64_t
pos
;
int
au_byterate
,
au_ssize
,
au_scale
;
avio_flush
(
pb
);
pos
=
avio_tell
(
pb
);
/* Updating one entry in the AVI OpenDML master index */
avio_seek
(
pb
,
avist
->
indexes
.
indx_start
-
8
,
SEEK_SET
);
ffio_wfourcc
(
pb
,
"indx"
);
/* enabling this entry */
avio_skip
(
pb
,
8
);
avio_wl32
(
pb
,
avi
->
riff_id
);
/* nEntriesInUse */
avio_skip
(
pb
,
16
*
avi
->
riff_id
);
avio_wl64
(
pb
,
ix
);
/* qwOffset */
avio_wl32
(
pb
,
pos
-
ix
);
/* dwSize */
ff_parse_specific_params
(
s
->
streams
[
stream_index
],
&
au_byterate
,
&
au_ssize
,
&
au_scale
);
if
(
s
->
streams
[
stream_index
]
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
&&
au_ssize
>
0
)
{
uint32_t
audio_segm_size
=
(
avist
->
audio_strm_length
-
avist
->
indexes
.
audio_strm_offset
);
if
((
audio_segm_size
%
au_ssize
>
0
)
&&
!
avist
->
sample_requested
)
{
avpriv_request_sample
(
s
,
"OpenDML index duration for audio packets with partial frames"
);
avist
->
sample_requested
=
1
;
}
avio_wl32
(
pb
,
audio_segm_size
/
au_ssize
);
/* dwDuration (sample count) */
}
else
avio_wl32
(
pb
,
avist
->
indexes
.
entry
);
/* dwDuration (packet count) */
avio_seek
(
pb
,
pos
,
SEEK_SET
);
}
static
int
avi_write_ix
(
AVFormatContext
*
s
)
{
AVIOContext
*
pb
=
s
->
pb
;
...
...
@@ -487,8 +520,7 @@ static int avi_write_ix(AVFormatContext *s)
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVIStream
*
avist
=
s
->
streams
[
i
]
->
priv_data
;
int64_t
ix
,
pos
;
int
au_byterate
,
au_ssize
,
au_scale
;
int64_t
ix
;
avi_stream2fourcc
(
tag
,
i
,
s
->
streams
[
i
]
->
codec
->
codec_type
);
ix_tag
[
3
]
=
'0'
+
i
;
...
...
@@ -513,29 +545,8 @@ static int avi_write_ix(AVFormatContext *s)
avio_wl32
(
pb
,
((
uint32_t
)
ie
->
len
&
~
0x80000000
)
|
(
ie
->
flags
&
0x10
?
0
:
0x80000000
));
}
avio_flush
(
pb
);
pos
=
avio_tell
(
pb
);
/* Updating one entry in the AVI OpenDML master index */
avio_seek
(
pb
,
avist
->
indexes
.
indx_start
-
8
,
SEEK_SET
);
ffio_wfourcc
(
pb
,
"indx"
);
/* enabling this entry */
avio_skip
(
pb
,
8
);
avio_wl32
(
pb
,
avi
->
riff_id
);
/* nEntriesInUse */
avio_skip
(
pb
,
16
*
avi
->
riff_id
);
avio_wl64
(
pb
,
ix
);
/* qwOffset */
avio_wl32
(
pb
,
pos
-
ix
);
/* dwSize */
ff_parse_specific_params
(
s
->
streams
[
i
],
&
au_byterate
,
&
au_ssize
,
&
au_scale
);
if
(
s
->
streams
[
i
]
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
&&
au_ssize
>
0
)
{
uint32_t
audio_segm_size
=
(
avist
->
audio_strm_length
-
avist
->
indexes
.
audio_strm_offset
);
if
((
audio_segm_size
%
au_ssize
>
0
)
&&
!
avist
->
sample_requested
)
{
avpriv_request_sample
(
s
,
"OpenDML index duration for audio packets with partial frames"
);
avist
->
sample_requested
=
1
;
}
avio_wl32
(
pb
,
audio_segm_size
/
au_ssize
);
/* dwDuration (sample count) */
}
else
avio_wl32
(
pb
,
avist
->
indexes
.
entry
);
/* dwDuration (packet count) */
avio_seek
(
pb
,
pos
,
SEEK_SET
);
update_odml_entry
(
s
,
i
,
ix
);
}
return
0
;
}
...
...
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