* Matroska muxer
* Copyright (c) 2007 David Conrad
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
}
end_ebml_master(pb, cues_element);
- av_free(cues->entries);
- av_free(cues);
return currentpos;
}
uint8_t *codecpriv;
int ret, codecpriv_size;
- ret = url_open_dyn_buf(&dyn_cp);
+ ret = avio_open_dyn_buf(&dyn_cp);
if(ret < 0)
return ret;
ff_put_wav_header(dyn_cp, codec);
}
- codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv);
+ codecpriv_size = avio_close_dyn_buf(dyn_cp, &codecpriv);
if (codecpriv_size)
put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size);
av_free(codecpriv);
case AVMEDIA_TYPE_SUBTITLE:
put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_SUBTITLE);
+ if (!native_id) {
+ av_log(s, AV_LOG_ERROR, "Subtitle codec %d is not supported.\n", codec->codec_id);
+ return AVERROR(ENOSYS);
+ }
break;
default:
- av_log(s, AV_LOG_ERROR, "Only audio, video, and subtitles are supported for Matroska.");
+ av_log(s, AV_LOG_ERROR, "Only audio, video, and subtitles are supported for Matroska.\n");
break;
}
ret = mkv_write_codecprivate(s, pb, codec, native_id, qt_id);
if (!mkv->dyn_bc)
return;
- bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
+ bufsize = avio_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
avio_write(s->pb, dyn_buf, bufsize);
av_free(dyn_buf);
mkv->dyn_bc = NULL;
if (!s->pb->seekable) {
if (!mkv->dyn_bc)
- url_open_dyn_buf(&mkv->dyn_bc);
+ avio_open_dyn_buf(&mkv->dyn_bc);
pb = mkv->dyn_bc;
}
}
if (pb->seekable) {
- cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
+ if (mkv->cues->num_entries) {
+ cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
+
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES, cuespos);
+ if (ret < 0) return ret;
+ }
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos);
- if (ret < 0) return ret;
mkv_write_seekhead(pb, mkv->main_seekhead);
// update the duration
end_ebml_master(pb, mkv->segment);
av_free(mkv->tracks);
+ av_freep(&mkv->cues->entries);
+ av_freep(&mkv->cues);
av_destruct_packet(&mkv->cur_audio_pkt);
avio_flush(pb);
return 0;