mirror of
https://github.com/mpv-player/mpv
synced 2025-01-30 19:52:14 +00:00
added demuxer_info
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3051 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d88419bcd5
commit
ad9c24d163
@ -624,4 +624,77 @@ switch(demuxer->file_format){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,13 @@ typedef struct {
|
||||
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 @@ typedef struct demuxer_st {
|
||||
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){
|
||||
|
Loading…
Reference in New Issue
Block a user