summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-03-03 17:53:55 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-03-03 17:53:55 +0000
commit4346539522fbe34a4d46d3c6366b29181f31dc7a (patch)
tree554e5938f59ae1ac6afeda3d510b54ca4b1ca8f7 /libavformat
parentbc874daea8273e2471f5a6f914cdc9cf97371a1c (diff)
av_log() cleanup
null pointer segfaults dont print redundant spam dont print prefix if reference==NULL class -> av_class dont copy AVClass to every object, its a waste of memory and not a good idea at all Originally committed as revision 2841 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h2
-rw-r--r--libavformat/utils.c28
2 files changed, 15 insertions, 15 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 153c2ddfb5..58109627f9 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -241,7 +241,7 @@ typedef struct AVStream {
/* format I/O context */
typedef struct AVFormatContext {
- AVClass class; /* set by av_alloc_format_context */
+ AVClass *av_class; /* set by av_alloc_format_context */
/* can only be iformat or oformat, not both at the same time */
struct AVInputFormat *iformat;
struct AVOutputFormat *oformat;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 29a8fbea76..1f07ac1ebe 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -301,9 +301,9 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened)
* open a media file from an IO stream. 'fmt' must be specified.
*/
-static const char* format_to_name(void* class_ptr)
+static const char* format_to_name(void* ptr)
{
- AVFormatContext* fc = (AVFormatContext*) class_ptr;
+ AVFormatContext* fc = (AVFormatContext*) ptr;
if(fc->iformat) return fc->iformat->name;
else if(fc->oformat) return fc->oformat->name;
else return "NULL";
@@ -316,7 +316,7 @@ AVFormatContext *av_alloc_format_context(void)
AVFormatContext *ic;
ic = av_mallocz(sizeof(AVFormatContext));
if (!ic) return ic;
- ic->class = av_format_context_class;
+ ic->av_class = &av_format_context_class;
return ic;
}
@@ -1745,13 +1745,13 @@ void dump_format(AVFormatContext *ic,
int i, flags;
char buf[256];
- av_log(ic, AV_LOG_DEBUG, "%s #%d, %s, %s '%s':\n",
+ av_log(NULL, AV_LOG_DEBUG, "%s #%d, %s, %s '%s':\n",
is_output ? "Output" : "Input",
index,
is_output ? ic->oformat->name : ic->iformat->name,
is_output ? "to" : "from", url);
if (!is_output) {
- av_log(ic, AV_LOG_DEBUG, " Duration: ");
+ av_log(NULL, AV_LOG_DEBUG, " Duration: ");
if (ic->duration != AV_NOPTS_VALUE) {
int hours, mins, secs, us;
secs = ic->duration / AV_TIME_BASE;
@@ -1760,23 +1760,23 @@ void dump_format(AVFormatContext *ic,
secs %= 60;
hours = mins / 60;
mins %= 60;
- av_log(ic, AV_LOG_DEBUG, "%02d:%02d:%02d.%01d", hours, mins, secs,
+ av_log(NULL, AV_LOG_DEBUG, "%02d:%02d:%02d.%01d", hours, mins, secs,
(10 * us) / AV_TIME_BASE);
} else {
- av_log(ic, AV_LOG_DEBUG, "N/A");
+ av_log(NULL, AV_LOG_DEBUG, "N/A");
}
- av_log(ic, AV_LOG_DEBUG, ", bitrate: ");
+ av_log(NULL, AV_LOG_DEBUG, ", bitrate: ");
if (ic->bit_rate) {
- av_log(ic, AV_LOG_DEBUG,"%d kb/s", ic->bit_rate / 1000);
+ av_log(NULL, AV_LOG_DEBUG,"%d kb/s", ic->bit_rate / 1000);
} else {
- av_log(ic, AV_LOG_DEBUG, "N/A");
+ av_log(NULL, AV_LOG_DEBUG, "N/A");
}
- av_log(ic, AV_LOG_DEBUG, "\n");
+ av_log(NULL, AV_LOG_DEBUG, "\n");
}
for(i=0;i<ic->nb_streams;i++) {
AVStream *st = ic->streams[i];
avcodec_string(buf, sizeof(buf), &st->codec, is_output);
- av_log(ic, AV_LOG_DEBUG, " Stream #%d.%d", index, i);
+ av_log(NULL, AV_LOG_DEBUG, " Stream #%d.%d", index, i);
/* the pid is an important information, so we display it */
/* XXX: add a generic system */
if (is_output)
@@ -1784,9 +1784,9 @@ void dump_format(AVFormatContext *ic,
else
flags = ic->iformat->flags;
if (flags & AVFMT_SHOW_IDS) {
- av_log(ic, AV_LOG_DEBUG, "[0x%x]", st->id);
+ av_log(NULL, AV_LOG_DEBUG, "[0x%x]", st->id);
}
- av_log(ic, AV_LOG_DEBUG, ": %s\n", buf);
+ av_log(NULL, AV_LOG_DEBUG, ": %s\n", buf);
}
}