aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/ti/gstreamer-ti/mpeg2-caps.patch
blob: c8246579f2603122b7a685ac1e902521724e40d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 5e5fe9fa15ceb0abae90c8f857f40d1791e7d2d4 Mon Sep 17 00:00:00 2001
From: don.darling <don.darling@24075187-2e39-4e88-bbb8-bc8aa768f540>
Date: Mon, 24 May 2010 21:24:12 +0000
Subject: Create source caps information for MPEG-2 streams in TIVidenc1.

If you don't generate this caps information, you will also get errors while
encoding that look like this:

(gst-launch-0.10:1580): GStreamer-CRITICAL **: gst_caps_unref: assertion `caps != NULL' failed

The fact that source caps information was never generated for MPEG-2 looks like
an oversight -- the static caps for TIVidenc1 already allowed MPEG-2.

git-svn-id: https://gstreamer.ti.com/svn/gstreamer_ti/trunk@647 24075187-2e39-4e88-bbb8-bc8aa768f540
---
diff --git a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
index 2e1fb31..9749459 100644
--- a/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
+++ b/gstreamer_ti/ti_build/ticodecplugin/src/gsttividenc1.c
@@ -724,10 +724,13 @@ static gboolean gst_tividenc1_set_source_caps(
     gboolean              ret;
     GstPad               *pad;
     char                 *string;
-    GstTICodec           *h264Codec = NULL, *mpeg4Codec = NULL;
+    GstTICodec           *h264Codec  = NULL;
+    GstTICodec           *mpeg4Codec = NULL;
+    GstTICodec           *mpeg2Codec = NULL;
 
     h264Codec  =  gst_ticodec_get_codec("H.264 Video Encoder");
     mpeg4Codec  =  gst_ticodec_get_codec("MPEG4 Video Encoder");
+    mpeg2Codec  =  gst_ticodec_get_codec("MPEG2 Video Encoder");
 
     pad = videnc1->srcpad;
 
@@ -754,6 +757,24 @@ static gboolean gst_tividenc1_set_source_caps(
         g_free(string);
     }
  
+    /* Create MPEG-2 source cap */
+    if (mpeg2Codec && (!strcmp(mpeg2Codec->CE_CodecName, videnc1->codecName))) {
+        gint mpegversion = 2;
+
+        caps =
+            gst_caps_new_simple("video/mpeg",
+                "mpegversion",  G_TYPE_INT,         mpegversion,
+                "framerate",    GST_TYPE_FRACTION,  videnc1->framerateNum,
+                                                    videnc1->framerateDen,
+                "width",        G_TYPE_INT,         dim.width,
+                "height",       G_TYPE_INT,         dim.height,
+                NULL);
+
+        string =  gst_caps_to_string(caps); 
+        GST_LOG("setting source caps to mpeg2: %s", string);
+        g_free(string);
+    }
+
     /* Create MPEG4 source cap */
     if (mpeg4Codec && (!strcmp(mpeg4Codec->CE_CodecName, videnc1->codecName))) {
         gint mpegversion = 4;
--
cgit v0.8.3.1-30-gff3a