summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorNico Sabbi <nicola.sabbi@poste.it>2006-08-27 12:14:13 +0000
committerNico Sabbi <nicola.sabbi@poste.it>2006-08-27 12:14:13 +0000
commit4eb72c6b2354e7e4126bb958832bf3dd24c8e7e9 (patch)
tree9ed6a13cd670062c7733bbf1754f56fb60b60901 /libavformat
parentc0c66dd81d232731c7bedfe56821de5fe233a081 (diff)
initial support for AVOption in AVFormatContext
Originally committed as revision 6108 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h1
-rw-r--r--libavformat/utils.c23
2 files changed, 22 insertions, 2 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 3f834a424d..9ba1b27865 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -112,6 +112,7 @@ typedef struct AVFormatParameters {
mpeg2ts_raw is TRUE */
int initial_pause:1; /* do not begin to play the stream
immediately (RTSP only) */
+ int prealloced_context:1;
enum CodecID video_codec_id;
enum CodecID audio_codec_id;
} AVFormatParameters;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 32810e2d78..a590de024c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -18,6 +18,7 @@
*/
#include "avformat.h"
#include "allformats.h"
+#include "opt.h"
#undef NDEBUG
#include <assert.h>
@@ -453,13 +454,28 @@ static const char* format_to_name(void* ptr)
else return "NULL";
}
-static const AVClass av_format_context_class = { "AVFormatContext", format_to_name };
+#define OFFSET(x) (int)&((AVFormatContext*)0)->x
+#define DEFAULT 0 //should be NAN but it doesnt work as its not a constant in glibc as required by ANSI/ISO C
+//these names are too long to be readable
+#define E AV_OPT_FLAG_ENCODING_PARAM
+#define D AV_OPT_FLAG_DECODING_PARAM
+
+static const AVOption options[]={
+{NULL},
+};
+
+static const AVClass av_format_context_class = { "AVFormatContext", format_to_name, options };
+
+void avformat_get_context_defaults(AVFormatContext *s){
+ memset(s, 0, sizeof(AVFormatContext));
+}
AVFormatContext *av_alloc_format_context(void)
{
AVFormatContext *ic;
ic = av_mallocz(sizeof(AVFormatContext));
if (!ic) return ic;
+ avformat_get_context_defaults(ic);
ic->av_class = &av_format_context_class;
return ic;
}
@@ -481,7 +497,10 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
memset(ap, 0, sizeof(default_ap));
}
- ic = av_alloc_format_context();
+ if(!ap->prealloced_context)
+ ic = av_alloc_format_context();
+ else
+ ic = *ic_ptr;
if (!ic) {
err = AVERROR_NOMEM;
goto fail;