Changeset 30678


Ignore:
Timestamp:
10/24/14 19:38:56 (9 years ago)
Author:
obi
Message:

[mispel] update gst subtitles stuff

Location:
titan/titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/player.h

    r30671 r30678  
    3131GstElement *pipeline = NULL;
    3232unsigned long long m_gst_startpts = 0;
     33CustomData data;
    3334#endif
    3435
     
    591592}
    592593
    593 #ifdef EPLAYER4
    594 typedef struct _CustomData {
    595   gboolean is_live;
    596   GstElement *pipeline;
    597   GMainLoop *loop;
    598 } CustomData;
    599 
    600 CustomData data;
    601 #endif
    602 
    603594//extern player
    604595int playerstart(char* file)
     
    766757                }
    767758
     759//gpointer this;
     760//memset (&this, 0, sizeof (this));
     761
    768762                GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
    769763#if GST_VERSION_MAJOR < 1
    770764//              gst_bus_set_sync_handler(bus, gstBusSyncHandler, this);
    771                 gst_bus_set_sync_handler(bus, NULL, NULL);
     765                gst_bus_set_sync_handler(bus, GST_BUS_DROP, NULL);
    772766#else
    773767//              gst_bus_set_sync_handler(bus, gstBusSyncHandler, this, NULL);
    774                 gst_bus_set_sync_handler(bus, NULL, NULL, NULL);
     768                gst_bus_set_sync_handler(bus, GST_BUS_DROP, NULL, NULL);
    775769#endif
    776770
     
    831825        return 1;
    832826}
    833 
    834827
    835828#ifdef EPLAYER4
     
    13841377
    13851378#ifdef EPLAYER4
    1386 typedef enum {atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC, atWMA} audiotype_t;
    1387 
    13881379audiotype_t gstCheckAudioPad(GstStructure* structure)
    13891380{
     
    14301421        return atUnknown;
    14311422}
     1423
     1424
     1425subtype_t getSubtitleType(GstPad* pad, gchar *g_codec)
     1426{
     1427g_codec = NULL;
     1428        subtype_t type = stUnknown;
     1429#if GST_VERSION_MAJOR < 1
     1430        GstCaps* caps = gst_pad_get_negotiated_caps(pad);
     1431#else
     1432        GstCaps* caps = gst_pad_get_current_caps(pad);
     1433#endif
     1434        if (!caps && !g_codec)
     1435        {
     1436                caps = gst_pad_get_allowed_caps(pad);
     1437        }
     1438
     1439        if (caps && !gst_caps_is_empty(caps))
     1440        {
     1441                GstStructure* str = gst_caps_get_structure(caps, 0);
     1442                if (str)
     1443                {
     1444                        const gchar *g_type = gst_structure_get_name(str);
     1445                        // eDebug("getSubtitleType::subtitle probe caps type=%s", g_type ? g_type : "(null)");
     1446                        if (g_type)
     1447                        {
     1448                                if ( !strcmp(g_type, "video/x-dvd-subpicture") )
     1449                                        type = stVOB;
     1450                                else if ( !strcmp(g_type, "text/x-pango-markup") )
     1451                                        type = stSRT;
     1452                                else if ( !strcmp(g_type, "text/plain") || !strcmp(g_type, "text/x-plain") || !strcmp(g_type, "text/x-raw") )
     1453                                        type = stPlainText;
     1454                                else if ( !strcmp(g_type, "subpicture/x-pgs") )
     1455                                        type = stPGS;
     1456                                else
     1457                                        printf("getSubtitleType::unsupported subtitle caps %s (%s)\n", g_type, g_codec ? g_codec : "(null)");
     1458//                                      eDebug("getSubtitleType::unsupported subtitle caps %s (%s)", g_type, g_codec ? g_codec : "(null)");
     1459                        }
     1460                }
     1461        }
     1462        else if ( g_codec )
     1463        {
     1464                // eDebug("getSubtitleType::subtitle probe codec tag=%s", g_codec);
     1465                if ( !strcmp(g_codec, "VOB") )
     1466                        type = stVOB;
     1467                else if ( !strcmp(g_codec, "SubStation Alpha") || !strcmp(g_codec, "SSA") )
     1468                        type = stSSA;
     1469                else if ( !strcmp(g_codec, "ASS") )
     1470                        type = stASS;
     1471                else if ( !strcmp(g_codec, "SRT") )
     1472                        type = stSRT;
     1473                else if ( !strcmp(g_codec, "UTF-8 plain text") )
     1474                        type = stPlainText;
     1475                else
     1476                        printf("getSubtitleType::unsupported subtitle codec %s\n", g_codec);
     1477        }
     1478        else
     1479                printf("getSubtitleType::unidentifiable subtitle stream!\n");
     1480
     1481        return type;
     1482}
     1483
    14321484#endif
    14331485
     
    15081560                g_object_get(pipeline, "n-audio", &n_audio, NULL);
    15091561                g_object_get(pipeline, "n-text", &n_text, NULL);
    1510                
     1562
    15111563                switch(type)
    15121564                {
     
    15421594                                                {
    15431595                                                        printf("Audio Codec: %s\n", g_codec);
    1544 
    1545                                                         tmpstr = ostrcat(g_codec, NULL, 0, 0);
    1546                                                         if(tmpstr != NULL)
     1596       
     1597                                                        tmpstr = ostrcat(oitoa(i), ": ", 1, 0);
     1598                                                        tmpstr = ostrcat(tmpstr, g_codec, 1, 0);
     1599                                                        if(g_codec != NULL && g_type != NULL)
    15471600                                                                tmpstr = ostrcat(tmpstr, " (", 1, 0);
    15481601                                                        tmpstr = ostrcat(tmpstr, (gchar*)g_type, 1, 0);
    1549                                                         if(g_codec != NULL)
     1602                                                        if(g_codec != NULL && g_type != NULL)
    15501603                                                                tmpstr = ostrcat(tmpstr, ")", 1, 0);
     1604
     1605                                                        printf("Tracklist tmpstr: %s\n", tmpstr);
    15511606
    15521607                                                        TrackList[i * 2] = ostrcat(tmpstr, NULL, 0, 0);
     
    15661621                                                printf("Audio Codec: %s\n", g_codec);
    15671622                                               
    1568                                                 tmpstr = ostrcat(g_codec, NULL, 0, 0);
    1569                                                 if(tmpstr != NULL)
     1623                                                tmpstr = ostrcat(oitoa(i), ": ", 1, 0);
     1624                                                tmpstr = ostrcat(tmpstr, g_codec, 1, 0);
     1625                                                if(g_codec != NULL && g_type != NULL)
    15701626                                                        tmpstr = ostrcat(tmpstr, " (", 1, 0);
    15711627                                                tmpstr = ostrcat(tmpstr, (gchar*)g_type, 1, 0);
    1572                                                 if(g_codec != NULL)
     1628                                                if(g_codec != NULL && g_type != NULL)
    15731629                                                        tmpstr = ostrcat(tmpstr, ")", 1, 0);
    1574                                                                
     1630
     1631                                                printf("Tracklist tmpstr: %s\n", tmpstr);                               
    15751632                                                TrackList[i * 2] = ostrcat(tmpstr, NULL, 0, 0);
    15761633
     
    15851642                                        GstTagList *tags = NULL;
    15861643                                        gchar *g_codec = NULL, *g_lang = NULL;
    1587 //                                      GstPad* pad = 0;
    1588                                
     1644                                        GstPad* pad = 0;
     1645                                        char* tmpstr = NULL;
     1646
     1647                                        g_signal_emit_by_name (pipeline, "get-text-pad", i, &pad);
     1648                                        printf("SubTitle Type: %d\n", getSubtitleType(pad, g_codec));
     1649
     1650#if GST_VERSION_MAJOR < 1
     1651                                        GstCaps* caps = gst_pad_get_negotiated_caps(pad);
     1652#else
     1653                                        GstCaps* caps = gst_pad_get_current_caps(pad);
     1654#endif
     1655                                        if (!caps && !g_codec)
     1656                                        {
     1657                                                caps = gst_pad_get_allowed_caps(pad);
     1658                                        }
     1659                                               
     1660                                        GstStructure* str = gst_caps_get_structure(caps, 0);
     1661                                        const gchar *g_type = gst_structure_get_name(str);
     1662
    15891663                                        g_signal_emit_by_name(pipeline, "get-text-tags", i, &tags);
    15901664                                       
     
    15981672                                                {
    15991673                                                        printf("SubTitle Codec: %s\n", g_codec);
    1600                                                         TrackList[i * 2] = ostrcat(g_codec, NULL, 0, 0);
     1674                                                        tmpstr = ostrcat(oitoa(i), ": ", 1, 0);
     1675                                                        tmpstr = ostrcat(tmpstr, g_codec, 1, 0);
     1676                                                        if(g_codec != NULL && g_type != NULL)
     1677                                                                tmpstr = ostrcat(tmpstr, " (", 1, 0);
     1678                                                        tmpstr = ostrcat(tmpstr, (gchar*)g_type, 1, 0);
     1679                                                        if(g_codec != NULL && g_type != NULL)
     1680                                                                tmpstr = ostrcat(tmpstr, ")", 1, 0);
     1681
     1682                                                        printf("Tracklist tmpstr: %s\n", tmpstr);
     1683                                                        TrackList[i * 2] = ostrcat(tmpstr, NULL, 0, 0);
    16011684                                                        g_free(g_codec); g_codec = NULL;
    16021685                                                }
     
    16091692                                                gst_tag_list_free(tags);
    16101693                                        }
    1611 /*
    1612                                         g_signal_emit_by_name(pipeline, "get-text-pad", i, &pad);
    1613                                         if(pad)
    1614                                                 g_signal_connect(G_OBJECT(pad), "notify::caps", G_CALLBACK (gstTextpadHasCAPS), this);
    1615 
    1616                                         printf("getSubtitleType: %d\n", getSubtitleType(pad, g_codec));
    1617 */
     1694                                        else
     1695                                        {
     1696                                                printf("SubTitle Codec: %s\n", g_codec);
     1697                                               
     1698                                                tmpstr = ostrcat(oitoa(i), ": ", 1, 0);
     1699                                                tmpstr = ostrcat(tmpstr, g_codec, 1, 0);
     1700                                                if(g_codec != NULL && g_type != NULL)
     1701                                                        tmpstr = ostrcat(tmpstr, " (", 1, 0);
     1702                                                tmpstr = ostrcat(tmpstr, (gchar*)g_type, 1, 0);
     1703                                                if(g_codec != NULL && g_type != NULL)
     1704                                                        tmpstr = ostrcat(tmpstr, ")", 1, 0);
     1705
     1706                                                printf("Tracklist tmpstr: %s\n", tmpstr);               
     1707                                                TrackList[i * 2] = ostrcat(tmpstr, NULL, 0, 0);
     1708
     1709                                                g_free(tmpstr); tmpstr = NULL;
     1710                                                g_free(g_codec); g_codec = NULL;                               
     1711                                        }
    16181712                                }
    16191713                                break;
  • titan/titan/struct.h

    r30665 r30678  
    19021902};
    19031903
     1904#ifdef EPLAYER4
     1905typedef enum { stUnknown, stPlainText, stSSA, stASS, stSRT, stVOB, stPGS } subtype_t;
     1906typedef enum {atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC, atWMA} audiotype_t;
     1907typedef struct _CustomData {
     1908  gboolean is_live;
     1909  GstElement *pipeline;
     1910  GMainLoop *loop;
     1911} CustomData;
    19041912#endif
     1913
     1914#endif
Note: See TracChangeset for help on using the changeset viewer.