[MPlayer-cvslog] r25686 - in trunk: libmpdemux/demux_mkv.c mplayer.c
eugeni
subversion at mplayerhq.hu
Sat Jan 12 02:12:40 CET 2008
Author: eugeni
Date: Sat Jan 12 02:12:39 2008
New Revision: 25686
Log:
Instead of keeping attachments in mkv demuxer, use demuxer_add_attachment().
These attachments are passed to libass after demuxer is opened.
Modified:
trunk/libmpdemux/demux_mkv.c
trunk/mplayer.c
Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c (original)
+++ trunk/libmpdemux/demux_mkv.c Sat Jan 12 02:12:39 2008
@@ -143,15 +143,6 @@ typedef struct mkv_index
uint64_t timecode, filepos;
} mkv_index_t;
-typedef struct mkv_attachment
-{
- char* name;
- char* mime;
- uint64_t uid;
- void* data;
- unsigned int data_size;
-} mkv_attachment_t;
-
typedef struct mkv_demuxer
{
off_t segment_start;
@@ -186,9 +177,6 @@ typedef struct mkv_demuxer
int last_aid;
int audio_tracks[MAX_A_STREAMS];
-
- mkv_attachment_t *attachments;
- int num_attachments;
} mkv_demuxer_t;
#define REALHEADER_SIZE 16
@@ -1457,7 +1445,6 @@ demux_mkv_read_attachments (demuxer_t *d
int i;
char* name = NULL;
char* mime = NULL;
- uint64_t uid = 0;
char* data = NULL;
int data_size = 0;
@@ -1466,9 +1453,6 @@ demux_mkv_read_attachments (demuxer_t *d
mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + an attachment...\n");
- grow_array(&mkv_d->attachments, mkv_d->num_attachments,
- sizeof(*mkv_d->attachments));
-
while (len > 0)
{
uint64_t l;
@@ -1492,10 +1476,6 @@ demux_mkv_read_attachments (demuxer_t *d
mime);
break;
- case MATROSKA_ID_FILEUID:
- uid = ebml_read_uint (s, &l);
- break;
-
case MATROSKA_ID_FILEDATA:
{
int x;
@@ -1521,22 +1501,10 @@ demux_mkv_read_attachments (demuxer_t *d
len -= l + il;
}
- mkv_d->attachments[mkv_d->num_attachments].name = name;
- mkv_d->attachments[mkv_d->num_attachments].mime = mime;
- mkv_d->attachments[mkv_d->num_attachments].uid = uid;
- mkv_d->attachments[mkv_d->num_attachments].data = data;
- mkv_d->attachments[mkv_d->num_attachments].data_size = data_size;
- mkv_d->num_attachments ++;
+ demuxer_add_attachment(demuxer, name, mime, data, data_size);
mp_msg(MSGT_DEMUX, MSGL_V,
"[mkv] Attachment: %s, %s, %u bytes\n",
name, mime, data_size);
-#ifdef USE_ASS
- if (ass_library &&
- extract_embedded_fonts && name && data && data_size &&
- mime && (strcmp(mime, "application/x-truetype-font") == 0 ||
- strcmp(mime, "application/x-font") == 0))
- ass_add_font(ass_library, name, data, data_size);
-#endif
break;
}
@@ -2596,17 +2564,6 @@ demux_close_mkv (demuxer_t *demuxer)
free (mkv_d->parsed_cues);
if (mkv_d->parsed_seekhead)
free (mkv_d->parsed_seekhead);
- if (mkv_d->attachments) {
- for (i = 0; i < mkv_d->num_attachments; ++i) {
- if (mkv_d->attachments[i].name)
- free (mkv_d->attachments[i].name);
- if (mkv_d->attachments[i].mime)
- free (mkv_d->attachments[i].mime);
- if (mkv_d->attachments[i].data)
- free (mkv_d->attachments[i].data);
- }
- free (mkv_d->attachments);
- }
free (mkv_d);
}
}
Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c (original)
+++ trunk/mplayer.c Sat Jan 12 02:12:39 2008
@@ -3118,6 +3118,19 @@ if (mpctx->stream->type != STREAMTYPE_DV
if (mpctx->global_sub_size <= mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id)
mpctx->global_sub_size = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id + 1;
+#ifdef USE_ASS
+if (ass_enabled && ass_library) {
+ for (i = 0; i < mpctx->demuxer->num_attachments; ++i) {
+ demux_attachment_t* att = mpctx->demuxer->attachments + i;
+ if (extract_embedded_fonts &&
+ att->name && att->type && att->data && att->data_size &&
+ (strcmp(att->type, "application/x-truetype-font") == 0 ||
+ strcmp(att->type, "application/x-font") == 0))
+ ass_add_font(ass_library, att->name, att->data, att->data_size);
+ }
+}
+#endif
+
current_module="demux_open2";
//file_format=demuxer->file_format;
More information about the MPlayer-cvslog
mailing list