Originally committed as revision 25777 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -22,7 +22,7 @@ |
| 22 | 22 |
#define AVFORMAT_AVFORMAT_H |
| 23 | 23 |
|
| 24 | 24 |
#define LIBAVFORMAT_VERSION_MAJOR 52 |
| 25 |
-#define LIBAVFORMAT_VERSION_MINOR 84 |
|
| 25 |
+#define LIBAVFORMAT_VERSION_MINOR 85 |
|
| 26 | 26 |
#define LIBAVFORMAT_VERSION_MICRO 0 |
| 27 | 27 |
|
| 28 | 28 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
| ... | ... |
@@ -245,6 +245,21 @@ void av_metadata_free(AVMetadata **m); |
| 245 | 245 |
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); |
| 246 | 246 |
|
| 247 | 247 |
|
| 248 |
+/** |
|
| 249 |
+ * Reads data and appends it to the current content of the AVPacket. |
|
| 250 |
+ * If pkt->size is 0 it behaves like av_get_packet. |
|
| 251 |
+ * Note that this uses av_grow_packet and thus involves a realloc |
|
| 252 |
+ * which is inefficient. Thus this function should only be used |
|
| 253 |
+ * when there is no reasonable way to know (an upper bound of) |
|
| 254 |
+ * the final size. |
|
| 255 |
+ * |
|
| 256 |
+ * @param pkt packet |
|
| 257 |
+ * @param size amount of data to read |
|
| 258 |
+ * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data |
|
| 259 |
+ * will not be lost even if an error occurs. |
|
| 260 |
+ */ |
|
| 261 |
+int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size); |
|
| 262 |
+ |
|
| 248 | 263 |
/*************************************************/ |
| 249 | 264 |
/* fractional numbers for exact pts handling */ |
| 250 | 265 |
|
| ... | ... |
@@ -339,6 +339,21 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size) |
| 339 | 339 |
return ret; |
| 340 | 340 |
} |
| 341 | 341 |
|
| 342 |
+int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size) |
|
| 343 |
+{
|
|
| 344 |
+ int ret; |
|
| 345 |
+ int old_size; |
|
| 346 |
+ if (!pkt->size) |
|
| 347 |
+ return av_get_packet(s, pkt, size); |
|
| 348 |
+ old_size = pkt->size; |
|
| 349 |
+ ret = av_grow_packet(pkt, size); |
|
| 350 |
+ if (ret < 0) |
|
| 351 |
+ return ret; |
|
| 352 |
+ ret = get_buffer(s, pkt->data + old_size, size); |
|
| 353 |
+ av_shrink_packet(pkt, old_size + FFMAX(ret, 0)); |
|
| 354 |
+ return ret; |
|
| 355 |
+} |
|
| 356 |
+ |
|
| 342 | 357 |
|
| 343 | 358 |
int av_filename_number_test(const char *filename) |
| 344 | 359 |
{
|