From: Luca Barbato <[email protected]>
Convenience wrapper around ff_combine_frame.
---
libavcodec/parser.c | 14 ++++++++++++++
libavcodec/parser.h | 16 ++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index e0525da..a049938 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -284,6 +284,20 @@ int ff_combine_frame(ParseContext *pc, int next,
return 0;
}
+int ff_parser_combine_data(ParseContext *pc, int next,
+ const uint8_t **buf, int *buf_size,
+ const uint8_t **outbuf, int *outbuf_size)
+{
+ int ret = ff_combine_frame(pc, next, buf, buf_size);
+
+ if (ret < 0) {
+ *outbuf = NULL;
+ *outbuf_size = 0;
+ }
+
+ return ret;
+}
+
void ff_parse_close(AVCodecParserContext *s)
{
ParseContext *pc = s->priv_data;
diff --git a/libavcodec/parser.h b/libavcodec/parser.h
index 582ddc8..4a7073e 100644
--- a/libavcodec/parser.h
+++ b/libavcodec/parser.h
@@ -45,6 +45,22 @@ typedef struct ParseContext{
* AVERROR(ENOMEM) if there was a memory allocation error
*/
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int
*buf_size);
+
+/**
+ * Convenience wrapper around ff_combine_frame.
+ *
+ * Combine the (truncated) bitstream to a complete frame.
+ *
+ * Set outbuf to NULL and outbuf_size to 0 if more data is needed
+ * to create a complete frame.
+ *
+ * @return AVERROR(EAGAIN) if no complete frame could be created,
+ * AVERROR(ENOMEM) if there was a memory allocation error
+ */
+int ff_parser_combine_data(ParseContext *pc, int next,
+ const uint8_t **buf, int *buf_size,
+ const uint8_t **outbuf, int *outbuf_size);
+
int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
int buf_size);
void ff_parse_close(AVCodecParserContext *s);
--
1.9.3 (Apple Git-50)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel