]> git.sesse.net Git - vlc/commitdiff
Merge branch 'master' into lpcm_encoder lpcm_encoder
authorSteinar H. Gunderson <steinar+vlc@gunderson.no>
Sun, 3 Oct 2010 12:58:06 +0000 (14:58 +0200)
committerSteinar H. Gunderson <steinar+vlc@gunderson.no>
Sun, 3 Oct 2010 12:58:06 +0000 (14:58 +0200)
extras/package/macosx/Resources/shuffle_embedded.png [changed mode: 0755->0644]
extras/package/macosx/Resources/shuffle_embedded_blue.png [changed mode: 0755->0644]
include/vlc/libvlc.h
include/vlc/libvlc_media_player.h
modules/access/decklink.cpp
modules/access/rtp/rtp.c [changed mode: 0644->0755]
src/control/core.c
src/libvlc.sym
test/samples/image.jpg [changed mode: 0755->0644]

index 8541768ff5f03c7b71e9d68eca7e4e950aec86b0..5b8c265f51c2403afc9f1d1f5869f2f8ed4e718d 100644 (file)
@@ -226,6 +226,14 @@ VLC_PUBLIC_API const char * libvlc_get_compiler(void);
  */
 VLC_PUBLIC_API const char * libvlc_get_changeset(void);
 
+/**
+ * Frees an heap allocation returned by a LibVLC function.
+ * If you know you're using the same underlying C run-time as the LibVLC
+ * implementation, then you can call ANSI C free() directly instead.
+ *
+ * \param ptr the pointer
+ */
+VLC_PUBLIC_API void libvlc_free( void *ptr );
 
 /** \defgroup libvlc_event LibVLC asynchronous events
  * LibVLC emits asynchronous events.
index e8fe7a7a970954fbf2de9ec1cf6ef6e9d6d2f57c..105090eafc13e384e06fbeee2935c4c595a5958a 100644 (file)
@@ -735,7 +735,7 @@ VLC_PUBLIC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f
  *
  * \param p_mi the media player
  * \return the video aspect ratio or NULL if unspecified
- * (the result must be released with free()).
+ * (the result must be released with free() or libvlc_free()).
  */
 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
 
index 60e8b831a41532c87f71e973d10b19b005d87e2f..99ab7c2ef23e3af361263ee014a895f154c60825 100644 (file)
@@ -79,6 +79,13 @@ static void Close( vlc_object_t * );
     "composite, svideo. " \
     "Leave blank for card default." )
 
+static const char *const ppsz_videoconns[] = {
+    "sdi", "hdmi", "opticalsdi", "component", "composite", "svideo"
+};
+static const char *const ppsz_videoconns_text[] = {
+    N_("SDI"), N_("HDMI"), N_("Optical SDI"), N_("Component"), N_("Composite"), N_("S-video")
+};
+        
 #define ASPECT_RATIO_TEXT N_("Aspect ratio")
 #define ASPECT_RATIO_LONGTEXT N_( \
     "Aspect ratio (4:3, 16:9). Default assumes square pixels." )
@@ -103,6 +110,7 @@ vlc_module_begin ()
                  CHANNELS_TEXT, CHANNELS_LONGTEXT, true )
     add_string( "decklink-video-connection", 0, NULL,
                  VIDEO_CONNECTION_TEXT, VIDEO_CONNECTION_LONGTEXT, true )
+        change_string_list( ppsz_videoconns, ppsz_videoconns_text, 0 )
     add_string( "decklink-aspect-ratio", NULL, NULL,
                 ASPECT_RATIO_TEXT, ASPECT_RATIO_LONGTEXT, true )
 
@@ -111,7 +119,6 @@ vlc_module_begin ()
     set_callbacks( Open, Close )
 vlc_module_end ()
 
-static int Demux  ( demux_t * );
 static int Control( demux_t *, int, va_list );
 
 class DeckLinkCaptureDelegate;
@@ -124,16 +131,12 @@ struct demux_sys_t
 
     es_out_id_t *p_video_es;
     es_out_id_t *p_audio_es;
-    bool b_first_frame;
-    int i_last_pts;
+    
+    vlc_mutex_t pts_lock;
+    int i_last_pts;  /* protected by <pts_lock> */
 
     uint32_t i_dominance_flags;
     int i_channels;
