summaryrefslogtreecommitdiff
path: root/libavformat/img2enc.c
diff options
context:
space:
mode:
authorMashiat Sarker Shakkhar <mashiat.sarker@gmail.com>2012-06-23 09:53:43 +0600
committerAnton Khirnov <anton@khirnov.net>2012-06-24 07:35:54 +0200
commitb5bce20cc395b1dfd0017dd3140fa39998cd0a02 (patch)
tree5da641d2f47bc59df2f1809f943a52c0a1ffc4a8 /libavformat/img2enc.c
parentfd269d6253576f220dbd18c367593cc6242989dc (diff)
downloadffmpeg-b5bce20cc395b1dfd0017dd3140fa39998cd0a02.tar.gz
image2: Add "start_number" private option to the muxer
This adds the capability to start counting file number from an arbitrary integer. This includes a few lines of trivial code from FFmpeg codebase. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavformat/img2enc.c')
-rw-r--r--libavformat/img2enc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index c825c2bf23..0f348576f5 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -26,8 +26,10 @@
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
+#include "libavutil/opt.h"
typedef struct {
+ const AVClass *class; /**< Class for private options. */
int img_number;
int is_pipe;
char path[1024];
@@ -37,7 +39,6 @@ static int write_header(AVFormatContext *s)
{
VideoMuxData *img = s->priv_data;
- img->img_number = 1;
av_strlcpy(img->path, s->filename, sizeof(img->path));
/* find format */
@@ -124,7 +125,21 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
+#define OFFSET(x) offsetof(VideoMuxData, x)
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption muxoptions[] = {
+ { "start_number", "first number in the sequence", OFFSET(img_number), AV_OPT_TYPE_INT, {.dbl = 1}, 1, INT_MAX, ENC },
+ { NULL },
+};
+
#if CONFIG_IMAGE2_MUXER
+static const AVClass img2mux_class = {
+ .class_name = "image2 muxer",
+ .item_name = av_default_item_name,
+ .option = muxoptions,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVOutputFormat ff_image2_muxer = {
.name = "image2",
.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
@@ -135,7 +150,8 @@ AVOutputFormat ff_image2_muxer = {
.video_codec = CODEC_ID_MJPEG,
.write_header = write_header,
.write_packet = write_packet,
- .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE
+ .flags = AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE,
+ .priv_class = &img2mux_class,
};
#endif
#if CONFIG_IMAGE2PIPE_MUXER