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
324ff594
Commit
324ff594
authored
Jul 14, 2014
by
Nidhi Makhijani
Committed by
Diego Biurrun
Jul 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avpacket: Check for and return errors in ff_interleave_add_packet()
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
2db953f8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
audiointerleave.c
libavformat/audiointerleave.c
+5
-3
internal.h
libavformat/internal.h
+2
-2
mux.c
libavformat/mux.c
+15
-5
No files found.
libavformat/audiointerleave.c
View file @
324ff594
...
@@ -99,7 +99,7 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
...
@@ -99,7 +99,7 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
int
(
*
get_packet
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
,
int
),
int
(
*
get_packet
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
,
int
),
int
(
*
compare_ts
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
))
int
(
*
compare_ts
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
))
{
{
int
i
;
int
i
,
ret
;
if
(
pkt
)
{
if
(
pkt
)
{
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
...
@@ -116,7 +116,8 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
...
@@ -116,7 +116,8 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
// rewrite pts and dts to be decoded time line position
// rewrite pts and dts to be decoded time line position
pkt
->
pts
=
pkt
->
dts
=
aic
->
dts
;
pkt
->
pts
=
pkt
->
dts
=
aic
->
dts
;
aic
->
dts
+=
pkt
->
duration
;
aic
->
dts
+=
pkt
->
duration
;
ff_interleave_add_packet
(
s
,
pkt
,
compare_ts
);
if
((
ret
=
ff_interleave_add_packet
(
s
,
pkt
,
compare_ts
))
<
0
)
return
ret
;
}
}
pkt
=
NULL
;
pkt
=
NULL
;
}
}
...
@@ -126,7 +127,8 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
...
@@ -126,7 +127,8 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
AVPacket
new_pkt
;
AVPacket
new_pkt
;
while
(
interleave_new_audio_packet
(
s
,
&
new_pkt
,
i
,
flush
))
while
(
interleave_new_audio_packet
(
s
,
&
new_pkt
,
i
,
flush
))
ff_interleave_add_packet
(
s
,
&
new_pkt
,
compare_ts
);
if
((
ret
=
ff_interleave_add_packet
(
s
,
&
new_pkt
,
compare_ts
))
<
0
)
return
ret
;
}
}
}
}
...
...
libavformat/internal.h
View file @
324ff594
...
@@ -87,8 +87,8 @@ void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int i
...
@@ -87,8 +87,8 @@ void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int i
* Add packet to AVFormatContext->packet_buffer list, determining its
* Add packet to AVFormatContext->packet_buffer list, determining its
* interleaved position using compare() function argument.
* interleaved position using compare() function argument.
*/
*/
void
ff_interleave_add_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
,
int
ff_interleave_add_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
,
int
(
*
compare
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
));
int
(
*
compare
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
));
void
ff_read_frame_flush
(
AVFormatContext
*
s
);
void
ff_read_frame_flush
(
AVFormatContext
*
s
);
...
...
libavformat/mux.c
View file @
324ff594
...
@@ -384,12 +384,15 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
...
@@ -384,12 +384,15 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
return
ret
;
return
ret
;
}
}
void
ff_interleave_add_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
,
int
ff_interleave_add_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
,
int
(
*
compare
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
))
int
(
*
compare
)(
AVFormatContext
*
,
AVPacket
*
,
AVPacket
*
))
{
{
int
ret
;
AVPacketList
**
next_point
,
*
this_pktl
;
AVPacketList
**
next_point
,
*
this_pktl
;
this_pktl
=
av_mallocz
(
sizeof
(
AVPacketList
));
this_pktl
=
av_mallocz
(
sizeof
(
AVPacketList
));
if
(
!
this_pktl
)
return
AVERROR
(
ENOMEM
);
this_pktl
->
pkt
=
*
pkt
;
this_pktl
->
pkt
=
*
pkt
;
#if FF_API_DESTRUCT_PACKET
#if FF_API_DESTRUCT_PACKET
FF_DISABLE_DEPRECATION_WARNINGS
FF_DISABLE_DEPRECATION_WARNINGS
...
@@ -397,7 +400,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
...
@@ -397,7 +400,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
#endif
pkt
->
buf
=
NULL
;
pkt
->
buf
=
NULL
;
av_dup_packet
(
&
this_pktl
->
pkt
);
// duplicate the packet if it uses non-alloced memory
// Duplicate the packet if it uses non-allocated memory
if
((
ret
=
av_dup_packet
(
&
this_pktl
->
pkt
))
<
0
)
{
av_free
(
this_pktl
);
return
ret
;
}
if
(
s
->
streams
[
pkt
->
stream_index
]
->
last_in_packet_buffer
)
{
if
(
s
->
streams
[
pkt
->
stream_index
]
->
last_in_packet_buffer
)
{
next_point
=
&
(
s
->
streams
[
pkt
->
stream_index
]
->
last_in_packet_buffer
->
next
);
next_point
=
&
(
s
->
streams
[
pkt
->
stream_index
]
->
last_in_packet_buffer
->
next
);
...
@@ -422,6 +429,8 @@ next_non_null:
...
@@ -422,6 +429,8 @@ next_non_null:
s
->
streams
[
pkt
->
stream_index
]
->
last_in_packet_buffer
=
s
->
streams
[
pkt
->
stream_index
]
->
last_in_packet_buffer
=
*
next_point
=
this_pktl
;
*
next_point
=
this_pktl
;
return
0
;
}
}
static
int
interleave_compare_dts
(
AVFormatContext
*
s
,
AVPacket
*
next
,
static
int
interleave_compare_dts
(
AVFormatContext
*
s
,
AVPacket
*
next
,
...
@@ -442,10 +451,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
...
@@ -442,10 +451,11 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
{
{
AVPacketList
*
pktl
;
AVPacketList
*
pktl
;
int
stream_count
=
0
;
int
stream_count
=
0
;
int
i
;
int
i
,
ret
;
if
(
pkt
)
{
if
(
pkt
)
{
ff_interleave_add_packet
(
s
,
pkt
,
interleave_compare_dts
);
if
((
ret
=
ff_interleave_add_packet
(
s
,
pkt
,
interleave_compare_dts
))
<
0
)
return
ret
;
}
}
if
(
s
->
max_interleave_delta
>
0
&&
s
->
packet_buffer
&&
!
flush
)
{
if
(
s
->
max_interleave_delta
>
0
&&
s
->
packet_buffer
&&
!
flush
)
{
...
...
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