changeset 3050:9ed968c05954

added demuxer_info
author alex
date Wed, 21 Nov 2001 16:14:14 +0000
parents 2d2a1358d563
children 8744df4f03de
files libmpdemux/demuxer.c libmpdemux/demuxer.h mplayer.c
diffstat 3 files changed, 84 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Wed Nov 21 10:34:06 2001 +0000
+++ b/libmpdemux/demuxer.c	Wed Nov 21 16:14:14 2001 +0000
@@ -624,4 +624,77 @@
 return 1;
 }
 
+int demux_info_add(demuxer_t *demuxer, char *opt, char *param)
+{
+    demuxer_info_t *info = &demuxer->info;
 
+    if (!strncmp(opt, "name"))
+    {
+	if (info->name)
+	{
+	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->name already present\n!");
+	    return(0);
+	}
+	info->name = malloc(strlen(param));
+	strcpy(info->name, param);
+	return(1);
+    }
+
+    if (!strncmp(opt, "author"))
+    {
+	if (info->author)
+	{
+	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->author already present\n!");
+	    return(0);
+	}
+	info->author = malloc(strlen(param));
+	strcpy(info->author, param);
+	return(1);
+    }
+
+    if (!strncmp(opt, "encoder"))
+    {
+	if (info->encoder)
+	{
+	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->encoder already present\n!");
+	    return(0);
+	}
+	info->encoder = malloc(strlen(param));
+	strcpy(info->encoder, param);
+	return(1);
+    }
+
+    if (!strncmp(opt, "comments"))
+    {
+	if (info->comments)
+	{
+	    mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->comments already present\n!");
+	    return(0);
+	}
+	info->comments = malloc(strlen(param));
+	strcpy(info->comments, param);
+	return(1);
+    }
+
+    mp_msg(MSGT_DEMUX, MSGL_WARN, "Unknown demuxer info->%s (=%s)!\n",
+	opt, param);
+    return(1);
+}
+
+int demux_info_print(demuxer_t *demuxer)
+{
+    demuxer_info_t *info = &demuxer->info;
+
+    if (info->name || info->author || info->encoder || info->comments)
+    {
+	mp_msg(MSGT_DEMUX, MSGL_INFO, "Clip info: \n");
+	if (info->name)
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Name: %s\n", info->name);
+	if (info->author)
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Author: %s\n", info->author);
+	if (info->encoder)
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Encoder: %s\n", info->encoder);
+	if (info->comments)
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, " Comments: %s\n", info->comments);
+    }
+}
--- a/libmpdemux/demuxer.h	Wed Nov 21 10:34:06 2001 +0000
+++ b/libmpdemux/demuxer.h	Wed Nov 21 16:14:14 2001 +0000
@@ -56,6 +56,13 @@
   void* sh;
 } demux_stream_t;
 
+typedef struct demuxer_info_st {
+  char *name;
+  char *author;
+  char *encoder;
+  char *comments;
+} demuxer_info_t;
+
 typedef struct demuxer_st {
   stream_t *stream;
   int synced;  // stream synced (used by mpeg)
@@ -76,6 +83,7 @@
   char s_streams[32];   // dvd subtitles (flag)
   
   void* priv;  // fileformat-dependent data
+  demuxer_info_t info;
 } demuxer_t;
 
 inline static demux_packet_t* new_demux_packet(int len){
--- a/mplayer.c	Wed Nov 21 10:34:06 2001 +0000
+++ b/mplayer.c	Wed Nov 21 16:14:14 2001 +0000
@@ -875,6 +875,9 @@
     goto goto_next_file; // exit_player(MSGTR_Exit_error);
 }
 
+/* display clip info */
+demux_info_print(demuxer);
+
 //================== Init AUDIO (codec) ==========================
 
 current_module="init_audio_codec";