Mercurial > mplayer.hg
comparison libmpdemux/demux_mkv.c @ 19640:521f71200591
Display track names in matroska files.
Patch by Paul Lebedev _paul d lebedev a gmail d com_.
author | eugeni |
---|---|
date | Sat, 02 Sep 2006 19:39:24 +0000 |
parents | a0105ea61f2d |
children | 84bf8bd9f9da |
comparison
equal
deleted
inserted
replaced
19639:bbe600db7b83 | 19640:521f71200591 |
---|---|
74 } mkv_content_encoding_t; | 74 } mkv_content_encoding_t; |
75 | 75 |
76 typedef struct mkv_track | 76 typedef struct mkv_track |
77 { | 77 { |
78 int tnum; | 78 int tnum; |
79 char *name; | |
79 | 80 |
80 char *codec_id; | 81 char *codec_id; |
81 int ms_compat; | 82 int ms_compat; |
82 char *language; | 83 char *language; |
83 | 84 |
1004 | 1005 |
1005 track = (mkv_track_t *) malloc (sizeof (*track)); | 1006 track = (mkv_track_t *) malloc (sizeof (*track)); |
1006 memset(track, 0, sizeof(*track)); | 1007 memset(track, 0, sizeof(*track)); |
1007 /* set default values */ | 1008 /* set default values */ |
1008 track->default_track = 1; | 1009 track->default_track = 1; |
1010 track->name = 0; | |
1009 track->language = strdup("eng"); | 1011 track->language = strdup("eng"); |
1010 | 1012 |
1011 len = length = ebml_read_length (s, &il); | 1013 len = length = ebml_read_length (s, &il); |
1012 len += il; | 1014 len += il; |
1013 while (length > 0) | 1015 while (length > 0) |
1023 mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Track number: %u\n", | 1025 mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Track number: %u\n", |
1024 track->tnum); | 1026 track->tnum); |
1025 break; | 1027 break; |
1026 } | 1028 } |
1027 | 1029 |
1030 case MATROSKA_ID_TRACKNAME: | |
1031 { | |
1032 track->name = ebml_read_utf8 (s, &l); | |
1033 if (track->name == NULL) | |
1034 return 0; | |
1035 mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Name: %s\n", | |
1036 track->name); | |
1037 break; | |
1038 } | |
1039 | |
1028 case MATROSKA_ID_TRACKTYPE: | 1040 case MATROSKA_ID_TRACKTYPE: |
1029 { | 1041 { |
1030 uint64_t num = ebml_read_uint (s, &l); | 1042 uint64_t num = ebml_read_uint (s, &l); |
1031 if (num == EBML_UINT_INVALID) | 1043 if (num == EBML_UINT_INVALID) |
1032 return 0; | 1044 return 0; |
1705 switch (mkv_d->tracks[i]->type) | 1717 switch (mkv_d->tracks[i]->type) |
1706 { | 1718 { |
1707 case MATROSKA_TRACK_VIDEO: | 1719 case MATROSKA_TRACK_VIDEO: |
1708 type = "video"; | 1720 type = "video"; |
1709 demux_mkv_open_video(demuxer, mkv_d->tracks[i], vid); | 1721 demux_mkv_open_video(demuxer, mkv_d->tracks[i], vid); |
1722 if (mkv_d->tracks[i]->name) | |
1723 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_NAME=%s\n", vid, mkv_d->tracks[i]->name); | |
1710 sprintf (str, "-vid %u", vid++); | 1724 sprintf (str, "-vid %u", vid++); |
1711 break; | 1725 break; |
1712 case MATROSKA_TRACK_AUDIO: | 1726 case MATROSKA_TRACK_AUDIO: |
1713 type = "audio"; | 1727 type = "audio"; |
1714 demux_mkv_open_audio(demuxer, mkv_d->tracks[i], aid); | 1728 demux_mkv_open_audio(demuxer, mkv_d->tracks[i], aid); |
1729 if (mkv_d->tracks[i]->name) | |
1730 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_NAME=%s\n", aid, mkv_d->tracks[i]->name); | |
1715 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid, mkv_d->tracks[i]->language); | 1731 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid, mkv_d->tracks[i]->language); |
1716 sprintf (str, "-aid %u, -alang %.5s",aid++,mkv_d->tracks[i]->language); | 1732 sprintf (str, "-aid %u, -alang %.5s",aid++,mkv_d->tracks[i]->language); |
1717 break; | 1733 break; |
1718 case MATROSKA_TRACK_SUBTITLE: | 1734 case MATROSKA_TRACK_SUBTITLE: |
1719 type = "subtitles"; | 1735 type = "subtitles"; |
1720 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sid); | 1736 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sid); |
1737 if (mkv_d->tracks[i]->name) | |
1738 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_NAME=%s\n", sid, mkv_d->tracks[i]->name); | |
1721 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid, mkv_d->tracks[i]->language); | 1739 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid, mkv_d->tracks[i]->language); |
1722 sprintf (str, "-sid %u, -slang %.5s",sid++,mkv_d->tracks[i]->language); | 1740 sprintf (str, "-sid %u, -slang %.5s",sid++,mkv_d->tracks[i]->language); |
1723 break; | 1741 break; |
1724 } | 1742 } |
1725 mp_msg(MSGT_DEMUX, MSGL_INFO, "[mkv] Track ID %u: %s (%s), %s\n", | 1743 if (mkv_d->tracks[i]->name) |
1744 mp_msg(MSGT_DEMUX, MSGL_INFO, "[mkv] Track ID %u: %s (%s) \"%s\", %s\n", | |
1745 mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id, mkv_d->tracks[i]->name, str); | |
1746 else | |
1747 mp_msg(MSGT_DEMUX, MSGL_INFO, "[mkv] Track ID %u: %s (%s), %s\n", | |
1726 mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id, str); | 1748 mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id, str); |
1727 } | 1749 } |
1728 } | 1750 } |
1729 | 1751 |
1730 static int | 1752 static int |
2656 free_cached_dps (demuxer); | 2678 free_cached_dps (demuxer); |
2657 if (mkv_d->tracks) | 2679 if (mkv_d->tracks) |
2658 { | 2680 { |
2659 for (i=0; i<mkv_d->num_tracks; i++) | 2681 for (i=0; i<mkv_d->num_tracks; i++) |
2660 { | 2682 { |
2683 if (mkv_d->tracks[i]->name) | |
2684 free (mkv_d->tracks[i]->name); | |
2661 if (mkv_d->tracks[i]->codec_id) | 2685 if (mkv_d->tracks[i]->codec_id) |
2662 free (mkv_d->tracks[i]->codec_id); | 2686 free (mkv_d->tracks[i]->codec_id); |
2663 if (mkv_d->tracks[i]->language) | 2687 if (mkv_d->tracks[i]->language) |
2664 free (mkv_d->tracks[i]->language); | 2688 free (mkv_d->tracks[i]->language); |
2665 if (mkv_d->tracks[i]->private_data) | 2689 if (mkv_d->tracks[i]->private_data) |