1 /* Quicktime muxer plugin for GStreamer
2 * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 * Unless otherwise indicated, Source Code is licensed under MIT license.
21 * See further explanation attached in License Statement (distributed in the file
24 * Permission is hereby granted, free of charge, to any person obtaining a copy of
25 * this software and associated documentation files (the "Software"), to deal in
26 * the Software without restriction, including without limitation the rights to
27 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
28 * of the Software, and to permit persons to whom the Software is furnished to do
29 * so, subject to the following conditions:
31 * The above copyright notice and this permission notice shall be included in all
32 * copies or substantial portions of the Software.
34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43 #ifndef __ATOMS_RECOVERY_H__
44 #define __ATOMS_RECOVERY_H__
53 /* Version to be incremented each time we decide
54 * to change the file layout */
55 #define ATOMS_RECOV_FILE_VERSION 1
57 #define ATOMS_RECOV_QUARK (g_quark_from_string ("qtmux-atoms-recovery"))
59 /* gerror error codes */
60 #define ATOMS_RECOV_ERR_GENERIC 1
61 #define ATOMS_RECOV_ERR_FILE 2
62 #define ATOMS_RECOV_ERR_PARSING 3
63 #define ATOMS_RECOV_ERR_VERSION 4
65 /* this struct represents each buffer in a moov file, containing the info
66 * that is placed in the stsd children atoms
67 * Fields should be writen in BE order, and booleans should be writen as
68 * 1byte with 0 for false, anything otherwise */
69 #define TRAK_BUFFER_ENTRY_INFO_SIZE 34
80 } TrakBufferEntryInfo;
85 guint32 duration; /* duration in trak timescale */
86 guint32 timescale; /* trak's timescale */
90 /* need for later updating duration */
91 guint64 tkhd_file_offset;
92 guint64 mdhd_file_offset;
94 /* need these offsets to update size */
96 guint64 mdia_file_offset;
98 guint64 minf_file_offset;
100 guint64 stbl_file_offset;
103 guint64 post_stsd_offset;
106 guint32 extra_atoms_size;
107 guint32 extra_atoms_offset;
109 /* for storing the samples info */
118 /* results from parsing the input file */
120 guint32 mdat_header_size;
133 guint32 prefix_size; /* prefix + ftyp total size */
136 TrakRecovData *traks_rd;
139 gboolean atoms_recov_write_trak_info (FILE * f, AtomTRAK * trak);
140 gboolean atoms_recov_write_headers (FILE * f, AtomFTYP * ftyp,
141 GstBuffer * prefix, AtomMOOV * moov,
143 guint32 traks_number);
144 gboolean atoms_recov_write_trak_samples (FILE * f, AtomTRAK * trak,
145 guint32 nsamples, guint32 delta,
146 guint32 size, guint64 chunk_offset,
147 gboolean sync, gboolean do_pts,
150 MdatRecovFile * mdat_recov_file_create (FILE * file, gboolean datafile,
152 void mdat_recov_file_free (MdatRecovFile * mrf);
153 MoovRecovFile * moov_recov_file_create (FILE * file, GError ** err);
154 void moov_recov_file_free (MoovRecovFile * moovrf);
155 gboolean moov_recov_parse_buffers (MoovRecovFile * moovrf,
156 MdatRecovFile * mdatrf,
158 gboolean moov_recov_write_file (MoovRecovFile * moovrf,
159 MdatRecovFile * mdatrf, FILE * outf,
160 GError ** err, GError ** warn);
162 #endif /* __ATOMS_RECOVERY_H__ */