-
-    vlc_mutex_t frame_lock;
-    block_t *p_video_frame;  /* protected by <frame_lock> */
-    block_t *p_audio_frame;  /* protected by <frame_lock> */
-    vlc_cond_t has_frame;  /* related to <frame_lock> */
 };
 
 class DeckLinkCaptureDelegate : public IDeckLinkInputCallback
@@ -211,6 +214,14 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
         videoFrame->GetStreamTime( &stream_time, &frame_duration, CLOCK_FREQ );
         p_video_frame->i_flags = BLOCK_FLAG_TYPE_I | p_sys->i_dominance_flags;
         p_video_frame->i_pts = p_video_frame->i_dts = VLC_TS_0 + stream_time;
+        
+        vlc_mutex_lock( &p_sys->pts_lock );
+        if( p_video_frame->i_pts > p_sys->i_last_pts )
+            p_sys->i_last_pts = p_video_frame->i_pts;
+        vlc_mutex_unlock( &p_sys->pts_lock );
+
+        es_out_Control( p_demux_->out, ES_OUT_SET_PCR, p_video_frame->i_pts );
+        es_out_Send( p_demux_->out, p_sys->p_video_es, p_video_frame );
     }
 
     if( audioFrame )
@@ -233,25 +244,15 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame
         BMDTimeValue packet_time;
         audioFrame->GetPacketTime( &packet_time, CLOCK_FREQ );
         p_audio_frame->i_pts = p_audio_frame->i_dts = VLC_TS_0 + packet_time;
-    }
-
-    if( p_video_frame || p_audio_frame )
-    {
-        vlc_mutex_lock( &p_sys->frame_lock );
-        if( p_video_frame )
-        {
-            if( p_sys->p_video_frame )
-                block_Release( p_sys->p_video_frame );
-            p_sys->p_video_frame = p_video_frame;
-        }
-        if( p_audio_frame )
-        {
-            if( p_sys->p_audio_frame )
-                block_Release( p_sys->p_audio_frame );
-            p_sys->p_audio_frame = p_audio_frame;
-        }
-        vlc_cond_signal( &p_sys->has_frame );
-        vlc_mutex_unlock( &p_sys->frame_lock );
+        
+        vlc_mutex_lock( &p_sys->pts_lock );
+        if( p_audio_frame->i_pts > p_sys->i_last_pts )
+            p_sys->i_last_pts = p_audio_frame->i_pts;
+        vlc_mutex_unlock( &p_sys->pts_lock );
+        if( p_audio_frame->i_pts > p_sys->i_last_pts )
+
+        es_out_Control( p_demux_->out, ES_OUT_SET_PCR, p_audio_frame->i_pts );
+        es_out_Send( p_demux_->out, p_sys->p_audio_es, p_audio_frame );
     }
 
     return S_OK;
@@ -277,7 +278,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* Set up p_demux */
-    p_demux->pf_demux = Demux;
+    p_demux->pf_demux = NULL;
     p_demux->pf_control = Control;
     p_demux->info.i_update = 0;
     p_demux->info.i_title = 0;
@@ -286,9 +287,7 @@ static int Open( vlc_object_t *p_this )
     if( !p_sys )
         return VLC_ENOMEM;
 
-    vlc_mutex_init( &p_sys->frame_lock );
-    vlc_cond_init( &p_sys->has_frame );
-    p_sys->b_first_frame = true;
+    vlc_mutex_init( &p_sys->pts_lock );
 
     IDeckLinkIterator *decklink_iterator = CreateDeckLinkIteratorInstance();
     if( !decklink_iterator )
@@ -346,7 +345,7 @@ static int Open( vlc_object_t *p_this )
         goto finish;
     }
 
-    psz_video_connection = var_CreateGetNonEmptyString( p_demux, "decklink-video-connection" );
+    psz_video_connection = var_InheritString( p_demux, "decklink-video-connection" );
     if( psz_video_connection )
     {
         BMDVideoConnection conn;
@@ -615,12 +614,6 @@ static void Close( vlc_object_t *p_this )
     if( p_sys->p_delegate )
         p_sys->p_delegate->Release();
 
-    if( p_sys->p_video_frame )
-        block_Release( p_sys->p_video_frame );
-
-    if( p_sys->p_audio_frame )
-        block_Release( p_sys->p_audio_frame );
-
     free( p_sys );
 }
 
@@ -647,52 +640,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_TIME:
             pi64 = (int64_t*)va_arg( args, int64_t * );
+            vlc_mutex_lock( &p_sys->pts_lock );
             *pi64 = p_sys->i_last_pts;
+            vlc_mutex_unlock( &p_sys->pts_lock );
             return VLC_SUCCESS;
 
-        /* TODO implement others */
         default:
             return VLC_EGENERIC;
     }
 
     return VLC_EGENERIC;
 }
-
-static int Demux( demux_t *p_demux )
-{
-    demux_sys_t *p_sys = p_demux->p_sys;
-    block_t *p_video_block = NULL;
-    block_t *p_audio_block = NULL;
-
-    vlc_mutex_lock( &p_sys->frame_lock );
-
-    while( !p_sys->p_video_frame && !p_sys->p_audio_frame )
-        vlc_cond_wait( &p_sys->has_frame, &p_sys->frame_lock );
-
-    p_video_block = p_sys->p_video_frame;
-    p_sys->p_video_frame = NULL;
-
-    p_audio_block = p_sys->p_audio_frame;
-    p_sys->p_audio_frame = NULL;
-
-    vlc_mutex_unlock( &p_sys->frame_lock );
-
-    if( p_video_block )
-    {
-        if( p_video_block->i_pts > p_sys->i_last_pts )
-            p_sys->i_last_pts = p_video_block->i_pts;
-        es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_video_block->i_pts );
-        es_out_Send( p_demux->out, p_sys->p_video_es, p_video_block );
-    }
-
-    if( p_audio_block )
-    {
-        if( p_audio_block->i_pts > p_sys->i_last_pts )
-            p_sys->i_last_pts = p_audio_block->i_pts;
-        es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_audio_block->i_pts );
-        es_out_Send( p_demux->out, p_sys->p_audio_es, p_audio_block );
-    }
-
-    return 1;
-}
-
old mode 100644 (file)
new mode 100755 (executable)
index 32e13b3..c896270
@@ -431,7 +431,6 @@ static void codec_decode (demux_t *demux, void *data, block_t *block)
         block_Release (block);
 }
 
-
 static void *stream_init (demux_t *demux, const char *name)
 {
     return stream_DemuxNew (demux, name, demux->out);
@@ -454,6 +453,11 @@ static void stream_decode (demux_t *demux, void *data, block_t *block)
     (void)demux;
 }
 
+static void *demux_init (demux_t *demux)
+{
+    return stream_init (demux, demux->psz_demux);
+}
+
 /*
  * Static payload types handler
  */
@@ -679,7 +683,22 @@ int rtp_autodetect (demux_t *demux, rtp_session_t *session,
         break;
 
       default:
-        return -1;
+        /*
+         * If the rtp payload type is unknown then check demux if it is specified
+         */
+        if ((strcmp(demux->psz_demux, "h264") == 0) || (strcmp(demux->psz_demux, "ts") == 0))
+        {
+          msg_Dbg (demux, "rtp autodetect specified demux=%s", demux->psz_demux);
+          pt.init = demux_init;
+          pt.destroy = stream_destroy;
+          pt.decode = stream_decode;
+          pt.frequency = 90000;
+          break;
+        }
+        else
+        {
+          return -1;
+        }
     }
     rtp_add_type (demux, session, &pt);
     return 0;
index 1411e9c0824bcb8c43b32cf679467719a5974004..745c85af64a27b39ec8986d25912684ba8a73cff 100644 (file)
@@ -159,3 +159,8 @@ const char * libvlc_get_changeset(void)
     extern const char psz_vlc_changeset[];
     return psz_vlc_changeset;
 }
+
+void libvlc_free( void *ptr )
+{
+    free( ptr );
+}
index f635a689fb32933fb634f0152c25e4dc107b03b5..363faff8dc8f3b89386db82bd3733e89592b6a6d 100644 (file)
@@ -32,6 +32,7 @@ libvlc_event_manager_register_event_type
 libvlc_event_manager_release
 libvlc_event_send
 libvlc_event_type_name
+libvlc_free
 libvlc_get_changeset
 libvlc_get_compiler
 libvlc_get_fullscreen
old mode 100755 (executable)
new mode 100644 (file)