VirtualBox

source: vbox/trunk/src/libs/ffmpeg-20060710/libavformat/mpjpeg.c@ 8998

最後變更 在這個檔案從8998是 5776,由 vboxsync 提交於 17 年 前

ffmpeg: exported to OSE

檔案大小: 2.0 KB
 
1/*
2 * Multipart JPEG format
3 * Copyright (c) 2000, 2001, 2002, 2003 Fabrice Bellard.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#include "avformat.h"
20
21/* Multipart JPEG */
22
23#define BOUNDARY_TAG "ffserver"
24
25#ifdef CONFIG_MUXERS
26static int mpjpeg_write_header(AVFormatContext *s)
27{
28 uint8_t buf1[256];
29
30 snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
31 put_buffer(&s->pb, buf1, strlen(buf1));
32 put_flush_packet(&s->pb);
33 return 0;
34}
35
36static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
37{
38 uint8_t buf1[256];
39
40 snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
41 put_buffer(&s->pb, buf1, strlen(buf1));
42 put_buffer(&s->pb, pkt->data, pkt->size);
43
44 snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
45 put_buffer(&s->pb, buf1, strlen(buf1));
46 put_flush_packet(&s->pb);
47 return 0;
48}
49
50static int mpjpeg_write_trailer(AVFormatContext *s)
51{
52 return 0;
53}
54
55static AVOutputFormat mpjpeg_muxer = {
56 "mpjpeg",
57 "Mime multipart JPEG format",
58 "multipart/x-mixed-replace;boundary=" BOUNDARY_TAG,
59 "mjpg",
60 0,
61 CODEC_ID_NONE,
62 CODEC_ID_MJPEG,
63 mpjpeg_write_header,
64 mpjpeg_write_packet,
65 mpjpeg_write_trailer,
66};
67
68int jpeg_init(void)
69{
70 av_register_output_format(&mpjpeg_muxer);
71 return 0;
72}
73#endif //CONFIG_MUXERS
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette