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
31c51f74
Commit
31c51f74
authored
Oct 04, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avpacket: add a function for wrapping existing data as side data
parent
b09ad37c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
11 deletions
+48
-11
APIchanges
doc/APIchanges
+3
-0
avcodec.h
libavcodec/avcodec.h
+16
-0
avpacket.c
libavcodec/avpacket.c
+28
-10
version.h
libavcodec/version.h
+1
-1
No files found.
doc/APIchanges
View file @
31c51f74
...
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
...
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
API changes, most recent first:
API changes, most recent first:
2015-xx-xx - xxxxxxx - lavc 57.11.0 - avcodec.h
Add av_packet_add_side_data().
2015-xx-xx - xxxxxxx - lavc 57.9.1 - avcodec.h
2015-xx-xx - xxxxxxx - lavc 57.9.1 - avcodec.h
Deprecate rtp_callback without replacement, i.e. it won't be possible to
Deprecate rtp_callback without replacement, i.e. it won't be possible to
get image slices before the full frame is encoded any more. The libavformat
get image slices before the full frame is encoded any more. The libavformat
...
...
libavcodec/avcodec.h
View file @
31c51f74
...
@@ -3556,6 +3556,22 @@ void av_free_packet(AVPacket *pkt);
...
@@ -3556,6 +3556,22 @@ void av_free_packet(AVPacket *pkt);
uint8_t
*
av_packet_new_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
uint8_t
*
av_packet_new_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
int
size
);
int
size
);
/**
* Wrap an existing array as a packet side data.
*
* @param pkt packet
* @param type side information type
* @param data the side data array. It must be allocated with the av_malloc()
* family of functions. The ownership of the data is transferred to
* pkt.
* @param size side information size
* @return a non-negative number on success, a negative AVERROR code on
* failure. On failure, the packet is unchanged and the data remains
* owned by the caller.
*/
int
av_packet_add_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
uint8_t
*
data
,
size_t
size
);
/**
/**
* Shrink the already allocated side data buffer
* Shrink the already allocated side data buffer
*
*
...
...
libavcodec/avpacket.c
View file @
31c51f74
...
@@ -237,29 +237,47 @@ void av_free_packet(AVPacket *pkt)
...
@@ -237,29 +237,47 @@ void av_free_packet(AVPacket *pkt)
FF_ENABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
#endif
uint8_t
*
av_packet_new
_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
int
av_packet_add
_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
in
t
size
)
uint8_t
*
data
,
size_
t
size
)
{
{
int
elems
=
pkt
->
side_data_elems
;
int
elems
=
pkt
->
side_data_elems
;
if
((
unsigned
)
elems
+
1
>
INT_MAX
/
sizeof
(
*
pkt
->
side_data
))
if
((
unsigned
)
elems
+
1
>
INT_MAX
/
sizeof
(
*
pkt
->
side_data
))
return
NULL
;
return
AVERROR
(
EOVERFLOW
);
if
((
unsigned
)
size
>
INT_MAX
-
AV_INPUT_BUFFER_PADDING_SIZE
)
return
NULL
;
pkt
->
side_data
=
av_realloc
(
pkt
->
side_data
,
pkt
->
side_data
=
av_realloc
(
pkt
->
side_data
,
(
elems
+
1
)
*
sizeof
(
*
pkt
->
side_data
));
(
elems
+
1
)
*
sizeof
(
*
pkt
->
side_data
));
if
(
!
pkt
->
side_data
)
if
(
!
pkt
->
side_data
)
return
NULL
;
return
AVERROR
(
ENOMEM
)
;
pkt
->
side_data
[
elems
].
data
=
av_malloc
(
size
+
AV_INPUT_BUFFER_PADDING_SIZE
);
pkt
->
side_data
[
elems
].
data
=
data
;
if
(
!
pkt
->
side_data
[
elems
].
data
)
return
NULL
;
pkt
->
side_data
[
elems
].
size
=
size
;
pkt
->
side_data
[
elems
].
size
=
size
;
pkt
->
side_data
[
elems
].
type
=
type
;
pkt
->
side_data
[
elems
].
type
=
type
;
pkt
->
side_data_elems
++
;
pkt
->
side_data_elems
++
;
return
pkt
->
side_data
[
elems
].
data
;
return
0
;
}
uint8_t
*
av_packet_new_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
int
size
)
{
int
ret
;
uint8_t
*
data
;
if
((
unsigned
)
size
>
INT_MAX
-
AV_INPUT_BUFFER_PADDING_SIZE
)
return
NULL
;
data
=
av_malloc
(
size
+
AV_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
data
)
return
NULL
;
ret
=
av_packet_add_side_data
(
pkt
,
type
,
data
,
size
);
if
(
ret
<
0
)
{
av_freep
(
&
data
);
return
NULL
;
}
return
data
;
}
}
uint8_t
*
av_packet_get_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
uint8_t
*
av_packet_get_side_data
(
AVPacket
*
pkt
,
enum
AVPacketSideDataType
type
,
...
...
libavcodec/version.h
View file @
31c51f74
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 1
0
#define LIBAVCODEC_VERSION_MINOR 1
1
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
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