[2/2] winegstreamer: Use boolean type where appropriate

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Oct 26 06:58:14 CDT 2013


---
 dlls/winegstreamer/gstdemux.c | 75 +++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 38 deletions(-)

diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 8bbbad1..2275d53 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -97,7 +97,7 @@ static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface);
 static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface);
 static HRESULT WINAPI GST_ChangeRate(IMediaSeeking *iface);
 
-static int amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) {
+static gboolean amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     WAVEFORMATEXTENSIBLE *wfe;
     WAVEFORMATEX *wfx;
     GstStructure *arg;
@@ -106,7 +106,7 @@ static int amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     arg = gst_caps_get_structure(caps, 0);
     typename = gst_structure_get_name(arg);
     if (!typename)
-        return 0;
+        return FALSE;
 
     wfe = CoTaskMemAlloc(sizeof(*wfe));
     wfx = (WAVEFORMATEX*)wfe;
@@ -122,9 +122,9 @@ static int amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) {
 
     wfx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
     if (!gst_structure_get_int(arg, "channels", (INT*)&wfx->nChannels))
-        return 0;
+        return FALSE;
     if (!gst_structure_get_int(arg, "rate", (INT*)&wfx->nSamplesPerSec))
-        return 0;
+        return FALSE;
     gst_structure_get_int(arg, "width", &depth);
     gst_structure_get_int(arg, "depth", &bpp);
     if (!depth || depth > 32 || depth % 8)
@@ -156,10 +156,10 @@ static int amt_from_gst_caps_audio(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     }
     wfx->nBlockAlign = wfx->nChannels * wfx->wBitsPerSample/8;
     wfx->nAvgBytesPerSec = wfx->nSamplesPerSec * wfx->nBlockAlign;
-    return 1;
+    return TRUE;
 }
 
