aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtpdec_jpeg.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-01 14:03:04 +0100
committerAnton Khirnov <anton@khirnov.net>2012-11-02 07:58:37 +0100
commit179a5c37e070f619f14289bdc0fa66a08219eed9 (patch)
tree2713046a1df6cefc885e1411a79f8a508c784b84 /libavformat/rtpdec_jpeg.c
parentf70381ab9d53132be2d009d6db9649b3cad8288b (diff)
downloadffmpeg-179a5c37e070f619f14289bdc0fa66a08219eed9.tar.gz
rtpdec: factorize identical code used in several handlers
Diffstat (limited to 'libavformat/rtpdec_jpeg.c')
-rw-r--r--libavformat/rtpdec_jpeg.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 944758d4fc..9f73f7d5dc 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "rtpdec.h"
#include "rtpdec_formats.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/mjpeg.h"
@@ -367,19 +368,11 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
avio_write(jpeg->frame, buf, sizeof(buf));
/* Prepare the JPEG packet. */
- av_init_packet(pkt);
- pkt->size = avio_close_dyn_buf(jpeg->frame, &pkt->data);
- if (pkt->size < 0) {
+ if ((ret = ff_rtp_finalize_packet(pkt, &jpeg->frame, st->index)) < 0) {
av_log(ctx, AV_LOG_ERROR,
"Error occured when getting frame buffer.\n");
- jpeg->frame = NULL;
- return pkt->size;
+ return ret;
}
- pkt->stream_index = st->index;
- pkt->destruct = av_destruct_packet;
-
- /* Re-init the frame buffer. */
- jpeg->frame = NULL;
return 0;
}