From 604fbb3132e88727e496c96c92cfe02748c25a1a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 14 Mar 2017 16:43:29 +0100 Subject: mov: Move code shared with CAF to a separate file --- libavformat/mov_esds.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 libavformat/mov_esds.c (limited to 'libavformat/mov_esds.c') diff --git a/libavformat/mov_esds.c b/libavformat/mov_esds.c new file mode 100644 index 0000000..b195f1a --- /dev/null +++ b/libavformat/mov_esds.c @@ -0,0 +1,43 @@ +/* + * This file is part of Libav. + * + * Libav 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, + * 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 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "avio.h" +#include "isom.h" + +int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb) +{ + AVStream *st; + int tag; + + if (fc->nb_streams < 1) + return 0; + st = fc->streams[fc->nb_streams-1]; + + avio_rb32(pb); /* version + flags */ + ff_mp4_read_descr(fc, pb, &tag); + if (tag == MP4ESDescrTag) { + ff_mp4_parse_es_descr(pb, NULL); + } else + avio_rb16(pb); /* ID */ + + ff_mp4_read_descr(fc, pb, &tag); + if (tag == MP4DecConfigDescrTag) + ff_mp4_read_dec_config_descr(fc, st, pb); + return 0; +} -- cgit v1.1