-static int amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) {
+static gboolean amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     VIDEOINFOHEADER *vih = CoTaskMemAlloc(sizeof(*vih));
     BITMAPINFOHEADER *bih = &vih->bmiHeader;
     GstStructure *arg;
@@ -168,11 +168,11 @@ static int amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     arg = gst_caps_get_structure(caps, 0);
     typename = gst_structure_get_name(arg);
     if (!typename)
-        return 0;
+        return FALSE;
     if (!gst_structure_get_int(arg, "width", &width) ||
         !gst_structure_get_int(arg, "height", &height) ||
         !gst_structure_get_fraction(arg, "framerate", &nom, &denom))
-        return 0;
+        return FALSE;
     amt->formattype = FORMAT_VideoInfo;
     amt->pbFormat = (BYTE*)vih;
     amt->cbFormat = sizeof(*vih);
@@ -183,20 +183,20 @@ static int amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     amt->majortype = MEDIATYPE_Video;
     if (!strcmp(typename, "video/x-raw-rgb")) {
         if (!gst_structure_get_int(arg, "bpp", (INT*)&bih->biBitCount))
-            return 0;
+            return FALSE;
         switch (bih->biBitCount) {
             case 16: amt->subtype = MEDIASUBTYPE_RGB555; break;
             case 24: amt->subtype = MEDIASUBTYPE_RGB24; break;
             case 32: amt->subtype = MEDIASUBTYPE_RGB32; break;
             default:
                 FIXME("Unknown bpp %u\n", bih->biBitCount);
-                return 0;
+                return FALSE;
         }
         bih->biCompression = BI_RGB;
     } else {
         amt->subtype = MEDIATYPE_Video;
         if (!gst_structure_get_fourcc(arg, "format", &amt->subtype.Data1))
-            return 0;
+            return FALSE;
         switch (amt->subtype.Data1) {
             case mmioFOURCC('I','4','2','0'):
             case mmioFOURCC('Y','V','1','2'):
@@ -222,7 +222,7 @@ static int amt_from_gst_caps_video(GstCaps *caps, AM_MEDIA_TYPE *amt) {
     bih->biWidth = width;
     bih->biHeight = height;
     bih->biPlanes = 1;
-    return 1;
+    return TRUE;
 }
 
 static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) {
@@ -230,14 +230,14 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) {
     AM_MEDIA_TYPE amt;
     GstStructure *arg;
     const char *typename;
-    int ret;
+    gboolean ret;
     arg = gst_caps_get_structure(caps, 0);
     typename = gst_structure_get_name(arg);
     if (!strcmp(typename, "audio/x-raw-int") ||
         !strcmp(typename, "audio/x-raw-float")) {
         if (!pin->isaud) {
             ERR("Setting audio caps on non-audio pad?\n");
-            return 0;
+            return FALSE;
         }
         ret = amt_from_gst_caps_audio(caps, &amt);
         FreeMediaType(&amt);
@@ -247,7 +247,7 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) {
                || !strcmp(typename, "video/x-raw-yuv")) {
         if (!pin->isvid) {
             ERR("Setting video caps on non-video pad?\n");
-            return 0;
+            return FALSE;
         }
         ret = amt_from_gst_caps_video(caps, &amt);
         FreeMediaType(&amt);
@@ -255,7 +255,7 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) {
         return ret;
     } else {
         FIXME("Unhandled type \"%s\"\n", typename);
-        return 0;
+        return FALSE;
     }
 }
 
@@ -265,40 +265,39 @@ static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) {
     AM_MEDIA_TYPE amt;
     GstStructure *arg;
     const char *typename;
-    int ret;
+    gboolean ret;
     arg = gst_caps_get_structure(caps, 0);
     typename = gst_structure_get_name(arg);
     if (!strcmp(typename, "audio/x-raw-int") ||
         !strcmp(typename, "audio/x-raw-float")) {
         if (!pin->isaud) {
             ERR("Setting audio caps on non-audio pad?\n");
-            return 0;
+            return FALSE;
         }
         ret = amt_from_gst_caps_audio(caps, &amt);
     } else if (!strcmp(typename, "video/x-raw-rgb")
                || !strcmp(typename, "video/x-raw-yuv")) {
         if (!pin->isvid) {
             ERR("Setting video caps on non-video pad?\n");
-            return 0;
+            return FALSE;
         }
         ret = amt_from_gst_caps_video(caps, &amt);
         if (ret)
             This->props.cbBuffer = max(This->props.cbBuffer, ((VIDEOINFOHEADER*)amt.pbFormat)->bmiHeader.biSizeImage);
     } else {
         FIXME("Unhandled type \"%s\"\n", typename);
-        return 0;
+        return FALSE;
     }
     TRACE("Linking returned %i for %s\n", ret, typename);
     if (!ret)
-        return 0;
+        return FALSE;
     FreeMediaType(pin->pmt);
     *pin->pmt = amt;
-    return 1;
+    return TRUE;
 }
 
 static gboolean gst_base_src_perform_seek(GSTImpl *This, GstEvent *event)
 {
-    gboolean res = TRUE;
     gdouble rate;
     GstFormat seek_format;
     GstSeekFlags flags;
@@ -314,7 +313,7 @@ static gboolean gst_base_src_perform_seek(GSTImpl *This, GstEvent *event)
 
     if (seek_format != GST_FORMAT_BYTES) {
         FIXME("Not handling other format %i\n", seek_format);
-        return 0;
+        return FALSE;
     }
 
     flush = flags & GST_SEEK_FLAG_FLUSH;
@@ -344,7 +343,7 @@ static gboolean gst_base_src_perform_seek(GSTImpl *This, GstEvent *event)
             gst_pad_activate_push(This->my_src, 1);
     }
 
-    return res;
+    return TRUE;
 }
 
 static gboolean event_src(GstPad *pad, GstEvent *event) {
@@ -370,7 +369,7 @@ static gboolean event_src(GstPad *pad, GstEvent *event) {
         case GST_EVENT_QOS:
             return gst_pad_event_default(pad, event);
     }
-    return 1;
+    return TRUE;
 }
 
 static gboolean event_sink(GstPad *pad, GstEvent *event) {
@@ -384,7 +383,7 @@ static gboolean event_sink(GstPad *pad, GstEvent *event) {
             gst_event_parse_new_segment_full(event, &update, &rate, &applied_rate, &format, &start, &stop, &pos);
             if (format != GST_FORMAT_TIME) {
                 FIXME("Ignoring new segment because of format %i\n", format);
-                return 1;
+                return TRUE;
             }
             gst_segment_set_newsegment_full(pin->segment, update, rate, applied_rate, format, start, stop, pos);
             pos /= 100;
@@ -392,21 +391,21 @@ static gboolean event_sink(GstPad *pad, GstEvent *event) {
                 stop /= 100;
             if (pin->pin.pin.pConnectedTo)
                 IPin_NewSegment(pin->pin.pin.pConnectedTo, pos, stop, rate*applied_rate);
-            return 1;
+            return TRUE;
         }
         case GST_EVENT_EOS:
             if (pin->pin.pin.pConnectedTo)
                 IPin_EndOfStream(pin->pin.pin.pConnectedTo);
-            return 1;
+            return TRUE;
         case GST_EVENT_FLUSH_START:
             if (pin->pin.pin.pConnectedTo)
                 IPin_BeginFlush(pin->pin.pin.pConnectedTo);
-            return 1;
+            return TRUE;
         case GST_EVENT_FLUSH_STOP:
             gst_segment_init(pin->segment, GST_FORMAT_TIME);
             if (pin->pin.pin.pConnectedTo)
                 IPin_EndFlush(pin->pin.pin.pConnectedTo);
-            return 1;
+            return TRUE;
         default:
             FIXME("%p stub %s\n", event, gst_event_type_get_name(event->type));
             return gst_pad_event_default(pad, event);
@@ -811,7 +810,7 @@ static gboolean query_function(GstPad *pad, GstQuery *query) {
             gst_query_parse_duration (query, &format, NULL);
             if (format == GST_FORMAT_PERCENT) {
                 gst_query_set_duration (query, GST_FORMAT_PERCENT, GST_FORMAT_PERCENT_MAX);
-                return 1;
+                return TRUE;
             }
             ret = gst_pad_query_convert (pad, GST_FORMAT_BYTES, This->filesize, &format, &duration);
             gst_query_set_duration(query, format, duration);
@@ -820,14 +819,14 @@ static gboolean query_function(GstPad *pad, GstQuery *query) {
             gst_query_parse_seeking (query, &format, NULL, NULL, NULL);
             TRACE("Seeking %i %i\n", format, GST_FORMAT_BYTES);
             if (format != GST_FORMAT_BYTES)
-                return 0;
+                return FALSE;
             gst_query_set_seeking(query, GST_FORMAT_BYTES, 1, 0, This->filesize);
-            return 1;
+            return TRUE;
         default:
             FIXME("Unhandled query type %i\n", GST_QUERY_TYPE(query));
         case GST_QUERY_URI:
         case GST_QUERY_CONVERT:
-            return 0;
+            return FALSE;
     }
 }
 
@@ -855,7 +854,7 @@ static gboolean activate_push(GstPad *pad, gboolean activate) {
             This->push_thread = CreateThread(NULL, 0, push_data, This, 0, NULL);
     }
     LeaveCriticalSection(&This->filter.csFilter);
-    return 1;
+    return TRUE;
 }
 
 static void no_more_pads(GstElement *decodebin, GSTImpl *This) {
@@ -963,7 +962,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
     This->start = This->nextofs = This->nextpullofs = This->stop = 0;
 
     /* Add initial pins */
-    This->initial = This->discont = 1;
+    This->initial = This->discont = TRUE;
     ResetEvent(This->event);
     gst_element_set_state(This->gstfilter, GST_STATE_PLAYING);
     gst_pad_set_active(This->my_src, 1);
@@ -993,7 +992,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
     if (This->push_thread)
         gst_pad_activate_push(This->my_src, 0);
 
-    This->initial = 0;
+    This->initial = FALSE;
     This->nextofs = This->nextpullofs = 0;
     return hr;
 }
-- 
1.8.4.1




More information about the wine-patches mailing list