Merge commit 'd09b4cce21cdad5ef2855698395ffd6e37445212'

* commit 'd09b4cce21cdad5ef2855698395ffd6e37445212':
  mpjpeg: Simplify using avio_printf

Conflicts:
	libavformat/mpjpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-07-08 23:53:08 +02:00
commit 2a33dc2cdf
1 changed files with 4 additions and 13 deletions

View File

@ -33,10 +33,7 @@ typedef struct MPJPEGContext {
static int mpjpeg_write_header(AVFormatContext *s) static int mpjpeg_write_header(AVFormatContext *s)
{ {
MPJPEGContext *mpj = s->priv_data; MPJPEGContext *mpj = s->priv_data;
uint8_t buf1[256]; avio_printf(s->pb, "--%s\r\n", mpj->boundary_tag);
snprintf(buf1, sizeof(buf1), "--%s\r\n", mpj->boundary_tag);
avio_write(s->pb, buf1, strlen(buf1));
avio_flush(s->pb); avio_flush(s->pb);
return 0; return 0;
} }
@ -44,17 +41,11 @@ static int mpjpeg_write_header(AVFormatContext *s)
static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt) static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
MPJPEGContext *mpj = s->priv_data; MPJPEGContext *mpj = s->priv_data;
uint8_t buf1[256]; avio_printf(s->pb, "Content-type: image/jpeg\r\n");
avio_printf(s->pb, "Content-length: %d\r\n\r\n", pkt->size);
snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\r\n");
avio_write(s->pb, buf1, strlen(buf1));
snprintf(buf1, sizeof(buf1), "Content-length: %d\r\n\r\n", pkt->size);
avio_write(s->pb, buf1, strlen(buf1));
avio_write(s->pb, pkt->data, pkt->size); avio_write(s->pb, pkt->data, pkt->size);
snprintf(buf1, sizeof(buf1), "\r\n--%s\r\n", mpj->boundary_tag); avio_printf(s->pb, "\r\n--%s\r\n", mpj->boundary_tag);
avio_write(s->pb, buf1, strlen(buf1));
return 0; return 0;
} }