[vlc-commits] core: add 3D stereo information to video_format_t
vlc | branch: master | Felix Abecassis | Tue Sep 9 19:03:20 2014 +0200| [9578a0a3908ff2541dee27d6cb018ffaf295b6e8] | committer: Jean-Baptiste Kempf core: add 3D stereo information to video_format_t Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9578a0a3908ff2541dee27d6cb018ffaf295b6e8 --- include/vlc_es.h | 26 ++ src/input/decoder.c |3 ++- src/misc/es_format.c |3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/vlc_es.h b/include/vlc_es.h index e0957bb..a933b11 100644 --- a/include/vlc_es.h +++ b/include/vlc_es.h @@ -192,6 +192,30 @@ typedef enum video_transform_t TRANSFORM_ANTI_TRANSPOSE = ORIENT_ANTI_TRANSPOSED } video_transform_t; +typedef enum video_multiview_mode_t +{ +/* No stereoscopy: 2D picture. */ +MULTIVIEW_2D = 0, + +/* Side-by-side with left eye first. */ +MULTIVIEW_STEREO_SBS, + +/* Top-bottom with left eye first. */ +MULTIVIEW_STEREO_TB, + +/* Row sequential with left eye first. */ +MULTIVIEW_STEREO_ROW, + +/* Column sequential with left eye first. */ +MULTIVIEW_STEREO_COL, + +/* Frame sequential with left eye first. */ +MULTIVIEW_STEREO_FRAME, + +/* Checkerboard pattern with left eye first. */ +MULTIVIEW_STEREO_CHECKERBOARD, +} video_multiview_mode_t; + /** * Video projection mode. */ @@ -288,6 +312,8 @@ struct video_format_t bool b_color_range_full;/**< 0-255 instead of 16-235 */ video_chroma_location_t chroma_location; /**< YCbCr chroma location */ +video_multiview_mode_t multiview_mode;/** Multiview mode, 2D, 3D */ + video_projection_mode_t projection_mode;/**< projection mode */ float f_pose_yaw_degrees; /**< view point yaw in degrees ]-180;180] */ float f_pose_pitch_degrees;/**< view point pitch in degrees ]-90;90] */ diff --git a/src/input/decoder.c b/src/input/decoder.c index bd966c1..2df09a9 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -328,7 +328,8 @@ static int vout_update_format( decoder_t *p_dec ) || p_dec->fmt_out.i_codec != p_owner->fmt.video.i_chroma || (int64_t)p_dec->fmt_out.video.i_sar_num * p_owner->fmt.video.i_sar_den != (int64_t)p_dec->fmt_out.video.i_sar_den * p_owner->fmt.video.i_sar_num || -p_dec->fmt_out.video.orientation != p_owner->fmt.video.orientation ) +p_dec->fmt_out.video.orientation != p_owner->fmt.video.orientation || +p_dec->fmt_out.video.multiview_mode != p_owner->fmt.video.multiview_mode ) { vout_thread_t *p_vout; diff --git a/src/misc/es_format.c b/src/misc/es_format.c index 0375767..b4090e9 100644 --- a/src/misc/es_format.c +++ b/src/misc/es_format.c @@ -395,6 +395,9 @@ bool video_format_IsSimilar( const video_format_t *f1, if( f1->orientation != f2->orientation) return false; +if( f1->multiview_mode!= f2->multiview_mode ) + return false; + if( f1->i_chroma == VLC_CODEC_RGB15 || f1->i_chroma == VLC_CODEC_RGB16 || f1->i_chroma == VLC_CODEC_RGB24 || ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] sharpen: help compiler auto-vectorization
vlc/vlc-2.2 | branch: master | Felix Abecassis | Fri May 22 15:32:39 2015 -0400| [d86a7e5df06cb6fed3c8826a6c61cdb03c95df43] | committer: Jean-Baptiste Kempf sharpen: help compiler auto-vectorization Refs #9458 Signed-off-by: Tristan Matthews (cherry picked from commit 32466e668505f25097e2811a563a19d16de5fbb7) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=d86a7e5df06cb6fed3c8826a6c61cdb03c95df43 --- modules/video_filter/sharpen.c | 38 -- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c index 8714673..5311464 100644 --- a/modules/video_filter/sharpen.c +++ b/modules/video_filter/sharpen.c @@ -171,13 +171,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) { picture_t *p_outpic; int i, j; -uint8_t *p_src = NULL; -uint8_t *p_out = NULL; +uint8_t *restrict p_src = NULL; +uint8_t *restrict p_out = NULL; int i_src_pitch; int i_out_pitch; int pix; const int v1 = -1; const int v2 = 3; /* 2^3 = 8 */ +const unsigned i_visible_lines = p_pic->p[Y_PLANE].i_visible_lines; +const unsigned i_visible_pitch = p_pic->p[Y_PLANE].i_visible_pitch; +const int sigma = var_GetFloat( p_filter, FILTER_PREFIX "sigma" ) * (1 << 20); if( !p_pic ) return NULL; @@ -196,22 +199,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) /* perform convolution only on Y plane. Avoid border line. */ vlc_mutex_lock( &p_filter->p_sys->lock ); -for( i = 0; i < p_pic->p[Y_PLANE].i_visible_lines; i++ ) + +memcpy(p_out, p_src, i_visible_pitch); + +for( i = 1; i < i_visible_lines - 1; i++ ) { -if( (i == 0) || (i == p_pic->p[Y_PLANE].i_visible_lines - 1) ) -{ -for( j = 0; j < p_pic->p[Y_PLANE].i_visible_pitch; j++ ) -p_out[i * i_out_pitch + j] = clip( p_src[i * i_src_pitch + j] ); -continue ; -} -for( j = 0; j < p_pic->p[Y_PLANE].i_visible_pitch; j++ ) -{ -if( (j == 0) || (j == p_pic->p[Y_PLANE].i_visible_pitch - 1) ) -{ -p_out[i * i_out_pitch + j] = p_src[i * i_src_pitch + j]; -continue ; -} +p_out[i * i_out_pitch] = p_src[i * i_src_pitch]; +for( j = 1; j < i_visible_pitch - 1; j++ ) +{ pix = (p_src[(i - 1) * i_src_pitch + j - 1] * v1) + (p_src[(i - 1) * i_src_pitch + j] * v1) + (p_src[(i - 1) * i_src_pitch + j + 1] * v1) + @@ -223,10 +219,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) (p_src[(i + 1) * i_src_pitch + j + 1] * v1); pix = pix >= 0 ? clip(pix) : -clip(pix * -1); - p_out[i * i_out_pitch + j] = clip( p_src[i * i_src_pitch + j] + - p_filter->p_sys->tab_precalc[pix + 256] ); + p_out[i * i_out_pitch + j] = clip( p_src[i * i_src_pitch + j] + + ((pix * sigma) >> 20)); } + +p_out[i * i_out_pitch + i_visible_pitch - 1] = +p_src[i * i_src_pitch + i_visible_pitch - 1]; } +memcpy(&p_out[(i_visible_lines - 1) * i_out_pitch], + &p_src[(i_visible_lines - 1) * i_src_pitch], i_visible_pitch); + vlc_mutex_unlock( &p_filter->p_sys->lock ); plane_CopyPixels( &p_outpic->p[U_PLANE], &p_pic->p[U_PLANE] ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] sharpen: help compiler auto-vectorization
vlc | branch: master | Felix Abecassis | Fri May 22 15:32:39 2015 -0400| [32466e668505f25097e2811a563a19d16de5fbb7] | committer: Tristan Matthews sharpen: help compiler auto-vectorization Refs #9458 Signed-off-by: Tristan Matthews > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=32466e668505f25097e2811a563a19d16de5fbb7 --- modules/video_filter/sharpen.c | 38 -- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c index 499358e..0edf928 100644 --- a/modules/video_filter/sharpen.c +++ b/modules/video_filter/sharpen.c @@ -171,13 +171,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) { picture_t *p_outpic; int i, j; -uint8_t *p_src = NULL; -uint8_t *p_out = NULL; +uint8_t *restrict p_src = NULL; +uint8_t *restrict p_out = NULL; int i_src_pitch; int i_out_pitch; int pix; const int v1 = -1; const int v2 = 3; /* 2^3 = 8 */ +const unsigned i_visible_lines = p_pic->p[Y_PLANE].i_visible_lines; +const unsigned i_visible_pitch = p_pic->p[Y_PLANE].i_visible_pitch; +const int sigma = var_GetFloat( p_filter, FILTER_PREFIX "sigma" ) * (1 << 20); if( !p_pic ) return NULL; @@ -196,22 +199,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) /* perform convolution only on Y plane. Avoid border line. */ vlc_mutex_lock( &p_filter->p_sys->lock ); -for( i = 0; i < p_pic->p[Y_PLANE].i_visible_lines; i++ ) + +memcpy(p_out, p_src, i_visible_pitch); + +for( i = 1; i < i_visible_lines - 1; i++ ) { -if( (i == 0) || (i == p_pic->p[Y_PLANE].i_visible_lines - 1) ) -{ -for( j = 0; j < p_pic->p[Y_PLANE].i_visible_pitch; j++ ) -p_out[i * i_out_pitch + j] = clip( p_src[i * i_src_pitch + j] ); -continue ; -} -for( j = 0; j < p_pic->p[Y_PLANE].i_visible_pitch; j++ ) -{ -if( (j == 0) || (j == p_pic->p[Y_PLANE].i_visible_pitch - 1) ) -{ -p_out[i * i_out_pitch + j] = p_src[i * i_src_pitch + j]; -continue ; -} +p_out[i * i_out_pitch] = p_src[i * i_src_pitch]; +for( j = 1; j < i_visible_pitch - 1; j++ ) +{ pix = (p_src[(i - 1) * i_src_pitch + j - 1] * v1) + (p_src[(i - 1) * i_src_pitch + j] * v1) + (p_src[(i - 1) * i_src_pitch + j + 1] * v1) + @@ -223,10 +219,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) (p_src[(i + 1) * i_src_pitch + j + 1] * v1); pix = pix >= 0 ? clip(pix) : -clip(pix * -1); - p_out[i * i_out_pitch + j] = clip( p_src[i * i_src_pitch + j] + - p_filter->p_sys->tab_precalc[pix + 256] ); + p_out[i * i_out_pitch + j] = clip( p_src[i * i_src_pitch + j] + + ((pix * sigma) >> 20)); } + +p_out[i * i_out_pitch + i_visible_pitch - 1] = +p_src[i * i_src_pitch + i_visible_pitch - 1]; } +memcpy(&p_out[(i_visible_lines - 1) * i_out_pitch], + &p_src[(i_visible_lines - 1) * i_src_pitch], i_visible_pitch); + vlc_mutex_unlock( &p_filter->p_sys->lock ); plane_CopyPixels( &p_outpic->p[U_PLANE], &p_pic->p[U_PLANE] ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] yuv_rgb: bail out if input/output orientation does not match
vlc/vlc-2.2 | branch: master | Felix Abecassis | Fri Sep 12 19:40:54 2014 +0200| [65ae93ceab1746aa17ff19b7732d1b726459b64a] | committer: Jean-Baptiste Kempf yuv_rgb: bail out if input/output orientation does not match (cherry picked from commit 19b9baa2b03af847ab0afc91e78c3ccd3e538cb4) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=65ae93ceab1746aa17ff19b7732d1b726459b64a --- modules/arm_neon/yuv_rgb.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/arm_neon/yuv_rgb.c b/modules/arm_neon/yuv_rgb.c index 44961ca..29f6a09 100644 --- a/modules/arm_neon/yuv_rgb.c +++ b/modules/arm_neon/yuv_rgb.c @@ -139,7 +139,8 @@ static int Open (vlc_object_t *obj) if (((filter->fmt_in.video.i_width | filter->fmt_in.video.i_height) & 1) || (filter->fmt_in.video.i_width != filter->fmt_out.video.i_width) - || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height)) + || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height) + || (filter->fmt_in.video.orientation != filter->fmt_out.video.orientation)) return VLC_EGENERIC; switch (filter->fmt_out.video.i_chroma) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android: request rotation if video is oriented
vlc/vlc-2.2 | branch: master | Felix Abecassis | Fri Sep 12 19:43:21 2014 +0200| [53d6fa0007650a8fe428394e7a5f233cffbef108] | committer: Jean-Baptiste Kempf android: request rotation if video is oriented (cherry picked from commit 362b0da80fd10ea976e570b92297691cb387a8f6) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=53d6fa0007650a8fe428394e7a5f233cffbef108 --- modules/video_output/android/surface.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/video_output/android/surface.c b/modules/video_output/android/surface.c index f6a183e..63cbf15 100644 --- a/modules/video_output/android/surface.c +++ b/modules/video_output/android/surface.c @@ -173,7 +173,8 @@ static void *InitLibrary(vout_display_sys_t *sys) static int Open(vlc_object_t *p_this) { vout_display_t *vd = (vout_display_t *)p_this; -video_format_t fmt = vd->fmt; +video_format_t fmt; +video_format_ApplyRotation(&fmt, &vd->fmt); if (fmt.i_chroma == VLC_CODEC_ANDROID_OPAQUE) return VLC_EGENERIC; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: fix a deadlock with the picture pool lock
vlc/vlc-2.2 | branch: master | Felix Abecassis | Tue Sep 9 19:29:06 2014 +0200| [068be492447bc313014815b20ba4c598cf49cc50] | committer: Jean-Baptiste Kempf vout: fix a deadlock with the picture pool lock A deadlock could occur in an high load situation where the vout and the decoder are taking excessive amounts of time. The vout thread repeatedly call ThreadDisplayPicture in its main loop until it returns an error, while keeping the picture pool locked. If no picture was recently received, the vout will redisplay the current picture (a "refresh") by calling ThreadDisplayRenderPicture with is_forced=true. If this refresh is excessively long, the vout thread will be stuck in a refresh loop. The decoder cannot make any progress since the picture pool lock is hold and the vout won't be polling for control commands, yielding a total deadlock of the program. This situation can be reproduced artificially by sleeping in the decoder and decreasing variable VOUT_REDISPLAY_DELAY. A simple solution to this issue is to exit the ThreadDisplayPicture loop after refreshing. Since a refresh typically occurs when no new pictures are received from the decoder, this should not decrease performance. (cherry picked from commit 22c80ce310c58f6730291b4026af9c7c8b38fb63) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=068be492447bc313014815b20ba4c598cf49cc50 --- src/video_output/video_output.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 8de262a..2dd43f4 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -1123,6 +1123,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, mtime_t *deadline) date_refresh = vout->p->displayed.date + VOUT_REDISPLAY_DELAY - render_delay; refresh = date_refresh <= date; } +bool force_refresh = !drop_next_frame && refresh; if (!first && !refresh && !drop_next_frame) { if (!frame_by_frame) { @@ -1144,8 +1145,9 @@ static int ThreadDisplayPicture(vout_thread_t *vout, mtime_t *deadline) return VLC_EGENERIC; /* display the picture immediately */ -bool is_forced = frame_by_frame || (!drop_next_frame && refresh) || vout->p->displayed.current->b_force; -return ThreadDisplayRenderPicture(vout, is_forced); +bool is_forced = frame_by_frame || force_refresh || vout->p->displayed.current->b_force; +int ret = ThreadDisplayRenderPicture(vout, is_forced); +return force_refresh ? VLC_EGENERIC : ret; } static void ThreadDisplaySubpicture(vout_thread_t *vout, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: fix a deadlock with the picture pool lock
vlc | branch: master | Felix Abecassis | Tue Sep 9 19:29:06 2014 +0200| [22c80ce310c58f6730291b4026af9c7c8b38fb63] | committer: Felix Abecassis vout: fix a deadlock with the picture pool lock A deadlock could occur in an high load situation where the vout and the decoder are taking excessive amounts of time. The vout thread repeatedly call ThreadDisplayPicture in its main loop until it returns an error, while keeping the picture pool locked. If no picture was recently received, the vout will redisplay the current picture (a "refresh") by calling ThreadDisplayRenderPicture with is_forced=true. If this refresh is excessively long, the vout thread will be stuck in a refresh loop. The decoder cannot make any progress since the picture pool lock is hold and the vout won't be polling for control commands, yielding a total deadlock of the program. This situation can be reproduced artificially by sleeping in the decoder and decreasing variable VOUT_REDISPLAY_DELAY. A simple solution to this issue is to exit the ThreadDisplayPicture loop after refreshing. Since a refresh typically occurs when no new pictures are received from the decoder, this should not decrease performance. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=22c80ce310c58f6730291b4026af9c7c8b38fb63 --- src/video_output/video_output.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 3f094d4..3577811 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -1112,6 +1112,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, mtime_t *deadline) date_refresh = vout->p->displayed.date + VOUT_REDISPLAY_DELAY - render_delay; refresh = date_refresh <= date; } +bool force_refresh = !drop_next_frame && refresh; if (!first && !refresh && !drop_next_frame) { if (!frame_by_frame) { @@ -1133,8 +1134,9 @@ static int ThreadDisplayPicture(vout_thread_t *vout, mtime_t *deadline) return VLC_EGENERIC; /* display the picture immediately */ -bool is_forced = frame_by_frame || (!drop_next_frame && refresh) || vout->p->displayed.current->b_force; -return ThreadDisplayRenderPicture(vout, is_forced); +bool is_forced = frame_by_frame || force_refresh || vout->p->displayed.current->b_force; +int ret = ThreadDisplayRenderPicture(vout, is_forced); +return force_refresh ? VLC_EGENERIC : ret; } static void ThreadDisplaySubpicture(vout_thread_t *vout, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] yuv_rgb: bail out if input/output orientation does not match
vlc | branch: master | Felix Abecassis | Fri Sep 12 19:40:54 2014 +0200| [19b9baa2b03af847ab0afc91e78c3ccd3e538cb4] | committer: Felix Abecassis yuv_rgb: bail out if input/output orientation does not match > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=19b9baa2b03af847ab0afc91e78c3ccd3e538cb4 --- modules/arm_neon/yuv_rgb.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/arm_neon/yuv_rgb.c b/modules/arm_neon/yuv_rgb.c index 44961ca..29f6a09 100644 --- a/modules/arm_neon/yuv_rgb.c +++ b/modules/arm_neon/yuv_rgb.c @@ -139,7 +139,8 @@ static int Open (vlc_object_t *obj) if (((filter->fmt_in.video.i_width | filter->fmt_in.video.i_height) & 1) || (filter->fmt_in.video.i_width != filter->fmt_out.video.i_width) - || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height)) + || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height) + || (filter->fmt_in.video.orientation != filter->fmt_out.video.orientation)) return VLC_EGENERIC; switch (filter->fmt_out.video.i_chroma) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android: request rotation if video is oriented
vlc | branch: master | Felix Abecassis | Fri Sep 12 19:43:21 2014 +0200| [362b0da80fd10ea976e570b92297691cb387a8f6] | committer: Felix Abecassis android: request rotation if video is oriented > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=362b0da80fd10ea976e570b92297691cb387a8f6 --- modules/video_output/android/surface.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/video_output/android/surface.c b/modules/video_output/android/surface.c index f6a183e..63cbf15 100644 --- a/modules/video_output/android/surface.c +++ b/modules/video_output/android/surface.c @@ -173,7 +173,8 @@ static void *InitLibrary(vout_display_sys_t *sys) static int Open(vlc_object_t *p_this) { vout_display_t *vd = (vout_display_t *)p_this; -video_format_t fmt = vd->fmt; +video_format_t fmt; +video_format_ApplyRotation(&fmt, &vd->fmt); if (fmt.i_chroma == VLC_CODEC_ANDROID_OPAQUE) return VLC_EGENERIC; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] input: waiting and flushing states should be mutually exclusive
vlc/vlc-2.2 | branch: master | Felix Abecassis | Tue Sep 2 11:00:23 2014 +0200| [a801b6b7e27a299435d4adf64194f9c448fee920] | committer: Jean-Baptiste Kempf input: waiting and flushing states should be mutually exclusive A crash could occur in the following situation: 1) A video decoder is created and starts waiting for the first picture: b_waiting = true, b_first = true 2) The first picture is received but the decoder is still in waiting mode: b_waiting = true, b_first = false 3) A second picture is received, the decoder is now waiting in DecoderWaitUnblock(). 4) From the input thread, an EOF event is received, EsOutChangePosition is called and sets the decoder in flushing mode. 5) The decoder thread wakes up and exits DecoderWaitUnblock because b_flushing is true. However this triggers the assertion in DecoderDecodeVideo since we have b_waiting && !b_first. Fix #11892, #12041 (cherry picked from commit a1603d9e69629a8168f5babce3388307bb677341) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=a801b6b7e27a299435d4adf64194f9c448fee920 --- src/input/decoder.c |1 + 1 file changed, 1 insertion(+) diff --git a/src/input/decoder.c b/src/input/decoder.c index 87c65ef..289b5fd 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -937,6 +937,7 @@ static void DecoderFlush( decoder_t *p_dec ) /* Empty the fifo */ block_FifoEmpty( p_owner->p_fifo ); +p_owner->b_waiting = false; /* Monitor for flush end */ p_owner->b_flushing = true; vlc_cond_signal( &p_owner->wait_request ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] input: waiting and flushing states should be mutually exclusive
vlc | branch: master | Felix Abecassis | Tue Sep 2 11:00:23 2014 +0200| [a1603d9e69629a8168f5babce3388307bb677341] | committer: Felix Abecassis input: waiting and flushing states should be mutually exclusive A crash could occur in the following situation: 1) A video decoder is created and starts waiting for the first picture: b_waiting = true, b_first = true 2) The first picture is received but the decoder is still in waiting mode: b_waiting = true, b_first = false 3) A second picture is received, the decoder is now waiting in DecoderWaitUnblock(). 4) From the input thread, an EOF event is received, EsOutChangePosition is called and sets the decoder in flushing mode. 5) The decoder thread wakes up and exits DecoderWaitUnblock because b_flushing is true. However this triggers the assertion in DecoderDecodeVideo since we have b_waiting && !b_first. Fix #11892, #12041 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1603d9e69629a8168f5babce3388307bb677341 --- src/input/decoder.c |1 + 1 file changed, 1 insertion(+) diff --git a/src/input/decoder.c b/src/input/decoder.c index bbcfcf8..d40c7d3 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -946,6 +946,7 @@ static void DecoderFlush( decoder_t *p_dec ) /* Empty the fifo */ block_FifoEmpty( p_owner->p_fifo ); +p_owner->b_waiting = false; /* Monitor for flush end */ p_owner->b_flushing = true; vlc_cond_signal( &p_owner->wait_request ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] h264: kill a warning in nal_decode by making src pointer const
vlc | branch: master | Felix Abecassis | Tue Sep 2 11:05:37 2014 +0200| [5810e8b0beece4faefddc6ba0d7c7dff1cc0eae1] | committer: Felix Abecassis h264: kill a warning in nal_decode by making src pointer const > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5810e8b0beece4faefddc6ba0d7c7dff1cc0eae1 --- modules/demux/mpeg/mpeg_parser_helpers.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/demux/mpeg/mpeg_parser_helpers.h b/modules/demux/mpeg/mpeg_parser_helpers.h index 362ae6b..3f39539 100644 --- a/modules/demux/mpeg/mpeg_parser_helpers.h +++ b/modules/demux/mpeg/mpeg_parser_helpers.h @@ -70,7 +70,7 @@ static inline int32_t bs_read_se( bs_t *s ) return val&0x01 ? (val+1)/2 : -(val/2); } -static inline size_t nal_decode(uint8_t * p_src, uint8_t * p_dst, size_t i_size) +static inline size_t nal_decode(const uint8_t * p_src, uint8_t * p_dst, size_t i_size) { size_t j = 0; for (size_t i = 0; i < i_size; i++) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] h264: add an enum for SEI messages
vlc | branch: master | Felix Abecassis | Mon Sep 1 14:05:24 2014 +0200| [5a487d087d8fe149474a03ecb657438c16994705] | committer: Felix Abecassis h264: add an enum for SEI messages > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5a487d087d8fe149474a03ecb657438c16994705 --- modules/packetizer/h264.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c index 2b84a27..c029171 100644 --- a/modules/packetizer/h264.c +++ b/modules/packetizer/h264.c @@ -147,6 +147,13 @@ enum nal_unit_type_e /* ref_idc == 0 for 6,9,10,11,12 */ }; +/* Defined in H.264 annex D */ +enum sei_type_e +{ +SEI_USER_DATA_REGISTERED = 4, +SEI_RECOVERY_POINT = 6 +}; + #define BLOCK_FLAG_PRIVATE_AUD (1 << BLOCK_FLAG_PRIVATE_SHIFT) static block_t *Packetize( decoder_t *, block_t ** ); @@ -1130,7 +1137,7 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag ) break; /* Look for user_data_registered_itu_t_t35 */ -if( i_type == 4 ) +if( i_type == SEI_USER_DATA_REGISTERED ) { static const uint8_t p_dvb1_data_start_code[] = { 0xb5, @@ -1149,7 +1156,7 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag ) } /* Look for SEI recovery point */ -if( i_type == 6 ) +if( i_type == SEI_RECOVERY_POINT ) { bs_t s; const int i_rec = i_size; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] avcodec: disable frame multithreading with dxva2
vlc/vlc-2.2 | branch: master | Felix Abecassis | Mon Aug 25 12:07:22 2014 +0200| [f97a4cf8d639fe97bb82edb992f02b21179487b0] | committer: Jean-Baptiste Kempf avcodec: disable frame multithreading with dxva2 Fix #11930, #11693 (cherry picked from commit bf9b995528941436fbdfad6e60ce7af76f20ea2e) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=f97a4cf8d639fe97bb82edb992f02b21179487b0 --- modules/codec/avcodec/video.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index 2e119d0..9169bef 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -351,6 +351,21 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, # endif } +/* Workaround: frame multithreading is not compatible with + * DXVA2. When a frame is being copied to host memory, the frame + * is locked and cannot be used as a reference frame + * simultaneously and thus decoding fails for some frames. This + * causes major image corruption. */ +# if defined(_WIN32) +char *avcodec_hw = var_InheritString( p_dec, "avcodec-hw" ); +if( avcodec_hw == NULL || strcasecmp( avcodec_hw, "none" ) ) +{ +msg_Warn( p_dec, "threaded frame decoding is not compatible with DXVA2, disabled" ); +p_sys->p_context->thread_type &= ~FF_THREAD_FRAME; +} +free( avcodec_hw ); +# endif + if( p_sys->p_context->thread_type & FF_THREAD_FRAME ) p_dec->i_extra_picture_buffers = 2 * p_sys->p_context->thread_count; #endif ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] avcodec: disable frame multithreading with dxva2
vlc | branch: master | Felix Abecassis | Mon Aug 25 12:07:22 2014 +0200| [bf9b995528941436fbdfad6e60ce7af76f20ea2e] | committer: Felix Abecassis avcodec: disable frame multithreading with dxva2 Fix #11930, #11693 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf9b995528941436fbdfad6e60ce7af76f20ea2e --- modules/codec/avcodec/video.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index d1fa89b..e75cc21 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -347,6 +347,21 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, # endif } +/* Workaround: frame multithreading is not compatible with + * DXVA2. When a frame is being copied to host memory, the frame + * is locked and cannot be used as a reference frame + * simultaneously and thus decoding fails for some frames. This + * causes major image corruption. */ +# if defined(_WIN32) +char *avcodec_hw = var_InheritString( p_dec, "avcodec-hw" ); +if( avcodec_hw == NULL || strcasecmp( avcodec_hw, "none" ) ) +{ +msg_Warn( p_dec, "threaded frame decoding is not compatible with DXVA2, disabled" ); +p_sys->p_context->thread_type &= ~FF_THREAD_FRAME; +} +free( avcodec_hw ); +# endif + if( p_sys->p_context->thread_type & FF_THREAD_FRAME ) p_dec->i_extra_picture_buffers = 2 * p_sys->p_context->thread_count; #endif ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] video_output: add missing include
vlc | branch: master | Felix Abecassis | Tue Aug 5 18:52:24 2014 +0200| [dc5a65a84bd9842c669f82a52109a999db6dd9a0] | committer: Felix Abecassis video_output: add missing include > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dc5a65a84bd9842c669f82a52109a999db6dd9a0 --- src/video_output/chrono.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video_output/chrono.h b/src/video_output/chrono.h index 8a22511..594712e 100644 --- a/src/video_output/chrono.h +++ b/src/video_output/chrono.h @@ -24,6 +24,8 @@ #ifndef LIBVLC_VOUT_CHRONO_H #define LIBVLC_VOUT_CHRONO_H +#include + typedef struct { int shift; mtime_t avg; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] core: add a new type of callback for list variables
vlc | branch: master | Felix Abecassis | Mon Aug 4 12:06:29 2014 +0200| [ad24c4fbf7e1bdef1df40be8e78a97b70a7b7af4] | committer: Felix Abecassis core: add a new type of callback for list variables This new callback is triggered when an element is added/removed from the list, or when the list is cleared. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ad24c4fbf7e1bdef1df40be8e78a97b70a7b7af4 --- include/vlc_common.h| 17 ++- include/vlc_variables.h |6 +++ src/libvlccore.sym |2 + src/misc/variables.c| 118 +-- src/misc/variables.h|2 + 5 files changed, 130 insertions(+), 15 deletions(-) Diff: http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=ad24c4fbf7e1bdef1df40be8e78a97b70a7b7af4 ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] variables: add helper function when adding/removing variable callbacks
vlc | branch: master | Felix Abecassis | Mon Aug 4 12:06:18 2014 +0200| [f8187680bdee75e53bc722403bf06fdd4d845c47] | committer: Felix Abecassis variables: add helper function when adding/removing variable callbacks > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f8187680bdee75e53bc722403bf06fdd4d845c47 --- src/misc/variables.c | 80 ++ 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/src/misc/variables.c b/src/misc/variables.c index a631863..69d0dce 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -804,36 +804,15 @@ int var_Get( vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val ) return var_GetChecked( p_this, psz_name, 0, p_val ); } -#undef var_AddCallback -/** - * Register a callback in a variable - * - * We store a function pointer that will be called upon variable - * modification. - * - * \param p_this The object that holds the variable - * \param psz_name The name of the variable - * \param pf_callback The function pointer - * \param p_data A generic pointer that will be passed as the last - * argument to the callback function. - * - * \warning The callback function is run in the thread that calls var_Set on - * the variable. Use proper locking. This thread may not have much - * time to spare, so keep callback functions short. - */ -int var_AddCallback( vlc_object_t *p_this, const char *psz_name, - vlc_callback_t pf_callback, void *p_data ) +static int AddCallback( vlc_object_t *p_this, const char *psz_name, +callback_entry_t entry ) { variable_t *p_var; -callback_entry_t entry; assert( p_this ); vlc_object_internals_t *p_priv = vlc_internals( p_this ); -entry.pf_callback = pf_callback; -entry.p_data = p_data; - vlc_mutex_lock( &p_priv->var_lock ); p_var = Lookup( p_this, psz_name ); @@ -841,7 +820,7 @@ int var_AddCallback( vlc_object_t *p_this, const char *psz_name, { vlc_mutex_unlock( &p_priv->var_lock ); msg_Err( p_this, "cannot add callback %p to nonexistent " - "variable '%s'", pf_callback, psz_name ); + "variable '%s'", entry.pf_callback, psz_name ); return VLC_ENOVAR; } @@ -856,16 +835,36 @@ int var_AddCallback( vlc_object_t *p_this, const char *psz_name, return VLC_SUCCESS; } -#undef var_DelCallback +#undef var_AddCallback /** - * Remove a callback from a variable + * Register a callback in a variable * - * pf_callback and p_data have to be given again, because different objects - * might have registered the same callback function. + * We store a function pointer that will be called upon variable + * modification. + * + * \param p_this The object that holds the variable + * \param psz_name The name of the variable + * \param pf_callback The function pointer + * \param p_data A generic pointer that will be passed as the last + * argument to the callback function. + * + * \warning The callback function is run in the thread that calls var_Set on + * the variable. Use proper locking. This thread may not have much + * time to spare, so keep callback functions short. */ -int var_DelCallback( vlc_object_t *p_this, const char *psz_name, +int var_AddCallback( vlc_object_t *p_this, const char *psz_name, vlc_callback_t pf_callback, void *p_data ) { +callback_entry_t entry; +entry.pf_callback = pf_callback; +entry.p_data = p_data; + +return AddCallback(p_this, psz_name, entry); +} + +static int DelCallback( vlc_object_t *p_this, const char *psz_name, +callback_entry_t entry ) +{ int i_entry; variable_t *p_var; #ifndef NDEBUG @@ -889,13 +888,13 @@ int var_DelCallback( vlc_object_t *p_this, const char *psz_name, for( i_entry = p_var->i_entries ; i_entry-- ; ) { -if( p_var->p_entries[i_entry].pf_callback == pf_callback -&& p_var->p_entries[i_entry].p_data == p_data ) +if( p_var->p_entries[i_entry].pf_callback == entry.pf_callback +&& p_var->p_entries[i_entry].p_data == entry.p_data ) { break; } #ifndef NDEBUG -else if( p_var->p_entries[i_entry].pf_callback == pf_callback ) +else if( p_var->p_entries[i_entry].pf_callback == entry.pf_callback ) b_found_similar = true; #endif } @@ -919,6 +918,23 @@ int var_DelCallback( vlc_object_t *p_this, const char *psz_name, return VLC_SUCCESS; } +#undef var_DelCallback +/** + * Remove a callback from a variable + * + * pf_callback and p_data have to be given again, because different objects + * might have registered the same callback function. + */ +int var_DelCallback( vlc_object_t *p_this, const c
[vlc-commits] variables: add internal type callback_table_t for storing a list of callbacks
vlc | branch: master | Felix Abecassis | Mon Aug 4 12:06:23 2014 +0200| [c4cd36ee80608967355b90bf18031b022e9ecdb6] | committer: Felix Abecassis variables: add internal type callback_table_t for storing a list of callbacks > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c4cd36ee80608967355b90bf18031b022e9ecdb6 --- src/misc/objects.c |4 ++-- src/misc/variables.c | 35 +++ src/misc/variables.h | 12 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/misc/objects.c b/src/misc/objects.c index 0026ea8..3b04518 100644 --- a/src/misc/objects.c +++ b/src/misc/objects.c @@ -603,8 +603,8 @@ static void DumpVariable (const void *data, const VISIT which, const int depth) fputs( ", has choices", stdout ); if( p_var->i_type & VLC_VAR_ISCOMMAND ) fputs( ", command", stdout ); -if( p_var->i_entries ) -printf( ", %d callbacks", p_var->i_entries ); +if( p_var->value_callbacks.i_entries ) +printf( ", %d callbacks", p_var->value_callbacks.i_entries ); switch( p_var->i_type & VLC_VAR_CLASS ) { case VLC_VAR_VOID: diff --git a/src/misc/variables.c b/src/misc/variables.c index 69d0dce..46d5194 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -169,10 +169,11 @@ static void Destroy( variable_t *p_var ) free( p_var->choices_text.p_values ); } #if 0 // ndef NDEBUG -for (int i = 0; i < p_var->i_entries; i++) +callback_table_t *p_table = &p_var->value_callbacks; +for (int i = 0; i < p_table->i_entries; i++) { const char *file = "?", *symbol = "?"; -const void *addr = p_var->p_entries[i].pf_callback; +const void *addr = p_table->p_entries[i].pf_callback; # ifdef __GLIBC__ Dl_info info; @@ -189,7 +190,7 @@ static void Destroy( variable_t *p_var ) free( p_var->psz_name ); free( p_var->psz_text ); -free( p_var->p_entries ); +free( p_var->value_callbacks.p_entries ); free( p_var ); } @@ -228,8 +229,7 @@ int var_Create( vlc_object_t *p_this, const char *psz_name, int i_type ) p_var->choices_text.p_values = NULL; p_var->b_incallback = false; -p_var->i_entries = 0; -p_var->p_entries = NULL; +p_var->value_callbacks = (callback_table_t){ 0 }; /* Always initialize the variable, even if it is a list variable; this * will lead to errors if the variable is not initialized, but it will @@ -825,10 +825,11 @@ static int AddCallback( vlc_object_t *p_this, const char *psz_name, } WaitUnused( p_this, p_var ); -INSERT_ELEM( p_var->p_entries, - p_var->i_entries, - p_var->i_entries, - entry ); +callback_table_t *p_table = &p_var->value_callbacks; +INSERT_ELEM( p_table->p_entries, + p_table->i_entries, + p_table->i_entries, + entry); vlc_mutex_unlock( &p_priv->var_lock ); @@ -886,15 +887,16 @@ static int DelCallback( vlc_object_t *p_this, const char *psz_name, WaitUnused( p_this, p_var ); -for( i_entry = p_var->i_entries ; i_entry-- ; ) +callback_table_t *p_table = &p_var->value_callbacks; +for( i_entry = p_table->i_entries ; i_entry-- ; ) { -if( p_var->p_entries[i_entry].pf_callback == entry.pf_callback -&& p_var->p_entries[i_entry].p_data == entry.p_data ) +if( p_table->p_entries[i_entry].pf_callback == entry.pf_callback +&& p_table->p_entries[i_entry].p_data == entry.p_data ) { break; } #ifndef NDEBUG -else if( p_var->p_entries[i_entry].pf_callback == entry.pf_callback ) +else if( p_table->p_entries[i_entry].pf_callback == entry.pf_callback ) b_found_similar = true; #endif } @@ -911,7 +913,7 @@ static int DelCallback( vlc_object_t *p_this, const char *psz_name, return VLC_EGENERIC; } -REMOVE_ELEM( p_var->p_entries, p_var->i_entries, i_entry ); +REMOVE_ELEM( p_table->p_entries, p_table->i_entries, i_entry ); vlc_mutex_unlock( &p_priv->var_lock ); @@ -1317,11 +1319,12 @@ static int TriggerCallback( vlc_object_t *p_this, variable_t *p_var, { assert( p_this ); -int i_entries = p_var->i_entries; +callback_table_t *p_table = &p_var->value_callbacks; +int i_entries = p_table->i_entries; if( i_entries == 0 ) return VLC_SUCCESS; -callback_entry_t *p_entries = p_var->p_entries; +callback_entry_t *p_entries = p_table->p_entries; vlc_object_internals_t *p_priv = vlc_internals( p_this ); assert( !p_var->b_incallback ); diff --git a/src/misc/variables
[vlc-commits] libvlc: add 3 libvlc events: MediaPlayerESAdded, MediaPlayerESDeleted, MediaPlayerESSelected
vlc | branch: master | Felix Abecassis | Mon Aug 4 12:07:25 2014 +0200| [710ad7ed786e36a77accec9d2296bd192233c506] | committer: Felix Abecassis libvlc: add 3 libvlc events: MediaPlayerESAdded, MediaPlayerESDeleted, MediaPlayerESSelected > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=710ad7ed786e36a77accec9d2296bd192233c506 --- include/vlc/libvlc_events.h |9 lib/event.c |3 ++ lib/media_player.c | 121 +++ 3 files changed, 133 insertions(+) diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h index f268fb5..963163a 100644 --- a/include/vlc/libvlc_events.h +++ b/include/vlc/libvlc_events.h @@ -74,6 +74,9 @@ enum libvlc_event_e { libvlc_MediaPlayerLengthChanged, libvlc_MediaPlayerVout, libvlc_MediaPlayerScrambledChanged, +libvlc_MediaPlayerESAdded, +libvlc_MediaPlayerESDeleted, +libvlc_MediaPlayerESSelected, libvlc_MediaListItemAdded=0x200, libvlc_MediaListWillAddItem, @@ -230,6 +233,12 @@ typedef struct libvlc_event_t { libvlc_media_t * new_media; } media_player_media_changed; + +struct +{ +libvlc_track_type_t i_type; +int i_id; +} media_player_es_changed; } u; /**< Type-dependent event description */ } libvlc_event_t; diff --git a/lib/event.c b/lib/event.c index aa285f9..7cc17bf 100644 --- a/lib/event.c +++ b/lib/event.c @@ -281,6 +281,9 @@ static const event_name_t event_list[] = { DEF(MediaPlayerLengthChanged) DEF(MediaPlayerVout) DEF(MediaPlayerScrambledChanged) +DEF(MediaPlayerESAdded) +DEF(MediaPlayerESDeleted) +DEF(MediaPlayerESSelected) DEF(MediaListItemAdded) DEF(MediaListWillAddItem) diff --git a/lib/media_player.c b/lib/media_player.c index b31a832..7201a78 100644 --- a/lib/media_player.c +++ b/lib/media_player.c @@ -58,6 +58,22 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd, void * p_userdata ); static int +input_es_changed( vlc_object_t * p_this, char const * psz_cmd, + int action, vlc_value_t *p_val, + void *p_userdata); + +static int +input_es_selected( vlc_object_t * p_this, char const * psz_cmd, + vlc_value_t oldval, vlc_value_t newval, + void * p_userdata ); + +static void +add_es_callbacks( input_thread_t *p_input_thread, libvlc_media_player_t *p_mi ); + +static void +del_es_callbacks( input_thread_t *p_input_thread, libvlc_media_player_t *p_mi ); + +static int snapshot_was_taken( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ); @@ -125,6 +141,7 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor input_scrambled_changed, p_mi ); var_DelCallback( p_input_thread, "intf-event", input_event_changed, p_mi ); +del_es_callbacks( p_input_thread, p_mi ); /* We owned this one */ input_Stop( p_input_thread, b_input_abort ); @@ -347,6 +364,85 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd, return VLC_SUCCESS; } +static int track_type_from_name(const char *psz_name) +{ + if( !strcmp( psz_name, "video-es" ) ) + return libvlc_track_video; +else if( !strcmp( psz_name, "audio-es" ) ) +return libvlc_track_audio; +else if( !strcmp( psz_name, "spu-es" ) ) +return libvlc_track_text; +else +return libvlc_track_unknown; +} + +static int input_es_changed( vlc_object_t *p_this, + char const *psz_cmd, + int action, + vlc_value_t *p_val, + void *p_userdata ) +{ +VLC_UNUSED(p_this); +libvlc_media_player_t *mp = p_userdata; +libvlc_event_t event; + +/* Ignore the "Disable" element */ +if (p_val && p_val->i_int < 0) +return VLC_EGENERIC; + +switch (action) +{ +case VLC_VAR_ADDCHOICE: +event.type = libvlc_MediaPlayerESAdded; +break; +case VLC_VAR_DELCHOICE: +case VLC_VAR_CLEARCHOICES: +event.type = libvlc_MediaPlayerESDeleted; +break; +default: +return VLC_EGENERIC; +} + +event.u.media_player_es_changed.i_type = track_type_from_name(psz_cmd); + +int i_id; +if (action != VLC_VAR_CLEARCHOICES) +{ +if (!p_val) +return VLC_EGENERIC; +i_id = p_val->i_int; +} +else +{ +/* -1 means all ES tracks of this type were deleted. */ +i_id = -1; +} +event.u.media_player_es_changed.i_id = i_id; + +libvlc_event_send(mp->p_event_manager, &event); + +return VLC_SUCCESS; +} + +static int +input_es_selected( vlc
[vlc-commits] mft: add missing dependency on h264_nal.{c,h}
vlc | branch: master | Felix Abecassis | Fri Aug 1 12:10:54 2014 +0200| [cd6820b850abb999808eb9c5edb93d9952c14474] | committer: Felix Abecassis mft: add missing dependency on h264_nal.{c,h} > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cd6820b850abb999808eb9c5edb93d9952c14474 --- modules/codec/Makefile.am |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am index bfcacc1..50d16d0 100644 --- a/modules/codec/Makefile.am +++ b/modules/codec/Makefile.am @@ -478,7 +478,7 @@ libdmo_plugin_la_LIBADD += -lole32 -luuid codec_LTLIBRARIES += libdmo_plugin.la endif -libmft_plugin_la_SOURCES = codec/mft.c +libmft_plugin_la_SOURCES = codec/mft.c codec/h264_nal.c codec/h264_nal.h if HAVE_WIN32 libmft_plugin_la_LIBADD = -lole32 -luuid codec_LTLIBRARIES += libmft_plugin.la ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] h264: refactor Exp-Golomb reading functions with existing mpeg demuxing code
vlc | branch: master | Felix Abecassis | Fri Aug 1 11:18:35 2014 +0200| [999867028cb6f3dcfb0bdbdb8289d8c392eac9a1] | committer: Felix Abecassis h264: refactor Exp-Golomb reading functions with existing mpeg demuxing code > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=999867028cb6f3dcfb0bdbdb8289d8c392eac9a1 --- modules/demux/mpeg/hevc.c|8 modules/demux/mpeg/mpeg_parser_helpers.h | 10 +- modules/mux/mp4.c| 20 ++-- modules/packetizer/h264.c| 19 +-- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/modules/demux/mpeg/hevc.c b/modules/demux/mpeg/hevc.c index 9add76b..b564ea5 100644 --- a/modules/demux/mpeg/hevc.c +++ b/modules/demux/mpeg/hevc.c @@ -263,12 +263,12 @@ static int32_t getFPS( demux_t *p_demux, block_t * p_block ) int32_t i = vps_sub_layer_ordering_info_present_flag? 0 : max_sub_layer_minus1; for( ; i <= max_sub_layer_minus1; i++ ) { -read_ue( &bs ); -read_ue( &bs ); -read_ue( &bs ); +bs_read_ue( &bs ); +bs_read_ue( &bs ); +bs_read_ue( &bs ); } uint32_t vps_max_layer_id = bs_read( &bs, 6); -uint32_t vps_num_layer_sets_minus1 = read_ue( &bs ); +uint32_t vps_num_layer_sets_minus1 = bs_read_ue( &bs ); bs_skip( &bs, vps_max_layer_id * vps_num_layer_sets_minus1 ); if( bs_read1( &bs )) diff --git a/modules/demux/mpeg/mpeg_parser_helpers.h b/modules/demux/mpeg/mpeg_parser_helpers.h index f8522e8..362ae6b 100644 --- a/modules/demux/mpeg/mpeg_parser_helpers.h +++ b/modules/demux/mpeg/mpeg_parser_helpers.h @@ -51,7 +51,8 @@ static inline void hevc_skip_profile_tiers_level( bs_t * bs, int32_t max_sub_lay } } -static inline uint32_t read_ue( bs_t * bs ) +/* Read unsigned Exp-Golomb code */ +static inline uint32_t bs_read_ue( bs_t * bs ) { int32_t i = 0; @@ -61,6 +62,13 @@ static inline uint32_t read_ue( bs_t * bs ) return (1 << i) - 1 + bs_read( bs, i ); } +/* Read signed Exp-Golomb code */ +static inline int32_t bs_read_se( bs_t *s ) +{ +int val = bs_read_ue( s ); + +return val&0x01 ? (val+1)/2 : -(val/2); +} static inline size_t nal_decode(uint8_t * p_src, uint8_t * p_dst, size_t i_size) { diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c index 92fe09a..68b9ecb 100644 --- a/modules/mux/mp4.c +++ b/modules/mux/mp4.c @@ -856,26 +856,26 @@ static void hevcParseSPS(uint8_t * p_buffer, size_t i_buffer, uint8_t * chroma_i hevc_skip_profile_tiers_level(&bs, sps_max_sublayer_minus1); /* skip sps id */ -(void) read_ue( &bs ); +(void) bs_read_ue( &bs ); -*chroma_idc = read_ue(&bs); +*chroma_idc = bs_read_ue(&bs); if (*chroma_idc == 3) bs_skip(&bs, 1); /* skip width and heigh */ -(void) read_ue( &bs ); -(void) read_ue( &bs ); +(void) bs_read_ue( &bs ); +(void) bs_read_ue( &bs ); uint32_t conformance_window_flag = bs_read1(&bs); if (conformance_window_flag) { /* skip offsets*/ -(void) read_ue(&bs); -(void) read_ue(&bs); -(void) read_ue(&bs); -(void) read_ue(&bs); +(void) bs_read_ue(&bs); +(void) bs_read_ue(&bs); +(void) bs_read_ue(&bs); +(void) bs_read_ue(&bs); } -*bit_depth_luma_minus8 = read_ue(&bs); -*bit_depth_chroma_minus8 = read_ue(&bs); +*bit_depth_luma_minus8 = bs_read_ue(&bs); +*bit_depth_chroma_minus8 = bs_read_ue(&bs); } static bo_t *GetHvcCTag(mp4_stream_t *p_stream) diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c index e671f6e..202ae6b 100644 --- a/modules/packetizer/h264.c +++ b/modules/packetizer/h264.c @@ -42,6 +42,7 @@ #include #include "../codec/cc.h" #include "packetizer_helper.h" +#include "../demux/mpeg/mpeg_parser_helpers.h" /* * Module descriptor @@ -572,24 +573,6 @@ static void CreateDecodedNAL( uint8_t **pp_ret, int *pi_ret, *pi_ret = dst - *pp_ret; } -static inline int bs_read_ue( bs_t *s ) -{ -int i = 0; - -while( bs_read1( s ) == 0 && s->p < s->p_end && i < 32 ) -{ -i++; -} -return( ( 1 << i) - 1 + bs_read( s, i ) ); -} - -static inline int bs_read_se( bs_t *s ) -{ -int val = bs_read_ue( s ); - -return val&0x01 ? (val+1)/2 : -(val/2); -} - /* * ParseNALBlock: parses annexB type NALs * All p_frag blocks are required to start with 0 0 0 1 4-byte startcode ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] h264_nal: add header guard
vlc | branch: master | Felix Abecassis | Fri Aug 1 11:18:31 2014 +0200| [d357138136e01693675d577e5fad67f73d64e563] | committer: Felix Abecassis h264_nal: add header guard > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d357138136e01693675d577e5fad67f73d64e563 --- modules/codec/h264_nal.h |5 + 1 file changed, 5 insertions(+) diff --git a/modules/codec/h264_nal.h b/modules/codec/h264_nal.h index 21a34be..f39e28b 100644 --- a/modules/codec/h264_nal.h +++ b/modules/codec/h264_nal.h @@ -18,6 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. */ +#ifndef H264_NAL_H +# define H264_NAL_H + # ifdef HAVE_CONFIG_H # include "config.h" # endif @@ -44,3 +47,5 @@ void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len, /* Get level and Profile */ bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t *p_level, size_t *p_nal_size); + +#endif /* H264_NAL_H */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] h264_nal: add a source file to separate declaration from definition
vlc | branch: master | Felix Abecassis | Fri Aug 1 11:18:23 2014 +0200| [61e14f1b4338a68f1c498510195ee517734cc34c] | committer: Felix Abecassis h264_nal: add a source file to separate declaration from definition > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=61e14f1b4338a68f1c498510195ee517734cc34c --- modules/codec/Makefile.am |7 +- modules/codec/h264_nal.c | 169 + modules/codec/h264_nal.h | 162 --- modules/packetizer/Modules.am |2 +- 4 files changed, 190 insertions(+), 150 deletions(-) Diff: http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=61e14f1b4338a68f1c498510195ee517734cc34c ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] h264: refactor emulation prevention byte handling
vlc | branch: master | Felix Abecassis | Fri Aug 1 11:18:40 2014 +0200| [0643589050694bdc42c5709ef2b3d5dbc62748d7] | committer: Felix Abecassis h264: refactor emulation prevention byte handling > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0643589050694bdc42c5709ef2b3d5dbc62748d7 --- modules/packetizer/h264.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c index 202ae6b..2b84a27 100644 --- a/modules/packetizer/h264.c +++ b/modules/packetizer/h264.c @@ -555,22 +555,7 @@ static void CreateDecodedNAL( uint8_t **pp_ret, int *pi_ret, *pp_ret = dst; if( dst ) -{ -while( src < end ) -{ -if( src < end - 3 && src[0] == 0x00 && src[1] == 0x00 && -src[2] == 0x03 ) -{ -*dst++ = 0x00; -*dst++ = 0x00; - -src += 3; -continue; -} -*dst++ = *src++; -} -} -*pi_ret = dst - *pp_ret; +*pi_ret = nal_decode(src, dst, i_src); } /* ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] libvlc: add error checking after calling var_Change
vlc/vlc-2.2 | branch: master | Felix Abecassis | Mon Jul 7 12:41:32 2014 +0200| [bf7b9d370419aa3a1365e4d01534b99cbfb9b00a] | committer: Felix Abecassis libvlc: add error checking after calling var_Change Previously, if var_Change failed (e.g. with VLC_ENOVAR), an uninitialized value was returned. > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=bf7b9d370419aa3a1365e4d01534b99cbfb9b00a --- lib/media_player.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/media_player.c b/lib/media_player.c index 5225079..b31a832 100644 --- a/lib/media_player.c +++ b/lib/media_player.c @@ -1135,10 +1135,10 @@ int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi ) if( !p_input_thread ) return -1; -var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); +int i_ret = var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); -return val.i_int; +return i_ret == VLC_SUCCESS ? val.i_int : -1; } int libvlc_media_player_get_chapter_count_for_title( @@ -1158,11 +1158,11 @@ int libvlc_media_player_get_chapter_count_for_title( vlc_object_release( p_input_thread ); return -1; } -var_Change( p_input_thread, psz_name, VLC_VAR_CHOICESCOUNT, &val, NULL ); +int i_ret = var_Change( p_input_thread, psz_name, VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); free( psz_name ); -return val.i_int; +return i_ret == VLC_SUCCESS ? val.i_int : -1; } void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, @@ -1208,10 +1208,10 @@ int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi ) if( !p_input_thread ) return -1; -var_Change( p_input_thread, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); +int i_ret = var_Change( p_input_thread, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); -return val.i_int; +return i_ret == VLC_SUCCESS ? val.i_int : -1; } void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi ) @@ -1344,7 +1344,9 @@ libvlc_track_description_t * return NULL; vlc_value_t val_list, text_list; -var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list); +int i_ret = var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list ); +if( i_ret != VLC_SUCCESS ) +return NULL; /* no tracks */ if( val_list.p_list->i_count <= 0 ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] libvlc: add error checking after calling var_Change
vlc | branch: master | Felix Abecassis | Mon Jul 7 12:41:32 2014 +0200| [4a170b9ad3831b0566e2f0436050c5123422effa] | committer: Felix Abecassis libvlc: add error checking after calling var_Change Previously, if var_Change failed (e.g. with VLC_ENOVAR), an uninitialized value was returned. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a170b9ad3831b0566e2f0436050c5123422effa --- lib/media_player.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/media_player.c b/lib/media_player.c index 5225079..b31a832 100644 --- a/lib/media_player.c +++ b/lib/media_player.c @@ -1135,10 +1135,10 @@ int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi ) if( !p_input_thread ) return -1; -var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); +int i_ret = var_Change( p_input_thread, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); -return val.i_int; +return i_ret == VLC_SUCCESS ? val.i_int : -1; } int libvlc_media_player_get_chapter_count_for_title( @@ -1158,11 +1158,11 @@ int libvlc_media_player_get_chapter_count_for_title( vlc_object_release( p_input_thread ); return -1; } -var_Change( p_input_thread, psz_name, VLC_VAR_CHOICESCOUNT, &val, NULL ); +int i_ret = var_Change( p_input_thread, psz_name, VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); free( psz_name ); -return val.i_int; +return i_ret == VLC_SUCCESS ? val.i_int : -1; } void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, @@ -1208,10 +1208,10 @@ int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi ) if( !p_input_thread ) return -1; -var_Change( p_input_thread, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); +int i_ret = var_Change( p_input_thread, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); vlc_object_release( p_input_thread ); -return val.i_int; +return i_ret == VLC_SUCCESS ? val.i_int : -1; } void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi ) @@ -1344,7 +1344,9 @@ libvlc_track_description_t * return NULL; vlc_value_t val_list, text_list; -var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list); +int i_ret = var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list ); +if( i_ret != VLC_SUCCESS ) +return NULL; /* no tracks */ if( val_list.p_list->i_count <= 0 ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android opaque: check error when locking the subtitles surface
vlc/vlc-2.2 | branch: master | Felix Abecassis | Mon Jun 23 19:18:50 2014 +0200| [34f4ced8d9658eb2014a90e36bad65d850dc06ca] | committer: Jean-Baptiste Kempf android opaque: check error when locking the subtitles surface (cherry picked from commit 2da3279c1765294d19980b0539d7fe7433942b8d) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=34f4ced8d9658eb2014a90e36bad65d850dc06ca --- modules/video_output/android/opaque.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/video_output/android/opaque.c b/modules/video_output/android/opaque.c index a289004..eac9d46 100644 --- a/modules/video_output/android/opaque.c +++ b/modules/video_output/android/opaque.c @@ -130,7 +130,11 @@ static void DisplaySubpicture(vout_display_t *vd, subpicture_t *subpicture) } ANativeWindow_Buffer buf = { 0 }; -sys->native_window.winLock(sys->window, &buf, NULL); +int32_t err = sys->native_window.winLock(sys->window, &buf, NULL); +if (err) { +jni_UnlockAndroidSurface(); +return; +} if (buf.width >= sys->fmt.i_width && buf.height >= sys->fmt.i_height) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android surface: check error when locking the video playback surface
vlc/vlc-2.2 | branch: master | Felix Abecassis | Mon Jun 23 19:21:41 2014 +0200| [50dc263245f68430ddf1599a661e5fefcd1ed9cc] | committer: Jean-Baptiste Kempf android surface: check error when locking the video playback surface (cherry picked from commit 713ab83f6a19057634e4c9b9c758ca397ebfc8e3) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=50dc263245f68430ddf1599a661e5fefcd1ed9cc --- modules/video_output/android/surface.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/video_output/android/surface.c b/modules/video_output/android/surface.c index 139511d..6aaa9ef 100644 --- a/modules/video_output/android/surface.c +++ b/modules/video_output/android/surface.c @@ -388,7 +388,11 @@ static int AndroidLockSurface(picture_t *picture) if (sys->native_window.winLock) { ANativeWindow_Buffer buf = { 0 }; -sys->native_window.winLock(sys->window, &buf, NULL); +int32_t err = sys->native_window.winLock(sys->window, &buf, NULL); +if (err) { +jni_UnlockAndroidSurface(); +return VLC_EGENERIC; +} info->w = buf.width; info->h = buf.height; info->bits = buf.bits; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android opaque: check error when locking the subtitles surface
vlc | branch: master | Felix Abecassis | Mon Jun 23 19:18:50 2014 +0200| [2da3279c1765294d19980b0539d7fe7433942b8d] | committer: Felix Abecassis android opaque: check error when locking the subtitles surface > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2da3279c1765294d19980b0539d7fe7433942b8d --- modules/video_output/android/opaque.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/video_output/android/opaque.c b/modules/video_output/android/opaque.c index a289004..eac9d46 100644 --- a/modules/video_output/android/opaque.c +++ b/modules/video_output/android/opaque.c @@ -130,7 +130,11 @@ static void DisplaySubpicture(vout_display_t *vd, subpicture_t *subpicture) } ANativeWindow_Buffer buf = { 0 }; -sys->native_window.winLock(sys->window, &buf, NULL); +int32_t err = sys->native_window.winLock(sys->window, &buf, NULL); +if (err) { +jni_UnlockAndroidSurface(); +return; +} if (buf.width >= sys->fmt.i_width && buf.height >= sys->fmt.i_height) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android surface: check error when locking the video playback surface
vlc | branch: master | Felix Abecassis | Mon Jun 23 19:21:41 2014 +0200| [713ab83f6a19057634e4c9b9c758ca397ebfc8e3] | committer: Felix Abecassis android surface: check error when locking the video playback surface > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=713ab83f6a19057634e4c9b9c758ca397ebfc8e3 --- modules/video_output/android/surface.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/video_output/android/surface.c b/modules/video_output/android/surface.c index 139511d..6aaa9ef 100644 --- a/modules/video_output/android/surface.c +++ b/modules/video_output/android/surface.c @@ -388,7 +388,11 @@ static int AndroidLockSurface(picture_t *picture) if (sys->native_window.winLock) { ANativeWindow_Buffer buf = { 0 }; -sys->native_window.winLock(sys->window, &buf, NULL); +int32_t err = sys->native_window.winLock(sys->window, &buf, NULL); +if (err) { +jni_UnlockAndroidSurface(); +return VLC_EGENERIC; +} info->w = buf.width; info->h = buf.height; info->bits = buf.bits; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] avcodec: copy correct chroma plane in CopyFromYv12.
vlc/vlc-2.1 | branch: master | Felix Abecassis | Wed Oct 23 11:28:27 2013 +| [bda92b706f1a7865f5ef1c100df5c7fff2ddbc95] | committer: Rémi Denis-Courmont avcodec: copy correct chroma plane in CopyFromYv12. Signed-off-by: Jean-Baptiste Kempf (cherry picked from commit 18e124ec4bcb679b17d0425f121106465d3a74f2) Signed-off-by: Rémi Denis-Courmont > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=bda92b706f1a7865f5ef1c100df5c7fff2ddbc95 --- modules/codec/avcodec/copy.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/avcodec/copy.c b/modules/codec/avcodec/copy.c index e0823aa..5593d07 100644 --- a/modules/codec/avcodec/copy.c +++ b/modules/codec/avcodec/copy.c @@ -412,5 +412,5 @@ void CopyFromYv12(picture_t *dst, uint8_t *src[3], size_t src_pitch[3], CopyPlane(dst->p[1].p_pixels, dst->p[1].i_pitch, src[1], src_pitch[1], width / 2, height / 2); CopyPlane(dst->p[2].p_pixels, dst->p[2].i_pitch, - src[1], src_pitch[2], width / 2, height / 2); + src[2], src_pitch[2], width / 2, height / 2); } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] text_renderer: avoid 0xff << 24 with an int type
vlc | branch: master | Felix Abecassis | Tue May 6 18:43:41 2014 +0200| [5cedfe6d1988246aeeb28b5c79351f7d36ef10d4] | committer: Felix Abecassis text_renderer: avoid 0xff << 24 with an int type > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5cedfe6d1988246aeeb28b5c79351f7d36ef10d4 --- modules/text_renderer/text_renderer.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/text_renderer/text_renderer.c b/modules/text_renderer/text_renderer.c index 3648581..4119c34 100644 --- a/modules/text_renderer/text_renderer.c +++ b/modules/text_renderer/text_renderer.c @@ -398,7 +398,7 @@ int HandleFontAttributes( xml_reader_t *p_xml_reader, rv = PushFont( p_fonts, psz_fontname, i_font_size, - (i_font_color & 0xff) | ((i_font_alpha & 0xff) << 24), + (i_font_color & 0xff) | ((uint32_t)(i_font_alpha & 0xff) << 24), i_karaoke_bg_color ); free( psz_fontname ); @@ -572,7 +572,7 @@ int ProcessNodes( filter_t *p_filter, p_default_style->psz_fontname, i_font_size, (i_font_color & 0xff) | - ((i_font_alpha & 0xff) << 24), + ((uint32_t)(i_font_alpha & 0xff) << 24), 0x00ff ); } if( p_default_style->i_style_flags & STYLE_BOLD ) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: fix field type mismatch
vlc | branch: master | Felix Abecassis | Wed May 14 11:47:00 2014 +0200| [ee71af08af92c9e368587fa09866b0210256729a] | committer: Felix Abecassis mediacodec: fix field type mismatch > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ee71af08af92c9e368587fa09866b0210256729a --- modules/codec/omxil/android_mediacodec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 2d912d0..94359c3 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -413,7 +413,7 @@ static int OpenDecoder(vlc_object_t *p_this) for (int i = 0; i < profile_levels_len && !found; ++i) { jobject profile_level = (*env)->GetObjectArrayElement(env, profile_levels, i); -int omx_profile = (*env)->GetLongField(env, profile_level, p_sys->profile_field); +int omx_profile = (*env)->GetIntField(env, profile_level, p_sys->profile_field); size_t codec_profile = convert_omx_to_profile_idc(omx_profile); if (codec_profile != fmt_profile) continue; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mkv: fix declaration/definition mismatch of demux_sys_t
vlc | branch: master | Felix Abecassis | Mon May 12 11:13:48 2014 +0200| [7f318cff999f87f69952f7243c2800ce081539db] | committer: Felix Abecassis mkv: fix declaration/definition mismatch of demux_sys_t Kill many compiler warnings. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7f318cff999f87f69952f7243c2800ce081539db --- modules/demux/mkv/chapter_command.hpp |2 +- modules/demux/mkv/demux.hpp |2 +- modules/demux/mkv/mkv.cpp |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/demux/mkv/chapter_command.hpp b/modules/demux/mkv/chapter_command.hpp index 7c8a3c1..80b3e45 100644 --- a/modules/demux/mkv/chapter_command.hpp +++ b/modules/demux/mkv/chapter_command.hpp @@ -35,7 +35,7 @@ const binary MATROSKA_DVD_LEVEL_PG = 0x18; const binary MATROSKA_DVD_LEVEL_PTT = 0x10; const binary MATROSKA_DVD_LEVEL_CN = 0x08; -class demux_sys_t; +struct demux_sys_t; class chapter_codec_cmds_c { diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp index c295f13..f6b910b 100644 --- a/modules/demux/mkv/demux.hpp +++ b/modules/demux/mkv/demux.hpp @@ -326,7 +326,7 @@ private: }; -class demux_sys_t +struct demux_sys_t { public: demux_sys_t( demux_t & demux ) diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp index b2b85bb..c1dd781 100644 --- a/modules/demux/mkv/mkv.cpp +++ b/modules/demux/mkv/mkv.cpp @@ -73,7 +73,7 @@ vlc_module_begin () add_shortcut( "mka", "mkv" ) vlc_module_end () -class demux_sys_t; +struct demux_sys_t; static int Demux ( demux_t * ); static int Control( demux_t *, int, va_list ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] es_out: fix potential division by zero
vlc | branch: master | Felix Abecassis | Tue May 6 18:45:01 2014 +0200| [882be2a1f8e756201e3b225cac26d239c20bd080] | committer: Felix Abecassis es_out: fix potential division by zero > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=882be2a1f8e756201e3b225cac26d239c20bd080 --- src/input/es_out.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/input/es_out.c b/src/input/es_out.c index f0334f5..c8ae945 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -620,7 +620,11 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced ) if( i_stream_duration <= i_buffering_duration && !b_forced ) { -const double f_level = __MAX( (double)i_stream_duration / i_buffering_duration, 0 ); +double f_level; +if (i_buffering_duration == 0) +f_level = 0; +else +f_level = __MAX( (double)i_stream_duration / i_buffering_duration, 0 ); input_SendEventCache( p_sys->p_input, f_level ); msg_Dbg( p_sys->p_input, "Buffering %d%%", (int)(100 * f_level) ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vdpau: fix redundant const qualifier
vlc | branch: master | Felix Abecassis | Tue May 6 18:10:58 2014 +0200| [ec8fdba21a06df0b6d1f38b0f56e18830ed885d2] | committer: Felix Abecassis vdpau: fix redundant const qualifier Was meant as constant pointer and constant pointed data. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ec8fdba21a06df0b6d1f38b0f56e18830ed885d2 --- modules/hw/vdpau/vlc_vdpau.c |4 ++-- modules/hw/vdpau/vlc_vdpau.h |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/hw/vdpau/vlc_vdpau.c b/modules/hw/vdpau/vlc_vdpau.c index 8e0a76d..9b44be8 100644 --- a/modules/hw/vdpau/vlc_vdpau.c +++ b/modules/hw/vdpau/vlc_vdpau.c @@ -321,7 +321,7 @@ VdpStatus vdp_output_surface_render_output_surface(const vdp_t *vdp, VdpOutputSurface dst_surface, const VdpRect *dst_rect, VdpOutputSurface src_surface, const VdpRect *src_rect, const VdpColor *colors, -const VdpOutputSurfaceRenderBlendState const *state, uint32_t flags) +const VdpOutputSurfaceRenderBlendState *const state, uint32_t flags) { return vdp->vt.output_surface_render_output_surface(dst_surface, dst_rect, src_surface, src_rect, colors, state, flags); @@ -422,7 +422,7 @@ VdpStatus vdp_video_mixer_set_feature_enables(const vdp_t *vdp, VdpStatus vdp_video_mixer_set_attribute_values(const vdp_t *vdp, VdpVideoMixer mixer, uint32_t count, -const VdpVideoMixerAttribute const *ids, const void *const *values) +const VdpVideoMixerAttribute *const ids, const void *const *values) { return vdp->vt.video_mixer_set_attribute_values(mixer, count, ids, values); } diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h index f899ba2..d5f073e 100644 --- a/modules/hw/vdpau/vlc_vdpau.h +++ b/modules/hw/vdpau/vlc_vdpau.h @@ -79,7 +79,7 @@ VdpStatus vdp_bitmap_surface_put_bits_native(const vdp_t *, VdpBitmapSurface, const void *const *, const uint32_t *, const VdpRect *); VdpStatus vdp_output_surface_render_output_surface(const vdp_t *, VdpOutputSurface, const VdpRect *, VdpOutputSurface, const VdpRect *, -const VdpColor *, const VdpOutputSurfaceRenderBlendState const *, +const VdpColor *, const VdpOutputSurfaceRenderBlendState *const, uint32_t); VdpStatus vdp_output_surface_render_bitmap_surface(const vdp_t *, VdpOutputSurface, const VdpRect *, VdpBitmapSurface, const VdpRect *, @@ -110,7 +110,7 @@ VdpStatus vdp_video_mixer_create(const vdp_t *, VdpDevice, uint32_t, VdpStatus vdp_video_mixer_set_feature_enables(const vdp_t *, VdpVideoMixer, uint32_t, const VdpVideoMixerFeature *, const VdpBool *); VdpStatus vdp_video_mixer_set_attribute_values(const vdp_t *, VdpVideoMixer, -uint32_t, const VdpVideoMixerAttribute const *, const void *const *); +uint32_t, const VdpVideoMixerAttribute *const, const void *const *); VdpStatus vdp_video_mixer_get_feature_support(const vdp_t *, VdpVideoMixer, uint32_t, const VdpVideoMixerFeature *, VdpBool *); VdpStatus vdp_video_mixer_get_feature_enables(const vdp_t *, VdpVideoMixer, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] filter_chain: fix potential undefined behavior
vlc | branch: master | Felix Abecassis | Tue May 6 17:41:46 2014 +0200| [490324fbc6db912e1367e33487c1711e8dea9384] | committer: Felix Abecassis filter_chain: fix potential undefined behavior If p_chain->first is NULL, we should not take the address of first->filter. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=490324fbc6db912e1367e33487c1711e8dea9384 --- src/misc/filter_chain.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c index d4c0941..63fbb0f 100644 --- a/src/misc/filter_chain.c +++ b/src/misc/filter_chain.c @@ -154,10 +154,8 @@ void filter_chain_Delete( filter_chain_t *p_chain ) void filter_chain_Reset( filter_chain_t *p_chain, const es_format_t *p_fmt_in, const es_format_t *p_fmt_out ) { -filter_t *p_filter; - -while( (p_filter = &p_chain->first->filter) != NULL ) -filter_chain_DeleteFilterInternal( p_chain, p_filter ); +while( p_chain->first != NULL ) +filter_chain_DeleteFilterInternal( p_chain, &p_chain->first->filter ); if( p_fmt_in ) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] lib: remove unused variable
vlc | branch: master | Felix Abecassis | Tue May 6 17:19:24 2014 +0200| [2ddd0f3eb3cd63d5fadf25902d81eade3141589a] | committer: Felix Abecassis lib: remove unused variable > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ddd0f3eb3cd63d5fadf25902d81eade3141589a --- lib/core.c |2 -- 1 file changed, 2 deletions(-) diff --git a/lib/core.c b/lib/core.c index f842b57..cc74071 100644 --- a/lib/core.c +++ b/lib/core.c @@ -38,8 +38,6 @@ #include "../src/revision.c" -static const char nomemstr[] = "Insufficient memory"; - libvlc_instance_t * libvlc_new( int argc, const char *const *argv ) { libvlc_threads_init (); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] swscale: modify output aspect ratio if transformation is not homothetic
vlc | branch: master | Felix Abecassis | Wed Apr 30 15:38:25 2014 +0200| [c021c39d818a11554e5d454aee6b43df18c6e54b] | committer: Felix Abecassis swscale: modify output aspect ratio if transformation is not homothetic Close #10745 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c021c39d818a11554e5d454aee6b43df18c6e54b --- modules/video_chroma/swscale.c | 20 1 file changed, 20 insertions(+) diff --git a/modules/video_chroma/swscale.c b/modules/video_chroma/swscale.c index 4b763dd..6559078 100644 --- a/modules/video_chroma/swscale.c +++ b/modules/video_chroma/swscale.c @@ -430,6 +430,26 @@ static int Init( filter_t *p_filter ) return VLC_EGENERIC; } +if (p_filter->b_allow_fmt_out_change) +{ +/* + * If the transformation is not homothetic we must modify the + * aspect ratio of the output format in order to have the + * output picture displayed correctly and not stretched + * horizontally or vertically. + * WARNING: this is a hack, ideally this should not be needed + * and the vout should update its video format instead. + */ +unsigned i_sar_num = p_fmti->i_sar_num * p_fmti->i_visible_width; +unsigned i_sar_den = p_fmti->i_sar_den * p_fmto->i_visible_width; +vlc_ureduce(&i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 65536); +i_sar_num *= p_fmto->i_visible_height; +i_sar_den *= p_fmti->i_visible_height; +vlc_ureduce(&i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 65536); +p_fmto->i_sar_num = i_sar_num; +p_fmto->i_sar_den = i_sar_den; +} + p_sys->b_add_a = cfg.b_add_a; p_sys->b_copy = cfg.b_copy; p_sys->fmt_in = *p_fmti; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] codec: implementation of Media Foundation Transform audio/video decoding
vlc | branch: master | Felix Abecassis | Fri Apr 25 15:25:37 2014 +0200| [2762ab0abe21d05dc9b4245263daea9e9a52364d] | committer: Felix Abecassis codec: implementation of Media Foundation Transform audio/video decoding Media Foundation is a framework for encoding/decoding multimedia content on Windows Vista and above. A Media Foundation Transform (MFT) is a module implementing an encoder, a decoder or a filter. MFTs can be enumerated and initialized using the function MFTEnumEx. A MFT can be SW or HW, synchronous or asynchronous. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2762ab0abe21d05dc9b4245263daea9e9a52364d --- NEWS |1 + modules/MODULES_LIST |1 + modules/codec/Makefile.am |6 + modules/codec/mft.c | 1169 + po/POTFILES.in|1 + 5 files changed, 1178 insertions(+) Diff: http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=2762ab0abe21d05dc9b4245263daea9e9a52364d ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Revert "MP4 demux: only set fragmented flag if filecontains movie fragment atoms."
vlc | branch: master | Felix Abecassis | Fri Apr 4 11:13:43 2014 +0200| [bbacf6f98daece8f61517094a4fcc8a426bcb2d2] | committer: Felix Paul Kühne Revert "MP4 demux: only set fragmented flag if filecontains movie fragment atoms." This reverts commit 9ef5be06a9b3d0a8bf867f707db2d9604b01c807. Fix #10983. Signed-off-by: Felix Paul Kühne > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bbacf6f98daece8f61517094a4fcc8a426bcb2d2 --- modules/demux/mp4/mp4.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 10a2ae8..f70fc3a 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -361,8 +361,7 @@ static int Open( vlc_object_t * p_this ) if( LoadInitFrag( p_demux, b_smooth ) != VLC_SUCCESS ) goto error; -if( MP4_BoxCount( p_sys->p_root, "/moov/mvex" ) > 0 && -MP4_BoxCount( p_sys->p_root, "/moof" ) > 0 ) +if( MP4_BoxCount( p_sys->p_root, "/moov/mvex" ) > 0 ) { p_sys->b_fragmented = true; } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android: fix green line issue when using an YUV surface in SW mode.
vlc | branch: master | Felix Abecassis | Thu Apr 3 19:33:57 2014 +0200| [a5d9020b282d107e76259748f428ba93e34eca4f] | committer: Felix Abecassis android: fix green line issue when using an YUV surface in SW mode. The padding lines introduced by avcodec for direct rendering are set to black since they might be used by Android during rescaling. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a5d9020b282d107e76259748f428ba93e34eca4f --- modules/video_output/android/surface.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/modules/video_output/android/surface.c b/modules/video_output/android/surface.c index 8325fe5..bc51913 100644 --- a/modules/video_output/android/surface.c +++ b/modules/video_output/android/surface.c @@ -329,6 +329,13 @@ static void SetupPictureYV12( SurfaceInfo* p_surfaceInfo, picture_t *p_picture ) p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch; p->i_pitch = i_c_stride; p->i_lines = p_picture->format.i_height / 2; +/* + Explicitly set the padding lines of the picture to black (127 for YUV) + since they might be used by Android during rescaling. +*/ +int visible_lines = p_picture->format.i_visible_height / 2; +if (visible_lines < p->i_lines) +memset(&p->p_pixels[visible_lines * p->i_pitch], 127, (p->i_lines - visible_lines) * p->i_pitch); } if( vlc_fourcc_AreUVPlanesSwapped( p_picture->format.i_chroma, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: check exceptions after getCapabilitiesForType()
vlc | branch: master | Felix Abecassis | Thu Apr 3 15:37:13 2014 +0200| [14b85712d1ed59aa37c23f07a85c8c694ff73b09] | committer: Felix Abecassis mediacodec: check exceptions after getCapabilitiesForType() Avoid crashing on some devices, but it forces fallback to SW decoding. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=14b85712d1ed59aa37c23f07a85c8c694ff73b09 --- modules/codec/omxil/android_mediacodec.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 951d879..ba70fdc 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -388,7 +388,11 @@ static int OpenDecoder(vlc_object_t *p_this) (*env)->NewStringUTF(env, mime)); jobject profile_levels = NULL; int profile_levels_len = 0; -if (codec_capabilities) { +if ((*env)->ExceptionOccurred(env)) { +msg_Warn(p_dec, "Exception occurred in MediaCodecInfo.getCapabilitiesForType"); +(*env)->ExceptionClear(env); +break; +} else if (codec_capabilities) { profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field); if (profile_levels) profile_levels_len = (*env)->GetArrayLength(env, profile_levels); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] omxil: do not use iomx (Android) for audio decoding
vlc | branch: master | Felix Abecassis | Thu Apr 3 12:18:48 2014 +0200| [f90e9ebc5a95ba65873995540901260233e32f97] | committer: Felix Abecassis omxil: do not use iomx (Android) for audio decoding > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f90e9ebc5a95ba65873995540901260233e32f97 --- modules/codec/omxil/omxil.c |5 + 1 file changed, 5 insertions(+) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index e3e34c4..6298cdc 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -780,6 +780,11 @@ static int OpenDecoder( vlc_object_t *p_this ) decoder_t *p_dec = (decoder_t*)p_this; int status; +#ifdef __ANDROID__ +if( p_dec->fmt_in.i_cat == AUDIO_ES ) +return VLC_EGENERIC; +#endif + if( 0 || !GetOmxRole(p_dec->fmt_in.i_codec, p_dec->fmt_in.i_cat, false) ) return VLC_EGENERIC; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] opengl: use buffer objects instead of host memory for subpictures
vlc | branch: master | Felix Abecassis | Tue Apr 1 15:44:52 2014 +0200| [c2699feec140bdce44cd7423666cd339f57b8541] | committer: Felix Abecassis opengl: use buffer objects instead of host memory for subpictures See bbbc51c713432b25b0ffdfa943b8441aa7d4f96e > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c2699feec140bdce44cd7423666cd339f57b8541 --- modules/video_output/opengl.c | 48 +++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index a5abdc3..35c4779 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "opengl.h" @@ -147,6 +148,9 @@ struct vout_display_opengl_t { GLuint vertex_buffer_object; GLuint texture_buffer_object[PICTURE_PLANE_MAX]; +GLuint *subpicture_buffer_object; +intsubpicture_buffer_object_count; + /* Shader variables commands*/ #ifdef SUPPORTS_SHADERS PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation; @@ -683,6 +687,17 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, #ifdef SUPPORTS_SHADERS vgl->GenBuffers(1, &vgl->vertex_buffer_object); vgl->GenBuffers(vgl->chroma->plane_count, vgl->texture_buffer_object); + +/* Initial number of allocated buffer objects for subpictures, will grow dynamically. */ +int subpicture_buffer_object_count = 8; +vgl->subpicture_buffer_object = malloc(subpicture_buffer_object_count * sizeof(GLuint)); +if (!vgl->subpicture_buffer_object) { +vlc_gl_Unlock(vgl->gl); +vout_display_opengl_Delete(vgl); +return NULL; +} +vgl->subpicture_buffer_object_count = subpicture_buffer_object_count; +vgl->GenBuffers(vgl->subpicture_buffer_object_count, vgl->subpicture_buffer_object); #endif vlc_gl_Unlock(vgl->gl); @@ -726,6 +741,9 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl) } vgl->DeleteBuffers(1, &vgl->vertex_buffer_object); vgl->DeleteBuffers(vgl->chroma->plane_count, vgl->texture_buffer_object); +if (vgl->subpicture_buffer_object_count > 0) +vgl->DeleteBuffers(vgl->subpicture_buffer_object_count, vgl->subpicture_buffer_object); +free(vgl->subpicture_buffer_object); #endif free(vgl->texture_temp_buf); @@ -1239,6 +1257,25 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl, glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#ifdef SUPPORTS_SHADERS +/* We need two buffer objects for each region: for vertex and texture coordinates. */ +if (2 * vgl->region_count > vgl->subpicture_buffer_object_count) { +if (vgl->subpicture_buffer_object_count > 0) +vgl->DeleteBuffers(vgl->subpicture_buffer_object_count, vgl->subpicture_buffer_object); +vgl->subpicture_buffer_object_count = 0; + +int new_count = 2 * vgl->region_count; +vgl->subpicture_buffer_object = realloc_or_free(vgl->subpicture_buffer_object, new_count * sizeof(GLuint)); +if (!vgl->subpicture_buffer_object) { +vlc_gl_Unlock(vgl->gl); +return VLC_ENOMEM; +} + +vgl->subpicture_buffer_object_count = new_count; +vgl->GenBuffers(vgl->subpicture_buffer_object_count, vgl->subpicture_buffer_object); +} +#endif + glActiveTexture(GL_TEXTURE0 + 0); glClientActiveTexture(GL_TEXTURE0 + 0); for (int i = 0; i < vgl->region_count; i++) { @@ -1260,10 +1297,17 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl, if (vgl->program[1]) { #ifdef SUPPORTS_SHADERS vgl->Uniform4f(vgl->GetUniformLocation(vgl->program[1], "FillColor"), 1.0f, 1.0f, 1.0f, glr->alpha); + +vgl->BindBuffer(GL_ARRAY_BUFFER, vgl->subpicture_buffer_object[2 * i]); +vgl->BufferData(GL_ARRAY_BUFFER, sizeof(textureCoord), textureCoord, GL_STATIC_DRAW); vgl->EnableVertexAttribArray(vgl->GetAttribLocation(vgl->program[1], "MultiTexCoord0")); -vgl->VertexAttribPointer(vgl->GetAttribLocation(vgl->program[1], "MultiTexCoord0"), 2, GL_FLOAT, 0, 0, textureCoord); +vgl->VertexAttribPointer(vgl->GetAttribLocation(vgl->program[1], "MultiTexCoord0"), 2, GL_FLOAT, 0, 0, 0); + +vgl->BindBuffer(GL_ARRAY_BUFFER, vgl->subpicture_buffer_object[2 * i + 1]); +vgl->BufferData(GL_ARRAY_BUFFER, sizeof(vertexCoord), vertexCoord, GL_STATIC_DRAW); vgl->EnableVertexAttribArray(vgl->GetAttribLocation(vgl->program[1], "VertexPosition")); -vgl->VertexAt
[vlc-commits] Direct3D: handle rotated movies.
vlc | branch: master | Felix Abecassis | Fri Mar 28 13:48:30 2014 +0100| [6149bbc90a14c8ffcf0417a7f47123e6c97014c0] | committer: Felix Abecassis Direct3D: handle rotated movies. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6149bbc90a14c8ffcf0417a7f47123e6c97014c0 --- modules/video_output/msw/direct3d.c | 103 +++ 1 file changed, 92 insertions(+), 11 deletions(-) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index 059c6d6..fc959fc 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -1316,31 +1316,112 @@ static void Direct3DDestroyShaders(vout_display_t *vd) sys->d3dx_shader = NULL; } +/** + * Compute the vertex ordering needed to rotate the video. Without + * rotation, the vertices of the rectangle are defined in a clockwise + * order. This function computes a remapping of the coordinates to + * implement the rotation, given fixed texture coordinates. + * The unrotated order is the following: + * 0--1 + * | | + * 3--2 + * For a 180 degrees rotation it should like this: + * 2--3 + * | | + * 1--0 + * Vertex 0 should be assigned coordinates at index 2 from the + * unrotated order and so on, thus yielding order: 2 3 0 1. + */ +static void orientationVertexOrder(video_orientation_t orientation, int vertex_order[static 4]) +{ +switch (orientation) { +case ORIENT_ROTATED_90: +vertex_order[0] = 1; +vertex_order[1] = 2; +vertex_order[2] = 3; +vertex_order[3] = 0; +break; +case ORIENT_ROTATED_270: +vertex_order[0] = 3; +vertex_order[1] = 0; +vertex_order[2] = 1; +vertex_order[3] = 2; +break; +case ORIENT_ROTATED_180: +vertex_order[0] = 2; +vertex_order[1] = 3; +vertex_order[2] = 0; +vertex_order[3] = 1; +break; +case ORIENT_TRANSPOSED: +vertex_order[0] = 0; +vertex_order[1] = 3; +vertex_order[2] = 2; +vertex_order[3] = 1; +break; +case ORIENT_HFLIPPED: +vertex_order[0] = 3; +vertex_order[1] = 2; +vertex_order[2] = 1; +vertex_order[3] = 0; +break; +case ORIENT_VFLIPPED: +vertex_order[0] = 1; +vertex_order[1] = 0; +vertex_order[2] = 3; +vertex_order[3] = 2; +break; +case ORIENT_ANTI_TRANSPOSED: /* transpose + vflip */ +vertex_order[0] = 1; +vertex_order[1] = 2; +vertex_order[2] = 3; +vertex_order[3] = 0; +break; + default: +vertex_order[0] = 0; +vertex_order[1] = 1; +vertex_order[2] = 2; +vertex_order[3] = 3; +break; +} +} + static void Direct3DSetupVertices(CUSTOMVERTEX *vertices, const RECT src_full, const RECT src_crop, const RECT dst, - int alpha) + int alpha, + video_orientation_t orientation) { const float src_full_width = src_full.right - src_full.left; const float src_full_height = src_full.bottom - src_full.top; -vertices[0].x = dst.left; -vertices[0].y = dst.top; + +/* Vertices of the dst rectangle in the unrotated (clockwise) order. */ +const int vertices_coords[4][2] = { +{ dst.left, dst.top}, +{ dst.right, dst.top}, +{ dst.right, dst.bottom }, +{ dst.left, dst.bottom }, +}; + +/* Compute index remapping necessary to implement the rotation. */ +int vertex_order[4]; +orientationVertexOrder(orientation, vertex_order); + +for (int i = 0; i < 4; ++i) { +vertices[i].x = vertices_coords[vertex_order[i]][0]; +vertices[i].y = vertices_coords[vertex_order[i]][1]; +} + vertices[0].tu = src_crop.left / src_full_width; vertices[0].tv = src_crop.top / src_full_height; -vertices[1].x = dst.right; -vertices[1].y = dst.top; vertices[1].tu = src_crop.right / src_full_width; vertices[1].tv = src_crop.top / src_full_height; -vertices[2].x = dst.right; -vertices[2].y = dst.bottom; vertices[2].tu = src_crop.right / src_full_width; vertices[2].tv = src_crop.bottom / src_full_height; -vertices[3].x = dst.left; -vertices[3].y = dst.bottom; vertices[3].tu = src_crop.left / src_full_width; vertices[3].tv = src_crop.bottom / src_full_height; @@ -1393,7 +1474,7 @@ static int Direct3DImportPicture(vout_display_t *vd, Direct3DSetupVertices(region->vertex, vd->sys->rect_src,
[vlc-commits] opengl: use buffer objects instead of host memory with glVertexAttribPointer.
vlc | branch: master | Felix Abecassis | Fri Mar 28 15:07:13 2014 +0100| [bbbc51c713432b25b0ffdfa943b8441aa7d4f96e] | committer: Felix Abecassis opengl: use buffer objects instead of host memory with glVertexAttribPointer. Previously, glVertexAttribPointer was called in function DrawWithShaders using an host array (textureCoord) allocated on the stack inside a loop. This caused stack buffer overflow afterwards. See http://www.opengl.org/wiki/Synchronization#Asynchronous_action Array definition could have been hoisted out of the loop but using buffer objects is a better solution since it is now the only option with recent OpenGL versions. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bbbc51c713432b25b0ffdfa943b8441aa7d4f96e --- modules/video_output/opengl.c | 40 ++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 512429e..a5abdc3 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -62,6 +62,10 @@ # define PFNGLUSEPROGRAMPROC typeof(glUseProgram)* # define PFNGLDELETEPROGRAMPROCtypeof(glDeleteProgram)* # define PFNGLATTACHSHADERPROC typeof(glAttachShader)* +# define PFNGLGENBUFFERSPROC typeof(glGenBuffers)* +# define PFNGLBINDBUFFERPROC typeof(glBindBuffer)* +# define PFNGLBUFFERDATAPROC typeof(glBufferData)* +# define PFNGLDELETEBUFFERSPROCtypeof(glDeleteBuffers)* #if defined(__APPLE__) && USE_OPENGL_ES # import #endif @@ -140,6 +144,9 @@ struct vout_display_opengl_t { intlocal_count; GLfloatlocal_value[16]; +GLuint vertex_buffer_object; +GLuint texture_buffer_object[PICTURE_PLANE_MAX]; + /* Shader variables commands*/ #ifdef SUPPORTS_SHADERS PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation; @@ -170,6 +177,11 @@ struct vout_display_opengl_t { PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog; PFNGLGETSHADERIVPROC GetShaderiv; PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog; + +PFNGLGENBUFFERSPROCGenBuffers; +PFNGLBINDBUFFERPROCBindBuffer; +PFNGLBUFFERDATAPROCBufferData; +PFNGLDELETEBUFFERSPROC DeleteBuffers; #endif #if defined(_WIN32) @@ -444,6 +456,12 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, vgl->LinkProgram = glLinkProgram; vgl->UseProgram= glUseProgram; vgl->DeleteProgram = glDeleteProgram; + +vgl->GenBuffers= glGenBuffers; +vgl->BindBuffer= glBindBuffer; +vgl->BufferData= glBufferData; +vgl->DeleteBuffers = glDeleteBuffers; + supports_shaders = true; #elif defined(SUPPORTS_SHADERS) vgl->CreateShader = (PFNGLCREATESHADERPROC)vlc_gl_GetProcAddress(vgl->gl, "glCreateShader"); @@ -472,6 +490,11 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, vgl->UseProgram= (PFNGLUSEPROGRAMPROC)vlc_gl_GetProcAddress(vgl->gl, "glUseProgram"); vgl->DeleteProgram = (PFNGLDELETEPROGRAMPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteProgram"); +vgl->GenBuffers= (PFNGLGENBUFFERSPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenBuffers"); +vgl->BindBuffer= (PFNGLBINDBUFFERPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindBuffer"); +vgl->BufferData= (PFNGLBUFFERDATAPROC)vlc_gl_GetProcAddress(vgl->gl, "glBufferData"); +vgl->DeleteBuffers = (PFNGLDELETEBUFFERSPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteBuffers"); + if (!vgl->CreateShader || !vgl->ShaderSource || !vgl->CreateProgram) supports_shaders = false; #endif @@ -657,6 +680,11 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); +#ifdef SUPPORTS_SHADERS +vgl->GenBuffers(1, &vgl->vertex_buffer_object); +vgl->GenBuffers(vgl->chroma->plane_count, vgl->texture_buffer_object); +#endif + vlc_gl_Unlock(vgl->gl); /* */ @@ -696,6 +724,8 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl) for (int i = 0; i < 3; i++) vgl->DeleteShader(vgl->shader[i]); } +vgl->DeleteBuffers(1, &vgl->vertex_buffer_object); +vgl->DeleteBuffers(vgl->chroma->plane_count, vgl->texture_buffer_object); #endif free(vgl->texture_temp_buf); @@ -1113,15 +1143,21 @@ static void DrawWithShaders(vout_display_opengl_t *vgl, glClientActiveTexture(GL_TEXTURE0+j); glBindTexture(vgl->tex_target, vgl->texture[0][j]); +vgl->BindBuffer(GL_ARRAY_BUFFER, vgl->texture_buffer_object[j]); +vgl->BufferData(GL_ARRAY_BUFFER, sizeof(textureCoord), tex
[vlc-commits] mediacodec: use a circular buffer of timestamps as a workaround for DTS only samples
vlc | branch: master | Felix Abecassis | Wed Mar 12 23:29:22 2014 +0100| [5e4e1fa495ed991022914f0f460f50f84d6dafa0] | committer: Felix Abecassis mediacodec: use a circular buffer of timestamps as a workaround for DTS only samples > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e4e1fa495ed991022914f0f460f50f84d6dafa0 --- modules/codec/omxil/android_mediacodec.c | 97 +- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index d9c47b5..951d879 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -54,6 +54,80 @@ extern void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, i extern void jni_EventHardwareAccelerationError(); extern bool jni_IsVideoPlayerActivityCreated(); +/* Implementation of a circular buffer of timestamps with overwriting + * of older values. MediaCodec has only one type of timestamp, if a + * block has no PTS, we send the DTS instead. Some hardware decoders + * cannot cope with this situation and output the frames in the wrong + * order. As a workaround in this case, we use a FIFO of timestamps in + * order to remember which input packets had no PTS. Since an + * hardware decoder can silently drop frames, this might cause a + * growing desynchronization with the actual timestamp. Thus the + * circular buffer has a limited size and will overwrite older values. + */ +typedef struct +{ +uint32_t begin; +uint32_t size; +uint32_t capacity; +int64_t *buffer; +} timestamp_fifo_t; + +static timestamp_fifo_t *timestamp_FifoNew(uint32_t capacity) +{ +timestamp_fifo_t *fifo = calloc(1, sizeof(*fifo)); +if (!fifo) +return NULL; +fifo->buffer = malloc(capacity * sizeof(*fifo->buffer)); +if (!fifo->buffer) { +free(fifo); +return NULL; +} +fifo->capacity = capacity; +return fifo; +} + +static void timestamp_FifoRelease(timestamp_fifo_t *fifo) +{ +free(fifo->buffer); +free(fifo); +} + +static bool timestamp_FifoIsEmpty(timestamp_fifo_t *fifo) +{ +return fifo->size == 0; +} + +static bool timestamp_FifoIsFull(timestamp_fifo_t *fifo) +{ +return fifo->size == fifo->capacity; +} + +static void timestamp_FifoEmpty(timestamp_fifo_t *fifo) +{ +fifo->size = 0; +} + +static void timestamp_FifoPut(timestamp_fifo_t *fifo, int64_t ts) +{ +uint32_t end = (fifo->begin + fifo->size) % fifo->capacity; +fifo->buffer[end] = ts; +if (!timestamp_FifoIsFull(fifo)) +fifo->size += 1; +else +fifo->begin = (fifo->begin + 1) % fifo->capacity; +} + +static int64_t timestamp_FifoGet(timestamp_fifo_t *fifo) +{ +if (timestamp_FifoIsEmpty(fifo)) +return VLC_TS_INVALID; + +int64_t result = fifo->buffer[fifo->begin]; +fifo->begin = (fifo->begin + 1) % fifo->capacity; +fifo->size -= 1; +return result; +} + struct decoder_sys_t { jclass media_codec_list_class, media_codec_class, media_format_class; @@ -92,6 +166,8 @@ struct decoder_sys_t bool direct_rendering; int i_output_buffers; /**< number of MediaCodec output buffers */ picture_t** inflight_picture; /**< stores the inflight picture for each output buffer or NULL */ + +timestamp_fifo_t *timestamp_fifo; }; enum Types @@ -451,6 +527,12 @@ static int OpenDecoder(vlc_object_t *p_this) (*env)->DeleteLocalRef(env, format); (*myVm)->DetachCurrentThread(myVm); + +const int timestamp_fifo_size = 32; +p_sys->timestamp_fifo = timestamp_FifoNew(timestamp_fifo_size); +if (!p_sys->timestamp_fifo) +goto error; + return VLC_SUCCESS; error: @@ -490,6 +572,8 @@ static void CloseDecoder(vlc_object_t *p_this) free(p_sys->name); ArchitectureSpecificCopyHooksDestroy(p_sys->pixel_format, &p_sys->architecture_specific_data); free(p_sys->inflight_picture); +if (p_sys->timestamp_fifo) +timestamp_FifoRelease(p_sys->timestamp_fifo); free(p_sys); } @@ -591,7 +675,16 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t // TODO: Use crop_top/crop_left as well? Or is that already taken into account? // On OMX_TI_COLOR_FormatYUV420PackedSemiPlanar the offset already incldues // the cropping, so the top/left cropping params should just be ignored. -p_pic->date = (*env)->GetLongField(env, p_sys->buffer_info, p_sys->pts_field); + +/* If the oldest input block had no PTS, the timestamp + * of the frame returned by MediaCodec might be wrong + * so we overwrite it with the corresponding dts. */ +int64_t forced_ts = timestam
[vlc-commits] mediacodec: cosmetics
vlc | branch: master | Felix Abecassis | Thu Mar 13 18:59:03 2014 +0100| [26bcd87ed99e1ca90bfffd30f0428327bee36b29] | committer: Felix Abecassis mediacodec: cosmetics > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=26bcd87ed99e1ca90bfffd30f0428327bee36b29 --- modules/codec/omxil/android_mediacodec.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 166d180..d9c47b5 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -244,7 +244,6 @@ static int OpenDecoder(vlc_object_t *p_this) p_dec->pf_decode_video = DecodeVideo; - p_dec->fmt_out.i_cat = p_dec->fmt_in.i_cat; p_dec->fmt_out.video = p_dec->fmt_in.video; p_dec->fmt_out.audio = p_dec->fmt_in.audio; @@ -508,8 +507,7 @@ static void DisplayBuffer(picture_sys_t* p_picsys, bool b_render) vlc_mutex_lock(get_android_opaque_mutex()); /* Picture might have been invalidated while waiting on the mutex. */ -if (!p_picsys->b_valid) -{ +if (!p_picsys->b_valid) { vlc_mutex_unlock(get_android_opaque_mutex()); return; } @@ -547,8 +545,7 @@ static void InvalidateAllPictures(decoder_t *p_dec) decoder_sys_t *p_sys = p_dec->p_sys; vlc_mutex_lock(get_android_opaque_mutex()); -for (int i = 0; i < p_sys->i_output_buffers; ++i) -{ +for (int i = 0; i < p_sys->i_output_buffers; ++i) { picture_t *p_pic = p_sys->inflight_picture[i]; if (p_pic) { p_pic->p_sys->b_valid = false; @@ -621,7 +618,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t (*env)->CallVoidMethod(env, p_sys->codec, p_sys->release_output_buffer, index, false); jthrowable exception = (*env)->ExceptionOccurred(env); -if(exception != NULL) { +if (exception != NULL) { jclass illegalStateException = (*env)->FindClass(env, "java/lang/IllegalStateException"); if((*env)->IsInstanceOf(env, exception, illegalStateException)) { msg_Err(p_dec, "Codec error (IllegalStateException) in MediaCodec.releaseOutputBuffer"); @@ -636,8 +633,8 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t msg_Warn(p_dec, "NewPicture failed"); (*env)->CallVoidMethod(env, p_sys->codec, p_sys->release_output_buffer, index, false); } - return; + } else if (index == INFO_OUTPUT_BUFFERS_CHANGED) { msg_Dbg(p_dec, "output buffers changed"); (*env)->DeleteGlobalRef(env, p_sys->output_buffers); @@ -653,7 +650,6 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t vlc_mutex_unlock(get_android_opaque_mutex()); } else if (index == INFO_OUTPUT_FORMAT_CHANGED) { - jobject format = (*env)->CallObjectMethod(env, p_sys->codec, p_sys->get_output_format); jobject format_string = (*env)->CallObjectMethod(env, format, p_sys->tostring); @@ -782,6 +778,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) p_sys->error_state = true; break; } + if (index < 0) { GetOutput(p_dec, env, &p_pic, timeout); if (p_pic) { @@ -793,7 +790,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) (*myVm)->DetachCurrentThread(myVm); return p_pic; } -timeout = 30*1000; +timeout = 30 * 1000; ++attempts; /* With opaque DR the output buffers are released by the vout therefore we implement a timeout for polling in @@ -821,6 +818,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) } continue; } + jobject buf = (*env)->GetObjectArrayElement(env, p_sys->input_buffers, index); jsize size = (*env)->GetDirectBufferCapacity(env, buf); uint8_t *bufptr = (*env)->GetDirectBufferAddress(env, buf); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Win32: the dimensions of the unclipped source rectangle should be the original format of the video
vlc | branch: master | Felix Abecassis | Wed Mar 12 16:48:17 2014 +0100| [6cddc0388fec4ff572f33fcabfe9a5fa87c2b1b1] | committer: Felix Abecassis Win32: the dimensions of the unclipped source rectangle should be the original format of the video Fix #10886 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6cddc0388fec4ff572f33fcabfe9a5fa87c2b1b1 --- modules/video_output/msw/common.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index 529db39..fbf790c 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -403,8 +403,8 @@ void UpdateRects(vout_display_t *vd, /* src image dimensions */ rect_src.left = 0; rect_src.top= 0; -rect_src.right = source->i_visible_width; -rect_src.bottom = source->i_visible_height; +rect_src.right = vd->fmt.i_visible_width; +rect_src.bottom = vd->fmt.i_visible_height; /* Clip the source image */ rect_src_clipped.left = source->i_x_offset + ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: fix typo
vlc | branch: master | Felix Abecassis | Fri Mar 7 13:23:25 2014 +0100| [e737cf0b009548bdb00908a184dc75255feb1170] | committer: Felix Abecassis dxva2: fix typo > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e737cf0b009548bdb00908a184dc75255feb1170 --- modules/codec/avcodec/dxva2.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 85d6f4a..960ee74 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -791,11 +791,11 @@ static int DxFindVideoServiceConversion(vlc_va_dxva2_t *va, GUID *input, D3DFORM continue; /* */ -bool is_suported = false; -for (const GUID *g = &input_list[0]; !is_suported && g < &input_list[input_count]; g++) { -is_suported = IsEqualGUID(mode->guid, g); +bool is_supported = false; +for (const GUID *g = &input_list[0]; !is_supported && g < &input_list[input_count]; g++) { +is_supported = IsEqualGUID(mode->guid, g); } -if (!is_suported) +if (!is_supported) continue; /* */ @@ -823,11 +823,11 @@ static int DxFindVideoServiceConversion(vlc_va_dxva2_t *va, GUID *input, D3DFORM const d3d_format_t *format = &d3d_formats[j]; /* */ -bool is_suported = false; -for (unsigned k = 0; !is_suported && k < output_count; k++) { -is_suported = format->format == output_list[k]; +bool is_supported = false; +for (unsigned k = 0; !is_supported && k < output_count; k++) { +is_supported = format->format == output_list[k]; } -if (!is_suported) +if (!is_supported) continue; /* We have our solution */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] avcodec: allocate more hardware surfaces for H.264 decoding
vlc/vlc-2.1 | branch: master | Felix Abecassis | Thu Mar 6 12:50:19 2014 +0100| [ae9e0fd29b3a74f066c33e4877ae43bfdeb219f5] | committer: Felix Abecassis avcodec: allocate more hardware surfaces for H.264 decoding Adapted from 47a9e86e839b455ba256ee89c141298c754d5524 to avoid ABI break. > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=ae9e0fd29b3a74f066c33e4877ae43bfdeb219f5 --- modules/codec/avcodec/dxva2.c |2 +- modules/codec/avcodec/vaapi.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index a589696..80643eb 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -865,7 +865,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, int surface_count; switch (codec_id) { case AV_CODEC_ID_H264: -surface_count = 16 + 1; +surface_count = 16 + 1 + 2; break; default: surface_count = 2 + 1; diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c index d8703a0..9914bbd 100644 --- a/modules/codec/avcodec/vaapi.c +++ b/modules/codec/avcodec/vaapi.c @@ -128,7 +128,7 @@ static int Open( vlc_va_t *p_external, int i_codec_id ) break; case AV_CODEC_ID_H264: i_profile = VAProfileH264High; -i_surface_count = 16+1; +i_surface_count = 16 + 1 + 2; break; default: return VLC_EGENERIC; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] avcodec: allocate one additional hardware surface for MPEG-2
vlc | branch: master | Felix Abecassis | Wed Mar 5 16:48:46 2014 +0100| [4d2b1bd21d9626b19c697c75fb67b14dd88c9367] | committer: Felix Abecassis avcodec: allocate one additional hardware surface for MPEG-2 Required to avoid visual glitches when running out of free surfaces with avcodec and vaapi/dxva2 backends. Fix #10868 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4d2b1bd21d9626b19c697c75fb67b14dd88c9367 --- modules/codec/avcodec/dxva2.c |4 modules/codec/avcodec/vaapi.c |2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index f3a1524..85d6f4a 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -865,6 +865,10 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, case AV_CODEC_ID_H264: surface_count = 16 + va->thread_count + 2; break; +case AV_CODEC_ID_MPEG1VIDEO: +case AV_CODEC_ID_MPEG2VIDEO: +surface_count = 2 + 2; +break; default: surface_count = 2 + 1; break; diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c index 14fc83d..88023f3 100644 --- a/modules/codec/avcodec/vaapi.c +++ b/modules/codec/avcodec/vaapi.c @@ -113,7 +113,7 @@ static int Open( vlc_va_t *va, int i_codec_id, int i_thread_count ) case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: i_profile = VAProfileMPEG2Main; -i_surface_count = 2+1; +i_surface_count = 2 + 2; break; case AV_CODEC_ID_MPEG4: i_profile = VAProfileMPEG4AdvancedSimple; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] magnify: correctly set i_visible_width/ i_visible_height after dimension scaling
vlc | branch: master | Felix Abecassis | Tue Mar 4 16:44:25 2014 +0100| [a4d43caa434a9834ae6c29d3925a2c5fe4520a50] | committer: Felix Abecassis magnify: correctly set i_visible_width/i_visible_height after dimension scaling Fix #10744 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a4d43caa434a9834ae6c29d3925a2c5fe4520a50 --- modules/video_filter/magnify.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c index 2a33206..9df90a9 100644 --- a/modules/video_filter/magnify.c +++ b/modules/video_filter/magnify.c @@ -190,8 +190,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) /* */ fmt_in = p_filter->fmt_in.video; -fmt_in.i_width = (fmt_in.i_width * ZOOM_FACTOR / o_zoom) & ~1; -fmt_in.i_height = (fmt_in.i_height * ZOOM_FACTOR / o_zoom) & ~1; +fmt_in.i_width = fmt_in.i_visible_width = (fmt_in.i_width * ZOOM_FACTOR / o_zoom) & ~1; +fmt_in.i_height = fmt_in.i_visible_height = (fmt_in.i_height * ZOOM_FACTOR / o_zoom) & ~1; /* */ fmt_out = p_filter->fmt_out.video; @@ -215,8 +215,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) /* image visualization */ fmt_out = p_filter->fmt_out.video; -fmt_out.i_width = (fmt_out.i_width /VIS_ZOOM) & ~1; -fmt_out.i_height = (fmt_out.i_height/VIS_ZOOM) & ~1; +fmt_out.i_width = fmt_out.i_visible_width = (fmt_out.i_width /VIS_ZOOM) & ~1; +fmt_out.i_height = fmt_out.i_visible_height = (fmt_out.i_height/VIS_ZOOM) & ~1; p_converted = image_Convert( p_sys->p_image, p_pic, &p_pic->format, &fmt_out ); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] avcodec: allocate more hardware surfaces for threaded decoding
vlc | branch: master | Felix Abecassis | Tue Mar 4 22:43:49 2014 +0200| [47a9e86e839b455ba256ee89c141298c754d5524] | committer: Felix Abecassis avcodec: allocate more hardware surfaces for threaded decoding The number of threads impacts the number of surfaces that should be allocated by the HW acceleration backend. If not enough surfaces are allocated, the VAAPI and DXVA modules returned the oldest surface currently in used. This technique can cause many visual glitches with some samples. The number of allocated surfaces now scales with the number of threads used by avcodec. Fix #9887 Signed-off-by: Rémi Denis-Courmont > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47a9e86e839b455ba256ee89c141298c754d5524 --- modules/codec/avcodec/dxva2.c |6 +- modules/codec/avcodec/vaapi.c |8 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 1298a5f..f3a1524 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -283,6 +283,8 @@ struct vlc_va_sys_t int surface_height; vlc_fourcc_t surface_chroma; +int thread_count; + vlc_va_surface_t surface[VA_DXVA2_MAX_SURFACE_COUNT]; LPDIRECT3DSURFACE9 hw_surface[VA_DXVA2_MAX_SURFACE_COUNT]; }; @@ -541,6 +543,8 @@ static int Open(vlc_va_t *external, AVCodecContext *ctx, goto error; } +va->thread_count = ctx->thread_count; + /* TODO print the hardware name/vendor for debugging purposes */ external->description = DxDescribe(va); external->pix_fmt = PIX_FMT_DXVA2_VLD; @@ -859,7 +863,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, int surface_count; switch (codec_id) { case AV_CODEC_ID_H264: -surface_count = 16 + 1; +surface_count = 16 + va->thread_count + 2; break; default: surface_count = 2 + 1; diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c index 139d781..14fc83d 100644 --- a/modules/codec/avcodec/vaapi.c +++ b/modules/codec/avcodec/vaapi.c @@ -96,7 +96,7 @@ struct vlc_va_sys_t }; /* */ -static int Open( vlc_va_t *va, int i_codec_id ) +static int Open( vlc_va_t *va, int i_codec_id, int i_thread_count ) { vlc_va_sys_t *sys = calloc( 1, sizeof(*sys) ); if ( unlikely(sys == NULL) ) @@ -129,8 +129,8 @@ static int Open( vlc_va_t *va, int i_codec_id ) break; case AV_CODEC_ID_H264: i_profile = VAProfileH264High; -i_surface_count = 16+1; -break; +i_surface_count = 16 + i_thread_count + 2; +break;; default: return VLC_EGENERIC; } @@ -552,7 +552,7 @@ static int Create( vlc_va_t *p_va, AVCodecContext *ctx, (void) fmt; -int err = Open( p_va, ctx->codec_id ); +int err = Open( p_va, ctx->codec_id, ctx->thread_count ); if( err ) return err; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: remove useless variable
vlc/vlc-2.1 | branch: master | Felix Abecassis | Tue Mar 4 15:22:00 2014 +0100| [0ef95852fbddc290c5181fdff3a45534845ecf29] | committer: Jean-Baptiste Kempf dxva2: remove useless variable Signed-off-by: Rémi Denis-Courmont (cherry picked from commit 40420d96a642e2721d24ea5129aa6fe71cb3220a) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=0ef95852fbddc290c5181fdff3a45534845ecf29 --- modules/codec/avcodec/dxva2.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index a7561ae..bde6e4c 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -347,8 +347,6 @@ static int Setup(vlc_va_t *external, void **hw, vlc_fourcc_t *chroma, va->hw.cfg = &va->cfg; va->hw.surface_count = va->surface_count; va->hw.surface = va->hw_surface; -for (unsigned i = 0; i < va->surface_count; i++) -va->hw.surface[i] = va->surface[i].d3d; /* */ DxCreateVideoConversion(va); @@ -872,7 +870,6 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, va->surface_count = 2 + 1; break; } -LPDIRECT3DSURFACE9 surface_list[VA_DXVA2_MAX_SURFACE_COUNT]; if (FAILED(IDirectXVideoDecoderService_CreateSurface(va->vs, va->surface_width, va->surface_height, @@ -881,7 +878,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, D3DPOOL_DEFAULT, 0, DXVA2_VideoDecoderRenderTarget, - surface_list, + va->hw_surface, NULL))) { msg_Err(va->log, "IDirectXVideoAccelerationService_CreateSurface failed"); va->surface_count = 0; @@ -889,7 +886,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, } for (unsigned i = 0; i < va->surface_count; i++) { vlc_va_surface_t *surface = &va->surface[i]; -surface->d3d = surface_list[i]; +surface->d3d = va->hw_surface[i]; surface->refcount = 0; surface->order = 0; } @@ -974,7 +971,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, &va->input, &dsc, &va->cfg, - surface_list, + va->hw_surface, va->surface_count, &decoder))) { msg_Err(va->log, "IDirectXVideoDecoderService_CreateVideoDecoder failed"); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: fix incorrect return value
vlc/vlc-2.1 | branch: master | Felix Abecassis | Tue Mar 4 15:21:59 2014 +0100| [4272f86dfa598e7f3323eac66b6fdedfb0112f36] | committer: Jean-Baptiste Kempf dxva2: fix incorrect return value Signed-off-by: Rémi Denis-Courmont (cherry picked from commit e3dfdba27fbba5f83bb8101e040b36e2480b03cf) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=4272f86dfa598e7f3323eac66b6fdedfb0112f36 --- modules/codec/avcodec/dxva2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 1e2f0b7..a7561ae 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -505,7 +505,7 @@ static int Open(vlc_va_t *external, int codec_id, const es_format_t *fmt) { vlc_va_dxva2_t *va = calloc(1, sizeof(*va)); if (!va) -return NULL; +return VLC_EGENERIC; external->sys = va; /* */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: check number of surfaces to allocate is not larger than the upper bound
vlc/vlc-2.1 | branch: master | Felix Abecassis | Tue Mar 4 15:22:01 2014 +0100| [a8d60e4cb34d421d84c73512ec2531d5f8b8b825] | committer: Jean-Baptiste Kempf dxva2: check number of surfaces to allocate is not larger than the upper bound Signed-off-by: Rémi Denis-Courmont (cherry picked from commit fe573d25f0c5c640e822671e561013ae8f3a069e) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=a8d60e4cb34d421d84c73512ec2531d5f8b8b825 --- modules/codec/avcodec/dxva2.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index bde6e4c..a589696 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -862,14 +862,18 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, /* Allocates all surfaces needed for the decoder */ va->surface_width = (fmt->i_width + 15) & ~15; va->surface_height = (fmt->i_height + 15) & ~15; +int surface_count; switch (codec_id) { case AV_CODEC_ID_H264: -va->surface_count = 16 + 1; +surface_count = 16 + 1; break; default: -va->surface_count = 2 + 1; +surface_count = 2 + 1; break; } +if (surface_count > VA_DXVA2_MAX_SURFACE_COUNT) +return VLC_EGENERIC; +va->surface_count = surface_count; if (FAILED(IDirectXVideoDecoderService_CreateSurface(va->vs, va->surface_width, va->surface_height, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: check number of surfaces to allocate is not larger than the upper bound
vlc | branch: master | Felix Abecassis | Tue Mar 4 15:22:01 2014 +0100| [fe573d25f0c5c640e822671e561013ae8f3a069e] | committer: Rémi Denis-Courmont dxva2: check number of surfaces to allocate is not larger than the upper bound Signed-off-by: Rémi Denis-Courmont > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe573d25f0c5c640e822671e561013ae8f3a069e --- modules/codec/avcodec/dxva2.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index a7c9ce2..c1d1a4a 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -855,14 +855,18 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, /* Allocates all surfaces needed for the decoder */ va->surface_width = (fmt->i_width + 15) & ~15; va->surface_height = (fmt->i_height + 15) & ~15; +int surface_count; switch (codec_id) { case AV_CODEC_ID_H264: -va->surface_count = 16 + 1; +surface_count = 16 + 1; break; default: -va->surface_count = 2 + 1; +surface_count = 2 + 1; break; } +if (surface_count > VA_DXVA2_MAX_SURFACE_COUNT) +return VLC_EGENERIC; +va->surface_count = surface_count; if (FAILED(IDirectXVideoDecoderService_CreateSurface(va->vs, va->surface_width, va->surface_height, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: remove useless variable
vlc | branch: master | Felix Abecassis | Tue Mar 4 15:22:00 2014 +0100| [40420d96a642e2721d24ea5129aa6fe71cb3220a] | committer: Rémi Denis-Courmont dxva2: remove useless variable Signed-off-by: Rémi Denis-Courmont > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40420d96a642e2721d24ea5129aa6fe71cb3220a --- modules/codec/avcodec/dxva2.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 824eaee..a7c9ce2 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -347,8 +347,6 @@ static int Setup(vlc_va_t *external, void **hw, vlc_fourcc_t *chroma, va->hw.cfg = &va->cfg; va->hw.surface_count = va->surface_count; va->hw.surface = va->hw_surface; -for (unsigned i = 0; i < va->surface_count; i++) -va->hw.surface[i] = va->surface[i].d3d; /* */ DxCreateVideoConversion(va); @@ -865,7 +863,6 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, va->surface_count = 2 + 1; break; } -LPDIRECT3DSURFACE9 surface_list[VA_DXVA2_MAX_SURFACE_COUNT]; if (FAILED(IDirectXVideoDecoderService_CreateSurface(va->vs, va->surface_width, va->surface_height, @@ -874,7 +871,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, D3DPOOL_DEFAULT, 0, DXVA2_VideoDecoderRenderTarget, - surface_list, + va->hw_surface, NULL))) { msg_Err(va->log, "IDirectXVideoAccelerationService_CreateSurface failed"); va->surface_count = 0; @@ -882,7 +879,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, } for (unsigned i = 0; i < va->surface_count; i++) { vlc_va_surface_t *surface = &va->surface[i]; -surface->d3d = surface_list[i]; +surface->d3d = va->hw_surface[i]; surface->refcount = 0; surface->order = 0; } @@ -967,7 +964,7 @@ static int DxCreateVideoDecoder(vlc_va_dxva2_t *va, &va->input, &dsc, &va->cfg, - surface_list, + va->hw_surface, va->surface_count, &decoder))) { msg_Err(va->log, "IDirectXVideoDecoderService_CreateVideoDecoder failed"); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] dxva2: fix incorrect return value
vlc | branch: master | Felix Abecassis | Tue Mar 4 15:21:59 2014 +0100| [e3dfdba27fbba5f83bb8101e040b36e2480b03cf] | committer: Rémi Denis-Courmont dxva2: fix incorrect return value Signed-off-by: Rémi Denis-Courmont > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3dfdba27fbba5f83bb8101e040b36e2480b03cf --- modules/codec/avcodec/dxva2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 330daf0..824eaee 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -498,7 +498,7 @@ static int Open(vlc_va_t *external, int codec_id, const es_format_t *fmt) { vlc_va_dxva2_t *va = calloc(1, sizeof(*va)); if (!va) -return NULL; +return VLC_EGENERIC; external->sys = va; /* */ ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: move timeout from dequeueInputBuffer to dequeueOutputBuffer
vlc | branch: master | Felix Abecassis | Tue Mar 4 19:11:44 2014 +0100| [8ab8c750cec943ea3da617dc19574429f2a03b2a] | committer: Felix Abecassis mediacodec: move timeout from dequeueInputBuffer to dequeueOutputBuffer dequeueOutputBuffer should have an higher priority since releasing an output buffer often allows MediaCodec to make progress > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8ab8c750cec943ea3da617dc19574429f2a03b2a --- modules/codec/omxil/android_mediacodec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 394abcd..166d180 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -558,12 +558,12 @@ static void InvalidateAllPictures(decoder_t *p_dec) vlc_mutex_unlock(get_android_opaque_mutex()); } -static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic) +static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong timeout) { decoder_sys_t *p_sys = p_dec->p_sys; while (1) { int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_output_buffer, - p_sys->buffer_info, (jlong) 0); + p_sys->buffer_info, timeout); if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); p_sys->error_state = true; @@ -776,14 +776,14 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) const int max_polling_attempts = 50; int attempts = 0; while (true) { -int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout); +int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, (jlong) 0); if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); p_sys->error_state = true; break; } if (index < 0) { -GetOutput(p_dec, env, &p_pic); +GetOutput(p_dec, env, &p_pic, timeout); if (p_pic) { /* If we couldn't get an available input buffer but a * decoded frame is available, we return the frame @@ -839,7 +839,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) break; } if (!p_pic) -GetOutput(p_dec, env, &p_pic); +GetOutput(p_dec, env, &p_pic, 0); (*myVm)->DetachCurrentThread(myVm); block_Release(p_block); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: disable direct rendering if VideoPlayerActivity was not started
vlc | branch: master | Felix Abecassis | Mon Feb 24 19:11:29 2014 +0100| [4ec53cf794d324dc58f7be9a71ff6c77c231eb4d] | committer: Adrien Maglo mediacodec: disable direct rendering if VideoPlayerActivity was not started Signed-off-by: Adrien Maglo > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4ec53cf794d324dc58f7be9a71ff6c77c231eb4d --- modules/codec/omxil/android_mediacodec.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 8fa68fa..394abcd 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -52,6 +52,7 @@ extern jobject jni_LockAndGetAndroidJavaSurface(); extern void jni_UnlockAndroidSurface(); extern void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den); extern void jni_EventHardwareAccelerationError(); +extern bool jni_IsVideoPlayerActivityCreated(); struct decoder_sys_t { @@ -399,7 +400,10 @@ static int OpenDecoder(vlc_object_t *p_this) (*env)->DeleteLocalRef(env, bytebuf); } -p_sys->direct_rendering = var_InheritBool(p_dec, CFG_PREFIX "dr"); +/* If the VideoPlayerActivity is not started, MediaCodec opaque + direct rendering should be disabled since no surface will be + attached to the JNI. */ +p_sys->direct_rendering = jni_IsVideoPlayerActivityCreated() && var_InheritBool(p_dec, CFG_PREFIX "dr"); if (p_sys->direct_rendering) { jobject surf = jni_LockAndGetAndroidJavaSurface(); if (surf) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] DirectSound: use calloc for aout_stream_sys_t
vlc | branch: master | Felix Abecassis | Fri Feb 28 15:54:54 2014 +0100| [5ef694fb37e95c5b75107585486e50fb1397adcf] | committer: Rémi Denis-Courmont DirectSound: use calloc for aout_stream_sys_t Fix a crash occurring when CreateDSBufferPCM() fails in Start() and afterwards Stop() uses uninitialized pointer values when releasing objects. Signed-off-by: Rémi Denis-Courmont > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ef694fb37e95c5b75107585486e50fb1397adcf --- modules/audio_output/directsound.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c index c7ab2e3..b2a9ca6 100644 --- a/modules/audio_output/directsound.c +++ b/modules/audio_output/directsound.c @@ -747,7 +747,7 @@ static HRESULT StreamStart( aout_stream_t *s, audio_sample_format_t *restrict fmt, const GUID *sid ) { -aout_stream_sys_t *sys = malloc( sizeof( *sys ) ); +aout_stream_sys_t *sys = calloc( 1, sizeof( *sys ) ); if( unlikely(sys == NULL) ) return E_OUTOFMEMORY; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] DirectSound: avoid double call to release function
vlc | branch: master | Felix Abecassis | Fri Feb 28 15:55:29 2014 +0100| [9b72dc3fa6776558d9fca0e506ec39b40ba39c7a] | committer: Rémi Denis-Courmont DirectSound: avoid double call to release function If Start() failed, IDirectSound_Release() was called twice. Signed-off-by: Rémi Denis-Courmont with changes > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b72dc3fa6776558d9fca0e506ec39b40ba39c7a --- modules/audio_output/directsound.c |3 --- 1 file changed, 3 deletions(-) diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c index b2a9ca6..cb986fe 100644 --- a/modules/audio_output/directsound.c +++ b/modules/audio_output/directsound.c @@ -772,10 +772,7 @@ static HRESULT StreamStart( aout_stream_t *s, hr = Start( VLC_OBJECT(s), sys, fmt ); if( FAILED(hr) ) -{ -IDirectSound_Release( sys->p_dsobject ); goto error; -} s->sys = sys; s->time_get = StreamTimeGet; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Win32: use visible dimensions for all vouts
vlc | branch: master | Felix Abecassis | Wed Feb 26 17:33:38 2014 +| [93ae604cedff323a5d6ed33548fd53a36b3ab9e6] | committer: Jean-Baptiste Kempf Win32: use visible dimensions for all vouts Close #9645 Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=93ae604cedff323a5d6ed33548fd53a36b3ab9e6 --- modules/video_output/msw/common.c |8 modules/video_output/msw/direct2d.c |4 ++-- modules/video_output/msw/direct3d.c | 10 +- modules/video_output/msw/directx.c |4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index f4954b1..529db39 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -213,7 +213,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback, /* fill in buffer info in first plane */ picture->p->p_pixels = data; picture->p->i_pitch = pitch; -picture->p->i_lines = picture->format.i_height; +picture->p->i_lines = picture->format.i_visible_height; /* Fill chroma planes for planar YUV */ if (picture->format.i_chroma == VLC_CODEC_I420 || @@ -226,7 +226,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback, p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch; p->i_pitch = pitch / 2; -p->i_lines = picture->format.i_height / 2; +p->i_lines = picture->format.i_visible_height / 2; } /* The dx/d3d buffer is always allocated as YV12 */ if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) { @@ -403,8 +403,8 @@ void UpdateRects(vout_display_t *vd, /* src image dimensions */ rect_src.left = 0; rect_src.top= 0; -rect_src.right = source->i_width; -rect_src.bottom = source->i_height; +rect_src.right = source->i_visible_width; +rect_src.bottom = source->i_visible_height; /* Clip the source image */ rect_src_clipped.left = source->i_x_offset + diff --git a/modules/video_output/msw/direct2d.c b/modules/video_output/msw/direct2d.c index 6f5b28a..6fad178 100644 --- a/modules/video_output/msw/direct2d.c +++ b/modules/video_output/msw/direct2d.c @@ -347,8 +347,8 @@ static int D2D_CreateRenderTarget(vout_display_t *vd) }; D2D1_SIZE_U bitmap_size = { -vd->fmt.i_width, -vd->fmt.i_height +vd->fmt.i_visible_width, +vd->fmt.i_visible_height }; hr = ID2D1HwndRenderTarget_CreateBitmap(sys->d2_render_target, diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index ff0f601..059c6d6 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -972,8 +972,8 @@ static int Direct3DCreatePool(vout_display_t *vd, video_format_t *fmt) /* Create a surface */ LPDIRECT3DSURFACE9 surface; HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(d3ddev, - fmt->i_width, - fmt->i_height, + fmt->i_visible_width, + fmt->i_visible_height, d3dfmt->format, D3DPOOL_DEFAULT, &surface, @@ -996,7 +996,7 @@ static int Direct3DCreatePool(vout_display_t *vd, video_format_t *fmt) picture_resource_t resource = { .p_sys = picsys }; for (int i = 0; i < PICTURE_PLANE_MAX; i++) -resource.p[i].i_lines = fmt->i_height / (i > 0 ? 2 : 1); +resource.p[i].i_lines = fmt->i_visible_height / (i > 0 ? 2 : 1); picture_t *picture = picture_NewFromResource(fmt, &resource); if (!picture) { @@ -1055,8 +1055,8 @@ static int Direct3DCreateScene(vout_display_t *vd, const video_format_t *fmt) */ LPDIRECT3DTEXTURE9 d3dtex; hr = IDirect3DDevice9_CreateTexture(d3ddev, -fmt->i_width, -fmt->i_height, +fmt->i_visible_width, +fmt->i_visible_height, 1, D3DUSAGE_RENDERTARGET, sys->d3dpp.BackBufferFormat, diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c index b65b145..4832fd0 100644 --- a/modules/video_output/msw/directx.c +++ b/modules/video_output/msw/directx.c
[vlc-commits] Subtitle: fix off-by-one error during allocation before call to sscanf
vlc | branch: master | Felix Abecassis | Wed Feb 26 18:36:13 2014 +0100| [d839410aadd7b407525293332733ab6aed6be9a4] | committer: Ilkka Ollakka Subtitle: fix off-by-one error during allocation before call to sscanf Fix a crash when parsing subtitles. From the man page of sscanf: "the next pointer must be a pointer to character array that is long enough to hold the input sequence and the terminating null byte" Signed-off-by: Ilkka Ollakka > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d839410aadd7b407525293332733ab6aed6be9a4 --- modules/demux/subtitle.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c index 2a7c191..29922cc 100644 --- a/modules/demux/subtitle.c +++ b/modules/demux/subtitle.c @@ -1012,8 +1012,8 @@ static int subtitle_ParseSubRipTiming( subtitle_t *p_subtitle, { int i_result = VLC_EGENERIC; char *psz_start, *psz_stop; -psz_start = malloc( strlen(s) ); -psz_stop = malloc( strlen(s) ); +psz_start = malloc( strlen(s) + 1 ); +psz_stop = malloc( strlen(s) + 1 ); if( sscanf( s, "%s --> %s", psz_start, psz_stop) == 2 && subtitle_ParseSubRipTimingValue( &p_subtitle->i_start, psz_start ) == VLC_SUCCESS && ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: remove flag is_sleeping from vout_control_t
vlc | branch: master | Felix Abecassis | Wed Feb 19 12:30:03 2014 +0100| [d72d22ae4d5a3115834bad8dae0a57b2e7904d94] | committer: Jean-Baptiste Kempf vout: remove flag is_sleeping from vout_control_t Previously, the is_sleeping flag was not set to true if a deadline was passed to vout_control_Pop. Consequently, the condition variable would not be signalled by function vout_control_Wake, called by vout_PutPicture to give a vout a picture to display. Thus, the vout would not wake up even when receiving several pictures, instead the vout waits until the end of the deadline. If the deadline was computed as the "refresh" deadline from ThreadDisplayPicture, the sleep time can be as high as 60-70 ms. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d72d22ae4d5a3115834bad8dae0a57b2e7904d94 --- src/video_output/control.c |6 +- src/video_output/control.h |1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/video_output/control.c b/src/video_output/control.c index 73877d5..bc7bda2 100644 --- a/src/video_output/control.c +++ b/src/video_output/control.c @@ -62,7 +62,6 @@ void vout_control_Init(vout_control_t *ctrl) vlc_cond_init(&ctrl->wait_acknowledge); ctrl->is_dead = false; -ctrl->is_sleeping = false; ctrl->can_sleep = true; ctrl->is_processing = false; ARRAY_INIT(ctrl->cmd); @@ -115,8 +114,7 @@ void vout_control_Wake(vout_control_t *ctrl) { vlc_mutex_lock(&ctrl->lock); ctrl->can_sleep = false; -if (ctrl->is_sleeping) -vlc_cond_signal(&ctrl->wait_request); +vlc_cond_signal(&ctrl->wait_request); vlc_mutex_unlock(&ctrl->lock); } @@ -190,10 +188,8 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd, /* Spurious wakeups are perfectly fine */ if (deadline <= VLC_TS_INVALID) { -ctrl->is_sleeping = true; if (ctrl->can_sleep) vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline); -ctrl->is_sleeping = false; } else { vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline)); } diff --git a/src/video_output/control.h b/src/video_output/control.h index 3d66793..f52a529 100644 --- a/src/video_output/control.h +++ b/src/video_output/control.h @@ -107,7 +107,6 @@ typedef struct { /* */ bool is_dead; -bool is_sleeping; bool can_sleep; bool is_processing; DECL_ARRAY(vout_control_cmd_t) cmd; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: check the can_sleep flag when a deadline is provided
vlc | branch: master | Felix Abecassis | Wed Feb 19 12:30:04 2014 +0100| [07be06c0cdf0433711cdb33341c2b22c6067e15b] | committer: Jean-Baptiste Kempf vout: check the can_sleep flag when a deadline is provided Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=07be06c0cdf0433711cdb33341c2b22c6067e15b --- src/video_output/control.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/video_output/control.c b/src/video_output/control.c index bc7bda2..7b4a19b 100644 --- a/src/video_output/control.c +++ b/src/video_output/control.c @@ -187,11 +187,11 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd, const mtime_t max_deadline = mdate() + timeout; /* Spurious wakeups are perfectly fine */ -if (deadline <= VLC_TS_INVALID) { -if (ctrl->can_sleep) +if (ctrl->can_sleep) { +if (deadline <= VLC_TS_INVALID) vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline); -} else { -vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline)); +else +vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline)); } } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: refactor deadline computation for cond_timedwait in vout_control_Pop
vlc | branch: master | Felix Abecassis | Wed Feb 19 12:30:05 2014 +0100| [453264d4bc7ad9b60285b2eb237a84f76f279e20] | committer: Jean-Baptiste Kempf vout: refactor deadline computation for cond_timedwait in vout_control_Pop Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=453264d4bc7ad9b60285b2eb237a84f76f279e20 --- src/video_output/control.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/video_output/control.c b/src/video_output/control.c index 7b4a19b..f317196 100644 --- a/src/video_output/control.c +++ b/src/video_output/control.c @@ -185,14 +185,11 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd, vlc_cond_broadcast(&ctrl->wait_acknowledge); const mtime_t max_deadline = mdate() + timeout; +const mtime_t wait_deadline = deadline <= VLC_TS_INVALID ? max_deadline : __MIN(deadline, max_deadline); /* Spurious wakeups are perfectly fine */ -if (ctrl->can_sleep) { -if (deadline <= VLC_TS_INVALID) -vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline); -else -vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline)); -} +if (ctrl->can_sleep) +vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, wait_deadline); } bool has_cmd; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: add more safety checks when trying to get codec capabilities
vlc | branch: master | Felix Abecassis | Wed Feb 19 16:39:19 2014 +0100| [addc5f26d000a390ba3a7b7a2e840620e8d3b88a] | committer: Jean-Baptiste Kempf mediacodec: add more safety checks when trying to get codec capabilities Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=addc5f26d000a390ba3a7b7a2e840620e8d3b88a --- modules/codec/omxil/android_mediacodec.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 330997d..8fa68fa 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -310,8 +310,13 @@ static int OpenDecoder(vlc_object_t *p_this) jobject codec_capabilities = (*env)->CallObjectMethod(env, info, p_sys->get_capabilities_for_type, (*env)->NewStringUTF(env, mime)); -jobject profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field); -int profile_levels_len = profile_levels ? (*env)->GetArrayLength(env, profile_levels) : 0; +jobject profile_levels = NULL; +int profile_levels_len = 0; +if (codec_capabilities) { +profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field); +if (profile_levels) +profile_levels_len = (*env)->GetArrayLength(env, profile_levels); +} msg_Dbg(p_dec, "Number of profile levels: %d", profile_levels_len); jobject types = (*env)->CallObjectMethod(env, info, p_sys->get_supported_types); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: do not accept codecs declaring no capabilities
vlc | branch: master | Felix Abecassis | Wed Feb 19 16:36:09 2014 +0100| [93f201fbe17b194a16031a497e97704384501394] | committer: Jean-Baptiste Kempf mediacodec: do not accept codecs declaring no capabilities Previously, if profileLevels was NULL or length 0, the codec was accepted. Some devices have several codecs for mime type video/avc, the first one is rejected based on the profile capability but the second one was accepted since there was no capability declared. Since the actual capability of the second codec was not better than the first one, decoding failed. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=93f201fbe17b194a16031a497e97704384501394 --- modules/codec/omxil/android_mediacodec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index bc990b1..330997d 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -323,7 +323,7 @@ static int OpenDecoder(vlc_object_t *p_this) /* The mime type is matching for this component. We now check if the capabilities of the codec is matching the video format. */ -if (p_dec->fmt_in.i_codec == VLC_CODEC_H264 && fmt_profile && profile_levels_len) { +if (p_dec->fmt_in.i_codec == VLC_CODEC_H264 && fmt_profile) { for (int i = 0; i < profile_levels_len && !found; ++i) { jobject profile_level = (*env)->GetObjectArrayElement(env, profile_levels, i); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: fix style
vlc | branch: master | Felix Abecassis | Wed Feb 19 11:25:37 2014 +0100| [d3c2782b73f159b57576034de811074ed4249e2c] | committer: Jean-Baptiste Kempf mediacodec: fix style Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d3c2782b73f159b57576034de811074ed4249e2c --- modules/codec/omxil/android_mediacodec.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 74091db..bc990b1 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -758,8 +758,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) /* Use the aspect ratio provided by the input (ie read from packetizer). * Don't check the current value of the aspect ratio in fmt_out, since we * want to allow changes in it to propagate. */ -if (p_dec->fmt_in.video.i_sar_num != 0 && p_dec->fmt_in.video.i_sar_den != 0) -{ +if (p_dec->fmt_in.video.i_sar_num != 0 && p_dec->fmt_in.video.i_sar_den != 0) { p_dec->fmt_out.video.i_sar_num = p_dec->fmt_in.video.i_sar_num; p_dec->fmt_out.video.i_sar_den = p_dec->fmt_in.video.i_sar_den; } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: fix typos in comment
vlc | branch: master | Felix Abecassis | Wed Feb 19 12:29:34 2014 +0100| [366a9aa8344aa33c939afe2ab7674273030b350c] | committer: Jean-Baptiste Kempf vout: fix typos in comment Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=366a9aa8344aa33c939afe2ab7674273030b350c --- src/video_output/control.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_output/control.c b/src/video_output/control.c index 930e09b..73877d5 100644 --- a/src/video_output/control.c +++ b/src/video_output/control.c @@ -188,7 +188,7 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd, const mtime_t max_deadline = mdate() + timeout; -/* Supurious wake up are perfectly fine */ +/* Spurious wakeups are perfectly fine */ if (deadline <= VLC_TS_INVALID) { ctrl->is_sleeping = true; if (ctrl->can_sleep) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: add missing exception handling code after dequeue{Input, Output}Buffer
vlc | branch: master | Felix Abecassis | Tue Feb 18 19:27:17 2014 +0100| [6eeac3302cb72b6093701c1a442a0b3895f91196] | committer: Jean-Baptiste Kempf mediacodec: add missing exception handling code after dequeue{Input, Output}Buffer Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6eeac3302cb72b6093701c1a442a0b3895f91196 --- modules/codec/omxil/android_mediacodec.c |9 + 1 file changed, 9 insertions(+) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 06ece8f..2911711 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -552,6 +552,11 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic) while (1) { int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_output_buffer, p_sys->buffer_info, (jlong) 0); +if ((*env)->ExceptionOccurred(env)) { +(*env)->ExceptionClear(env); +return; +} + if (index >= 0) { if (!p_sys->pixel_format) { msg_Warn(p_dec, "Buffers returned before output format is set, dropping frame"); @@ -748,6 +753,10 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) int attempts = 0; while (true) { int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout); +if ((*env)->ExceptionOccurred(env)) { +(*env)->ExceptionClear(env); +break; +} if (index < 0) { GetOutput(p_dec, env, &p_pic); if (p_pic) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: handle MediaCodec exceptions while decoding
vlc | branch: master | Felix Abecassis | Tue Feb 18 19:27:18 2014 +0100| [75cc1f0e68e3e55737c46df22df80d772ceae754] | committer: Jean-Baptiste Kempf mediacodec: handle MediaCodec exceptions while decoding If an exception is thrown when using the MediaCodec API, the decoder module enters an error state and will not attempt to queue/dequeue buffers anymore. The error state is notified to the Java using the JNI function jni_EventHardwareAccelerationError(). Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=75cc1f0e68e3e55737c46df22df80d772ceae754 --- modules/codec/omxil/android_mediacodec.c | 17 + 1 file changed, 17 insertions(+) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 2911711..9a38c24 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -51,6 +51,7 @@ extern JavaVM *myVm; extern jobject jni_LockAndGetAndroidJavaSurface(); extern void jni_UnlockAndroidSurface(); extern void jni_SetAndroidSurfaceSizeEnv(JNIEnv *p_env, int width, int height, int visible_width, int visible_height, int sar_num, int sar_den); +extern void jni_EventHardwareAccelerationError(); struct decoder_sys_t { @@ -81,6 +82,8 @@ struct decoder_sys_t bool started; bool decoded; +bool error_state; +bool error_event_sent; ArchitectureSpecificCopyData architecture_specific_data; @@ -554,6 +557,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic) p_sys->buffer_info, (jlong) 0); if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); +p_sys->error_state = true; return; } @@ -614,6 +618,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic) msg_Err(p_dec, "Codec error (IllegalStateException) in MediaCodec.releaseOutputBuffer"); (*env)->ExceptionClear(env); (*env)->DeleteLocalRef(env, illegalStateException); +p_sys->error_state = true; } } (*env)->DeleteLocalRef(env, buf); @@ -717,6 +722,16 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) block_t *p_block = *pp_block; +if (p_sys->error_state) { +block_Release(p_block); +if (!p_sys->error_event_sent) { +/* Signal the error to the Java. */ +jni_EventHardwareAccelerationError(); +p_sys->error_event_sent = true; +} +return NULL; +} + (*myVm)->AttachCurrentThread(myVm, &env, NULL); if (p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED)) { @@ -732,6 +747,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) if ((*env)->ExceptionOccurred(env)) { msg_Warn(p_dec, "Exception occurred in MediaCodec.flush"); (*env)->ExceptionClear(env); +p_sys->error_state = true; } } p_sys->decoded = false; @@ -755,6 +771,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block) int index = (*env)->CallIntMethod(env, p_sys->codec, p_sys->dequeue_input_buffer, timeout); if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); +p_sys->error_state = true; break; } if (index < 0) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: add a NULL pointer check after getting the profileLevels field
vlc | branch: master | Felix Abecassis | Fri Feb 14 19:06:13 2014 +0100| [e8289c83b34c3e4304f1e74a717775bd20318bb4] | committer: Jean-Baptiste Kempf mediacodec: add a NULL pointer check after getting the profileLevels field Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e8289c83b34c3e4304f1e74a717775bd20318bb4 --- modules/codec/omxil/android_mediacodec.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 9150acc..06ece8f 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -305,10 +305,11 @@ static int OpenDecoder(vlc_object_t *p_this) continue; } - jobject codec_capabilities = (*env)->CallObjectMethod(env, info, p_sys->get_capabilities_for_type, - (*env)->NewStringUTF(env, mime)); - jobject profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field); - int profile_levels_len = (*env)->GetArrayLength(env, profile_levels); +jobject codec_capabilities = (*env)->CallObjectMethod(env, info, p_sys->get_capabilities_for_type, + (*env)->NewStringUTF(env, mime)); +jobject profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field); +int profile_levels_len = profile_levels ? (*env)->GetArrayLength(env, profile_levels) : 0; +msg_Dbg(p_dec, "Number of profile levels: %d", profile_levels_len); jobject types = (*env)->CallObjectMethod(env, info, p_sys->get_supported_types); int num_types = (*env)->GetArrayLength(env, types); @@ -319,7 +320,7 @@ static int OpenDecoder(vlc_object_t *p_this) /* The mime type is matching for this component. We now check if the capabilities of the codec is matching the video format. */ -if (p_dec->fmt_in.i_codec == VLC_CODEC_H264 && fmt_profile) { +if (p_dec->fmt_in.i_codec == VLC_CODEC_H264 && fmt_profile && profile_levels_len) { for (int i = 0; i < profile_levels_len && !found; ++i) { jobject profile_level = (*env)->GetObjectArrayElement(env, profile_levels, i); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Direct3D: set dimensions of the D3D picture region
vlc | branch: master | Felix Abecassis | Thu Feb 13 18:33:39 2014 +0100| [c11fd844e6fbfe1640b7b66a21961de897f16312] | committer: Jean-Baptiste Kempf Direct3D: set dimensions of the D3D picture region Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c11fd844e6fbfe1640b7b66a21961de897f16312 --- modules/video_output/msw/direct3d.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index e80cbf7..7b31e90 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -314,6 +314,8 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic d3d_region_t picture_region; if (!Direct3DImportPicture(vd, &picture_region, surface)) { +picture_region.width = picture->format.i_visible_width; +picture_region.height = picture->format.i_visible_height; int subpicture_region_count = 0; d3d_region_t *subpicture_region = NULL; if (subpicture) ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Direct3D: pass dimensions of the D3D region to the pixel shader
vlc | branch: master | Felix Abecassis | Thu Feb 13 18:33:40 2014 +0100| [c765ee0b504dafcb460f964518a5af3821a662d7] | committer: Jean-Baptiste Kempf Direct3D: pass dimensions of the D3D region to the pixel shader Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c765ee0b504dafcb460f964518a5af3821a662d7 --- modules/video_output/msw/direct3d.c |8 1 file changed, 8 insertions(+) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index 7b31e90..ff0f601 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -1559,7 +1559,15 @@ static int Direct3DRenderRegion(vout_display_t *vd, if (sys->d3dx_shader) { if (use_pixel_shader) +{ hr = IDirect3DDevice9_SetPixelShader(d3ddev, sys->d3dx_shader); +float shader_data[4] = { region->width, region->height, 0, 0 }; +hr = IDirect3DDevice9_SetPixelShaderConstantF(d3ddev, 0, shader_data, 1); +if (FAILED(hr)) { +msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr); +return -1; +} +} else /* Disable any existing pixel shader. */ hr = IDirect3DDevice9_SetPixelShader(d3ddev, NULL); if (FAILED(hr)) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Direct3D: do not use pixel shader when rendering subpictures
vlc | branch: master | Felix Abecassis | Thu Feb 13 16:29:24 2014 +0100| [ed673d837c4f23137d5d280099c427860ced1ee6] | committer: Jean-Baptiste Kempf Direct3D: do not use pixel shader when rendering subpictures Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed673d837c4f23137d5d280099c427860ced1ee6 --- modules/video_output/msw/direct3d.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index 4b3aae8..e80cbf7 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -1519,7 +1519,8 @@ static void Direct3DImportSubpicture(vout_display_t *vd, } static int Direct3DRenderRegion(vout_display_t *vd, -d3d_region_t *region) +d3d_region_t *region, +bool use_pixel_shader) { vout_display_sys_t *sys = vd->sys; @@ -1555,7 +1556,10 @@ static int Direct3DRenderRegion(vout_display_t *vd, } if (sys->d3dx_shader) { -hr = IDirect3DDevice9_SetPixelShader(d3ddev, sys->d3dx_shader); +if (use_pixel_shader) +hr = IDirect3DDevice9_SetPixelShader(d3ddev, sys->d3dx_shader); +else /* Disable any existing pixel shader. */ +hr = IDirect3DDevice9_SetPixelShader(d3ddev, NULL); if (FAILED(hr)) { msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr); return -1; @@ -1618,14 +1622,14 @@ static void Direct3DRenderScene(vout_display_t *vd, return; } -Direct3DRenderRegion(vd, picture); +Direct3DRenderRegion(vd, picture, true); if (subpicture_count > 0) IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHABLENDENABLE, TRUE); for (int i = 0; i < subpicture_count; i++) { d3d_region_t *r = &subpicture[i]; if (r->texture) -Direct3DRenderRegion(vd, r); +Direct3DRenderRegion(vd, r, false); } if (subpicture_count > 0) IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHABLENDENABLE, FALSE); ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Direct3D: do not leak textures when recycling them
vlc/vlc-2.1 | branch: master | Felix Abecassis | Thu Feb 13 10:19:05 2014 +0100| [39d9f1f628594c35b365e1013b8c313af31ebf5c] | committer: Jean-Baptiste Kempf Direct3D: do not leak textures when recycling them If several textures from the cache (i.e. used during the previous call) are matching we invalidate all of them but only keep the last one. We therefore lose all references to the other ones. Close #10248 Signed-off-by: Jean-Baptiste Kempf (cherry picked from commit e25184612eee912c8ef329cf1ad7a0a2b76d96ba) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=39d9f1f628594c35b365e1013b8c313af31ebf5c --- modules/video_output/msw/direct3d.c |1 + 1 file changed, 1 insertion(+) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index 7920cd4..2341495 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -1257,6 +1257,7 @@ static void Direct3DImportSubpicture(vout_display_t *vd, #endif *d3dr = *cache; memset(cache, 0, sizeof(*cache)); +break; } } if (!d3dr->texture) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Direct3D: do not leak textures when recycling them
vlc | branch: master | Felix Abecassis | Thu Feb 13 10:19:05 2014 +0100| [e25184612eee912c8ef329cf1ad7a0a2b76d96ba] | committer: Jean-Baptiste Kempf Direct3D: do not leak textures when recycling them If several textures from the cache (i.e. used during the previous call) are matching we invalidate all of them but only keep the last one. We therefore lose all references to the other ones. Close #10248 Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e25184612eee912c8ef329cf1ad7a0a2b76d96ba --- modules/video_output/msw/direct3d.c |1 + 1 file changed, 1 insertion(+) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index 6b33bf4..4b3aae8 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -1439,6 +1439,7 @@ static void Direct3DImportSubpicture(vout_display_t *vd, #endif *d3dr = *cache; memset(cache, 0, sizeof(*cache)); +break; } } if (!d3dr->texture) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Win32: return a failure when a CHANGE_DISPLAY_SIZE event is forced
vlc/vlc-2.1 | branch: master | Felix Abecassis | Tue Feb 11 16:20:06 2014 +0100| [67e390d56379cac43ede7ea633614b8473ec5b0c] | committer: Jean-Baptiste Kempf Win32: return a failure when a CHANGE_DISPLAY_SIZE event is forced See x11.c for rationale. Close #9273 Signed-off-by: Jean-Baptiste Kempf (cherry picked from commit ad58279cf86051a108589eeea6520f69243c1fb8) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=67e390d56379cac43ede7ea633614b8473ec5b0c --- modules/video_output/msw/common.c |1 + 1 file changed, 1 insertion(+) diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index d20c136..45f1f5e 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -603,6 +603,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args) rect_window.right - rect_window.left, rect_window.bottom - rect_window.top, SWP_NOMOVE); } +return VLC_EGENERIC; } UpdateRects(vd, cfg, source, is_forced); return VLC_SUCCESS; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Win32: return a failure when a CHANGE_DISPLAY_SIZE event is forced
vlc | branch: master | Felix Abecassis | Tue Feb 11 16:20:06 2014 +0100| [ad58279cf86051a108589eeea6520f69243c1fb8] | committer: Jean-Baptiste Kempf Win32: return a failure when a CHANGE_DISPLAY_SIZE event is forced See x11.c for rationale. Close #9273 Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ad58279cf86051a108589eeea6520f69243c1fb8 --- modules/video_output/msw/common.c |1 + 1 file changed, 1 insertion(+) diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index 1174a42..f4954b1 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -588,6 +588,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args) rect_window.right - rect_window.left, rect_window.bottom - rect_window.top, SWP_NOMOVE); } +return VLC_EGENERIC; } UpdateRects(vd, cfg, source, is_forced); return VLC_SUCCESS; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: check if the codec can handle the H264 profile of the input format
vlc | branch: master | Felix Abecassis | Tue Feb 11 13:31:12 2014 +0100| [1b9ac1d34a9228394007f9255f96515ff4734da0] | committer: Jean-Baptiste Kempf mediacodec: check if the codec can handle the H264 profile of the input format The level is ignored for now since some encoders are not computing the level and instead set it to the maximum possible value. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b9ac1d34a9228394007f9255f96515ff4734da0 --- modules/codec/omxil/android_mediacodec.c | 47 +++--- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index bf53e76..9150acc 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -57,7 +57,8 @@ struct decoder_sys_t jclass media_codec_list_class, media_codec_class, media_format_class; jclass buffer_info_class, byte_buffer_class; jmethodID tostring; -jmethodID get_codec_count, get_codec_info_at, is_encoder; +jmethodID get_codec_count, get_codec_info_at, is_encoder, get_capabilities_for_type; +jfieldID profile_levels_field, profile_field, level_field; jmethodID get_supported_types, get_name; jmethodID create_by_codec_name, configure, start, stop, flush, release; jmethodID get_output_format, get_input_buffers, get_output_buffers; @@ -127,6 +128,11 @@ static const struct member members[] = { { "isEncoder", "()Z", "android/media/MediaCodecInfo", OFF(is_encoder), METHOD }, { "getSupportedTypes", "()[Ljava/lang/String;", "android/media/MediaCodecInfo", OFF(get_supported_types), METHOD }, { "getName", "()Ljava/lang/String;", "android/media/MediaCodecInfo", OFF(get_name), METHOD }, +{ "getCapabilitiesForType", "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", "android/media/MediaCodecInfo", OFF(get_capabilities_for_type), METHOD }, + +{ "profileLevels", "[Landroid/media/MediaCodecInfo$CodecProfileLevel;", "android/media/MediaCodecInfo$CodecCapabilities", OFF(profile_levels_field), FIELD }, +{ "profile", "I", "android.media.MediaCodecInfo$CodecProfileLevel", OFF(profile_field), FIELD }, +{ "level", "I", "android.media.MediaCodecInfo$CodecProfileLevel", OFF(level_field), FIELD }, { "createByCodecName", "(Ljava/lang/String;)Landroid/media/MediaCodec;", "android/media/MediaCodec", OFF(create_by_codec_name), STATIC_METHOD }, { "configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", "android/media/MediaCodec", OFF(configure), METHOD }, @@ -224,14 +230,9 @@ static int OpenDecoder(vlc_object_t *p_this) return VLC_EGENERIC; } -if (p_dec->fmt_in.i_codec == VLC_CODEC_H264) { -size_t i_profile = 0x; -h264_get_profile_level(&p_dec->fmt_in, &i_profile, NULL, NULL); -if (i_profile >= 110) { -msg_Err(p_dec, "H.264 profile is too high or unknown. Disabling Hardware Acceleration."); -return VLC_EGENERIC; -} -} +size_t fmt_profile = 0; +if (p_dec->fmt_in.i_codec == VLC_CODEC_H264) +h264_get_profile_level(&p_dec->fmt_in, &fmt_profile, NULL, NULL); /* Allocate the memory needed to store the decoder's structure */ if ((p_dec->p_sys = p_sys = calloc(1, sizeof(*p_sys))) == NULL) @@ -303,13 +304,37 @@ static int OpenDecoder(vlc_object_t *p_this) (*env)->DeleteLocalRef(env, info); continue; } + + jobject codec_capabilities = (*env)->CallObjectMethod(env, info, p_sys->get_capabilities_for_type, + (*env)->NewStringUTF(env, mime)); + jobject profile_levels = (*env)->GetObjectField(env, codec_capabilities, p_sys->profile_levels_field); + int profile_levels_len = (*env)->GetArrayLength(env, profile_levels); + jobject types = (*env)->CallObjectMethod(env, info, p_sys->get_supported_types); int num_types = (*env)->GetArrayLength(env, types); bool found = false; for (int j = 0; j < num_types && !found; j++) { jobject type = (*env)->GetObjectArrayElement(env, types, j); -if (!jstrcmp(env, type, mime)) -found = true; +if (!jstrcmp(env, type, mime)) { +/* The mime type is matching for this component. We + now check if the capabilities of the codec is + matching the video format. */ +
[vlc-commits] omxil: add conversion functions from OMX H264 profile/ levels to profile_idc/level_idc
vlc | branch: master | Felix Abecassis | Tue Feb 11 13:31:11 2014 +0100| [fe8525155164927e08208a43b125a7fa80d9ee76] | committer: Jean-Baptiste Kempf omxil: add conversion functions from OMX H264 profile/levels to profile_idc/level_idc Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe8525155164927e08208a43b125a7fa80d9ee76 --- modules/codec/omxil/omxil_utils.h |4 +++ modules/codec/omxil/utils.c | 59 + 2 files changed, 63 insertions(+) diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h index 78f05da..0a5dc17 100644 --- a/modules/codec/omxil/omxil_utils.h +++ b/modules/codec/omxil/omxil_utils.h @@ -261,3 +261,7 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index); * H264 specific code */ bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t *p_level, size_t *p_nal_size); + +size_t convert_omx_to_profile_idc(OMX_VIDEO_AVCPROFILETYPE profile_type); + +size_t convert_omx_to_level_idc(OMX_VIDEO_AVCLEVELTYPE level_type); diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c index f2ef79c..af050c3 100644 --- a/modules/codec/omxil/utils.c +++ b/modules/codec/omxil/utils.c @@ -1073,3 +1073,62 @@ bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t if (p_level) *p_level = p[2]; return true; } + +static const struct +{ +OMX_VIDEO_AVCPROFILETYPE omx_profile; +size_t profile_idc; +} omx_to_profile_idc[] = +{ +{ OMX_VIDEO_AVCProfileBaseline, 66 }, +{ OMX_VIDEO_AVCProfileMain, 77 }, +{ OMX_VIDEO_AVCProfileExtended, 88 }, +{ OMX_VIDEO_AVCProfileHigh, 100 }, +{ OMX_VIDEO_AVCProfileHigh10, 110 }, +{ OMX_VIDEO_AVCProfileHigh422, 122 }, +{ OMX_VIDEO_AVCProfileHigh444, 244 }, +}; + +size_t convert_omx_to_profile_idc(OMX_VIDEO_AVCPROFILETYPE profile_type) +{ +size_t array_length = sizeof(omx_to_profile_idc)/sizeof(omx_to_profile_idc[0]); +for (size_t i = 0; i < array_length; ++i) { +if (omx_to_profile_idc[i].omx_profile == profile_type) +return omx_to_profile_idc[i].profile_idc; +} +return 0; +} + +static const struct +{ +OMX_VIDEO_AVCLEVELTYPE omx_level; +size_t level_idc; +} omx_to_level_idc[] = +{ +{ OMX_VIDEO_AVCLevel1, 10 }, +{ OMX_VIDEO_AVCLevel1b, 9 }, +{ OMX_VIDEO_AVCLevel11, 11 }, +{ OMX_VIDEO_AVCLevel12, 12 }, +{ OMX_VIDEO_AVCLevel13, 13 }, +{ OMX_VIDEO_AVCLevel2, 20 }, +{ OMX_VIDEO_AVCLevel21, 21 }, +{ OMX_VIDEO_AVCLevel22, 22 }, +{ OMX_VIDEO_AVCLevel3, 30 }, +{ OMX_VIDEO_AVCLevel31, 31 }, +{ OMX_VIDEO_AVCLevel32, 32 }, +{ OMX_VIDEO_AVCLevel4, 40 }, +{ OMX_VIDEO_AVCLevel41, 41 }, +{ OMX_VIDEO_AVCLevel42, 42 }, +{ OMX_VIDEO_AVCLevel5, 50 }, +{ OMX_VIDEO_AVCLevel51, 51 }, +}; + +size_t convert_omx_to_level_idc(OMX_VIDEO_AVCLEVELTYPE level_type) +{ +size_t array_length = sizeof(omx_to_level_idc)/sizeof(omx_to_level_idc[0]); +for (size_t i = 0; i < array_length; ++i) { +if (omx_to_level_idc[i].omx_level == level_type) +return omx_to_level_idc[i].level_idc; +} +return 0; +} ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] omxil: move code to parse profile and level of H264 format to omx_utils.h
vlc | branch: master | Felix Abecassis | Sun Feb 9 18:22:28 2014 +0100| [3bdc428bf00c74bec6d988f1cadec3675c0058df] | committer: Jean-Baptiste Kempf omxil: move code to parse profile and level of H264 format to omx_utils.h Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3bdc428bf00c74bec6d988f1cadec3675c0058df --- modules/codec/omxil/omxil.c | 35 --- modules/codec/omxil/omxil_utils.h |5 + modules/codec/omxil/utils.c | 30 ++ 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 2800e44..e3e34c4 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -108,39 +108,12 @@ static OMX_ERRORTYPE ImplementationSpecificWorkarounds(decoder_t *p_dec, { decoder_sys_t *p_sys = p_dec->p_sys; OMX_PARAM_PORTDEFINITIONTYPE *def = &p_port->definition; -int i_profile = 0x, i_level = 0x; +size_t i_profile = 0x, i_level = 0x; /* Try to find out the profile of the video */ -while(p_fmt->i_cat == VIDEO_ES && def->eDir == OMX_DirInput && - p_fmt->i_codec == VLC_CODEC_H264) -{ -uint8_t *p = (uint8_t*)p_dec->fmt_in.p_extra; -if(!p || !p_dec->fmt_in.p_extra) break; - -/* Check the profile / level */ -if(p_dec->fmt_in.i_original_fourcc == VLC_FOURCC('a','v','c','1') && - p[0] == 1) -{ -if(p_dec->fmt_in.i_extra < 12) break; -p_sys->i_nal_size_length = 1 + (p[4]&0x03); -if( !(p[5]&0x1f) ) break; -p += 8; -} -else -{ -if(p_dec->fmt_in.i_extra < 8) break; -if(!p[0] && !p[1] && !p[2] && p[3] == 1) p += 4; -else if(!p[0] && !p[1] && p[2] == 1) p += 3; -else break; -} - -if( ((*p++)&0x1f) != 7) break; - -/* Get profile/level out of first SPS */ -i_profile = p[0]; -i_level = p[2]; -break; -} +if(p_fmt->i_cat == VIDEO_ES && def->eDir == OMX_DirInput && + p_fmt->i_codec == VLC_CODEC_H264) + h264_get_profile_level(&p_dec->fmt_in, &i_profile, &i_level, &p_sys->i_nal_size_length); if(!strcmp(p_sys->psz_component, "OMX.TI.Video.Decoder")) { diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h index 6aa9e12..78f05da 100644 --- a/modules/codec/omxil/omxil_utils.h +++ b/modules/codec/omxil/omxil_utils.h @@ -256,3 +256,8 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index); #define QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka 0x7FA30C03 #define OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m 0x7FA30C04 #define OMX_IndexVendorSetYUV420pMode 0x7f03 + +/* + * H264 specific code + */ +bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t *p_level, size_t *p_nal_size); diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c index 56563da..f2ef79c 100644 --- a/modules/codec/omxil/utils.c +++ b/modules/codec/omxil/utils.c @@ -1043,3 +1043,33 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port) } } } + +bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile, size_t *p_level, size_t *p_nal_size) +{ +uint8_t *p = (uint8_t*)p_fmt->p_extra; +if(!p || !p_fmt->p_extra) return false; + +/* Check the profile / level */ +if(p_fmt->i_original_fourcc == VLC_FOURCC('a','v','c','1') && + p[0] == 1) +{ + if(p_fmt->i_extra < 12) return false; + if (p_nal_size) *p_nal_size = 1 + (p[4]&0x03); + if( !(p[5]&0x1f) ) return false; + p += 8; +} +else +{ + if(p_fmt->i_extra < 8) return false; + if(!p[0] && !p[1] && !p[2] && p[3] == 1) p += 4; + else if(!p[0] && !p[1] && p[2] == 1) p += 3; + else return false; +} + +if( ((*p++)&0x1f) != 7) return false; + +/* Get profile/level out of first SPS */ +if (p_profile) *p_profile = p[0]; +if (p_level) *p_level = p[2]; +return true; +} ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: disambiguate error message (same as below)
vlc | branch: master | Felix Abecassis | Sun Feb 9 18:22:26 2014 +0100| [3d4d9fe5453cb88b5d3b4d8110c4a01c80180529] | committer: Jean-Baptiste Kempf mediacodec: disambiguate error message (same as below) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3d4d9fe5453cb88b5d3b4d8110c4a01c80180529 --- modules/codec/omxil/android_mediacodec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index e7109d2..d3eedc1 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -362,7 +362,7 @@ static int OpenDecoder(vlc_object_t *p_this) // Configure MediaCodec with the Android surface. (*env)->CallVoidMethod(env, p_sys->codec, p_sys->configure, format, surf, NULL, 0); if ((*env)->ExceptionOccurred(env)) { -msg_Warn(p_dec, "Exception occurred in MediaCodec.configure"); +msg_Warn(p_dec, "Exception occurred in MediaCodec.configure with an output surface."); (*env)->ExceptionClear(env); goto error; } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: disable HW acceleration for profiles Hi10P and higher
vlc | branch: master | Felix Abecassis | Sun Feb 9 18:22:29 2014 +0100| [d05bec79626d2ff10ea578ba1de9597c98f603f8] | committer: Jean-Baptiste Kempf mediacodec: disable HW acceleration for profiles Hi10P and higher Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d05bec79626d2ff10ea578ba1de9597c98f603f8 --- modules/codec/omxil/android_mediacodec.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index 5fc5013..bf53e76 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -223,6 +223,16 @@ static int OpenDecoder(vlc_object_t *p_this) msg_Dbg(p_dec, "codec %d not supported", p_dec->fmt_in.i_codec); return VLC_EGENERIC; } + +if (p_dec->fmt_in.i_codec == VLC_CODEC_H264) { +size_t i_profile = 0x; +h264_get_profile_level(&p_dec->fmt_in, &i_profile, NULL, NULL); +if (i_profile >= 110) { +msg_Err(p_dec, "H.264 profile is too high or unknown. Disabling Hardware Acceleration."); +return VLC_EGENERIC; +} +} + /* Allocate the memory needed to store the decoder's structure */ if ((p_dec->p_sys = p_sys = calloc(1, sizeof(*p_sys))) == NULL) return VLC_ENOMEM; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] mediacodec: unlock the surface if configuring MediaCodec failed
vlc | branch: master | Felix Abecassis | Sun Feb 9 18:22:27 2014 +0100| [91a4846e1eab08e8a6a89420fe58b5f2367d4ad7] | committer: Jean-Baptiste Kempf mediacodec: unlock the surface if configuring MediaCodec failed Solve a bug where the display stays black when the dimension of the video is not supported by MediaCodec (either too small or too large). Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91a4846e1eab08e8a6a89420fe58b5f2367d4ad7 --- modules/codec/omxil/android_mediacodec.c |1 + 1 file changed, 1 insertion(+) diff --git a/modules/codec/omxil/android_mediacodec.c b/modules/codec/omxil/android_mediacodec.c index d3eedc1..5fc5013 100644 --- a/modules/codec/omxil/android_mediacodec.c +++ b/modules/codec/omxil/android_mediacodec.c @@ -364,6 +364,7 @@ static int OpenDecoder(vlc_object_t *p_this) if ((*env)->ExceptionOccurred(env)) { msg_Warn(p_dec, "Exception occurred in MediaCodec.configure with an output surface."); (*env)->ExceptionClear(env); +jni_UnlockAndroidSurface(); goto error; } p_dec->fmt_out.i_codec = VLC_CODEC_ANDROID_OPAQUE; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: assume aspect ratio is 1:1 if information is missing
vlc | branch: master | Felix Abecassis | Wed Jan 29 14:37:44 2014 +| [bf5bc83e52ef5b4fd090b74b6d5bd9523b6dcbd7] | committer: Jean-Baptiste Kempf vout: assume aspect ratio is 1:1 if information is missing Avoid signalling a change of aspect-ratio when it only changed from 1:1 to 0:0. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf5bc83e52ef5b4fd090b74b6d5bd9523b6dcbd7 --- src/video_output/display.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video_output/display.c b/src/video_output/display.c index b268c18..cd107fd 100644 --- a/src/video_output/display.c +++ b/src/video_output/display.c @@ -1175,8 +1175,9 @@ void vout_SetDisplayAspect(vout_display_t *vd, unsigned dar_num, unsigned dar_de sar_den = dar_den * osys->source.i_visible_width; vlc_ureduce(&sar_num, &sar_den, sar_num, sar_den, 0); } else { -sar_num = 0; -sar_den = 0; +/* Assume 1:1 SAR if the information is missing */ +sar_num = 1; +sar_den = 1; } if (osys->sar.num != sar_num || osys->sar.den != sar_den) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: reduce zoom ratio in order to avoid signalling unnecessary zoom events
vlc | branch: master | Felix Abecassis | Wed Jan 29 14:37:43 2014 +| [cabe71212a0c4bce61e8ebcc52953eadd951597b] | committer: Jean-Baptiste Kempf vout: reduce zoom ratio in order to avoid signalling unnecessary zoom events For instance changing from 10:10 to 1:1 should not generate an event if we are not in display fill mode. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cabe71212a0c4bce61e8ebcc52953eadd951597b --- src/video_output/display.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/src/video_output/display.c b/src/video_output/display.c index cd107fd..1f38c22 100644 --- a/src/video_output/display.c +++ b/src/video_output/display.c @@ -1145,6 +1145,13 @@ void vout_SetDisplayZoom(vout_display_t *vd, int num, int den) { vout_display_owner_sys_t *osys = vd->owner.sys; +if (num > 0 && den > 0) { +vlc_ureduce(&num, &den, num, den, 0); +} else { +num = 1; +den = 1; +} + if (osys->is_display_filled || osys->zoom.num != num || osys->zoom.den != den) { osys->ch_zoom = true; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] vout: remove commented code (moved to vlc_vout_wrapper.h)
vlc | branch: master | Felix Abecassis | Wed Jan 29 14:37:45 2014 +| [167a7a532172a2040eef06e7b4728a96303a5bda] | committer: Jean-Baptiste Kempf vout: remove commented code (moved to vlc_vout_wrapper.h) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=167a7a532172a2040eef06e7b4728a96303a5bda --- src/video_output/display.h | 82 1 file changed, 82 deletions(-) diff --git a/src/video_output/display.h b/src/video_output/display.h index 86746fd..1c22918 100644 --- a/src/video_output/display.h +++ b/src/video_output/display.h @@ -23,88 +23,6 @@ #include -#if 0 -#include -#include - -/** - * It retreive a picture from the display - */ -static inline picture_pool_t *vout_display_Pool(vout_display_t *vd, unsigned count) -{ -return vd->pool(vd, count); -} - -/** - * It preparse a picture for display. - */ -static inline void vout_display_Prepare(vout_display_t *vd, picture_t *picture) -{ -if (vd->prepare ) -vd->prepare(vd, picture); -} - -/** - * It display a picture. - */ -static inline void vout_display_Display(vout_display_t *vd, picture_t *picture) -{ -vd->display(vd, picture); -} - -/** - * It holds a state for a vout display. - */ -typedef struct { -vout_display_cfg_t cfg; - -bool is_on_top; -struct { -int num; -int den; -} sar; -} vout_display_state_t; - -/** - * It creates a vout managed display. - */ -vout_display_t *vout_NewDisplay( vout_thread_t *, - const video_format_t *, - const vout_display_state_t *, - const char *psz_module, - mtime_t i_double_click_timeout, - mtime_t i_hide_timeout ); -/** - * It creates a vout managed display wrapping a video splitter. - */ -vout_display_t *vout_NewSplitter(vout_thread_t *, - const video_format_t *source, - const vout_display_state_t *state, - const char *module, - const char *splitter, - mtime_t double_click_timeout, - mtime_t hide_timeout ); - -/** - * It destroy a vout managed display. - */ -void vout_DeleteDisplay(vout_display_t *, vout_display_state_t *); - -picture_t *vout_FilterDisplay(vout_display_t *, picture_t *); - -void vout_ManageDisplay(vout_display_t *, bool allow_reset_pictures); - -void vout_SetDisplayFullscreen(vout_display_t *, bool is_fullscreen); -void vout_SetDisplayFilled(vout_display_t *, bool is_filled); -void vout_SetDisplayZoom(vout_display_t *, int num, int den); -void vout_SetWindowState(vout_display_t *, unsigned state); -void vout_SetDisplayAspect(vout_display_t *, unsigned sar_num, unsigned sar_den); -void vout_SetDisplayCrop(vout_display_t *, - unsigned crop_num, unsigned crop_den, - unsigned x, unsigned y, unsigned width, unsigned height); - -#endif - vout_display_t *vout_NewSplitter(vout_thread_t *vout, const video_format_t *source, const vout_display_state_t *state, ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Direct3D: implement HLSL pixel shading in the rendering pipeline
vlc | branch: master | Felix Abecassis | Fri Feb 7 17:26:18 2014 +| [27d6d6fd5eff764b8d36f9abeb33ed069da713b3] | committer: Jean-Baptiste Kempf Direct3D: implement HLSL pixel shading in the rendering pipeline The user can choose to apply a builtin shader using a selection list in the options of the Direct3D vout module. A custom shader function can also be loaded by specifying the path of the shader file. Many changes since the latest patch proposal: we are not compiling "shader techniques" anymore but now shader functions using the "main" entrypoint. All the shaders previously in pixelShader.fx are now builtins. Based on the code by Sasha Koruga for GSoC 2010. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=27d6d6fd5eff764b8d36f9abeb33ed069da713b3 --- NEWS |1 + modules/video_output/Modules.am|2 +- modules/video_output/msw/builtin_shaders.h | 150 ++ modules/video_output/msw/common.h |3 + modules/video_output/msw/direct3d.c| 234 +++- 5 files changed, 387 insertions(+), 3 deletions(-) Diff: http://git.videolan.org/gitweb.cgi/vlc.git/?a=commitdiff;h=27d6d6fd5eff764b8d36f9abeb33ed069da713b3 ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] hotkeys: fullscreen state of the vout should have precedence over fullscreen state of the playlist
vlc/vlc-2.1 | branch: master | Felix Abecassis | Tue Jan 28 10:56:46 2014 +0100| [8e2c9c8cc496042bbe480510836e6a84b465c5c9] | committer: Jean-Baptiste Kempf hotkeys: fullscreen state of the vout should have precedence over fullscreen state of the playlist Double clicking to toggle to fullscreen mode does not trigger this code path since 7b8083d228. The state of the playlist was therefore not in sync with the vout. Pressing the fullscreen hotkey caused the state of the playlist to be used to set the state of the vout, thus causing the bug. Close #10433. Signed-off-by: Jean-Baptiste Kempf (cherry picked from commit 9f7bfd93e3a749a2912adda6380370310cd4dffa) Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=8e2c9c8cc496042bbe480510836e6a84b465c5c9 --- modules/control/hotkeys.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index ec21bec..b358494 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -733,9 +733,13 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) case ACTIONID_TOGGLE_FULLSCREEN: { -bool fs = var_ToggleBool( p_playlist, "fullscreen" ); if( p_vout ) -var_SetBool( p_vout, "fullscreen", fs ); +{ +bool fs = var_ToggleBool( p_vout, "fullscreen" ); +var_SetBool( p_playlist, "fullscreen", fs ); +} +else +var_ToggleBool( p_playlist, "fullscreen" ); break; } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] hotkeys: fullscreen state of the vout should have precedence over fullscreen state of the playlist
vlc | branch: master | Felix Abecassis | Tue Jan 28 10:56:46 2014 +0100| [9f7bfd93e3a749a2912adda6380370310cd4dffa] | committer: Jean-Baptiste Kempf hotkeys: fullscreen state of the vout should have precedence over fullscreen state of the playlist Double clicking to toggle to fullscreen mode does not trigger this code path since 7b8083d228. The state of the playlist was therefore not in sync with the vout. Pressing the fullscreen hotkey caused the state of the playlist to be used to set the state of the vout, thus causing the bug. Close #10433. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f7bfd93e3a749a2912adda6380370310cd4dffa --- modules/control/hotkeys.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index ab68340..1e7fcdf 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -733,9 +733,13 @@ static int PutAction( intf_thread_t *p_intf, int i_action ) case ACTIONID_TOGGLE_FULLSCREEN: { -bool fs = var_ToggleBool( p_playlist, "fullscreen" ); if( p_vout ) -var_SetBool( p_vout, "fullscreen", fs ); +{ +bool fs = var_ToggleBool( p_vout, "fullscreen" ); +var_SetBool( p_playlist, "fullscreen", fs ); +} +else +var_ToggleBool( p_playlist, "fullscreen" ); break; } ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Win32: correctly use option "disable-screensaver"
vlc/vlc-2.1 | branch: master | Felix Abecassis | Fri Jan 24 19:14:53 2014 +0100| [a365ac25fbe216c99321be24e63aab99f2f37602] | committer: Jean-Baptiste Kempf Win32: correctly use option "disable-screensaver" Close #10366. Signed-off-by: Jean-Baptiste Kempf (cherry picked from commit d38e0f861f5b7e38f52bb54b55062cfa93b28eb2) Signed-off-by: Jean-Baptiste Kempf Conflicts: modules/video_output/msw/common.c > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=a365ac25fbe216c99321be24e63aab99f2f37602 --- modules/video_output/msw/common.c |3 +-- modules/video_output/msw/events.c | 10 ++ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index a0e663d..d20c136 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -78,6 +78,7 @@ int CommonInit(vout_display_t *vd) sys->is_on_top = false; var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); +var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); /* */ sys->event = EventThreadCreate(vd); @@ -113,8 +114,6 @@ int CommonInit(vout_display_t *vd) vout_display_SendEventFullscreen(vd, false); } -/* Why not with glwin32 */ -var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); DisableScreensaver (vd); return VLC_SUCCESS; diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c index ada4d43..df1697f 100644 --- a/modules/video_output/msw/events.c +++ b/modules/video_output/msw/events.c @@ -225,7 +225,8 @@ static void *EventThread( void *p_this ) } /* Prevent monitor from powering off */ -SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); +if (var_GetBool(vd, "disable-screensaver")) + SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); /* Main loop */ /* GetMessage will sleep if there's no message in the queue */ @@ -753,13 +754,6 @@ static long FAR PASCAL DirectXEventProc( HWND hwnd, UINT message, } vout_display_t *vd = p_event->vd; -/* Catch the screensaver and the monitor turn-off */ -if( message == WM_SYSCOMMAND && -( (wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER ) ) -{ -//if( vd ) msg_Dbg( vd, "WinProc WM_SYSCOMMAND screensaver" ); -return 0; /* this stops them from happening */ -} #if 0 if( message == WM_SETCURSOR ) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] Win32: correctly use option "disable-screensaver"
vlc | branch: master | Felix Abecassis | Fri Jan 24 19:14:53 2014 +0100| [d38e0f861f5b7e38f52bb54b55062cfa93b28eb2] | committer: Jean-Baptiste Kempf Win32: correctly use option "disable-screensaver" Close #10366. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d38e0f861f5b7e38f52bb54b55062cfa93b28eb2 --- modules/video_output/msw/common.c |2 +- modules/video_output/msw/events.c | 10 ++ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c index 3a0f626..1174a42 100644 --- a/modules/video_output/msw/common.c +++ b/modules/video_output/msw/common.c @@ -63,6 +63,7 @@ int CommonInit(vout_display_t *vd) sys->is_on_top = false; var_Create(vd, "video-deco", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); +var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); /* */ sys->event = EventThreadCreate(vd); @@ -98,7 +99,6 @@ int CommonInit(vout_display_t *vd) vout_display_SendEventFullscreen(vd, false); } -var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT); DisableScreensaver (vd); return VLC_SUCCESS; diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c index c9dcaa2..90939dc 100644 --- a/modules/video_output/msw/events.c +++ b/modules/video_output/msw/events.c @@ -157,7 +157,8 @@ static void *EventThread( void *p_this ) } /* Prevent monitor from powering off */ -SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); +if (var_GetBool(vd, "disable-screensaver")) + SetThreadExecutionState( ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED | ES_CONTINUOUS ); /* Main loop */ /* GetMessage will sleep if there's no message in the queue */ @@ -919,13 +920,6 @@ static long FAR PASCAL WinVoutEventProc( HWND hwnd, UINT message, } vout_display_t *vd = p_event->vd; -/* Catch the screensaver and the monitor turn-off */ -if( message == WM_SYSCOMMAND && -( (wParam & 0xFFF0) == SC_SCREENSAVE || (wParam & 0xFFF0) == SC_MONITORPOWER ) ) -{ -//if( vd ) msg_Dbg( vd, "WinProc WM_SYSCOMMAND screensaver" ); -return 0; /* this stops them from happening */ -} #if 0 if( message == WM_SETCURSOR ) { ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] android: implement subtitles rendering for Android MediaCodec opaque direct rendering
vlc | branch: master | Felix Abecassis | Wed Jan 22 09:46:17 2014 +| [efd5eca5eaa1693c1f977ecd2e883851e2a53f01] | committer: Jean-Baptiste Kempf android: implement subtitles rendering for Android MediaCodec opaque direct rendering A blending filter is used on the subtitles surface above the main one by wrapping the corresponding NativeWindow into a picture_t. Signed-off-by: Jean-Baptiste Kempf > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=efd5eca5eaa1693c1f977ecd2e883851e2a53f01 --- modules/video_output/android/opaque.c | 114 + 1 file changed, 114 insertions(+) diff --git a/modules/video_output/android/opaque.c b/modules/video_output/android/opaque.c index 7334e02..371d65f 100644 --- a/modules/video_output/android/opaque.c +++ b/modules/video_output/android/opaque.c @@ -29,7 +29,12 @@ #include #include #include +#include + +#include + #include "../codec/omxil/android_opaque.h" +#include "utils.h" static int Open (vlc_object_t *); static void Close(vlc_object_t *); @@ -44,6 +49,16 @@ vlc_module_begin() set_callbacks(Open, Close) vlc_module_end() +extern JavaVM *myVm; +extern jobject jni_LockAndGetSubtitlesSurface(); +extern void jni_UnlockAndroidSurface(); + +static const vlc_fourcc_t subpicture_chromas[] = +{ +VLC_CODEC_RGBA, +0 +}; + /* * Local prototypes */ @@ -55,8 +70,65 @@ static int Control(vout_display_t *, int, va_list); struct vout_display_sys_t { picture_pool_t *pool; + +void *p_library; +native_window_api_t native_window; + +jobject jsurf; +ANativeWindow *window; + +video_format_t fmt; + +filter_t *p_spu_blend; +picture_t *subtitles_picture; + +bool b_has_subpictures; }; +static void DisplaySubpicture(vout_display_t *vd, subpicture_t *subpicture) +{ +vout_display_sys_t *sys = vd->sys; + +jobject jsurf = jni_LockAndGetSubtitlesSurface(); +if (sys->window && jsurf != sys->jsurf) +{ +sys->native_window.winRelease(sys->window); +sys->window = NULL; +} +sys->jsurf = jsurf; +if (!sys->window) +{ +JNIEnv *p_env; +(*myVm)->AttachCurrentThread(myVm, &p_env, NULL); +sys->window = sys->native_window.winFromSurface(p_env, jsurf); +(*myVm)->DetachCurrentThread(myVm); +} + +ANativeWindow_Buffer buf = { 0 }; +sys->native_window.winLock(sys->window, &buf, NULL); + +if (buf.width >= sys->fmt.i_width && buf.height >= sys->fmt.i_height) +{ +/* Wrap the NativeWindow corresponding to the subtitles surface in a picture_t */ +picture_t *picture = sys->subtitles_picture; +picture->p[0].p_pixels = (uint8_t*)buf.bits; +picture->p[0].i_lines = buf.height; +picture->p[0].i_pitch = picture->p[0].i_pixel_pitch * buf.stride; +/* Clear the subtitles surface. */ +memset(picture->p[0].p_pixels, 0, picture->p[0].i_pitch * picture->p[0].i_lines); +if (subpicture) +{ +/* Allocate a blending filter if needed. */ +if (unlikely(!sys->p_spu_blend)) +sys->p_spu_blend = filter_NewBlend(VLC_OBJECT(vd), &picture->format); +picture_BlendSubpicture(picture, sys->p_spu_blend, subpicture); +} +} + +sys->native_window.unlockAndPost(sys->window); +jni_UnlockAndroidSurface(); +} + static int LockSurface(picture_t *); static void UnlockSurface(picture_t *); @@ -79,6 +151,22 @@ static int Open(vlc_object_t *p_this) if (!sys) return VLC_ENOMEM; +sys->p_library = LoadNativeWindowAPI(&sys->native_window); +if (!sys->p_library) +{ +free(sys); +msg_Err(vd, "Could not initialize NativeWindow API."); +return VLC_EGENERIC; +} +sys->fmt = fmt; +video_format_t subpicture_format = sys->fmt; +subpicture_format.i_chroma = VLC_CODEC_RGBA; +/* Create a RGBA picture for rendering subtitles. */ +sys->subtitles_picture = picture_NewFromFormat(&subpicture_format); + +/* Export the subpicture capability of this vout. */ +vd->info.subpicture_chromas = subpicture_chromas; + int i_pictures = POOL_SIZE; picture_t** pictures = calloc(sizeof(*pictures), i_pictures); if (!pictures) @@ -141,6 +229,12 @@ static void Close(vlc_object_t *p_this) vout_display_sys_t *sys = vd->sys; picture_pool_Delete(sys->pool); +if (sys->window) +sys->native_window.winRelease(sys->window); +dlclose(sys->p_library); +picture_Release(sys->subtitles_picture); +if (sys->p_spu_blend) +filter_Delet