diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-14 22:34:33 +0000 |
commit | 7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch) | |
tree | f863b467dea9559a6ec9c48affbfae11f8104164 /gst-libs/gst/riff | |
parent | a19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff) | |
download | gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2 gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip |
gst-indent
Original commit message from CVS:
gst-indent
Diffstat (limited to 'gst-libs/gst/riff')
-rw-r--r-- | gst-libs/gst/riff/riff-ids.h | 80 | ||||
-rw-r--r-- | gst-libs/gst/riff/riff-media.c | 342 | ||||
-rw-r--r-- | gst-libs/gst/riff/riff-media.h | 23 | ||||
-rw-r--r-- | gst-libs/gst/riff/riff-read.c | 336 | ||||
-rw-r--r-- | gst-libs/gst/riff/riff-read.h | 59 | ||||
-rw-r--r-- | gst-libs/gst/riff/riff.c | 18 |
6 files changed, 395 insertions, 463 deletions
diff --git a/gst-libs/gst/riff/riff-ids.h b/gst-libs/gst/riff/riff-ids.h index da465c2d..141cbab5 100644 --- a/gst-libs/gst/riff/riff-ids.h +++ b/gst-libs/gst/riff/riff-ids.h @@ -66,29 +66,29 @@ #define GST_RIFF_FCCH_MSVC GST_MAKE_FOURCC ('M','S','V','C') /* INFO types - see http://www.saettler.com/RIFFMCI/riffmci.html */ -#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */ -#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */ -#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */ -#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */ -#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */ -#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */ -#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */ -#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */ -#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */ -#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */ -#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */ -#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */ -#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */ -#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */ -#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */ -#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */ -#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product */ -#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */ -#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */ -#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */ -#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */ -#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */ -#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */ +#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */ +#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */ +#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */ +#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */ +#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */ +#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */ +#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */ +#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */ +#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */ +#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */ +#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */ +#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */ +#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */ +#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */ +#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */ +#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */ +#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product */ +#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */ +#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */ +#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */ +#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */ +#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */ +#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */ /*********Chunk Names***************/ #define GST_RIFF_FF00 GST_MAKE_FOURCC (0xFF,0xFF,0x00,0x00) @@ -167,7 +167,7 @@ #define GST_RIFF_v422 GST_MAKE_FOURCC ('v', '4', '2', '2') #define GST_RIFF_V422 GST_MAKE_FOURCC ('V', '4', '2', '2') #define GST_RIFF_mvi1 GST_MAKE_FOURCC ('m', 'v', 'i', '1') -#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */ +#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */ #define GST_RIFF_AURA GST_MAKE_FOURCC ('A', 'U', 'R', 'A') #define GST_RIFF_DMB1 GST_MAKE_FOURCC ('D', 'M', 'B', '1') #define GST_RIFF_dmb1 GST_MAKE_FOURCC ('d', 'm', 'b', '1') @@ -203,7 +203,7 @@ #define GST_RIFF_rpza GST_MAKE_FOURCC ('r', 'p', 'z', 'a') /* And this here's the mistakes that need to be supported */ -#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */ +#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */ /*********** FND in MJPG **********/ #define GST_RIFF_ISFT GST_MAKE_FOURCC ('I', 'S', 'F', 'T') @@ -216,26 +216,28 @@ #define GST_RIFF_rec GST_MAKE_FOURCC ('r', 'e', 'c', ' ') /* common data structures */ -typedef struct _gst_riff_strh { - guint32 type; /* stream type */ - guint32 fcc_handler; /* fcc_handler */ +typedef struct _gst_riff_strh +{ + guint32 type; /* stream type */ + guint32 fcc_handler; /* fcc_handler */ guint32 flags; /* flags values */ #define GST_RIFF_STRH_DISABLED 0x000000001 #define GST_RIFF_STRH_VIDEOPALCHANGES 0x000010000 guint32 priority; - guint32 init_frames; /* initial frames (???) */ + guint32 init_frames; /* initial frames (???) */ guint32 scale; guint32 rate; guint32 start; guint32 length; - guint32 bufsize; /* suggested buffer size */ + guint32 bufsize; /* suggested buffer size */ guint32 quality; guint32 samplesize; /* XXX 16 bytes ? */ } gst_riff_strh; -typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */ +typedef struct _gst_riff_strf_vids +{ /* == BitMapInfoHeader */ guint32 size; guint32 width; guint32 height; @@ -245,13 +247,14 @@ typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */ guint32 image_size; guint32 xpels_meter; guint32 ypels_meter; - guint32 num_colors; /* used colors */ - guint32 imp_colors; /* important colors */ + guint32 num_colors; /* used colors */ + guint32 imp_colors; /* important colors */ /* may be more for some codecs */ } gst_riff_strf_vids; -typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */ +typedef struct _gst_riff_strf_auds +{ /* == WaveHeader (?) */ guint16 format; /**** from public Microsoft RIFF docs ******/ #define GST_RIFF_WAVE_FORMAT_UNKNOWN (0x0000) @@ -290,7 +293,8 @@ typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */ guint16 size; } gst_riff_strf_auds; -typedef struct _gst_riff_strf_iavs { +typedef struct _gst_riff_strf_iavs +{ guint32 DVAAuxSrc; guint32 DVAAuxCtl; guint32 DVAAuxSrc1; @@ -301,7 +305,8 @@ typedef struct _gst_riff_strf_iavs { guint32 DVReserved2; } gst_riff_strf_iavs; -typedef struct _gst_riff_index_entry { +typedef struct _gst_riff_index_entry +{ guint32 id; guint32 flags; #define GST_RIFF_IF_LIST (0x00000001L) @@ -312,7 +317,8 @@ typedef struct _gst_riff_index_entry { guint32 size; } gst_riff_index_entry; -typedef struct _gst_riff_dmlh { +typedef struct _gst_riff_dmlh +{ guint32 totalframes; } gst_riff_dmlh; diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index 424e243b..b51b4fb5 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -27,198 +27,183 @@ #include "riff-media.h" GstCaps * -gst_riff_create_video_caps (guint32 codec_fcc, - gst_riff_strh *strh, - gst_riff_strf_vids *strf, - char **codec_name) +gst_riff_create_video_caps (guint32 codec_fcc, + gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name) { GstCaps *caps = NULL; switch (codec_fcc) { - case GST_MAKE_FOURCC('I','4','2','0'): + case GST_MAKE_FOURCC ('I', '4', '2', '0'): caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, codec_fcc, - NULL); + "format", GST_TYPE_FOURCC, codec_fcc, NULL); if (codec_name) - *codec_name = g_strdup ("Raw, uncompressed I420"); + *codec_name = g_strdup ("Raw, uncompressed I420"); break; - case GST_MAKE_FOURCC('Y','U','Y','2'): + case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): caps = gst_caps_new_simple ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, codec_fcc, - NULL); + "format", GST_TYPE_FOURCC, codec_fcc, NULL); if (codec_name) - *codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2"); + *codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2"); break; - case GST_MAKE_FOURCC('M','J','P','G'): /* YUY2 MJPEG */ + case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */ caps = gst_caps_new_simple ("video/x-jpeg", NULL); if (codec_name) - *codec_name = g_strdup ("Motion JPEG"); + *codec_name = g_strdup ("Motion JPEG"); break; - case GST_MAKE_FOURCC('J','P','E','G'): /* generic (mostly RGB) MJPEG */ + case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */ caps = gst_caps_new_simple ("video/x-jpeg", NULL); if (codec_name) - *codec_name = g_strdup ("JPEG Still Image"); + *codec_name = g_strdup ("JPEG Still Image"); break; - - case GST_MAKE_FOURCC('P','I','X','L'): /* Miro/Pinnacle fourccs */ - case GST_MAKE_FOURCC('V','I','X','L'): /* Miro/Pinnacle fourccs */ + + case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */ + case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */ caps = gst_caps_new_simple ("video/x-jpeg", NULL); if (codec_name) - *codec_name = g_strdup ("Miro/Pinnacle Video XL"); + *codec_name = g_strdup ("Miro/Pinnacle Video XL"); break; - - case GST_MAKE_FOURCC('H','F','Y','U'): - caps = gst_caps_new_simple ( "video/x-huffyuv", NULL); + + case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'): + caps = gst_caps_new_simple ("video/x-huffyuv", NULL); if (codec_name) - *codec_name = g_strdup ("Huffman Lossless Codec"); + *codec_name = g_strdup ("Huffman Lossless Codec"); break; - - case GST_MAKE_FOURCC('M','P','E','G'): - case GST_MAKE_FOURCC('M','P','G','I'): + + case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'): + case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'): caps = gst_caps_new_simple ("video/mpeg", - "systemstream", G_TYPE_BOOLEAN, FALSE, - "mpegversion", G_TYPE_BOOLEAN, 1, - NULL); + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", G_TYPE_BOOLEAN, 1, NULL); if (codec_name) - *codec_name = g_strdup ("MPEG video"); + *codec_name = g_strdup ("MPEG video"); break; - case GST_MAKE_FOURCC('H','2','6','3'): + case GST_MAKE_FOURCC ('H', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("ITU H.26n"); + *codec_name = g_strdup ("ITU H.26n"); break; - case GST_MAKE_FOURCC('i','2','6','3'): + case GST_MAKE_FOURCC ('i', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("ITU H.263"); + *codec_name = g_strdup ("ITU H.263"); break; - case GST_MAKE_FOURCC('L','2','6','3'): + case GST_MAKE_FOURCC ('L', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Lead H.263"); + *codec_name = g_strdup ("Lead H.263"); break; - case GST_MAKE_FOURCC('M','2','6','3'): + case GST_MAKE_FOURCC ('M', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft H.263"); + *codec_name = g_strdup ("Microsoft H.263"); break; - case GST_MAKE_FOURCC('V','D','O','W'): + case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("VDOLive"); + *codec_name = g_strdup ("VDOLive"); break; - case GST_MAKE_FOURCC('V','I','V','O'): + case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Vivo H.263"); + *codec_name = g_strdup ("Vivo H.263"); break; - case GST_MAKE_FOURCC('x','2','6','3'): + case GST_MAKE_FOURCC ('x', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("Xirlink H.263"); + *codec_name = g_strdup ("Xirlink H.263"); break; - case GST_MAKE_FOURCC('D','I','V','3'): + case GST_MAKE_FOURCC ('D', 'I', 'V', '3'): caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 3, - NULL); + "divxversion", G_TYPE_INT, 3, NULL); if (codec_name) - *codec_name = g_strdup ("DivX MPEG-4 Version 3"); + *codec_name = g_strdup ("DivX MPEG-4 Version 3"); break; - case GST_MAKE_FOURCC('D','I','V','4'): + case GST_MAKE_FOURCC ('D', 'I', 'V', '4'): caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 4, - NULL); + "divxversion", G_TYPE_INT, 4, NULL); if (codec_name) - *codec_name = g_strdup ("DivX MPEG-4 Version 4"); + *codec_name = g_strdup ("DivX MPEG-4 Version 4"); break; - case GST_MAKE_FOURCC('d','i','v','x'): - case GST_MAKE_FOURCC('D','I','V','X'): - case GST_MAKE_FOURCC('D','X','5','0'): - case GST_MAKE_FOURCC('D','I','V','5'): + case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'): + case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): + case GST_MAKE_FOURCC ('D', 'X', '5', '0'): + case GST_MAKE_FOURCC ('D', 'I', 'V', '5'): caps = gst_caps_new_simple ("video/x-divx", - "divxversion", G_TYPE_INT, 5, - NULL); + "divxversion", G_TYPE_INT, 5, NULL); if (codec_name) - *codec_name = g_strdup ("DivX MPEG-4 Version 5"); + *codec_name = g_strdup ("DivX MPEG-4 Version 5"); break; - case GST_MAKE_FOURCC('X','V','I','D'): - case GST_MAKE_FOURCC('x','v','i','d'): + case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'): + case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'): caps = gst_caps_new_simple ("video/x-xvid", NULL); if (codec_name) - *codec_name = g_strdup ("XVID MPEG-4"); + *codec_name = g_strdup ("XVID MPEG-4"); break; - case GST_MAKE_FOURCC('M','P','G','4'): + case GST_MAKE_FOURCC ('M', 'P', 'G', '4'): caps = gst_caps_new_simple ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 41, - NULL); + "msmpegversion", G_TYPE_INT, 41, NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft MPEG-4 4.1"); + *codec_name = g_strdup ("Microsoft MPEG-4 4.1"); break; - case GST_MAKE_FOURCC('M','P','4','2'): + case GST_MAKE_FOURCC ('M', 'P', '4', '2'): caps = gst_caps_new_simple ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 42, - NULL); + "msmpegversion", G_TYPE_INT, 42, NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft MPEG-4 4.2"); + *codec_name = g_strdup ("Microsoft MPEG-4 4.2"); break; - case GST_MAKE_FOURCC('M','P','4','3'): + case GST_MAKE_FOURCC ('M', 'P', '4', '3'): caps = gst_caps_new_simple ("video/x-msmpeg", - "msmpegversion", G_TYPE_INT, 43, - NULL); + "msmpegversion", G_TYPE_INT, 43, NULL); if (codec_name) - *codec_name = g_strdup ("Microsoft MPEG-4 4.3"); + *codec_name = g_strdup ("Microsoft MPEG-4 4.3"); break; - case GST_MAKE_FOURCC('3','I','V','1'): - case GST_MAKE_FOURCC('3','I','V','2'): - caps = gst_caps_new_simple ( "video/x-3ivx", NULL); + case GST_MAKE_FOURCC ('3', 'I', 'V', '1'): + case GST_MAKE_FOURCC ('3', 'I', 'V', '2'): + caps = gst_caps_new_simple ("video/x-3ivx", NULL); if (codec_name) - *codec_name = g_strdup ("3ivx"); + *codec_name = g_strdup ("3ivx"); break; - case GST_MAKE_FOURCC('D','V','S','D'): - case GST_MAKE_FOURCC('d','v','s','d'): + case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'): + case GST_MAKE_FOURCC ('d', 'v', 's', 'd'): caps = gst_caps_new_simple ("video/x-dv", - "systemstream", G_TYPE_BOOLEAN, FALSE, - NULL); + "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); if (codec_name) - *codec_name = g_strdup ("Generic DV"); + *codec_name = g_strdup ("Generic DV"); break; - case GST_MAKE_FOURCC('W','M','V','1'): + case GST_MAKE_FOURCC ('W', 'M', 'V', '1'): caps = gst_caps_new_simple ("video/x-wmv", - "wmvversion", G_TYPE_INT, 1, - NULL); + "wmvversion", G_TYPE_INT, 1, NULL); if (codec_name) - *codec_name = g_strdup ("Windows Media Video 7"); + *codec_name = g_strdup ("Windows Media Video 7"); break; - case GST_MAKE_FOURCC('W','M','V','2'): + case GST_MAKE_FOURCC ('W', 'M', 'V', '2'): caps = gst_caps_new_simple ("video/x-wmv", - "wmvversion", G_TYPE_INT, 2, - NULL); + "wmvversion", G_TYPE_INT, 2, NULL); if (codec_name) - *codec_name = g_strdup ("Windows Media Video 8"); + *codec_name = g_strdup ("Windows Media Video 8"); break; - - case GST_MAKE_FOURCC('W','M','V','3'): + + case GST_MAKE_FOURCC ('W', 'M', 'V', '3'): caps = gst_caps_new_simple ("video/x-wmv", - "wmvversion", G_TYPE_INT, 3, - NULL); + "wmvversion", G_TYPE_INT, 3, NULL); if (codec_name) - *codec_name = g_strdup ("Windows Media Video 9"); + *codec_name = g_strdup ("Windows Media Video 9"); break; default: GST_WARNING ("Unkown video fourcc " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (codec_fcc)); + GST_FOURCC_ARGS (codec_fcc)); return NULL; } @@ -228,153 +213,136 @@ gst_riff_create_video_caps (guint32 codec_fcc, gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL); } else { gst_caps_set_simple (caps, - "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, - NULL); + "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL); } if (strf != NULL) { gst_caps_set_simple (caps, - "width", G_TYPE_INT, strf->width, - "height", G_TYPE_INT, strf->height, - NULL); + "width", G_TYPE_INT, strf->width, + "height", G_TYPE_INT, strf->height, NULL); } else { gst_caps_set_simple (caps, - "width", GST_TYPE_INT_RANGE, 16, 4096, - "height", GST_TYPE_INT_RANGE, 16, 4096, - NULL); + "width", GST_TYPE_INT_RANGE, 16, 4096, + "height", GST_TYPE_INT_RANGE, 16, 4096, NULL); } return caps; } GstCaps * -gst_riff_create_audio_caps (guint16 codec_id, - gst_riff_strh *strh, - gst_riff_strf_auds *strf, - char **codec_name) +gst_riff_create_audio_caps (guint16 codec_id, + gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name) { GstCaps *caps = NULL; switch (codec_id) { - case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */ + case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */ caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, - "layer", G_TYPE_INT, 3, - NULL); + "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); if (codec_name) - *codec_name = g_strdup ("MPEG 1 layer 3"); + *codec_name = g_strdup ("MPEG 1 layer 3"); break; - case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */ + case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */ caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 1, - "layer", G_TYPE_INT, 2, - NULL); + "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL); if (codec_name) - *codec_name = g_strdup ("MPEG 1 layer 2"); + *codec_name = g_strdup ("MPEG 1 layer 2"); break; - case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ + case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ if (strf != NULL) { - gint ba = GUINT16_FROM_LE (strf->blockalign); - gint ch = GUINT16_FROM_LE (strf->channels); - gint ws = GUINT16_FROM_LE (strf->size); - - caps = gst_caps_new_simple ("audio/x-raw-int", - "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, - "width", G_TYPE_INT, (int)(ba * 8 / ch), - "depth", G_TYPE_INT, ws, - "signed", G_TYPE_BOOLEAN, ws != 8, - NULL); + gint ba = GUINT16_FROM_LE (strf->blockalign); + gint ch = GUINT16_FROM_LE (strf->channels); + gint ws = GUINT16_FROM_LE (strf->size); + + caps = gst_caps_new_simple ("audio/x-raw-int", + "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, + "width", G_TYPE_INT, (int) (ba * 8 / ch), + "depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL); } else { - caps = gst_caps_from_string ("audio/x-raw-int, " - "endianness = (int) LITTLE_ENDIAN, " - "signed = (boolean) { true, false }, " - "width = (int) { 8, 16 }, " - "height = (int) { 8, 16 }"); + caps = gst_caps_from_string ("audio/x-raw-int, " + "endianness = (int) LITTLE_ENDIAN, " + "signed = (boolean) { true, false }, " + "width = (int) { 8, 16 }, " "height = (int) { 8, 16 }"); } if (codec_name) - *codec_name = g_strdup ("PCM WAV"); + *codec_name = g_strdup ("PCM WAV"); break; case GST_RIFF_WAVE_FORMAT_MULAW: if (strf != NULL && strf->size != 8) { - GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.", - strf->size); + GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.", + strf->size); } caps = gst_caps_new_simple ("audio/x-mulaw", NULL); if (codec_name) - *codec_name = g_strdup ("Mulaw"); + *codec_name = g_strdup ("Mulaw"); break; case GST_RIFF_WAVE_FORMAT_ALAW: if (strf != NULL && strf->size != 8) { - GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.", - strf->size); + GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.", + strf->size); } caps = gst_caps_new_simple ("audio/x-alaw", NULL); if (codec_name) - *codec_name = g_strdup ("Alaw"); + *codec_name = g_strdup ("Alaw"); break; - case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */ - case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */ - case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */ - case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */ - case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */ - case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */ + case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */ + case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */ + case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */ + case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */ + case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */ + case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */ caps = gst_caps_new_simple ("audio/x-vorbis", NULL); if (codec_name) - *codec_name = g_strdup ("Vorbis"); + *codec_name = g_strdup ("Vorbis"); break; case GST_RIFF_WAVE_FORMAT_A52: caps = gst_caps_new_simple ("audio/x-ac3", NULL); if (codec_name) - *codec_name = g_strdup ("AC3"); + *codec_name = g_strdup ("AC3"); break; default: - GST_WARNING ("Unkown audio tag 0x%04x", - codec_id); + GST_WARNING ("Unkown audio tag 0x%04x", codec_id); break; } if (strf != NULL) { gst_caps_set_simple (caps, - "rate", G_TYPE_INT, strf->rate, - "channels", G_TYPE_INT, strf->channels, - NULL); + "rate", G_TYPE_INT, strf->rate, + "channels", G_TYPE_INT, strf->channels, NULL); } else { gst_caps_set_simple (caps, - "rate", GST_TYPE_INT_RANGE, 8000, 96000, - "channels", GST_TYPE_INT_RANGE, 1, 2, - NULL); + "rate", GST_TYPE_INT_RANGE, 8000, 96000, + "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); } return caps; } GstCaps * -gst_riff_create_iavs_caps (guint32 codec_fcc, - gst_riff_strh *strh, - gst_riff_strf_iavs *strf, - char **codec_name) +gst_riff_create_iavs_caps (guint32 codec_fcc, + gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name) { GstCaps *caps = NULL; switch (codec_fcc) { - /* is this correct? */ - case GST_MAKE_FOURCC ('D','V','S','D'): - case GST_MAKE_FOURCC ('d','v','s','d'): - caps = gst_caps_new_simple ("video/x-dv", - "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); + /* is this correct? */ + case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'): + case GST_MAKE_FOURCC ('d', 'v', 's', 'd'): + caps = gst_caps_new_simple ("video/x-dv", + "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); if (codec_name) - *codec_name = g_strdup ("Generic DV"); + *codec_name = g_strdup ("Generic DV"); default: GST_WARNING ("Unkown IAVS fourcc " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (codec_fcc)); + GST_FOURCC_ARGS (codec_fcc)); return NULL; } @@ -389,22 +357,22 @@ GstCaps * gst_riff_create_video_template_caps (void) { guint32 tags[] = { - GST_MAKE_FOURCC ('I','4','2','0'), - GST_MAKE_FOURCC ('Y','U','Y','2'), - GST_MAKE_FOURCC ('M','J','P','G'), - GST_MAKE_FOURCC ('D','V','S','D'), - GST_MAKE_FOURCC ('W','M','V','1'), - GST_MAKE_FOURCC ('W','M','V','2'), - GST_MAKE_FOURCC ('M','P','G','4'), - GST_MAKE_FOURCC ('M','P','4','2'), - GST_MAKE_FOURCC ('M','P','4','3'), - GST_MAKE_FOURCC ('H','F','Y','U'), - GST_MAKE_FOURCC ('D','I','V','3'), - GST_MAKE_FOURCC ('M','P','E','G'), - GST_MAKE_FOURCC ('H','2','6','3'), - GST_MAKE_FOURCC ('D','I','V','X'), - GST_MAKE_FOURCC ('X','V','I','D'), - GST_MAKE_FOURCC ('3','I','V','1'), + GST_MAKE_FOURCC ('I', '4', '2', '0'), + GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), + GST_MAKE_FOURCC ('M', 'J', 'P', 'G'), + GST_MAKE_FOURCC ('D', 'V', 'S', 'D'), + GST_MAKE_FOURCC ('W', 'M', 'V', '1'), + GST_MAKE_FOURCC ('W', 'M', 'V', '2'), + GST_MAKE_FOURCC ('M', 'P', 'G', '4'), + GST_MAKE_FOURCC ('M', 'P', '4', '2'), + GST_MAKE_FOURCC ('M', 'P', '4', '3'), + GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'), + GST_MAKE_FOURCC ('D', 'I', 'V', '3'), + GST_MAKE_FOURCC ('M', 'P', 'E', 'G'), + GST_MAKE_FOURCC ('H', '2', '6', '3'), + GST_MAKE_FOURCC ('D', 'I', 'V', 'X'), + GST_MAKE_FOURCC ('X', 'V', 'I', 'D'), + GST_MAKE_FOURCC ('3', 'I', 'V', '1'), /* FILL ME */ 0 }; @@ -452,7 +420,7 @@ GstCaps * gst_riff_create_iavs_template_caps (void) { guint32 tags[] = { - GST_MAKE_FOURCC ('D','V','S','D'), + GST_MAKE_FOURCC ('D', 'V', 'S', 'D'), /* FILL ME */ 0 }; diff --git a/gst-libs/gst/riff/riff-media.h b/gst-libs/gst/riff/riff-media.h index 220671af..ca4a9434 100644 --- a/gst-libs/gst/riff/riff-media.h +++ b/gst-libs/gst/riff/riff-media.h @@ -27,23 +27,15 @@ #include "riff-ids.h" G_BEGIN_DECLS - /* * Create one caps. strh/strf can be NULL (for non-fixed caps). */ - -GstCaps *gst_riff_create_video_caps (guint32 codec_fcc, - gst_riff_strh *strh, - gst_riff_strf_vids *strf, - char **codec_name); -GstCaps *gst_riff_create_audio_caps (guint16 codec_id, - gst_riff_strh *strh, - gst_riff_strf_auds *strf, - char **codec_name); -GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc, - gst_riff_strh *strh, - gst_riff_strf_iavs *strf, - char **codec_name); + GstCaps * gst_riff_create_video_caps (guint32 codec_fcc, + gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name); +GstCaps *gst_riff_create_audio_caps (guint16 codec_id, + gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name); +GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc, + gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name); /* * Create template caps (includes all known types). @@ -51,8 +43,7 @@ GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc, GstCaps *gst_riff_create_video_template_caps (void); GstCaps *gst_riff_create_audio_template_caps (void); -GstCaps *gst_riff_create_iavs_template_caps (void); +GstCaps *gst_riff_create_iavs_template_caps (void); G_END_DECLS - #endif /* __GST_RIFF_READ_H__ */ diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index 6f282c51..c8c5b634 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -28,28 +28,28 @@ #include "riff-ids.h" #include "riff-read.h" -enum { +enum +{ ARG_0, ARG_METADATA - /* FILL ME */ + /* FILL ME */ }; -static void gst_riff_read_class_init (GstRiffReadClass *klass); -static void gst_riff_read_init (GstRiffRead *riff); +static void gst_riff_read_class_init (GstRiffReadClass * klass); +static void gst_riff_read_init (GstRiffRead * riff); -static GstElementStateReturn - gst_riff_read_change_state (GstElement *element); +static GstElementStateReturn gst_riff_read_change_state (GstElement * element); static GstElementClass *parent_class = NULL; GType -gst_riff_read_get_type (void) +gst_riff_read_get_type (void) { static GType gst_riff_read_type = 0; if (!gst_riff_read_type) { static const GTypeInfo gst_riff_read_info = { - sizeof (GstRiffReadClass), + sizeof (GstRiffReadClass), NULL, NULL, (GClassInitFunc) gst_riff_read_class_init, @@ -62,24 +62,24 @@ gst_riff_read_get_type (void) gst_riff_read_type = g_type_register_static (GST_TYPE_ELEMENT, "GstRiffRead", - &gst_riff_read_info, 0); + &gst_riff_read_info, 0); } return gst_riff_read_type; } static void -gst_riff_read_class_init (GstRiffReadClass *klass) +gst_riff_read_class_init (GstRiffReadClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); parent_class = g_type_class_ref (GST_TYPE_ELEMENT); - + gstelement_class->change_state = gst_riff_read_change_state; } static void -gst_riff_read_init (GstRiffRead *riff) +gst_riff_read_init (GstRiffRead * riff) { riff->sinkpad = NULL; riff->bs = NULL; @@ -87,23 +87,23 @@ gst_riff_read_init (GstRiffRead *riff) } static GstElementStateReturn -gst_riff_read_change_state (GstElement *element) +gst_riff_read_change_state (GstElement * element) { GstRiffRead *riff = GST_RIFF_READ (element); switch (GST_STATE_TRANSITION (element)) { case GST_STATE_READY_TO_PAUSED: if (!riff->sinkpad) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; riff->bs = gst_bytestream_new (riff->sinkpad); break; case GST_STATE_PAUSED_TO_READY: gst_bytestream_destroy (riff->bs); while (riff->level) { - GstRiffLevel *level = riff->level->data; + GstRiffLevel *level = riff->level->data; - riff->level = g_list_remove (riff->level, level); - g_free (level); + riff->level = g_list_remove (riff->level, level); + g_free (level); } break; default: @@ -124,7 +124,7 @@ gst_riff_read_change_state (GstElement *element) */ static guint -gst_riff_read_element_level_up (GstRiffRead *riff) +gst_riff_read_element_level_up (GstRiffRead * riff) { guint num = 0; guint64 pos = gst_bytestream_tell (riff->bs); @@ -150,10 +150,8 @@ gst_riff_read_element_level_up (GstRiffRead *riff) */ static gboolean -gst_riff_peek_head (GstRiffRead *riff, - guint32 *tag, - guint32 *length, - guint *level_up) +gst_riff_peek_head (GstRiffRead * riff, + guint32 * tag, guint32 * length, guint * level_up) { guint8 *data; @@ -167,7 +165,7 @@ gst_riff_peek_head (GstRiffRead *riff, if (GST_IS_EVENT (event)) { gst_pad_event_default (riff->sinkpad, event); if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) - return FALSE; + return FALSE; } else { GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL)); return FALSE; @@ -192,8 +190,7 @@ gst_riff_peek_head (GstRiffRead *riff, */ static GstBuffer * -gst_riff_read_element_data (GstRiffRead *riff, - guint length) +gst_riff_read_element_data (GstRiffRead * riff, guint length) { GstBuffer *buf = NULL; @@ -218,8 +215,7 @@ gst_riff_read_element_data (GstRiffRead *riff, */ GstEvent * -gst_riff_read_seek (GstRiffRead *riff, - guint64 offset) +gst_riff_read_seek (GstRiffRead * riff, guint64 offset) { guint64 length = gst_bytestream_length (riff->bs); guint32 remaining; @@ -261,7 +257,7 @@ gst_riff_read_seek (GstRiffRead *riff, } else if (GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) { gst_pad_event_default (riff->sinkpad, event); if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) - return NULL; + return NULL; event = NULL; } } @@ -274,8 +270,7 @@ gst_riff_read_seek (GstRiffRead *riff, */ guint32 -gst_riff_peek_tag (GstRiffRead *riff, - guint *level_up) +gst_riff_peek_tag (GstRiffRead * riff, guint * level_up) { guint32 tag; @@ -290,7 +285,7 @@ gst_riff_peek_tag (GstRiffRead *riff, */ guint32 -gst_riff_peek_list (GstRiffRead *riff) +gst_riff_peek_list (GstRiffRead * riff) { guint32 lst; guint8 *data; @@ -315,7 +310,7 @@ gst_riff_peek_list (GstRiffRead *riff) */ gboolean -gst_riff_read_skip (GstRiffRead *riff) +gst_riff_read_skip (GstRiffRead * riff) { guint32 tag, length; GstEvent *event; @@ -346,7 +341,7 @@ gst_riff_read_skip (GstRiffRead *riff) /* no */ if (!(event = gst_riff_read_seek (riff, - gst_bytestream_tell (riff->bs) + length))) + gst_bytestream_tell (riff->bs) + length))) return FALSE; gst_event_unref (event); @@ -359,9 +354,7 @@ gst_riff_read_skip (GstRiffRead *riff) */ gboolean -gst_riff_read_data (GstRiffRead *riff, - guint32 *tag, - GstBuffer **buf) +gst_riff_read_data (GstRiffRead * riff, guint32 * tag, GstBuffer ** buf) { guint32 length; @@ -377,9 +370,7 @@ gst_riff_read_data (GstRiffRead *riff, */ gboolean -gst_riff_read_ascii (GstRiffRead *riff, - guint32 *tag, - gchar **str) +gst_riff_read_ascii (GstRiffRead * riff, guint32 * tag, gchar ** str) { GstBuffer *buf; @@ -400,8 +391,7 @@ gst_riff_read_ascii (GstRiffRead *riff, */ gboolean -gst_riff_read_strh (GstRiffRead *riff, - gst_riff_strh **header) +gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header) { guint32 tag; GstBuffer *buf; @@ -417,28 +407,27 @@ gst_riff_read_strh (GstRiffRead *riff, } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh)) { g_warning ("Too small strh (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh)); gst_buffer_unref (buf); return FALSE; } - strh = g_memdup (GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); + strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); gst_buffer_unref (buf); #if (G_BYTE_ORDER == G_BIG_ENDIAN) - strh->type = GUINT32_FROM_LE (strh->type); + strh->type = GUINT32_FROM_LE (strh->type); strh->fcc_handler = GUINT32_FROM_LE (strh->fcc_handler); - strh->flags = GUINT32_FROM_LE (strh->flags); - strh->priority = GUINT32_FROM_LE (strh->priority); + strh->flags = GUINT32_FROM_LE (strh->flags); + strh->priority = GUINT32_FROM_LE (strh->priority); strh->init_frames = GUINT32_FROM_LE (strh->init_frames); - strh->scale = GUINT32_FROM_LE (strh->scale); - strh->rate = GUINT32_FROM_LE (strh->rate); - strh->start = GUINT32_FROM_LE (strh->start); - strh->length = GUINT32_FROM_LE (strh->length); - strh->bufsize = GUINT32_FROM_LE (strh->bufsize); - strh->quality = GUINT32_FROM_LE (strh->quality); - strh->samplesize = GUINT32_FROM_LE (strh->samplesize); + strh->scale = GUINT32_FROM_LE (strh->scale); + strh->rate = GUINT32_FROM_LE (strh->rate); + strh->start = GUINT32_FROM_LE (strh->start); + strh->length = GUINT32_FROM_LE (strh->length); + strh->bufsize = GUINT32_FROM_LE (strh->bufsize); + strh->quality = GUINT32_FROM_LE (strh->quality); + strh->samplesize = GUINT32_FROM_LE (strh->samplesize); #endif /* avoid divisions by zero */ @@ -449,20 +438,19 @@ gst_riff_read_strh (GstRiffRead *riff, /* debug */ GST_INFO ("strh tag found"); - GST_INFO (" type " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (strh->type)); + GST_INFO (" type " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (strh->type)); GST_INFO (" fcc_handler " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (strh->fcc_handler)); + GST_FOURCC_ARGS (strh->fcc_handler)); GST_INFO (" flags 0x%08x", strh->flags); - GST_INFO (" priority %d", strh->priority); - GST_INFO (" init_frames %d", strh->init_frames); - GST_INFO (" scale %d", strh->scale); - GST_INFO (" rate %d", strh->rate); - GST_INFO (" start %d", strh->start); - GST_INFO (" length %d", strh->length); - GST_INFO (" bufsize %d", strh->bufsize); - GST_INFO (" quality %d", strh->quality); - GST_INFO (" samplesize %d", strh->samplesize); + GST_INFO (" priority %d", strh->priority); + GST_INFO (" init_frames %d", strh->init_frames); + GST_INFO (" scale %d", strh->scale); + GST_INFO (" rate %d", strh->rate); + GST_INFO (" start %d", strh->start); + GST_INFO (" length %d", strh->length); + GST_INFO (" bufsize %d", strh->bufsize); + GST_INFO (" quality %d", strh->quality); + GST_INFO (" samplesize %d", strh->samplesize); *header = strh; @@ -470,8 +458,7 @@ gst_riff_read_strh (GstRiffRead *riff, } gboolean -gst_riff_read_strf_vids (GstRiffRead *riff, - gst_riff_strf_vids **header) +gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header) { guint32 tag; GstBuffer *buf; @@ -487,32 +474,31 @@ gst_riff_read_strf_vids (GstRiffRead *riff, } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids)) { g_warning ("Too small strf_vids (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids)); gst_buffer_unref (buf); return FALSE; } - strf = g_memdup (GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); + strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); #if (G_BYTE_ORDER == G_BIG_ENDIAN) - strf->size = GUINT32_FROM_LE (strf->size); - strf->width = GUINT32_FROM_LE (strf->width); - strf->height = GUINT32_FROM_LE (strf->height); - strf->planes = GUINT16_FROM_LE (strf->planes); - strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt); + strf->size = GUINT32_FROM_LE (strf->size); + strf->width = GUINT32_FROM_LE (strf->width); + strf->height = GUINT32_FROM_LE (strf->height); + strf->planes = GUINT16_FROM_LE (strf->planes); + strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt); strf->compression = GUINT32_FROM_LE (strf->compression); - strf->image_size = GUINT32_FROM_LE (strf->image_size); + strf->image_size = GUINT32_FROM_LE (strf->image_size); strf->xpels_meter = GUINT32_FROM_LE (strf->xpels_meter); strf->ypels_meter = GUINT32_FROM_LE (strf->ypels_meter); - strf->num_colors = GUINT32_FROM_LE (strf->num_colors); - strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors); + strf->num_colors = GUINT32_FROM_LE (strf->num_colors); + strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors); #endif /* size checking */ if (strf->size > GST_BUFFER_SIZE (buf)) { g_warning ("strf_vids header gave %d bytes data, only %d available", - strf->size, GST_BUFFER_SIZE (buf)); + strf->size, GST_BUFFER_SIZE (buf)); strf->size = GST_BUFFER_SIZE (buf); } @@ -524,7 +510,7 @@ gst_riff_read_strf_vids (GstRiffRead *riff, GST_INFO (" planes %d", strf->planes); GST_INFO (" bit_cnt %d", strf->bit_cnt); GST_INFO (" compression " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (strf->compression)); + GST_FOURCC_ARGS (strf->compression)); GST_INFO (" image_size %d", strf->image_size); GST_INFO (" xpels_meter %d", strf->xpels_meter); GST_INFO (" ypels_meter %d", strf->ypels_meter); @@ -539,8 +525,7 @@ gst_riff_read_strf_vids (GstRiffRead *riff, } gboolean -gst_riff_read_strf_auds (GstRiffRead *riff, - gst_riff_strf_auds **header) +gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header) { guint32 tag; GstBuffer *buf; @@ -556,21 +541,20 @@ gst_riff_read_strf_auds (GstRiffRead *riff, } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_auds)) { g_warning ("Too small strf_auds (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds)); gst_buffer_unref (buf); return FALSE; } - strf = g_memdup (GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); + strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); #if (G_BYTE_ORDER == G_BIG_ENDIAN) - strf->format = GUINT16_FROM_LE (strf->format); - strf->channels = GUINT16_FROM_LE (strf->channels); - strf->rate = GUINT32_FROM_LE (strf->rate); - strf->av_bps = GUINT32_FROM_LE (strf->av_bps); + strf->format = GUINT16_FROM_LE (strf->format); + strf->channels = GUINT16_FROM_LE (strf->channels); + strf->rate = GUINT32_FROM_LE (strf->rate); + strf->av_bps = GUINT32_FROM_LE (strf->av_bps); strf->blockalign = GUINT16_FROM_LE (strf->blockalign); - strf->size = GUINT16_FROM_LE (strf->size); + strf->size = GUINT16_FROM_LE (strf->size); #endif /* debug */ @@ -580,7 +564,7 @@ gst_riff_read_strf_auds (GstRiffRead *riff, GST_INFO (" rate %d", strf->rate); GST_INFO (" av_bps %d", strf->av_bps); GST_INFO (" blockalign %d", strf->blockalign); - GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */ + GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */ gst_buffer_unref (buf); @@ -590,8 +574,7 @@ gst_riff_read_strf_auds (GstRiffRead *riff, } gboolean -gst_riff_read_strf_iavs (GstRiffRead *riff, - gst_riff_strf_iavs **header) +gst_riff_read_strf_iavs (GstRiffRead * riff, gst_riff_strf_iavs ** header) { guint32 tag; GstBuffer *buf; @@ -607,22 +590,21 @@ gst_riff_read_strf_iavs (GstRiffRead *riff, } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs)) { g_warning ("Too small strf_iavs (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs)); gst_buffer_unref (buf); return FALSE; } - strf = g_memdup (GST_BUFFER_DATA (buf), - GST_BUFFER_SIZE (buf)); + strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf)); gst_buffer_unref (buf); #if (G_BYTE_ORDER == G_BIG_ENDIAN) - strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc); - strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl); - strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1); - strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1); - strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc); - strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl); + strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc); + strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl); + strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1); + strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1); + strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc); + strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl); strf->DVReserved1 = GUINT32_FROM_LE (strf->DVReserved1); strf->DVReserved2 = GUINT32_FROM_LE (strf->DVReserved2); #endif @@ -648,8 +630,7 @@ gst_riff_read_strf_iavs (GstRiffRead *riff, */ gboolean -gst_riff_read_list (GstRiffRead *riff, - guint32 *tag) +gst_riff_read_list (GstRiffRead * riff, guint32 * tag) { guint32 length, lst; GstRiffLevel *level; @@ -667,7 +648,7 @@ gst_riff_read_list (GstRiffRead *riff, return FALSE; } gst_bytestream_flush_fast (riff->bs, 4); - *tag = GUINT32_FROM_LE (* (guint32 *) data); + *tag = GUINT32_FROM_LE (*(guint32 *) data); /* remember level */ level = g_new (GstRiffLevel, 1); @@ -683,7 +664,7 @@ gst_riff_read_list (GstRiffRead *riff, */ gboolean -gst_riff_read_info (GstRiffRead *riff) +gst_riff_read_info (GstRiffRead * riff) { guint32 tag; guint64 end; @@ -713,100 +694,102 @@ gst_riff_read_info (GstRiffRead *riff) /* find out the type of metadata */ switch (tag) { case GST_RIFF_INFO_IARL: - type = GST_TAG_LOCATION; - break; + type = GST_TAG_LOCATION; + break; case GST_RIFF_INFO_IART: - type = GST_TAG_ARTIST; - break; + type = GST_TAG_ARTIST; + break; case GST_RIFF_INFO_ICMS: - type = NULL; /*"Commissioner";*/ - break; + type = NULL; /*"Commissioner"; */ + break; case GST_RIFF_INFO_ICMT: - type = GST_TAG_COMMENT; - break; + type = GST_TAG_COMMENT; + break; case GST_RIFF_INFO_ICOP: - type = GST_TAG_COPYRIGHT; - break; + type = GST_TAG_COPYRIGHT; + break; case GST_RIFF_INFO_ICRD: - type = GST_TAG_DATE; - break; + type = GST_TAG_DATE; + break; case GST_RIFF_INFO_ICRP: - type = NULL; /*"Cropped";*/ - break; + type = NULL; /*"Cropped"; */ + break; case GST_RIFF_INFO_IDIM: - type = NULL; /*"Dimensions";*/ - break; + type = NULL; /*"Dimensions"; */ + break; case GST_RIFF_INFO_IDPI: - type = NULL; /*"Dots per Inch";*/ - break; + type = NULL; /*"Dots per Inch"; */ + break; case GST_RIFF_INFO_IENG: - type = NULL; /*"Engineer";*/ - break; + type = NULL; /*"Engineer"; */ + break; case GST_RIFF_INFO_IGNR: - type = GST_TAG_GENRE; - break; + type = GST_TAG_GENRE; + break; case GST_RIFF_INFO_IKEY: - type = NULL; /*"Keywords";*/; - break; + type = NULL; /*"Keywords"; */ ; + break; case GST_RIFF_INFO_ILGT: - type = NULL; /*"Lightness";*/ - break; + type = NULL; /*"Lightness"; */ + break; case GST_RIFF_INFO_IMED: - type = NULL; /*"Medium";*/ - break; + type = NULL; /*"Medium"; */ + break; case GST_RIFF_INFO_INAM: - type = GST_TAG_TITLE; - break; + type = GST_TAG_TITLE; + break; case GST_RIFF_INFO_IPLT: - type = NULL; /*"Palette";*/ - break; + type = NULL; /*"Palette"; */ + break; case GST_RIFF_INFO_IPRD: - type = NULL; /*"Product";*/ - break; + type = NULL; /*"Product"; */ + break; case GST_RIFF_INFO_ISBJ: - type = NULL; /*"Subject";*/ - break; + type = NULL; /*"Subject"; */ + break; case GST_RIFF_INFO_ISFT: - type = GST_TAG_ENCODER; - break; + type = GST_TAG_ENCODER; + break; case GST_RIFF_INFO_ISHP: - type = NULL; /*"Sharpness";*/ - break; + type = NULL; /*"Sharpness"; */ + break; case GST_RIFF_INFO_ISRC: - type = GST_TAG_ISRC; - break; + type = GST_TAG_ISRC; + break; case GST_RIFF_INFO_ISRF: - type = NULL; /*"Source Form";*/ - break; + type = NULL; /*"Source Form"; */ + break; case GST_RIFF_INFO_ITCH: - type = NULL; /*"Technician";*/ - break; + type = NULL; /*"Technician"; */ + break; default: - type = NULL; - GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (tag)); - break; + type = NULL; + GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT, + GST_FOURCC_ARGS (tag)); + break; } if (type) { name = NULL; if (!gst_riff_read_ascii (riff, &tag, &name)) { - return FALSE; + return FALSE; } if (name && name[0] != '\0') { - GValue src = { 0 }, dest = { 0 }; - GType dest_type = gst_tag_get_type (type); - - have_tags = TRUE; - g_value_init (&src, G_TYPE_STRING); - g_value_set_string (&src, name); - g_value_init (&dest, dest_type); - g_value_transform (&src, &dest); - g_value_unset (&src); - gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, - type, &dest, NULL); - g_value_unset (&dest); + GValue src = { 0 } + , dest = { + 0}; + GType dest_type = gst_tag_get_type (type); + + have_tags = TRUE; + g_value_init (&src, G_TYPE_STRING); + g_value_set_string (&src, name); + g_value_init (&dest, dest_type); + g_value_transform (&src, &dest); + g_value_unset (&src); + gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND, + type, &dest, NULL); + g_value_unset (&dest); } g_free (name); } else { @@ -821,10 +804,10 @@ gst_riff_read_info (GstRiffRead *riff) /* let the world know about this wonderful thing */ for (padlist = gst_element_get_pad_list (element); - padlist != NULL; padlist = padlist->next) { - if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE(padlist->data)) { - gst_event_ref (event); - gst_pad_push (GST_PAD (padlist->data), GST_DATA (event)); + padlist != NULL; padlist = padlist->next) { + if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE (padlist->data)) { + gst_event_ref (event); + gst_pad_push (GST_PAD (padlist->data), GST_DATA (event)); } } gst_event_unref (event); @@ -839,8 +822,7 @@ gst_riff_read_info (GstRiffRead *riff) */ gboolean -gst_riff_read_header (GstRiffRead *riff, - guint32 *doctype) +gst_riff_read_header (GstRiffRead * riff, guint32 * doctype) { GstRiffLevel *level; guint32 tag, length; @@ -861,7 +843,7 @@ gst_riff_read_header (GstRiffRead *riff, return FALSE; } gst_bytestream_flush_fast (riff->bs, 4); - *doctype = GUINT32_FROM_LE (* (guint32 *) data); + *doctype = GUINT32_FROM_LE (*(guint32 *) data); /* remember level */ level = g_new (GstRiffLevel, 1); diff --git a/gst-libs/gst/riff/riff-read.h b/gst-libs/gst/riff/riff-read.h index 9c663cca..41ae89e3 100644 --- a/gst-libs/gst/riff/riff-read.h +++ b/gst-libs/gst/riff/riff-read.h @@ -27,7 +27,6 @@ #include <gst/bytestream/bytestream.h> G_BEGIN_DECLS - #define GST_TYPE_RIFF_READ \ (gst_riff_read_get_type ()) #define GST_RIFF_READ(obj) \ @@ -40,13 +39,13 @@ G_BEGIN_DECLS (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RIFF_READ)) #define GST_RIFF_READ_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RIFF_READ, GstRiffReadClass)) - -typedef struct _GstRiffLevel { - guint64 start, - length; + typedef struct _GstRiffLevel +{ + guint64 start, length; } GstRiffLevel; -typedef struct _GstRiffRead { +typedef struct _GstRiffRead +{ GstElement parent; GstPad *sinkpad; @@ -55,43 +54,35 @@ typedef struct _GstRiffRead { GList *level; } GstRiffRead; -typedef struct _GstRiffReadClass { +typedef struct _GstRiffReadClass +{ GstElementClass parent; } GstRiffReadClass; -GType gst_riff_read_get_type (void); +GType gst_riff_read_get_type (void); -guint32 gst_riff_peek_tag (GstRiffRead *riff, - guint *level_up); -guint32 gst_riff_peek_list (GstRiffRead *riff); +guint32 gst_riff_peek_tag (GstRiffRead * riff, guint * level_up); +guint32 gst_riff_peek_list (GstRiffRead * riff); -GstEvent *gst_riff_read_seek (GstRiffRead *riff, - guint64 offset); -gboolean gst_riff_read_skip (GstRiffRead *riff); -gboolean gst_riff_read_data (GstRiffRead *riff, - guint32 *tag, - GstBuffer **buf); -gboolean gst_riff_read_ascii (GstRiffRead *riff, - guint32 *tag, - gchar **str); -gboolean gst_riff_read_list (GstRiffRead *riff, - guint32 *tag); -gboolean gst_riff_read_header (GstRiffRead *read, - guint32 *doctype); +GstEvent *gst_riff_read_seek (GstRiffRead * riff, guint64 offset); +gboolean gst_riff_read_skip (GstRiffRead * riff); +gboolean gst_riff_read_data (GstRiffRead * riff, + guint32 * tag, GstBuffer ** buf); +gboolean gst_riff_read_ascii (GstRiffRead * riff, guint32 * tag, gchar ** str); +gboolean gst_riff_read_list (GstRiffRead * riff, guint32 * tag); +gboolean gst_riff_read_header (GstRiffRead * read, guint32 * doctype); /* * Utility functions (including byteswapping). */ -gboolean gst_riff_read_strh (GstRiffRead *riff, - gst_riff_strh **header); -gboolean gst_riff_read_strf_vids (GstRiffRead *riff, - gst_riff_strf_vids **header); -gboolean gst_riff_read_strf_auds (GstRiffRead *riff, - gst_riff_strf_auds **header); -gboolean gst_riff_read_strf_iavs (GstRiffRead *riff, - gst_riff_strf_iavs **header); -gboolean gst_riff_read_info (GstRiffRead *riff); +gboolean gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header); +gboolean gst_riff_read_strf_vids (GstRiffRead * riff, + gst_riff_strf_vids ** header); +gboolean gst_riff_read_strf_auds (GstRiffRead * riff, + gst_riff_strf_auds ** header); +gboolean gst_riff_read_strf_iavs (GstRiffRead * riff, + gst_riff_strf_iavs ** header); +gboolean gst_riff_read_info (GstRiffRead * riff); G_END_DECLS - #endif /* __GST_RIFF_READ_H__ */ diff --git a/gst-libs/gst/riff/riff.c b/gst-libs/gst/riff/riff.c index 9c0ce2ae..ab8d47b5 100644 --- a/gst-libs/gst/riff/riff.c +++ b/gst-libs/gst/riff/riff.c @@ -26,19 +26,13 @@ #include <gst/gst.h> static gboolean -plugin_init (GstPlugin *plugin) +plugin_init (GstPlugin * plugin) { return gst_library_load ("gstbytestream"); } -GST_PLUGIN_DEFINE ( - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "riff", - "RIFF I/O functions", - plugin_init, - VERSION, - GST_LICENSE, - GST_PACKAGE, - GST_ORIGIN -) +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "riff", + "RIFF I/O functions", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN) |