mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
qtmux: delegate mvex handling to atoms
... which keeps qtmux simpler.
This commit is contained in:
parent
2618cb03af
commit
ce865cc374
3 changed files with 20 additions and 42 deletions
|
@ -2593,24 +2593,14 @@ atom_trak_set_id (AtomTRAK * trak, guint32 id)
|
|||
trak->tkhd.track_ID = id;
|
||||
}
|
||||
|
||||
void
|
||||
atom_moov_add_trak (AtomMOOV * moov, AtomTRAK * trak)
|
||||
{
|
||||
atom_trak_set_id (trak, moov->mvhd.next_track_id++);
|
||||
moov->traks = g_list_append (moov->traks, trak);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
atom_moov_add_trex (AtomMOOV * moov, AtomTREX * trex)
|
||||
{
|
||||
moov->mvex.trexs = g_list_append (moov->mvex.trexs, trex);
|
||||
}
|
||||
|
||||
AtomTREX *
|
||||
atom_trex_new (AtomsContext * context, AtomTRAK * trak,
|
||||
guint32 default_sample_description_index,
|
||||
guint32 default_sample_duration, guint32 default_sample_size,
|
||||
guint32 default_sample_flags)
|
||||
static AtomTREX *
|
||||
atom_trex_new (AtomTRAK * trak)
|
||||
{
|
||||
guint8 flags[3] = { 0, 0, 0 };
|
||||
AtomTREX *trex = g_new0 (AtomTREX, 1);
|
||||
|
@ -2618,14 +2608,23 @@ atom_trex_new (AtomsContext * context, AtomTRAK * trak,
|
|||
atom_full_init (&trex->header, FOURCC_trex, 0, 0, 0, flags);
|
||||
|
||||
trex->track_ID = trak->tkhd.track_ID;
|
||||
trex->default_sample_description_index = default_sample_description_index;
|
||||
trex->default_sample_duration = default_sample_duration;
|
||||
trex->default_sample_size = default_sample_size;
|
||||
trex->default_sample_flags = default_sample_flags;
|
||||
trex->default_sample_description_index = 1;
|
||||
trex->default_sample_duration = 0;
|
||||
trex->default_sample_size = 0;
|
||||
trex->default_sample_flags = 0;
|
||||
|
||||
return trex;
|
||||
}
|
||||
|
||||
void
|
||||
atom_moov_add_trak (AtomMOOV * moov, AtomTRAK * trak)
|
||||
{
|
||||
atom_trak_set_id (trak, moov->mvhd.next_track_id++);
|
||||
moov->traks = g_list_append (moov->traks, trak);
|
||||
/* additional trak means also new trex */
|
||||
atom_moov_add_trex (moov, atom_trex_new (trak));
|
||||
}
|
||||
|
||||
static guint64
|
||||
atom_trak_get_duration (AtomTRAK * trak)
|
||||
{
|
||||
|
|
|
@ -694,10 +694,6 @@ void atom_stbl_add_samples (AtomSTBL * stbl, guint32 nsamples,
|
|||
guint64 chunk_offset, gboolean sync,
|
||||
gboolean do_pts, gint64 pts_offset);
|
||||
|
||||
AtomTREX* atom_trex_new (AtomsContext *context, AtomTRAK *trak,
|
||||
guint32 default_sample_description_index,
|
||||
guint32 default_sample_duration, guint32 default_sample_size,
|
||||
guint32 default_sample_flags);
|
||||
AtomMOOV* atom_moov_new (AtomsContext *context);
|
||||
void atom_moov_free (AtomMOOV *moov);
|
||||
guint64 atom_moov_copy_data (AtomMOOV *atom, guint8 **buffer, guint64 *size, guint64* offset);
|
||||
|
@ -707,7 +703,6 @@ void atom_moov_set_64bits (AtomMOOV *moov, gboolean large_file);
|
|||
void atom_moov_set_fragmented (AtomMOOV *moov, gboolean fragmented);
|
||||
void atom_moov_chunks_add_offset (AtomMOOV *moov, guint32 offset);
|
||||
void atom_moov_add_trak (AtomMOOV *moov, AtomTRAK *trak);
|
||||
void atom_moov_add_trex (AtomMOOV *moov, AtomTREX *trex);
|
||||
|
||||
guint64 atom_mvhd_copy_data (AtomMVHD * atom, guint8 ** buffer,
|
||||
guint64 * size, guint64 * offset);
|
||||
|
|
|
@ -271,23 +271,6 @@ gst_qt_mux_pad_reset (GstQTPad * qtpad)
|
|||
qtpad->trak = NULL;
|
||||
}
|
||||
|
||||
static AtomTRAK *
|
||||
gst_qt_mux_add_trak (GstQTMux * qtmux)
|
||||
{
|
||||
AtomTRAK *trak;
|
||||
|
||||
trak = atom_trak_new (qtmux->context);
|
||||
atom_moov_add_trak (qtmux->moov, trak);
|
||||
if (qtmux->fragmented) {
|
||||
AtomTREX *trex;
|
||||
|
||||
trex = atom_trex_new (qtmux->context, trak, 1, 0, 0, 0);
|
||||
atom_moov_add_trex (qtmux->moov, trex);
|
||||
}
|
||||
|
||||
return trak;
|
||||
}
|
||||
|
||||
/*
|
||||
* Takes GstQTMux back to its initial state
|
||||
*/
|
||||
|
@ -348,7 +331,8 @@ gst_qt_mux_reset (GstQTMux * qtmux, gboolean alloc)
|
|||
for (walk = qtmux->sinkpads; walk; walk = g_slist_next (walk)) {
|
||||
GstQTPad *qtpad = (GstQTPad *) walk->data;
|
||||
|
||||
qtpad->trak = gst_qt_mux_add_trak (qtmux);
|
||||
qtpad->trak = atom_trak_new (qtmux->context);
|
||||
atom_moov_add_trak (qtmux->moov, qtpad->trak);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1476,7 +1460,6 @@ gst_qt_mux_stop_file (GstQTMux * qtmux)
|
|||
timescale);
|
||||
atom_moov_update_timescale (qtmux->moov, timescale);
|
||||
atom_moov_set_64bits (qtmux->moov, large_file);
|
||||
atom_moov_set_fragmented (qtmux->moov, qtmux->fragmented);
|
||||
|
||||
atom_moov_update_duration (qtmux->moov);
|
||||
|
||||
|
@ -2714,8 +2697,9 @@ gst_qt_mux_request_new_pad (GstElement * element,
|
|||
(GstCollectDataDestroyNotify) (gst_qt_mux_pad_reset));
|
||||
/* set up pad */
|
||||
gst_qt_mux_pad_reset (collect_pad);
|
||||
collect_pad->trak = atom_trak_new (qtmux->context);
|
||||
atom_moov_add_trak (qtmux->moov, collect_pad->trak);
|
||||
|
||||
collect_pad->trak = gst_qt_mux_add_trak (qtmux);
|
||||
qtmux->sinkpads = g_slist_append (qtmux->sinkpads, collect_pad);
|
||||
|
||||
/* set up pad functions */
|
||||
|
|
Loading…
Reference in a new issue