From ca46897bf7b0a271a91d1a39b5e48b8787fa6c62 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Thu, 19 Nov 2015 18:36:39 +0000 Subject: [PATCH] isomp4: centralize all FourCC 10 FourCCs generated with GST_MAKE_FOURCC() in gstqtmux.c and atoms.c already exist in fourcc.h. Don't duplicate these and use them directly. Plus moving 6 to fourcc.h, to centralize them all. --- gst/isomp4/atoms.c | 23 ++++++++--------------- gst/isomp4/fourcc.h | 6 ++++++ gst/isomp4/gstqtmux.c | 16 ++++++++-------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/gst/isomp4/atoms.c b/gst/isomp4/atoms.c index efebf2d..fc98ab3 100644 --- a/gst/isomp4/atoms.c +++ b/gst/isomp4/atoms.c @@ -4362,8 +4362,7 @@ build_fiel_extension (gint fields) return NULL; } - atom_data = - atom_data_new_from_data (GST_MAKE_FOURCC ('f', 'i', 'e', 'l'), &f, 1); + atom_data = atom_data_new_from_data (FOURCC_fiel, &f, 1); return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, atom_data_free); @@ -4378,9 +4377,7 @@ build_jp2x_extension (const GstBuffer * prefix) return NULL; } - atom_data = - atom_data_new_from_gst_buffer (GST_MAKE_FOURCC ('j', 'p', '2', 'x'), - prefix); + atom_data = atom_data_new_from_gst_buffer (FOURCC_jp2x, prefix); return build_atom_info_wrapper ((Atom *) atom_data, atom_data_copy_data, atom_data_free); @@ -4436,8 +4433,7 @@ build_jp2h_extension (AtomTRAK * trak, gint width, gint height, /* ihdr = image header box */ gst_byte_writer_put_uint32_be_unchecked (&writer, 22); - gst_byte_writer_put_uint32_le_unchecked (&writer, GST_MAKE_FOURCC ('i', 'h', - 'd', 'r')); + gst_byte_writer_put_uint32_le_unchecked (&writer, FOURCC_ihdr); gst_byte_writer_put_uint32_be_unchecked (&writer, height); gst_byte_writer_put_uint32_be_unchecked (&writer, width); gst_byte_writer_put_uint16_be_unchecked (&writer, ncomp); @@ -4452,8 +4448,7 @@ build_jp2h_extension (AtomTRAK * trak, gint width, gint height, /* colour specification box */ gst_byte_writer_put_uint32_be_unchecked (&writer, 15); - gst_byte_writer_put_uint32_le_unchecked (&writer, GST_MAKE_FOURCC ('c', 'o', - 'l', 'r')); + gst_byte_writer_put_uint32_le_unchecked (&writer, FOURCC_colr); /* specification method: enumerated */ gst_byte_writer_put_uint8_unchecked (&writer, 0x1); @@ -4466,8 +4461,7 @@ build_jp2h_extension (AtomTRAK * trak, gint width, gint height, if (cmap_array) { gst_byte_writer_put_uint32_be_unchecked (&writer, cmap_size); - gst_byte_writer_put_uint32_le_unchecked (&writer, - GST_MAKE_FOURCC ('c', 'm', 'a', 'p')); + gst_byte_writer_put_uint32_le_unchecked (&writer, FOURCC_cmap); for (i = 0; i < cmap_array_size; i++) { const GValue *item; gint value; @@ -4494,8 +4488,7 @@ build_jp2h_extension (AtomTRAK * trak, gint width, gint height, if (cdef_array) { gst_byte_writer_put_uint32_be_unchecked (&writer, cdef_size); - gst_byte_writer_put_uint32_le_unchecked (&writer, - GST_MAKE_FOURCC ('c', 'd', 'e', 'f')); + gst_byte_writer_put_uint32_le_unchecked (&writer, FOURCC_cdef); gst_byte_writer_put_uint16_be_unchecked (&writer, cdef_array_size); for (i = 0; i < cdef_array_size; i++) { const GValue *item; @@ -4561,7 +4554,7 @@ build_amr_extension (void) GST_WRITE_UINT8 (ext + 8, 1); buf = GST_BUFFER_NEW_READONLY (ext, sizeof (ext)); - res = build_codec_data_extension (GST_MAKE_FOURCC ('d', 'a', 'm', 'r'), buf); + res = build_codec_data_extension (FOURCC_damr, buf); gst_buffer_unref (buf); return res; } @@ -4583,7 +4576,7 @@ build_h263_extension (void) GST_WRITE_UINT8 (ext + 6, 0); buf = GST_BUFFER_NEW_READONLY (ext, sizeof (ext)); - res = build_codec_data_extension (GST_MAKE_FOURCC ('d', '2', '6', '3'), buf); + res = build_codec_data_extension (FOURCC_d263, buf); gst_buffer_unref (buf); return res; } diff --git a/gst/isomp4/fourcc.h b/gst/isomp4/fourcc.h index bba6ad7..b0e3130 100644 --- a/gst/isomp4/fourcc.h +++ b/gst/isomp4/fourcc.h @@ -103,7 +103,9 @@ G_BEGIN_DECLS #define FOURCC_ctab GST_MAKE_FOURCC('c','t','a','b') #define FOURCC_ctts GST_MAKE_FOURCC('c','t','t','s') #define FOURCC_cslg GST_MAKE_FOURCC('c','s','l','g') +#define FOURCC_d263 GST_MAKE_FOURCC('d','2','6','3') #define FOURCC_dac3 GST_MAKE_FOURCC('d','a','c','3') +#define FOURCC_damr GST_MAKE_FOURCC('d','a','m','r') #define FOURCC_data GST_MAKE_FOURCC('d','a','t','a') #define FOURCC_dcom GST_MAKE_FOURCC('d','c','o','m') #define FOURCC_desc GST_MAKE_FOURCC('d','e','s','c') @@ -115,6 +117,10 @@ G_BEGIN_DECLS #define FOURCC_dref GST_MAKE_FOURCC('d','r','e','f') #define FOURCC_drmi GST_MAKE_FOURCC('d','r','m','i') #define FOURCC_drms GST_MAKE_FOURCC('d','r','m','s') +#define FOURCC_dvcp GST_MAKE_FOURCC('d','v','c','p') +#define FOURCC_dvc_ GST_MAKE_FOURCC('d','v','c',' ') +#define FOURCC_dv5p GST_MAKE_FOURCC('d','v','5','p') +#define FOURCC_dv5n GST_MAKE_FOURCC('d','v','5','n') #define FOURCC_edts GST_MAKE_FOURCC('e','d','t','s') #define FOURCC_elst GST_MAKE_FOURCC('e','l','s','t') #define FOURCC_enda GST_MAKE_FOURCC('e','n','d','a') diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index a2968f1..2529dc7 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -4001,15 +4001,15 @@ gst_qt_mux_video_sink_set_caps (GstQTPad * qtpad, GstCaps * caps) switch (version) { case 25: if (pal) - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', 'c', 'p'); + entry.fourcc = FOURCC_dvcp; else - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', 'c', ' '); + entry.fourcc = FOURCC_dvc_; break; case 50: if (pal) - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', '5', 'p'); + entry.fourcc = FOURCC_dv5p; else - entry.fourcc = GST_MAKE_FOURCC ('d', 'v', '5', 'n'); + entry.fourcc = FOURCC_dv5n; break; default: GST_WARNING_OBJECT (qtmux, "unrecognized dv version"); @@ -4077,13 +4077,13 @@ gst_qt_mux_video_sink_set_caps (GstQTPad * qtpad, GstCaps * caps) variant = gst_structure_get_string (structure, "format"); if (!variant || !g_strcmp0 (variant, "standard")) - entry.fourcc = GST_MAKE_FOURCC ('a', 'p', 'c', 'n'); + entry.fourcc = FOURCC_apcn; else if (!g_strcmp0 (variant, "lt")) - entry.fourcc = GST_MAKE_FOURCC ('a', 'p', 'c', 's'); + entry.fourcc = FOURCC_apcs; else if (!g_strcmp0 (variant, "hq")) - entry.fourcc = GST_MAKE_FOURCC ('a', 'p', 'c', 'h'); + entry.fourcc = FOURCC_apch; else if (!g_strcmp0 (variant, "proxy")) - entry.fourcc = GST_MAKE_FOURCC ('a', 'p', '4', 'h'); + entry.fourcc = FOURCC_ap4h; } if (!entry.fourcc) -- 2.7.4