Re: [FFmpeg-devel] [PATCH v2 4/9] lavc/ccaption_dec: default rollup to row 10

2016-01-13 Thread Anshul


On 13 January 2016 7:12:55 AM IST, Aman Gupta  wrote:
>From: Aman Gupta 
>
>This ensures that captions are written towards the bottom of the screen
>when tuning into mid-stream. The row will be reset on the receipt of
>the
>next PAC command. Row 10 was chosen as it corresponds to the value of
>"0" in a PAC (see row_map in handle_pac()).
>---
> libavcodec/ccaption_dec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>index 6bdd754..8c913fe 100644
>--- a/libavcodec/ccaption_dec.c
>+++ b/libavcodec/ccaption_dec.c
>@@ -148,6 +148,7 @@ static av_cold int init_decoder(AVCodecContext
>*avctx)
> /* taking by default roll up to 2 */
> ctx->mode = CCMODE_ROLLUP;
> ctx->rollup = 2;
>+ctx->cursor_row = 10;
> ret = ff_ass_subtitle_header(avctx, "Monospace",
>  ASS_DEFAULT_FONT_SIZE,
>  ASS_DEFAULT_COLOR,
>@@ -185,7 +186,7 @@ static void flush_decoder(AVCodecContext *avctx)
> ctx->prev_cmd[1] = 0;
> ctx->mode = CCMODE_ROLLUP;
> ctx->rollup = 2;
>-ctx->cursor_row = 0;
>+ctx->cursor_row = 10;
> ctx->cursor_column = 0;
> ctx->cursor_font = 0;
> ctx->cursor_color = 0;


How do you test that rows are captured correctly in ass format?
And subs are actually placed acc to row.


-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 3/9] fate: add test for realtime ccaption decoder

2016-01-13 Thread Anshul


On 13 January 2016 7:12:54 AM IST, Aman Gupta  wrote:
>From: Aman Gupta 
>
>---
> tests/fate/subtitles.mak   |  3 +++
>tests/ref/fate/sub-cc-realtime | 42
>++
> 2 files changed, 45 insertions(+)
> create mode 100644 tests/ref/fate/sub-cc-realtime
>
>diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
>index d273f2e..8aa0279 100644
>--- a/tests/fate/subtitles.mak
>+++ b/tests/fate/subtitles.mak
>@@ -4,6 +4,9 @@ fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc
>windows-1250 -i $(TARGET_SAMP
>FATE_SUBTITLES_ASS-$(call ALLYES, AVDEVICE LAVFI_INDEV CCAPTION_DECODER
>MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc
>fate-sub-cc: CMD = fmtstdout ass -f lavfi -i
>"movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v[out0+subcc]"
> 
>+FATE_SUBTITLES_ASS-$(call ALLYES, AVDEVICE LAVFI_INDEV
>CCAPTION_DECODER MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc-realtime
>+fate-sub-cc-realtime: CMD = fmtstdout ass -real_time 1 -f lavfi -i
>"movie=$(TARGET_SAMPLES)/sub/Closedcaption_rollup.m2v[out0+subcc]"
>+
>FATE_SUBTITLES_ASS-$(call DEMDEC, ASS, ASS) +=
>fate-sub-ass-to-ass-transcode
>fate-sub-ass-to-ass-transcode: CMD = fmtstdout ass -i
>$(TARGET_SAMPLES)/sub/1ededcbd7b.ass
> 
>diff --git a/tests/ref/fate/sub-cc-realtime
>b/tests/ref/fate/sub-cc-realtime
>new file mode 100644
>index 000..0b4037c
>--- /dev/null
>+++ b/tests/ref/fate/sub-cc-realtime
>@@ -0,0 +1,42 @@
>+[Script Info]
>+; Script generated by FFmpeg/Lavc
>+ScriptType: v4.00+
>+PlayResX: 384
>+PlayResY: 288
>+
>+[V4+ Styles]
>+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour,
>OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX,
>ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment,
>MarginL, MarginR, MarginV, Encoding
>+Style:
>Default,Monospace,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,3,1,0,2,10,10,10,0
>+
>+[Events]
>+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV,
>Effect, Text
>+Dialogue: 0,0:00:14.14,999:59:59.99,Default,,0,0,0,,(
>+Dialogue: 0,0:00:15.47,999:59:59.99,Default,,0,0,0,,({\i1} in
>+Dialogue: 0,0:00:15.92,999:59:59.99,Default,,0,0,0,,({\i1} inau
>+Dialogue: 0,0:00:16.36,999:59:59.99,Default,,0,0,0,,({\i1} inaudi
>+Dialogue: 0,0:00:16.81,999:59:59.99,Default,,0,0,0,,({\i1} inaudibl
>+Dialogue: 0,0:00:17.25,999:59:59.99,Default,,0,0,0,,({\i1} inaudible 
>+Dialogue: 0,0:00:17.70,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>ra
>+Dialogue: 0,0:00:18.14,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radi
>+Dialogue: 0,0:00:18.59,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio 
>+Dialogue: 0,0:00:19.03,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio ch
>+Dialogue: 0,0:00:19.48,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chat
>+Dialogue: 0,0:00:19.92,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatte
>+Dialogue: 0,0:00:20.36,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter
>+Dialogue: 0,0:00:21.70,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )
>+Dialogue: 0,0:00:42.61,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>>
>+Dialogue: 0,0:00:43.05,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> S
>+Dialogue: 0,0:00:43.50,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Saf
>+Dialogue: 0,0:00:43.94,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safet
>+Dialogue: 0,0:00:44.39,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety 
>+Dialogue: 0,0:00:44.83,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety re
>+Dialogue: 0,0:00:45.28,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety rema
>+Dialogue: 0,0:00:45.72,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety remain
>+Dialogue: 0,0:00:46.17,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety remains 
>+Dialogue: 0,0:00:46.61,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety remains ou
>+Dialogue: 0,0:00:47.06,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety remains our 
>+Dialogue: 0,0:00:47.50,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety remains our nu
>+Dialogue: 0,0:00:47.95,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety remains our numb
>+Dialogue: 0,0:00:48.39,999:59:59.99,Default,,0,0,0,,({\i1} inaudible
>radio chatter{\i0} )\N>> Safety

Re: [FFmpeg-devel] [PATCH v2 2/9] lavc/ccaption_dec: implement real_time option

2016-01-13 Thread Anshul
en
>+// for our own buffering.
>+if (ctx->real_time) {
>+struct Screen *screen = ctx->screen +
>!ctx->active_screen;
>+screen->row_used = 0;
>+}
>+break;
> case 0x2f:
> /* end of caption */
> ff_dlog(ctx, "handle_eoc\n");
>@@ -562,24 +596,54 @@ static int decode(AVCodecContext *avctx, void
>*data, int *got_sub, AVPacket *avp
> continue;
> else
>process_cc608(ctx, avpkt->pts, *(bptr + i + 1) & 0x7f, *(bptr + i + 2)
>& 0x7f);
>-if (ctx->buffer_changed && *ctx->buffer.str)
>+
>+if (!ctx->buffer_changed)
>+continue;
>+ctx->buffer_changed = 0;
>+
>+if (*ctx->buffer.str || ctx->real_time)
> {
>-int start_time = av_rescale_q(ctx->start_time,
>avctx->time_base, ass_tb);
>-int end_time = av_rescale_q(ctx->end_time,
>avctx->time_base, ass_tb);
>+int64_t sub_pts = ctx->real_time ? avpkt->pts :
>ctx->start_time;
>+int start_time = av_rescale_q(sub_pts, avctx->time_base,
>ass_tb);
>+int duration = 10 * ass_tb.den;
>+if (!ctx->real_time) {
>+int end_time = av_rescale_q(ctx->end_time,
>avctx->time_base, ass_tb);
>+duration = end_time - start_time;
>+}
> ff_dlog(ctx, "cdp writing data (%s)\n",ctx->buffer.str);
>-ret = ff_ass_add_rect_bprint(sub, &ctx->buffer,
>start_time, end_time - start_time);
>+ret = ff_ass_add_rect_bprint(sub, &ctx->buffer,
>start_time, duration);
> if (ret < 0)
> return ret;
>-sub->pts = av_rescale_q(ctx->start_time, avctx->time_base,
>AV_TIME_BASE_Q);
>+sub->pts = av_rescale_q(sub_pts, avctx->time_base,
>AV_TIME_BASE_Q);
> ctx->buffer_changed = 0;
>+ctx->last_real_time = avpkt->pts;
>+ctx->screen_touched = 0;
> }
> }
> 
>+if (ctx->real_time && ctx->screen_touched &&
>+avpkt->pts > ctx->last_real_time + av_rescale_q(20, ass_tb,
>avctx->time_base)) {
>+ctx->last_real_time = avpkt->pts;
>+    ctx->screen_touched = 0;
>+
>+capture_screen(ctx);
>+ctx->buffer_changed = 0;
>+
>+int start_time = av_rescale_q(avpkt->pts, avctx->time_base,
>ass_tb);
>+ret = ff_ass_add_rect_bprint(sub, &ctx->buffer, start_time,
>-1);
>+if (ret < 0)
>+return ret;
>+sub->pts = av_rescale_q(avpkt->pts, avctx->time_base,
>AV_TIME_BASE_Q);
>+}
>+
> *got_sub = sub->num_rects > 0;
> return ret;
> }
> 
>+#define OFFSET(x) offsetof(CCaptionSubContext, x)
>+#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
> static const AVOption options[] = {
>+{ "real_time", "emit subtitle events as they are decoded for
>real-time display", OFFSET(real_time), AV_OPT_TYPE_BOOL, { .i64 = 0 },
>0, 1, SD },
> {NULL}
> };
> 


LGTM.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 1/9] lavc/ccaption_dec: flush context on seek

2016-01-13 Thread Anshul


On 13 January 2016 7:12:52 AM IST, Aman Gupta  wrote:
>From: Aman Gupta 
>
>---
> libavcodec/ccaption_dec.c | 21 +
> 1 file changed, 21 insertions(+)
>
>diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>index ca497e5..a9dfc94 100644
>--- a/libavcodec/ccaption_dec.c
>+++ b/libavcodec/ccaption_dec.c
>@@ -173,6 +173,26 @@ static av_cold int close_decoder(AVCodecContext
>*avctx)
> return 0;
> }
> 
>+static void flush_decoder(AVCodecContext *avctx)
>+{
>+CCaptionSubContext *ctx = avctx->priv_data;
>+ctx->screen[0].row_used = 0;
>+ctx->screen[1].row_used = 0;
>+ctx->prev_cmd[0] = 0;
>+ctx->prev_cmd[1] = 0;
>+ctx->mode = CCMODE_ROLLUP;
>+ctx->rollup = 2;
>+ctx->cursor_row = 0;
>+ctx->cursor_column = 0;
>+ctx->cursor_font = 0;
>+ctx->cursor_color = 0;
>+ctx->active_screen = 0;
>+ctx->last_real_time = 0;
>+ctx->screen_touched = 0;
>+ctx->buffer_changed = 0;
>+av_bprint_clear(&ctx->buffer);
>+}
>+
> /**
>  * @param ctx closed caption context just to print log
>  */
>@@ -578,6 +598,7 @@ AVCodec ff_ccaption_decoder = {
> .priv_data_size = sizeof(CCaptionSubContext),
> .init   = init_decoder,
> .close  = close_decoder,
>+.flush  = flush_decoder,
> .decode = decode,
> .priv_class = &ccaption_dec_class,
> };


LGTM

-Anshul
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavc/ccaption_dec: implement real_time option

2016-01-11 Thread anshul . ffmpeg
EMDEC, ASS, ASS) +=
> fate-sub-ass-to-ass-transcode fate-sub-ass-to-ass-transcode: CMD =
> fmtstdout ass -i $(TARGET_SAMPLES)/sub/1ededcbd7b.ass
> 
> diff --git a/tests/ref/fate/sub-cc-realtime b/tests/ref/fate/sub-cc-realtime
> new file mode 100644
> index 000..4d2f110
> --- /dev/null
> +++ b/tests/ref/fate/sub-cc-realtime
> @@ -0,0 +1,42 @@
> +[Script Info]
> +; Script generated by FFmpeg/Lavc
> +ScriptType: v4.00+
> +PlayResX: 384
> +PlayResY: 288
> +
> +[V4+ Styles]
> +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour,
> OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX,
> ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL,
> MarginR, MarginV, Encoding +Style:
> Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,1
> 0,10,0 +
> +[Events]
> +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect,
> Text +Dialogue: 0,0:00:14.14,9:59:59.99,Default,,0,0,0,,(
> +Dialogue: 0,0:00:15.47,9:59:59.99,Default,,0,0,0,,({/i1} in
> +Dialogue: 0,0:00:15.92,9:59:59.99,Default,,0,0,0,,({/i1} inau
> +Dialogue: 0,0:00:16.36,9:59:59.99,Default,,0,0,0,,({/i1} inaudi
> +Dialogue: 0,0:00:16.81,9:59:59.99,Default,,0,0,0,,({/i1} inaudibl
> +Dialogue: 0,0:00:17.25,9:59:59.99,Default,,0,0,0,,({/i1} inaudible
> +Dialogue: 0,0:00:17.70,9:59:59.99,Default,,0,0,0,,({/i1} inaudible ra
> +Dialogue: 0,0:00:18.14,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radi
> +Dialogue: 0,0:00:18.59,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio
> +Dialogue: 0,0:00:19.03,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio ch
> +Dialogue: 0,0:00:19.48,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio
> chat +Dialogue: 0,0:00:19.92,9:59:59.99,Default,,0,0,0,,({/i1} inaudible
> radio chatte +Dialogue: 0,0:00:20.36,9:59:59.99,Default,,0,0,0,,({/i1}
> inaudible radio chatter +Dialogue:
> 0,0:00:21.70,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> ) +Dialogue: 0,0:00:42.61,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio
> chatter{/i0} )\N>> +Dialogue:
> 0,0:00:43.05,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> S +Dialogue: 0,0:00:43.50,9:59:59.99,Default,,0,0,0,,({/i1} inaudible
> radio chatter{/i0} )\N>> Saf +Dialogue:
> 0,0:00:43.94,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safet +Dialogue: 0,0:00:44.39,9:59:59.99,Default,,0,0,0,,({/i1}
> inaudible radio chatter{/i0} )\N>> Safety +Dialogue:
> 0,0:00:44.83,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety re +Dialogue: 0,0:00:45.28,9:59:59.99,Default,,0,0,0,,({/i1}
> inaudible radio chatter{/i0} )\N>> Safety rema +Dialogue:
> 0,0:00:45.72,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remain +Dialogue:
> 0,0:00:46.17,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains +Dialogue:
> 0,0:00:46.61,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains ou +Dialogue:
> 0,0:00:47.06,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains our +Dialogue:
> 0,0:00:47.50,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains our nu +Dialogue:
> 0,0:00:47.95,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains our numb +Dialogue:
> 0,0:00:48.39,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains our number +Dialogue:
> 0,0:00:48.84,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains our number o +Dialogue:
> 0,0:00:49.28,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio chatter{/i0}
> )\N>> Safety remains our number one


Unable to apply, I get following errors.
anshul@linux-kiran:~/Project/FFmpeg> git am ~/Documents/\[FFmpeg-devel\]\ 
\[PATCH\ 2_2\]\ lavc_ccaption_dec_implement\ real_time\ option.mbox
Applying: lavc/ccaption_dec: implement real_time option
/home/anshul/Project/FFmpeg/.git/rebase-apply/patch:206: trailing whitespace.
Dialogue: 0,0:00:17.25,9:59:59.99,Default,,0,0,0,,({/i1} inaudible 
/home/anshul/Project/FFmpeg/.git/rebase-apply/patch:209: trailing whitespace.
Dialogue: 0,0:00:18.59,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio 
/home/anshul/Project/FFmpeg/.git/rebase-apply/patch:219: trailing whitespace.
Dialogue: 0,0:00:44.39,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio 
chatter{/i0} )\N>> Safety 
/home/anshul/Project/FFmpeg/.git/rebase-apply/patch:223: trailing whitespace.
Dialogue: 0,0:00:46.17,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio 
chatter{/i0} )\N>> Safety remains 
/home/anshul/Project/FFmpeg/.git/rebase-apply/patch:225: trailing whitespace.
Dialogue: 0,0:00:47.06,9:59:59.99,Default,,0,0,0,,({/i1} inaudible radio 
chatter{/i0} )\N>> Safety remains our 
warning: 5 lines add whitespace errors.


These errors are all from test file, can you tell me your github fork url

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/ccaption_dec: remove unnecessary buffering of closed caption packets

2016-01-08 Thread Anshul


On 8 January 2016 5:27:37 pm IST, "Clément Bœsch"  wrote:
>On Fri, Jan 08, 2016 at 05:24:15PM +0530, Anshul wrote:
>> 
>> 
>> On 6 January 2016 1:55:27 am IST, "Clément Bœsch"  wrote:
>> >On Sun, Jan 03, 2016 at 01:07:15PM +0100, Clément Bœsch wrote:
>> >[...]
>> >> This indeed LGTM, but I'm not the maintainer.
>> >> 
>> >
>> >OK I finally understood why it's done that way:
>validate_cc_data_pair()
>> >alters the pkt data, but the decoder isn't supposed to do that.
>> >
>> >So this patch is actually incorrect in this state.
>> 
>> 
>> I did not knew, what could be the disadvantage of changing pkt data,
>I
>> changed it to save some CPU cycles.
>
>The packet is considered read-only for the decoder. It appears not to
>be
>marked as const for whatever bad reason.
>
>But what CPU cycles would you be saving anyway here? I don't see what
>operation you are saving.
>
>[...]

Not much, just bitwise operations to discard parity bit, every time for 
conversion and comparison.

-Anshul

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/ccaption_dec: remove unnecessary buffering of closed caption packets

2016-01-08 Thread Anshul


On 6 January 2016 1:55:27 am IST, "Clément Bœsch"  wrote:
>On Sun, Jan 03, 2016 at 01:07:15PM +0100, Clément Bœsch wrote:
>[...]
>> This indeed LGTM, but I'm not the maintainer.
>> 
>
>OK I finally understood why it's done that way: validate_cc_data_pair()
>alters the pkt data, but the decoder isn't supposed to do that.
>
>So this patch is actually incorrect in this state.


I did not knew, what could be the disadvantage of changing pkt data, I changed 
it to save some CPU cycles.

But I can change it, if there is any disadvantage.

Over there I have just removed parity bit

-Anshul
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 04/10] libavcodec/ccaption_dec: reap_screen after flipping on EOC

2016-01-08 Thread Anshul Maheshwari
On Thu, Jan 7, 2016 at 6:14 AM, Aman Gupta  wrote:

> Probably should have written a longer commit message here. The EOC command
> stands for "end of caption" aka "display buffer". It's used with POPON
> mode, where characters are written to an off-screen buffer and EOC flips
> the buffers to display what has been written so far. Thus, it makes sense
> to reap the screen *after* flipping the active screen, not *before*.
>
> The previous behavior was simply wrong, but masked by other bugs also
> fixed in this patchset.
>
> Aman
>
> On Tue, Jan 5, 2016 at 11:41 PM, Aman Gupta  wrote:
>
>> From: Aman Gupta 
>>
>> ---
>>  libavcodec/ccaption_dec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>> index 9f17e77..5d4c568 100644
>> --- a/libavcodec/ccaption_dec.c
>> +++ b/libavcodec/ccaption_dec.c
>> @@ -399,9 +399,9 @@ static void handle_erase(CCaptionSubContext *ctx, int
>> n_screen)
>>
>>  static void handle_eoc(CCaptionSubContext *ctx)
>>  {
>> -reap_screen(ctx);
>>  ctx->active_screen = !ctx->active_screen;
>>  ctx->cursor_column = 0;
>> +reap_screen(ctx);
>>  }
>>
>>  static void handle_delete_end_of_row(CCaptionSubContext *ctx, char hi,
>> char lo)
>> --
>> 2.5.3
>>
>>
> I dont see it as bug, this problem comes because of change in 02/10 patch.

handle_eoc always called handle_edm, am I missing some patch?

how does it matter, since this code has to be exectued sequentially? reap
before or after I see them  at same instant or at same command.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 03/10] libavcodec/ccaption_dec: add calculate_duration option

2016-01-08 Thread Anshul Maheshwari
On Fri, Jan 8, 2016 at 3:51 PM, Anshul Maheshwari 
wrote:

>
>
> On Thu, Jan 7, 2016 at 6:10 AM, Aman Gupta  wrote:
>
> > Aman Gupta  wrote:
>> > > --- a/libavcodec/ccaption_dec.c
>> > > +++ b/libavcodec/ccaption_dec.c
>> > > @@ -150,6 +150,7 @@ struct Screen {
>> > >
>> > >  typedef struct CCaptionSubContext {
>> > >  AVClass *class;
>> > > +int calculate_duration;
>> > >  struct Screen screen[2];
>> > >  int active_screen;
>> > >  uint8_t cursor_row;
>> > > @@ -545,8 +546,12 @@ static int decode(AVCodecContext *avctx, void
>> > *data, int *got_sub, AVPacket *avp
>> > >  continue;
>> > >  else
>> > >  process_cc608(ctx, *(bptr + i + 1) & 0x7f, *(bptr + i +
>> 2)
>> > & 0x7f);
>> > > -if (ctx->screen_changed)
>> > > -{
>> > > +
>> > > +if (!ctx->screen_changed)
>> > > +continue;
>> > > +ctx->screen_changed = 0;
>> > > +
>> > > +if (ctx->calculate_duration) {
>> > >  if (ctx->prev_string) {
>> > >  int start_time = av_rescale_q(ctx->prev_time,
>> > avctx->time_base, (AVRational){ 1, 100 });
>> > >  int end_time = av_rescale_q(avpkt->pts,
>> > avctx->time_base, (AVRational){ 1, 100 });
>> > > @@ -560,7 +565,12 @@ static int decode(AVCodecContext *avctx, void
>> > *data, int *got_sub, AVPacket *avp
>> > >  av_bprintf(&ctx->buffer, "\r\n");
>> > >  ctx->prev_string = av_strdup(ctx->buffer.str);
>> > >  ctx->prev_time = avpkt->pts;
>> > > -ctx->screen_changed = 0;
>> > > +} else {
>> > > +int start_time = av_rescale_q(avpkt->pts,
>> avctx->time_base,
>> > (AVRational){ 1, 100 });
>> > > +ret = ff_ass_add_rect_bprint(sub, &ctx->buffer,
>> start_time,
>> > -1);
>>
> Is it possible to check the length of buffer, and avoid empty frames.
>

No need, I did understood that they are needed.

>
> > > +if (ret < 0)
>> > > +return ret;
>> > > +sub->pts = av_rescale_q(avpkt->pts, avctx->time_base,
>> > AV_TIME_BASE_Q);
>> > >  }
>> > >  }
>> > >
>> > > @@ -568,7 +578,10 @@ static int decode(AVCodecContext *avctx, void
>> > *data, int *got_sub, AVPacket *avp
>> > >  return ret;
>> > >  }
>> > >
>> > > +#define OFFSET(x) offsetof(CCaptionSubContext, x)
>> > > +#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
>> > >  static const AVOption options[] = {
>> > > +{ "calculate_duration", "Buffer closed captions to calculate
>> > durations.", OFFSET(calculate_duration), AV_OPT_TYPE_BOOL, { .i64 = 1
>> }, 0,
>> > 1, SD },
>> > >  {NULL}
>> > >  };
>> > >
>> >
>>
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 03/10] libavcodec/ccaption_dec: add calculate_duration option

2016-01-08 Thread Anshul Maheshwari
On Thu, Jan 7, 2016 at 6:10 AM, Aman Gupta  wrote:

> > Aman Gupta  wrote:
> > > --- a/libavcodec/ccaption_dec.c
> > > +++ b/libavcodec/ccaption_dec.c
> > > @@ -150,6 +150,7 @@ struct Screen {
> > >
> > >  typedef struct CCaptionSubContext {
> > >  AVClass *class;
> > > +int calculate_duration;
> > >  struct Screen screen[2];
> > >  int active_screen;
> > >  uint8_t cursor_row;
> > > @@ -545,8 +546,12 @@ static int decode(AVCodecContext *avctx, void
> > *data, int *got_sub, AVPacket *avp
> > >  continue;
> > >  else
> > >  process_cc608(ctx, *(bptr + i + 1) & 0x7f, *(bptr + i + 2)
> > & 0x7f);
> > > -if (ctx->screen_changed)
> > > -{
> > > +
> > > +if (!ctx->screen_changed)
> > > +continue;
> > > +ctx->screen_changed = 0;
> > > +
> > > +if (ctx->calculate_duration) {
> > >  if (ctx->prev_string) {
> > >  int start_time = av_rescale_q(ctx->prev_time,
> > avctx->time_base, (AVRational){ 1, 100 });
> > >  int end_time = av_rescale_q(avpkt->pts,
> > avctx->time_base, (AVRational){ 1, 100 });
> > > @@ -560,7 +565,12 @@ static int decode(AVCodecContext *avctx, void
> > *data, int *got_sub, AVPacket *avp
> > >  av_bprintf(&ctx->buffer, "\r\n");
> > >  ctx->prev_string = av_strdup(ctx->buffer.str);
> > >  ctx->prev_time = avpkt->pts;
> > > -ctx->screen_changed = 0;
> > > +} else {
> > > +int start_time = av_rescale_q(avpkt->pts,
> avctx->time_base,
> > (AVRational){ 1, 100 });
> > > +ret = ff_ass_add_rect_bprint(sub, &ctx->buffer,
> start_time,
> > -1);
>
Is it possible to check the length of buffer, and avoid empty frames.

> > > +if (ret < 0)
> > > +return ret;
> > > +sub->pts = av_rescale_q(avpkt->pts, avctx->time_base,
> > AV_TIME_BASE_Q);
> > >  }
> > >  }
> > >
> > > @@ -568,7 +578,10 @@ static int decode(AVCodecContext *avctx, void
> > *data, int *got_sub, AVPacket *avp
> > >  return ret;
> > >  }
> > >
> > > +#define OFFSET(x) offsetof(CCaptionSubContext, x)
> > > +#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
> > >  static const AVOption options[] = {
> > > +{ "calculate_duration", "Buffer closed captions to calculate
> > durations.", OFFSET(calculate_duration), AV_OPT_TYPE_BOOL, { .i64 = 1 },
> 0,
> > 1, SD },
> > >  {NULL}
> > >  };
> > >
> >
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] libavcodec/ccaption_dec: remove unnecessary include

2016-01-07 Thread Anshul Maheshwari
On Tue, Jan 5, 2016 at 8:58 AM, Aman Gupta  wrote:

> From: Aman Gupta 
>
> ---
>  libavcodec/ccaption_dec.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> index 9f67caa..4e478e0 100644
> --- a/libavcodec/ccaption_dec.c
> +++ b/libavcodec/ccaption_dec.c
> @@ -21,7 +21,6 @@
>
>  #include "avcodec.h"
>  #include "ass.h"
> -#include "libavutil/internal.h"
>  #include "libavutil/opt.h"
>
>  #define SCREEN_ROWS 15
> --
> 2.5.3
>
>
LGTM

-- 
with regards
Anshul
:)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] libavcodec/ccaption_dec: clean up and standardize white space

2016-01-07 Thread Anshul Maheshwari
le_eoc(CCaptionSubContext *ctx,
> int64_t pts)
>  return ret;
>  }
>
> -static void handle_delete_end_of_row( CCaptionSubContext *ctx, char hi,
> char lo)
> +static void handle_delete_end_of_row(CCaptionSubContext *ctx, char hi,
> char lo)
>  {
>  struct Screen *screen = get_writing_screen(ctx);
>  char *row = screen->characters[ctx->cursor_row];
>  write_char(ctx, row, ctx->cursor_column, 0);
> -
>  }
>
>  static void handle_char(CCaptionSubContext *ctx, char hi, char lo,
> int64_t pts)
> @@ -437,12 +431,12 @@ static void handle_char(CCaptionSubContext *ctx,
> char hi, char lo, int64_t pts)
>  SET_FLAG(screen->row_used,ctx->cursor_row);
>
>  ret = write_char(ctx, row, ctx->cursor_column, hi);
> -if( ret == 0 )
> +if (ret == 0)
>  ctx->cursor_column++;
>
> -if(lo) {
> +if (lo) {
>  ret = write_char(ctx, row, ctx->cursor_column, lo);
> -if ( ret == 0 )
> +if (ret == 0)
>  ctx->cursor_column++;
>  }
>  write_char(ctx, row, ctx->cursor_column, 0);
> @@ -451,16 +445,16 @@ static void handle_char(CCaptionSubContext *ctx,
> char hi, char lo, int64_t pts)
>  ctx->prev_cmd[0] = 0;
>  ctx->prev_cmd[1] = 0;
>  if (lo)
> -   ff_dlog(ctx, "(%c,%c)\n",hi,lo);
> +   ff_dlog(ctx, "(%c,%c)\n", hi, lo);
>  else
> -   ff_dlog(ctx, "(%c)\n",hi);
> +   ff_dlog(ctx, "(%c)\n", hi);
>  }
>
>  static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t
> hi, uint8_t lo)
>  {
>  int ret = 0;
>  #define COR3(var, with1, with2, with3)  ( (var) == (with1) ||  (var) ==
> (with2) || (var) == (with3) )
> -if ( hi == ctx->prev_cmd[0] && lo == ctx->prev_cmd[1]) {
> +if (hi == ctx->prev_cmd[0] && lo == ctx->prev_cmd[1]) {
>  /* ignore redundant command */
>  } else if ( (hi == 0x10 && (lo >= 0x40 || lo <= 0x5f)) ||
>( (hi >= 0x11 && hi <= 0x17) && (lo >= 0x40 && lo <= 0x7f)
> ) ) {
> @@ -511,12 +505,11 @@ static int process_cc608(CCaptionSubContext *ctx,
> int64_t pts, uint8_t hi, uint8
>  }
>
>  /* set prev command */
> - ctx->prev_cmd[0] = hi;
> - ctx->prev_cmd[1] = lo;
> +ctx->prev_cmd[0] = hi;
> +ctx->prev_cmd[1] = lo;
>
>  #undef COR3
>  return ret;
> -
>  }
>
>  static int decode(AVCodecContext *avctx, void *data, int *got_sub,
> AVPacket *avpkt)
> @@ -528,9 +521,9 @@ static int decode(AVCodecContext *avctx, void *data,
> int *got_sub, AVPacket *avp
>  int ret = 0;
>  int i;
>
> -if ( ctx->pktbuf->size < len) {
> +if (ctx->pktbuf->size < len) {
>  ret = av_buffer_realloc(&ctx->pktbuf, len);
> - if(ret < 0) {
> + if (ret < 0) {
>  av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d
> truncated to %d\n",len, ctx->pktbuf->size);
>  len = ctx->pktbuf->size;
>  ret = 0;
> @@ -539,17 +532,16 @@ static int decode(AVCodecContext *avctx, void *data,
> int *got_sub, AVPacket *avp
>  memcpy(ctx->pktbuf->data, avpkt->data, len);
>  bptr = ctx->pktbuf->data;
>
> -
>  for (i  = 0; i < len; i += 3) {
>  uint8_t cc_type = *(bptr + i) & 3;
> -if (validate_cc_data_pair( bptr + i) )
> +if (validate_cc_data_pair(bptr + i))
>  continue;
>  /* ignoring data field 1 */
>  if(cc_type == 1)
>  continue;
>  else
>  process_cc608(ctx, avpkt->pts, *(bptr + i + 1) & 0x7f, *(bptr
> + i + 2) & 0x7f);
> -if(ctx->screen_changed && *ctx->buffer.str)
> +if (ctx->screen_changed && *ctx->buffer.str)
>  {
>  int start_time = av_rescale_q(ctx->start_time,
> avctx->time_base, (AVRational){ 1, 100 });
>  int end_time = av_rescale_q(ctx->end_time, avctx->time_base,
> (AVRational){ 1, 100 });
> --
> 2.5.3
>
>
LGTM

-- 
with regards
Anshul
:)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] HLS webVtt in unfavorable conditions

2015-12-13 Thread Anshul

Hello,

Its regarding ticket #5067(avformat:open): crash on Mapping Multicast TV 
Stream to HLS with "Exactly one WebVTT stream is needed" as message


I have attached patch for hls not failing in condition where subtitles 
streams are of bitmap type and ts containing data streams mapped to output.


But this patch have side effect, that user is not warned that stream 
that are shown as mapped in logs are actually ignored by hls segmeter.


I have not added errors/warning about ignoring streams, since I was 
unable to decide whether they should be warning or error.


Thanks
Anshul Maheshwari

>From e266babd729f1ed90c8956090f9e9658c85e13a9 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Sun, 13 Dec 2015 20:45:02 +0530
Subject: [PATCH] hls supports only webVTT as subtitles

Signed-off-by: Anshul Maheshwari 
---
 libavformat/hlsenc.c | 26 +-
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index adcf7df..0bbea39 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -285,10 +285,13 @@ static int hls_mux_init(AVFormatContext *s)
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st;
 AVFormatContext *loc;
-if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
+if (s->streams[i]->codec->codec_id == AV_CODEC_ID_WEBVTT)
 loc = vtt_oc;
-else
+else if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
+s->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
 loc = oc;
+else
+continue;
 
 if (!(st = avformat_new_stream(loc, NULL)))
 return AVERROR(ENOMEM);
@@ -612,7 +615,7 @@ static int hls_write_header(AVFormatContext *s)
 hls->has_video +=
 s->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO;
 hls->has_subtitle +=
-s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE;
+s->streams[i]->codec->codec_id == AV_CODEC_ID_WEBVTT;
 }
 
 if (hls->has_video > 1)
@@ -714,10 +717,11 @@ static int hls_write_header(AVFormatContext *s)
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *inner_st;
 AVStream *outer_st = s->streams[i];
-if (outer_st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE)
-inner_st = hls->avf->streams[i];
-else if (hls->vtt_avf)
+if (hls->vtt_avf && outer_st->codec->codec_id == AV_CODEC_ID_WEBVTT)
 inner_st = hls->vtt_avf->streams[0];
+else if(outer_st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
+   outer_st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
+inner_st = hls->avf->streams[i];
 else {
 /* We have a subtitle stream, when the user does not want one */
 inner_st = NULL;
@@ -750,13 +754,17 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
 int ret, can_split = 1;
 int stream_index = 0;
 
-if( st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE ) {
+if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
+   st->codec->codec_type == AVMEDIA_TYPE_AUDIO ) {
+oc = hls->avf;
+stream_index = pkt->stream_index;
+} else if( hls->vtt_avf && st->codec->codec_id == AV_CODEC_ID_WEBVTT) {
 oc = hls->vtt_avf;
 stream_index = 0;
 } else {
-oc = hls->avf;
-stream_index = pkt->stream_index;
+	return 0;
 }
+
 if (hls->start_pts == AV_NOPTS_VALUE) {
 hls->start_pts = pkt->pts;
 hls->end_pts   = pkt->pts;
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] MXF: Multiple Entry with same desc

2015-12-06 Thread Anshul

Hello,

There were multiple entry of same descriptor, I have kept entry with /* 
MPEG2VideoDescriptor */ comment

and removed other one.

Attached patch for same.

Thanks
Anshul
>From 88836433c9d4bc66aaeb1143f7af6e4fa93656d8 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Sun, 6 Dec 2015 23:52:15 +0530
Subject: [PATCH] Remove Redundant Entry of MPEG2 Video Desc

Signed-off-by: Anshul Maheshwari 
---
 libavformat/mxfdec.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 6b1c654..0e055fd 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2279,7 +2279,6 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x42,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* Generic Sound */
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x28,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* CDCI */
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x29,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* RGBA */
-{ { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* MPEG 2 Video */
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x48,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* Wave */
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x47,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* AES3 */
 { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* MPEG2VideoDescriptor */
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Proposed vf_decimate enhancement

2015-09-29 Thread Anshul



On 09/29/2015 12:46 PM, Paul B Mahol wrote:

On 9/29/15, Ray Cole  wrote:

I hope this is the appropriate place to propose an enhancement. This is the
first time I've offered up code to any open source project...so be gentle
:-)

First, I love ffmpeg. Wonderful software and thank you for your efforts.

I have been pulling down a number of movies back to 24 FPS (24000/1001)
using fieldmatch and decimate. However decimate seemed to drop incorrect
frames from time-to-time particularly on scenes with little motion. The
pullup filter likewise made poor decisions under similar circumstances.

So...I modified vf_decimate and it is working very well for me. I make no
claims that the enhancements would work for anyone else. My source is 1080i
29.97 fps movies recording from component video. I'm pulling down to 24 fps
(24000/1001 actually).

The changes are:
1) The total and max diffs are used to find the lowest frame to drop rather
than just the max diff. If these two methods disagree with one another then
it goes through a 'conflict resolution'. The conflict resolution checks to
see if either method matches the most commonly-dropped frame (a simple
short-term history of drops is retained for this purpose). If so, the most
commonly-dropped frame is assumed to be correct. If they do not match then
it uses the last dropped frame. This keeps the filter from varying the frame
drop so often and made a big difference in detection, at least with the
stuff I'm working with.

2) The existing vf_decimate allows frame 4 to be dropped immediately
followed by frame 0 whereas frame 3 dropped could never be followed by frame
4 dropped - similar with frames 0 through 2. Having 2 frames in a row
eligible to be dropped seems wrong and the biggest issue I had was when the
drop cycle was hitting frame 4. So I put in some code that says if the last
frame dropped was frame 4 then frame 0 and frame 1 is not eligible for drop.
If frame 3 was last dropped then frame 0 is not dropped. This enforces 2
undropped frames between drops. I'm not "married" to this...but it did help
quite a bit.

3) I had one movie where frame 4 was ALWAYS the correct frame to drop...so I
added an option to 'lock on' to a pattern in 1 of 2 ways. The first way is
for someone to pass force_drop=x where x is the frame number to drop each
time. The other is passing lock_on=1 to tell it to figure out what frame it
should lock onto. I mainly used this to assist in finding places where the
code was dropping incorrect frames. I'm not sure I really consider this
'useful' for anything other than such testing where you know what should be
dropped. It still goes through all the computations as before but insists on
dropping the specified frame and noting if the computations resulted in a
different frame than requested.

I realize the attached code needs cleanup to conform to standards but I just
wanted to put it up for discussion. The first change above is really the
major change and it could (obviously) be enabled/disabled by an option to
decimate if desired.

-- Ray Cole


Whole file is unacceptable, how one can find what changed?, please
learn how to produce patches.

To produce patch
Hint: > git add
    > git commit
> git send mail or > git format   patch

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source

2015-09-26 Thread Anshul



On 09/26/2015 04:16 PM, Anshul wrote:



On 09/26/2015 03:57 PM, DeHackEd wrote:

On 09/26/2015 05:26 AM, Anshul wrote:


On 09/26/2015 05:46 AM, DeHackEd wrote:

Assumes 'GA94' format (ATSC standard)

Signed-off-by: DHE 
---
   doc/encoders.texi|  5 +
   libavcodec/libx264.c | 37 +
   2 files changed, 42 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 3550bcc..bb16dea 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2069,6 +2069,11 @@ For example to specify libx264 encoding 
options with @command{ffmpeg}:
   ffmpeg -i foo.mpg -vcodec libx264 -x264opts 
keyint=123:min-keyint=20 -an out.mkv

   @end example

+@item a53cc
+Import closed captions (which must be ATSC compatible format) into 
output.

+Only the mpeg2 and h264 decoders provide these. Default is 0 (off).
+
+
   @item x264-params (N.A.)
   Override the x264 configuration using a :-separated list of 
key=value

   parameters.
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 58fcfb0..4227bcc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -83,6 +83,7 @@ typedef struct X264Context {
   int avcintra_class;
   int motion_est;
   int forced_idr;
+int a53_cc;
   char *x264_params;
   } X264Context;

@@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, 
AVPacket *pkt, const AVFrame *frame,

   int nnal, i, ret;
   x264_picture_t pic_out = {0};
   int pict_type;
+AVFrameSideData *side_data;

   x264_picture_init( &x4->pic );
   x4->pic.img.i_csp   = x4->params.i_csp;
@@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, 
AVPacket *pkt, const AVFrame *frame,

X264_TYPE_AUTO;

   reconfig_encoder(ctx, frame);
+
+if (x4->a53_cc) {
+side_data = av_frame_get_side_data(frame, 
AV_FRAME_DATA_A53_CC);

+if (side_data) {
+x4->pic.extra_sei.num_payloads = 1;
+x4->pic.extra_sei.payloads = 
av_mallocz(sizeof(x4->pic.extra_sei.payloads[0]));

+x4->pic.extra_sei.sei_free = av_free;
+
+ x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 11;
+x4->pic.extra_sei.payloads[0].payload = 
av_mallocz(x4->pic.extra_sei.payloads[0].payload_size);

+ x4->pic.extra_sei.payloads[0].payload_type = 4;
+ memcpy(x4->pic.extra_sei.payloads[0].payload + 10, 
side_data->data, side_data->size);

+x4->pic.extra_sei.payloads[0].payload[0] = 181;
+x4->pic.extra_sei.payloads[0].payload[1] = 0;
+x4->pic.extra_sei.payloads[0].payload[2] = 49;
+
+/**
+ * 'GA94' is standard in North America for ATSC, 
but hard coding
+ * this style may not be the right thing to do -- 
other formats
+ * do exist. This information is not available in 
the side_data

+ * so we are going with this right now.
+ */
I think GA94 is correct for this situation, since in our x264 
decoder we don't consider any other standard

for extracting closed caption.

I don't know if we have any logic which differentiate between ATSC, 
ISDB or DVB we parse all transport stream
in same manner. if someone know where we differentiate atsc and dvb 
in FFmpeg please point me there.


Note: This logic will also fail when x264 is muxed in formats like 
gxf where closed caption are kept in vbi instead

of GA94.

Overall  LGTM.

I don't know how to apply encrypted mails using git, and when I save 
your email in Thunderbird, git am is unable to apply.
if you can send the same patch as attachment or command to convert 
encrypted .eml file to normal patch I would test this

too.
I think the easiest solution is to grab the patch from the github 
repo I use:

https://github.com/DeHackEd/FFmpeg/commit/16b4c7fc2311d672e99f.patch
anshul@linux-z9q9:~/Project/Multimedia/FFmpeg> git apply 
16b4c7fc2311d672e99f.patch

16b4c7fc2311d672e99f.patch:54: trailing whitespace.

16b4c7fc2311d672e99f.patch:75: trailing whitespace.
 */
16b4c7fc2311d672e99f.patch:81: trailing whitespace.
    x4->pic.extra_sei.payloads[0].payload[8] =
warning: 3 lines add whitespace errors.
anshul@linux-z9q9:~/Project/Multimedia/FFmpeg>

Though I have fixed it at my end to test, but my advice that you fix 
it too and send another patch.



It works fine for me.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source

2015-09-26 Thread Anshul



On 09/26/2015 03:57 PM, DeHackEd wrote:

On 09/26/2015 05:26 AM, Anshul wrote:


On 09/26/2015 05:46 AM, DeHackEd wrote:

Assumes 'GA94' format (ATSC standard)

Signed-off-by: DHE 
---
   doc/encoders.texi|  5 +
   libavcodec/libx264.c | 37 +
   2 files changed, 42 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 3550bcc..bb16dea 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with 
@command{ffmpeg}:
   ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an 
out.mkv
   @end example

+@item a53cc
+Import closed captions (which must be ATSC compatible format) into output.
+Only the mpeg2 and h264 decoders provide these. Default is 0 (off).
+
+
   @item x264-params (N.A.)
   Override the x264 configuration using a :-separated list of key=value
   parameters.
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 58fcfb0..4227bcc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -83,6 +83,7 @@ typedef struct X264Context {
   int avcintra_class;
   int motion_est;
   int forced_idr;
+int a53_cc;
   char *x264_params;
   } X264Context;

@@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
   int nnal, i, ret;
   x264_picture_t pic_out = {0};
   int pict_type;
+AVFrameSideData *side_data;

   x264_picture_init( &x4->pic );
   x4->pic.img.i_csp   = x4->params.i_csp;
@@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
   X264_TYPE_AUTO;

   reconfig_encoder(ctx, frame);
+
+if (x4->a53_cc) {
+side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC);
+if (side_data) {
+x4->pic.extra_sei.num_payloads = 1;
+x4->pic.extra_sei.payloads = 
av_mallocz(sizeof(x4->pic.extra_sei.payloads[0]));
+x4->pic.extra_sei.sei_free = av_free;
+
+x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 
11;
+x4->pic.extra_sei.payloads[0].payload = 
av_mallocz(x4->pic.extra_sei.payloads[0].payload_size);
+x4->pic.extra_sei.payloads[0].payload_type = 4;
+memcpy(x4->pic.extra_sei.payloads[0].payload + 10, 
side_data->data, side_data->size);
+x4->pic.extra_sei.payloads[0].payload[0] = 181;
+x4->pic.extra_sei.payloads[0].payload[1] = 0;
+x4->pic.extra_sei.payloads[0].payload[2] = 49;
+
+/**
+ * 'GA94' is standard in North America for ATSC, but hard 
coding
+ * this style may not be the right thing to do -- other formats
+ * do exist. This information is not available in the side_data
+ * so we are going with this right now.
+ */

I think GA94 is correct for this situation, since in our x264 decoder we don't 
consider any other standard
for extracting closed caption.

I don't know if we have any logic which differentiate between ATSC, ISDB or DVB 
we parse all transport stream
in same manner. if someone know where we differentiate atsc and dvb in FFmpeg 
please point me there.

Note: This logic will also fail when x264 is muxed in formats like gxf where 
closed caption are kept in vbi instead
of GA94.

Overall  LGTM.

I don't know how to apply encrypted mails using git, and when I save your email 
in Thunderbird, git am is unable to apply.
if you can send the same patch as attachment or command to convert encrypted 
.eml file to normal patch I would test this
too.

I think the easiest solution is to grab the patch from the github repo I use:
https://github.com/DeHackEd/FFmpeg/commit/16b4c7fc2311d672e99f.patch
anshul@linux-z9q9:~/Project/Multimedia/FFmpeg> git apply 
16b4c7fc2311d672e99f.patch

16b4c7fc2311d672e99f.patch:54: trailing whitespace.

16b4c7fc2311d672e99f.patch:75: trailing whitespace.
 */
16b4c7fc2311d672e99f.patch:81: trailing whitespace.
    x4->pic.extra_sei.payloads[0].payload[8] =
warning: 3 lines add whitespace errors.
anshul@linux-z9q9:~/Project/Multimedia/FFmpeg>

Though I have fixed it at my end to test, but my advice that you fix it 
too and send another patch.


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libx264: copy A53 closed captions from source

2015-09-26 Thread Anshul



On 09/26/2015 05:46 AM, DeHackEd wrote:

Assumes 'GA94' format (ATSC standard)

Signed-off-by: DHE 
---
  doc/encoders.texi|  5 +
  libavcodec/libx264.c | 37 +
  2 files changed, 42 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 3550bcc..bb16dea 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2069,6 +2069,11 @@ For example to specify libx264 encoding options with 
@command{ffmpeg}:
  ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an 
out.mkv
  @end example

+@item a53cc
+Import closed captions (which must be ATSC compatible format) into output.
+Only the mpeg2 and h264 decoders provide these. Default is 0 (off).
+
+
  @item x264-params (N.A.)
  Override the x264 configuration using a :-separated list of key=value
  parameters.
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 58fcfb0..4227bcc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -83,6 +83,7 @@ typedef struct X264Context {
  int avcintra_class;
  int motion_est;
  int forced_idr;
+int a53_cc;
  char *x264_params;
  } X264Context;

@@ -256,6 +257,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
  int nnal, i, ret;
  x264_picture_t pic_out = {0};
  int pict_type;
+AVFrameSideData *side_data;

  x264_picture_init( &x4->pic );
  x4->pic.img.i_csp   = x4->params.i_csp;
@@ -278,6 +280,40 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, 
const AVFrame *frame,
  X264_TYPE_AUTO;

  reconfig_encoder(ctx, frame);
+
+if (x4->a53_cc) {
+side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_A53_CC);
+if (side_data) {
+x4->pic.extra_sei.num_payloads = 1;
+x4->pic.extra_sei.payloads = 
av_mallocz(sizeof(x4->pic.extra_sei.payloads[0]));
+x4->pic.extra_sei.sei_free = av_free;
+
+x4->pic.extra_sei.payloads[0].payload_size = side_data->size + 
11;
+x4->pic.extra_sei.payloads[0].payload = 
av_mallocz(x4->pic.extra_sei.payloads[0].payload_size);
+x4->pic.extra_sei.payloads[0].payload_type = 4;
+memcpy(x4->pic.extra_sei.payloads[0].payload + 10, 
side_data->data, side_data->size);
+x4->pic.extra_sei.payloads[0].payload[0] = 181;
+x4->pic.extra_sei.payloads[0].payload[1] = 0;
+x4->pic.extra_sei.payloads[0].payload[2] = 49;
+
+/**
+ * 'GA94' is standard in North America for ATSC, but hard 
coding
+ * this style may not be the right thing to do -- other formats
+ * do exist. This information is not available in the side_data
+ * so we are going with this right now.
+ */
I think GA94 is correct for this situation, since in our x264 decoder we 
don't consider any other standard

for extracting closed caption.

I don't know if we have any logic which differentiate between ATSC, ISDB 
or DVB we parse all transport stream
in same manner. if someone know where we differentiate atsc and dvb in 
FFmpeg please point me there.


Note: This logic will also fail when x264 is muxed in formats like gxf 
where closed caption are kept in vbi instead

of GA94.

Overall  LGTM.

I don't know how to apply encrypted mails using git, and when I save 
your email in Thunderbird, git am is unable to apply.
if you can send the same patch as attachment or command to convert 
encrypted .eml file to normal patch I would test this too.


-Anshul


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add ocr filter

2015-09-18 Thread Anshul
On September 18, 2015 9:12:46 PM IST, wm4  wrote:
>On 18.09.2015 17:19, Nicolas George wrote:
>> wm4:
>>> Nice snarky, content-free remark. But you know that just because a
>hack got
>>> "blessed" because it has "verified users", this is not a reason to
>implement
>>> things in the right way, so that they are also maintainable and
>orthogonal.
>>
>> Do you intend to propose a patch that implements things "the right
>way",
>> "orthogonal", in less than, let's say, two years? If not, do not
>criticize
>> people who propose something that works.
>
>I have no interest in ffmpeg.c, so of course I won't. But I had a
>pretty 
>simple way to implement it in mpv without having to go through 
>ridiculous things like a libavfilter movie source filter. It was 
>probably 10 lines in total.
>
>>> (Or what do you tell to a user who wants to add hardsubbing captions
>to his
>>> existing transcode commandline? Have fun.)
>>
>> Maybe I tell them to wait until the genius wm4 has condescended to
>implement
>> it.
>>
>> My patches, either for sub2video or for subcc in movie, are indeed
>ugly
>> hacks, I never denied it. But they work, right now, and they are of
>service
>> to users. Furthermore, they are isolated features, without tendrils
>all over
>> the place, without causing unrelated problems and ready to be removed
>when a
>> proper implementation is committed.
>>
>> By disparaging them, you are insulting both me and every user who
>uses the
>> features. There are very few people whose contributions are so
>invaluable
>> that the community has to bear with their rudeness.
>
>Honestly, I find most of your passively aggressive replies at least 
>annoying and often enough definitely sound like they're intended to 
>insult. You just did it again - read your mail. Maybe you could turn it
>
>down a little?
>
>And just for the protocol, yes, I called it a terrible hack, but you 
>agree that it's an "ugly hack", so I'm not sure what I did wrong here.
>
>By implementing something as a hack, you put the burden on future 
>generations of developers who somehow have to clean it up (instead of 
>only having to implement it the right way), and of course without 
>causing any "regressions". (Which means pretty please duplicate all the
>
>fucked corner-casey up stuff that happened to work because of a
>specific 
>implementation etc.)
>
>You know, I don't do this to argue with you to death or because I enjoy
>
>fighting (surprisingly I don't) - I just want sane technical solutions,
>
>because just committing mistakes causes a magnitude of more work at a 
>later point. Either because somehow has to clean it up, or because
>it'll 
>be so hard to fix bugs/add features.
>
>Anyway, the bottom line is, no you can't output a subtitle stream, if 
>you want to, add subtitles to lavfi.
>
>___

Hey guys,

Dont want to add salt in this fight,
But on end note can anyone define what is "hack" ?

Because I get this answer to most of my approch.

Mine Analysed defination of hack in this community is that when other 
developers dont understand the code or when it is out of  the general aproch, 
developers here call it hack. I might be wrong with my notion but I am asking 
to confirm.

this question was also creeping in my brain because  none of Google defination 
match here:
Hack:
verb

cut with rough or heavy blows.
gain unauthorized access to data in a system or computer.
cough persistently.
manage; cope.

noun

a rough cut, blow, or stroke.
an act of computer hacking.


Note: I dont want to hijack original thread,  so please explain with refrence 
to this thread that which way of implentation wont be consider hack, which ways 
for ocr would be consider hack.

I am not speaking to make fun or insult, but it was far easy to implement ocr 
of dvbsub to get srt from dvbdub in ccextractor  then here in FFmpeg because of 
unclear definition of hack. So I beg to make it clear today.

I really dont want answers in gurbish, like:
 1) hack is that it would make difficult to developer or maintainer( until how 
do you scale difficult and easy, as per human brain is concerned difficult is 
what we dont understand which is non comparative ) 


The worst answer of hack is that: this is not the way I do in ffmpeg,
Since that is the reason you could not do it and new approch is needed.

Thanks
Anshul 

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Need guidance

2015-09-16 Thread anshul



On Thursday 17 September 2015 12:52 AM, Kinnera Saranu wrote:

Hey,

 Yes I am interested in coding.In the first stage i would like to setup
the environment/code base of this organization and understand more about it.

Regards
Kinnera

On Thu, Sep 17, 2015 at 12:46 AM, Lou Logan  wrote:


On Thu, 17 Sep 2015 00:24:38 +0530, Kinnera Saranu wrote:


Hey I'm new, but I'd like to contribute to your organisation, can someone
please guide me along?

Hi,

How would you like to contribute? What are you interested in doing?
With more specifics we can point you in the right direction.

Lou
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Rule 1) Don't Top Post on this Mailing List.

for setting up your environment look here.
https://trac.ffmpeg.org/wiki/CompilationGuide

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Need guidance

2015-09-16 Thread anshul




On Thursday 17 September 2015 12:24 AM, Kinnera Saranu wrote:

Hey I'm new, but I'd like to contribute to your organisation, can someone
please guide me along?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Hello,

Welcome to FFmpeg community.

Please Read following link
https://www.ffmpeg.org/developer.html#Contributing

If you need some idea about what you should do, pick anything from 
following link

https://trac.ffmpeg.org/wiki/SponsoringPrograms/GSoC/2015

If development is not your taste or you don't find yourself capable of 
doing any above task.
Then start with trac.ffmpeg.org and start reproducing bugs, which will 
give you confidence, exposure and curiosity(may be) and if some bug is 
very trivial then come back here and ask for help here on how to solve it.


Thanks
Anshul Maheshwari
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Voting committee

2015-09-16 Thread anshul



On Monday 14 September 2015 10:50 PM, Nicolas George wrote:

L'octidi 28 fructidor, an CCXXIII, Ganesh Ajjanagadde a écrit :

Looks mostly good to me. One thing I think that should be clarified is
the meaning of "linear combination" - I assume you meant a non-trivial
(exclude all zeros) linear combination over the nonnegative integers?

Thanks. You are right, this was imprecise. I meant linear combination with
total coefficients one; barycenter in other words. For example: 10 commits
are ok, 20 devel mails are ok, then 5 commits and 10 devel mails are ok too.

Of course, the value I have put are rather arbitrary. Please people feel
free to propose other values.

Regards,



Some thoughts on voting commitee:
It looks like maintainer list is ignored. Like if there is maintainer of 
XYZ feature. and decision of XYZ features are taken by committee then 
ignoring him just because he don't have lots of commit would be bad 
idea. Maintainer has taken responsibility so until he is not removed 
from maintainer list from that part and his place is not filled by 
someone else.


There could be conflicts like if XYZ part is not developed well or used 
by many people take snow or ffserver for example people want to remove 
it completely. Since majority of comitee don't like that feature then 
that does not mean that they are authorized to remove that part. If 
there is no maintainer for some part they can remove it to decrease work 
load but if there is maintainer they must not over rule him.


There should be restriction on voting committee to remove some part of 
FFMpeg, or I fear that bad voting committee can tear this project apart.


There may be one more scenario like there is committee of  20 people 
where 11 voted on X way and 9 voted on Y way. and at end of day 9 voter 
forked ffmpeg and made there own project.
So I would put one more restriction here that its not about what 
majority wants  X way or Y way there should be what reasons are given to 
follow X way or Y way. and confirmation that everyone understand pros 
and cons of particular way. No valid reason given against anyones wills 
other then majority voter should be avoided at any cost or we may loose 
developer.


-Anshul



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Describe eia_608 as text subtitles

2015-08-27 Thread Anshul



On 08/27/2015 05:46 PM, Carl Eugen Hoyos wrote:

Hi!

Attached patch fixes an issue with ffplay here (it tries to scale the text
subtitles), please comment,
Any Video sample  that work with this patch and do not work without it 
would be great.


At my PC I am not able to play any ClosedCaption Sample from mine own 
repository with ffplay even with this patch.


Command line output would also be welcomed.

Though patch looks correct to me, just need more information for testing 
and documenting it here.


-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/dvbsubdec: Add option to select when to computer clut (always/never/"if needed")

2015-07-26 Thread Anshul
On July 26, 2015 10:33:22 PM IST, Michael Niedermayer  wrote:
>From: Michael Niedermayer 
>
>Signed-off-by: Michael Niedermayer 
>---
> libavcodec/dvbsubdec.c |4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
>index 9f59b72..e3b72ab 100644
>--- a/libavcodec/dvbsubdec.c
>+++ b/libavcodec/dvbsubdec.c
>@@ -237,6 +237,7 @@ typedef struct DVBSubContext {
> int time_out;
> int compute_edt; /**< if 1 end display time calculated using pts
>   if 0 (Default) calculated using time out */
>+int compute_clut;
> int64_t prev_start;
> DVBSubRegion *region_list;
> DVBSubCLUT   *clut_list;
>@@ -912,7 +913,7 @@ static int save_subtitle_set(AVCodecContext *avctx,
>AVSubtitle *sub, int *got_ou
> 
>memcpy(rect->pict.data[0], region->pbuf, region->buf_size);
> 
>-if (clut == &default_clut)
>+if ((clut == &default_clut && ctx->compute_clut == -1) ||
>ctx->compute_clut == 1)
> compute_default_clut(&rect->pict, rect->w, rect->h);
> 
> i++;
>@@ -1706,6 +1707,7 @@ end:
> #define DS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_SUBTITLE_PARAM
> static const AVOption options[] = {
>{"compute_edt", "compute end of time using pts or timeout",
>offsetof(DVBSubContext, compute_edt), FF_OPT_TYPE_INT, {.i64 = 0}, 0,
>1, DS},
>+{"compute_clut", "compute clut when not available(-1) or always(1)
>or never(0)", offsetof(DVBSubContext, compute_clut), FF_OPT_TYPE_INT,
>{.i64 = -1}, -1, 1, DS},
> {NULL}
> };
> static const AVClass dvbsubdec_class = {
>-- 
>1.7.9.5
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


LGTM.

-Anshul

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Tell users about Closed Captions in video streams

2015-07-06 Thread Anshul
We had long disscussion last year for same thing, and i ended up in libavfilter 
movie, though i dont have any problem with this patch.

We also used side data for same thing if u want u can look in that directions.

my opinion would be to treat h264 caption in same way as it is treated in mpeg, 
mpeg and h264 cc need different processing, but can be kept in similar context.

Sorry if this mails end up top posted, i am unable to confirm setting of this 
tool now.

-Anshul
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Adding Webvtt in hls muxer

2015-06-04 Thread Anshul

Hello

New patch to remove merge conflicts.

-Anshul
>From 4433686fdc62f9aebe23937b51b641febacfa2fe Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Thu, 4 Jun 2015 13:25:52 +0530
Subject: [PATCH] Add WebVtt support in hls

Signed-off-by: Anshul Maheshwari 
---
 libavformat/hlsenc.c | 202 ---
 1 file changed, 192 insertions(+), 10 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4d9466c..8122325 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -39,6 +39,7 @@
 
 typedef struct HLSSegment {
 char filename[1024];
+char sub_filename[1024];
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
@@ -61,8 +62,10 @@ typedef struct HLSContext {
 int64_t sequence;
 int64_t start_sequence;
 AVOutputFormat *oformat;
+AVOutputFormat *vtt_oformat;
 
 AVFormatContext *avf;
+AVFormatContext *vtt_avf;
 
 float time;// Set by a private option.
 int max_nb_segments;   // Set by a private option.
@@ -73,6 +76,7 @@ typedef struct HLSContext {
 int allowcache;
 int64_t recording_time;
 int has_video;
+int has_subtitle;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
@@ -86,17 +90,23 @@ typedef struct HLSContext {
 HLSSegment *old_segments;
 
 char *basename;
+char *vtt_basename;
+char *vtt_m3u8_name;
 char *baseurl;
 char *format_options_str;
+char *vtt_format_options_str;
+char *subtitle_filename;
 AVDictionary *format_options;
+AVDictionary *vtt_format_options;
+
 } HLSContext;
 
 static int hls_delete_old_segments(HLSContext *hls) {
 
 HLSSegment *segment, *previous_segment = NULL;
 float playlist_duration = 0.0f;
-int ret = 0, path_size;
-char *dirname = NULL, *p, *path;
+int ret = 0, path_size, sub_path_size;
+char *dirname = NULL, *p, *path, *sub_path;
 
 segment = hls->segments;
 while (segment) {
@@ -138,13 +148,28 @@ static int hls_delete_old_segments(HLSContext *hls) {
 ret = AVERROR(ENOMEM);
 goto fail;
 }
+sub_path_size = strlen(dirname) + strlen(segment->sub_filename) + 1;
+sub_path = av_malloc(sub_path_size);
+if (!sub_path) {
+ret = AVERROR(ENOMEM);
+goto fail;
+}
+
 av_strlcpy(path, dirname, path_size);
 av_strlcat(path, segment->filename, path_size);
 if (unlink(path) < 0) {
 av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
  path, strerror(errno));
 }
+
+av_strlcpy(sub_path, dirname, sub_path_size);
+av_strlcat(sub_path, segment->sub_filename, sub_path_size);
+if (unlink(sub_path) < 0) {
+av_log(hls, AV_LOG_ERROR, "failed to delete old segment %s: %s\n",
+ sub_path, strerror(errno));
+}
 av_free(path);
+av_free(sub_path);
 previous_segment = segment;
 segment = previous_segment->next;
 av_free(previous_segment);
@@ -160,6 +185,7 @@ static int hls_mux_init(AVFormatContext *s)
 {
 HLSContext *hls = s->priv_data;
 AVFormatContext *oc;
+AVFormatContext *vtt_oc;
 int i, ret;
 
 ret = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
@@ -172,9 +198,24 @@ static int hls_mux_init(AVFormatContext *s)
 oc->max_delay  = s->max_delay;
 av_dict_copy(&oc->metadata, s->metadata, 0);
 
+if(hls->vtt_oformat) {
+ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
+if (ret < 0)
+return ret;
+vtt_oc  = hls->vtt_avf;
+vtt_oc->oformat = hls->vtt_oformat;
+av_dict_copy(&vtt_oc->metadata, s->metadata, 0);
+}
+
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st;
-if (!(st = avformat_new_stream(oc, NULL)))
+AVFormatContext *loc;
+if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
+loc = vtt_oc;
+else
+loc = oc;
+
+if (!(st = avformat_new_stream(loc, NULL)))
 return AVERROR(ENOMEM);
 avcodec_copy_context(st->codec, s->streams[i]->codec);
 st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
@@ -197,6 +238,9 @@ static int hls_append_segment(HLSContext *hls, double duration, int64_t pos,
 
 av_strlcpy(en->filename, av_basename(hls->avf->filename), sizeof(en->filename));
 
+if(hls->has_subtitle)
+av_strlcpy(en->sub_filename, av_basename(hls->vtt_avf->filename), sizeof(en->sub_filename));
+
 en->duration = duration;
 en->pos  = pos;

Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-06-03 Thread Anshul



On 06/02/2015 03:54 PM, Michael Niedermayer wrote:

On Tue, Jun 02, 2015 at 06:13:20AM +, Carl Eugen Hoyos wrote:

Anshul  gmail.com> writes:


can you provide me link of carl file you said it was
smallest, I would make that test case again with
carl file.

http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/192583/focus=192944
http://ffmpeg.org/pipermail/ffmpeg-devel/2015-May/172810.html

uploaded to fate too
(note we could still replace the file as long as no test has been
  written and pushed that uses it)
I had pull request on github #136 
<https://github.com/FFmpeg/FFmpeg/pull/136https://github.com/FFmpeg/FFmpeg/pull/136>, 
with test case with Closedcaption_rollup.m2v file.


-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-06-01 Thread Anshul



On 05/31/2015 06:53 PM, Michael Niedermayer wrote:

On Sun, May 31, 2015 at 01:59:44PM +0200, Clément Bœsch wrote:

On Tue, May 05, 2015 at 08:37:03PM +0530, Anshul wrote:


On 05/05/2015 08:33 PM, Anshul wrote:


On 05/04/2015 08:50 PM, Michael Niedermayer wrote:

this is 31mb, that does not seem reasonable for a subtitle test,
please provide a smaller file, like one without unused/untested
video streams or a shorter one

also fate fails with the patch applied
probably line endings arent preserved somewhere, probably best to
push to github and post a link



I have created pull request here.
https://github.com/FFmpeg/FFmpeg/pull/136

and here is shorter file then previous one.
http://gsocdev.ccextractor.org/~anshul/test_video/Closedcaption_atsc_rollup.ts

-Anshul

Apology: Forgot to attach new patch for short File.

-Anshul

 From 052f5c9e805f20450f33ed64c5043b862c70abd0 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 5 May 2015 20:20:09 +0530
Subject: [PATCH] Adding Fate test for ClosedCaption

Signed-off-by: Anshul Maheshwari 
---
  tests/fate/subtitles.mak |  3 +++
  tests/ref/fate/sub-cc| 16 
  2 files changed, 19 insertions(+)
  create mode 100644 tests/ref/fate/sub-cc

diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 07d886a..dddf33d 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -1,6 +1,9 @@
  FATE_SUBTITLES_ASS-$(call ALLYES, AQTITLE_DEMUXER TEXT_DECODER ICONV) += 
fate-sub-aqtitle
  fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc windows-1250 -i 
$(TARGET_SAMPLES)/sub/AQTitle_capability_tester.aqt
  
+FATE_SUBTITLES_ASS-$(call ALLYES, CCAPTION_DECODER MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc

+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"
+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
  
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc

new file mode 100644
index 000..02d207e
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,16 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, 
OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, 
Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, 
MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.83,0:00:02.34,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:02.34,0:00:04.47,Default,,0,0,0,,( explosion )\N( inaudible 
radio chatter )
+Dialogue: 0,0:00:04.47,0:00:05.84,Default,,0,0,0,,( inaudible radio chatter 
)\N>> Safety remains our number one
+Dialogue: 0,0:00:05.84,0:00:07.31,Default,,0,0,0,,>> Safety remains our number 
one\Npriority.

So what's the state of this patch and the sample? Can it be applied?

state is: waiting for a sample to be provided to me so i can upload it



can you provide me link of carl file you said it was smallest, I would 
make that test case again

with carl file.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-06 Thread Anshul



On 05/07/2015 03:43 AM, Michael Niedermayer wrote:

On Thu, May 07, 2015 at 01:29:11AM +0530, Anshul wrote:


On 05/06/2015 01:21 AM, Michael Niedermayer wrote:

On Tue, May 05, 2015 at 08:33:42PM +0530, Anshul wrote:
[...]

and here is shorter file then previous one.
http://gsocdev.ccextractor.org/~anshul/test_video/Closedcaption_atsc_rollup.ts

considering that this is created by FFmpeg
  Metadata:
   service_name: Service01
   service_provider: FFmpeg

please make a smaller file

I cant encode any video with subtitle, I used ffmpeg to cut the
previous video in smaller video.
if I transcode the video then cc will be lost.

this is still 16 times larger than the next largest file in
fate/sub

the video streams bitrate should play no role in testing the subtites

I searched for other opensource encoder that could embed cc in videos.
but I was unable to find out. if you know about any openSource cc encoder.
then please share.

i thought it was easy
if not then lets upload carls file, its the smallest so far,

if that file works for your test ?

Carl,

can you please give me link of the sample, I would make the test case 
patch again.


-Anshul

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-06 Thread Anshul



On 05/06/2015 01:21 AM, Michael Niedermayer wrote:

On Tue, May 05, 2015 at 08:33:42PM +0530, Anshul wrote:
[...]

and here is shorter file then previous one.
http://gsocdev.ccextractor.org/~anshul/test_video/Closedcaption_atsc_rollup.ts

considering that this is created by FFmpeg
  Metadata:
   service_name: Service01
   service_provider: FFmpeg

please make a smaller file
I cant encode any video with subtitle, I used ffmpeg to cut the previous 
video in smaller video.

if I transcode the video then cc will be lost.

this is still 16 times larger than the next largest file in
fate/sub

the video streams bitrate should play no role in testing the subtites

I searched for other opensource encoder that could embed cc in videos.
but I was unable to find out. if you know about any openSource cc encoder.
then please share.

thanks

[...]


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-05 Thread Anshul



On 05/05/2015 08:33 PM, Anshul wrote:



On 05/04/2015 08:50 PM, Michael Niedermayer wrote:


this is 31mb, that does not seem reasonable for a subtitle test,
please provide a smaller file, like one without unused/untested
video streams or a shorter one

also fate fails with the patch applied
probably line endings arent preserved somewhere, probably best to
push to github and post a link



I have created pull request here.
https://github.com/FFmpeg/FFmpeg/pull/136

and here is shorter file then previous one.
http://gsocdev.ccextractor.org/~anshul/test_video/Closedcaption_atsc_rollup.ts

-Anshul


Apology: Forgot to attach new patch for short File.

-Anshul

From 052f5c9e805f20450f33ed64c5043b862c70abd0 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 5 May 2015 20:20:09 +0530
Subject: [PATCH] Adding Fate test for ClosedCaption

Signed-off-by: Anshul Maheshwari 
---
 tests/fate/subtitles.mak |  3 +++
 tests/ref/fate/sub-cc| 16 
 2 files changed, 19 insertions(+)
 create mode 100644 tests/ref/fate/sub-cc

diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 07d886a..dddf33d 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -1,6 +1,9 @@
 FATE_SUBTITLES_ASS-$(call ALLYES, AQTITLE_DEMUXER TEXT_DECODER ICONV) += fate-sub-aqtitle
 fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc windows-1250 -i $(TARGET_SAMPLES)/sub/AQTitle_capability_tester.aqt
 
+FATE_SUBTITLES_ASS-$(call ALLYES, CCAPTION_DECODER MOVIE_FILTER MPEGTS_DEMUXER) += fate-sub-cc
+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"
+
 FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
 fate-sub-jacosub: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
 
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
new file mode 100644
index 000..02d207e
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,16 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:00.83,0:00:02.34,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:02.34,0:00:04.47,Default,,0,0,0,,( explosion )\N( inaudible radio chatter )
+Dialogue: 0,0:00:04.47,0:00:05.84,Default,,0,0,0,,( inaudible radio chatter )\N>> Safety remains our number one
+Dialogue: 0,0:00:05.84,0:00:07.31,Default,,0,0,0,,>> Safety remains our number one\Npriority.
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-05 Thread Anshul



On 05/04/2015 08:50 PM, Michael Niedermayer wrote:

On Mon, May 04, 2015 at 05:30:05PM +0530, Anshul wrote:


On 05/04/2015 05:27 PM, Anshul wrote:


On 05/04/2015 03:09 AM, Michael Niedermayer wrote:

On Sun, May 03, 2015 at 08:53:14PM +0200, Clément Bœsch wrote:

On Sun, May 03, 2015 at 06:46:15PM +0530, Anshul wrote:

On 05/02/2015 08:24 PM, Clément Bœsch wrote:

On Tue, Apr 28, 2015 at 07:50:15PM +0530, Anshul wrote:

On 04/28/2015 02:14 PM, Clément Bœsch wrote:

Then FATE test patch should be applied after the CC patch.


New patch attached. I have used other ass api.

+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"


BTW, do we really need to go through libavfilter to extract the cc?

Yes, there is no other way then libavfilter that I know.
Closed caption was
possible only after nicolas patch.
if you want more details, Why libavfilter was chosen,
you might need to read
last year's mail chain.
there has been long debate on it. so I don't want to
indulge myself again in
it.

+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB,
JACOSUB) += fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
new file mode 100644
index 000..035a51a
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,38 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour,
SecondaryColour, OutlineColour, BackColour, Bold,
Italic, Underline, StrikeOut, ScaleX, ScaleY,
Spacing, Angle, BorderStyle, Outline, Shadow,
Alignment, MarginL, MarginR, MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL,
MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,(
explosion )\N( inaudible radio chatter )
+Dialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,(
inaudible radio chatter )\N>> Safety remains our
number one
+Dialogue:
0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety
remains our number one\Npriority.
+Dialogue:
0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>>
BP can talk about safety all
+Dialogue:
0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can
talk about safety all\Nthey want, but they're not
going
+Dialogue:
0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want,
but they're not going\Nto become a safer company.
+Dialogue:
0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a
safer company.\N>> They base everything on risk.
+Dialogue:
0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base
everything on risk.\N"How many lives can we afford
to
+Dialogue:
0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many
lives can we afford to\Nlose before we need to deal
with
+Dialogue:
0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before
we need to deal with\Nthis?"
+Dialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.
+Dialogue:
0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>>
Yes, this plant just blew up!
+Dialogue:
0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this
plant just blew up!\N>> From Texas and Alaska to the
+Dialogue:
0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From
Texas and Alaska to the\NGulf of Mexico...
+Dialogue:
0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of
Mexico...\N>> BP apologized again...
+Dialogue:
0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP
apologized again...\N>> ... Apology after apology.
+Dialogue:
0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ...
Apology after apology.\N>> They pledged repeatedly
to
+Dialogue:
0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They
pledged repeatedly to\Nrun a safer operation, yet
they
+Dialogue:
0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer
operation, yet they\Ncontinued to cut costs.
+Dialogue:
0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to
cut costs.\N>> We have a facility here that
+Dialogue:
0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a
facility here that\Ncould produce a cloud of gas
+Dialogue:
0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could
produce a cloud of gas\Nthat would make this place
look
+Dialogue:
0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would
make this place look\Nlike Hiroshima.
+Dialogue:
0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like
Hiroshima.\N>> What went wrong at BP?
+Dialogue:
0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went
wrong at BP?\N>> The culture of BP management

This output looks better.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmp

Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-04 Thread Anshul



On 05/04/2015 05:27 PM, Anshul wrote:



On 05/04/2015 03:09 AM, Michael Niedermayer wrote:

On Sun, May 03, 2015 at 08:53:14PM +0200, Clément Bœsch wrote:

On Sun, May 03, 2015 at 06:46:15PM +0530, Anshul wrote:


On 05/02/2015 08:24 PM, Clément Bœsch wrote:

On Tue, Apr 28, 2015 at 07:50:15PM +0530, Anshul wrote:

On 04/28/2015 02:14 PM, Clément Bœsch wrote:

Then FATE test patch should be applied after the CC patch.


New patch attached. I have used other ass api.
+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]" 


BTW, do we really need to go through libavfilter to extract the cc?
Yes, there is no other way then libavfilter that I know. Closed 
caption was

possible only after nicolas patch.
if you want more details, Why libavfilter was chosen, you might 
need to read

last year's mail chain.
there has been long debate on it. so I don't want to indulge 
myself again in

it.

+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += 
fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss

diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
new file mode 100644
index 000..035a51a
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,38 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, 
SecondaryColour, OutlineColour, BackColour, Bold, Italic, 
Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, 
BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, 
MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0

+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, 
MarginV, Effect, Text

+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,( explosion 
)\N( inaudible radio chatter )
+Dialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,( inaudible 
radio chatter )\N>> Safety remains our number one
+Dialogue: 0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety 
remains our number one\Npriority.
+Dialogue: 
0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>> BP can 
talk about safety all
+Dialogue: 0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can 
talk about safety all\Nthey want, but they're not going
+Dialogue: 0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want, 
but they're not going\Nto become a safer company.
+Dialogue: 0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a 
safer company.\N>> They base everything on risk.
+Dialogue: 0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base 
everything on risk.\N"How many lives can we afford to
+Dialogue: 0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many 
lives can we afford to\Nlose before we need to deal with
+Dialogue: 0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before 
we need to deal with\Nthis?"

+Dialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.
+Dialogue: 0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>> 
Yes, this plant just blew up!
+Dialogue: 0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this 
plant just blew up!\N>> From Texas and Alaska to the
+Dialogue: 0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From 
Texas and Alaska to the\NGulf of Mexico...
+Dialogue: 0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of 
Mexico...\N>> BP apologized again...
+Dialogue: 0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP 
apologized again...\N>> ... Apology after apology.
+Dialogue: 0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ... 
Apology after apology.\N>> They pledged repeatedly to
+Dialogue: 0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They 
pledged repeatedly to\Nrun a safer operation, yet they
+Dialogue: 0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer 
operation, yet they\Ncontinued to cut costs.
+Dialogue: 0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to 
cut costs.\N>> We have a facility here that
+Dialogue: 0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a 
facility here that\Ncould produce a cloud of gas
+Dialogue: 0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could 
produce a cloud of gas\Nthat would make this place look
+Dialogue: 0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would 
make this place look\Nlike Hiroshima.
+Dialogue: 0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like 
Hiroshima.\N>> What went wrong at BP?
+Dialogue: 0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went 
wrong at BP?\N>> The culture of BP management

This output looks better.



_______
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 From 13dedb5bd7df3efd88f6a3b0dbc521e869d8f6a2 Mon Sep 

Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-04 Thread Anshul



On 05/04/2015 03:09 AM, Michael Niedermayer wrote:

On Sun, May 03, 2015 at 08:53:14PM +0200, Clément Bœsch wrote:

On Sun, May 03, 2015 at 06:46:15PM +0530, Anshul wrote:


On 05/02/2015 08:24 PM, Clément Bœsch wrote:

On Tue, Apr 28, 2015 at 07:50:15PM +0530, Anshul wrote:

On 04/28/2015 02:14 PM, Clément Bœsch wrote:

Then FATE test patch should be applied after the CC patch.


New patch attached. I have used other ass api.

+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"

BTW, do we really need to go through libavfilter to extract the cc?

Yes, there is no other way then libavfilter that I know. Closed caption was
possible only after nicolas patch.
if you want more details, Why libavfilter was chosen, you might need to read
last year's mail chain.
there has been long debate on it. so I don't want to indulge myself again in
it.

+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
new file mode 100644
index 000..035a51a
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,38 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, 
OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, 
Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, 
MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,( explosion )\N( inaudible 
radio chatter )
+Dialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,( inaudible radio chatter 
)\N>> Safety remains our number one
+Dialogue: 0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety remains our number 
one\Npriority.
+Dialogue: 0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>> BP can talk 
about safety all
+Dialogue: 0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can talk about safety 
all\Nthey want, but they're not going
+Dialogue: 0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want, but they're not 
going\Nto become a safer company.
+Dialogue: 0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a safer 
company.\N>> They base everything on risk.
+Dialogue: 0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base everything on 
risk.\N"How many lives can we afford to
+Dialogue: 0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many lives can we 
afford to\Nlose before we need to deal with
+Dialogue: 0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before we need to deal 
with\Nthis?"
+Dialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.
+Dialogue: 0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>> Yes, this plant 
just blew up!
+Dialogue: 0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this plant just blew 
up!\N>> From Texas and Alaska to the
+Dialogue: 0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From Texas and Alaska to 
the\NGulf of Mexico...
+Dialogue: 0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of Mexico...\N>> BP 
apologized again...
+Dialogue: 0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP apologized 
again...\N>> ... Apology after apology.
+Dialogue: 0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ... Apology after 
apology.\N>> They pledged repeatedly to
+Dialogue: 0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They pledged repeatedly 
to\Nrun a safer operation, yet they
+Dialogue: 0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer operation, yet 
they\Ncontinued to cut costs.
+Dialogue: 0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to cut costs.\N>> 
We have a facility here that
+Dialogue: 0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a facility here 
that\Ncould produce a cloud of gas
+Dialogue: 0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could produce a cloud of 
gas\Nthat would make this place look
+Dialogue: 0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would make this place 
look\Nlike Hiroshima.
+Dialogue: 0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like Hiroshima.\N>> What 
went wrong at BP?
+Dialogue: 0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went wrong at 
BP?\N>> The culture of BP management

This output looks better.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

 From 13dedb5bd7df3efd88f6a3b0dbc521e869d8f6a2 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 28 Apr 

Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-05-03 Thread Anshul



On 05/02/2015 08:24 PM, Clément Bœsch wrote:

On Tue, Apr 28, 2015 at 07:50:15PM +0530, Anshul wrote:


On 04/28/2015 02:14 PM, Clément Bœsch wrote:

Then FATE test patch should be applied after the CC patch.


New patch attached. I have used other ass api.

+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"

BTW, do we really need to go through libavfilter to extract the cc?

Yes, there is no other way then libavfilter that I know. Closed caption was
possible only after nicolas patch.
if you want more details, Why libavfilter was chosen, you might need to read
last year's mail chain.
there has been long debate on it. so I don't want to indulge myself again in
it.

+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
new file mode 100644
index 000..035a51a
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,38 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, 
OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, 
Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, 
MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,( explosion )\N( inaudible 
radio chatter )
+Dialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,( inaudible radio chatter 
)\N>> Safety remains our number one
+Dialogue: 0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety remains our number 
one\Npriority.
+Dialogue: 0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>> BP can talk 
about safety all
+Dialogue: 0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can talk about safety 
all\Nthey want, but they're not going
+Dialogue: 0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want, but they're not 
going\Nto become a safer company.
+Dialogue: 0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a safer 
company.\N>> They base everything on risk.
+Dialogue: 0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base everything on 
risk.\N"How many lives can we afford to
+Dialogue: 0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many lives can we 
afford to\Nlose before we need to deal with
+Dialogue: 0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before we need to deal 
with\Nthis?"
+Dialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.
+Dialogue: 0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>> Yes, this plant 
just blew up!
+Dialogue: 0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this plant just blew 
up!\N>> From Texas and Alaska to the
+Dialogue: 0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From Texas and Alaska to 
the\NGulf of Mexico...
+Dialogue: 0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of Mexico...\N>> BP 
apologized again...
+Dialogue: 0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP apologized 
again...\N>> ... Apology after apology.
+Dialogue: 0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ... Apology after 
apology.\N>> They pledged repeatedly to
+Dialogue: 0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They pledged repeatedly 
to\Nrun a safer operation, yet they
+Dialogue: 0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer operation, yet 
they\Ncontinued to cut costs.
+Dialogue: 0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to cut costs.\N>> 
We have a facility here that
+Dialogue: 0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a facility here 
that\Ncould produce a cloud of gas
+Dialogue: 0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could produce a cloud of 
gas\Nthat would make this place look
+Dialogue: 0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would make this place 
look\Nlike Hiroshima.
+Dialogue: 0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like Hiroshima.\N>> What 
went wrong at BP?
+Dialogue: 0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went wrong at 
BP?\N>> The culture of BP management

This output looks better.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

 From 13dedb5bd7df3efd88f6a3b0dbc521e869d8f6a2 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 28 Apr 2015 19:41:28 +0530
Subject: [PATCH] Correcting jumbled ass of captions

Signed-off-by: Anshul Maheshwari 
---
  libavcodec/ccaption_dec.c | 6 +-
  1 file changed

Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-04-28 Thread Anshul



On 04/28/2015 02:14 PM, Clément Bœsch wrote:

Then FATE test patch should be applied after the CC patch.


New patch attached. I have used other ass api.

+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"

BTW, do we really need to go through libavfilter to extract the cc?
Yes, there is no other way then libavfilter that I know. Closed caption 
was possible only after nicolas patch.
if you want more details, Why libavfilter was chosen, you might need to 
read last year's mail chain.
there has been long debate on it. so I don't want to indulge myself 
again in it.

+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
  
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc

new file mode 100644
index 000..035a51a
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,38 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, 
OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, 
Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, 
MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )
+Dialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,( explosion )\N( inaudible 
radio chatter )
+Dialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,( inaudible radio chatter 
)\N>> Safety remains our number one
+Dialogue: 0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety remains our number 
one\Npriority.
+Dialogue: 0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>> BP can talk 
about safety all
+Dialogue: 0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can talk about safety 
all\Nthey want, but they're not going
+Dialogue: 0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want, but they're not 
going\Nto become a safer company.
+Dialogue: 0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a safer 
company.\N>> They base everything on risk.
+Dialogue: 0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base everything on 
risk.\N"How many lives can we afford to
+Dialogue: 0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many lives can we 
afford to\Nlose before we need to deal with
+Dialogue: 0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before we need to deal 
with\Nthis?"
+Dialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.
+Dialogue: 0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>> Yes, this plant 
just blew up!
+Dialogue: 0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this plant just blew 
up!\N>> From Texas and Alaska to the
+Dialogue: 0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From Texas and Alaska to 
the\NGulf of Mexico...
+Dialogue: 0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of Mexico...\N>> BP 
apologized again...
+Dialogue: 0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP apologized 
again...\N>> ... Apology after apology.
+Dialogue: 0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ... Apology after 
apology.\N>> They pledged repeatedly to
+Dialogue: 0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They pledged repeatedly 
to\Nrun a safer operation, yet they
+Dialogue: 0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer operation, yet 
they\Ncontinued to cut costs.
+Dialogue: 0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to cut costs.\N>> 
We have a facility here that
+Dialogue: 0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a facility here 
that\Ncould produce a cloud of gas
+Dialogue: 0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could produce a cloud of 
gas\Nthat would make this place look
+Dialogue: 0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would make this place 
look\Nlike Hiroshima.
+Dialogue: 0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like Hiroshima.\N>> What 
went wrong at BP?
+Dialogue: 0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went wrong at 
BP?\N>> The culture of BP management

This output looks better.



_______
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


>From 13dedb5bd7df3efd88f6a3b0dbc521e869d8f6a2 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 28 Apr 2015 19:41:28 +0530
Subject: [PATCH] Correcting jumbled ass of captions

Signed-off-by: Anshul Maheshwari 
---
 libavcodec/ccaption_dec.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_de

Re: [FFmpeg-devel] Test case for Closed caption decoder.

2015-04-28 Thread Anshul



On 04/27/2015 10:38 PM, Clément Bœsch wrote:

On Mon, Apr 27, 2015 at 10:35:49PM +0530, Anshul wrote:

Hello,

I am attaching patch for closed caption decoder.

Thanks
Anshul
 From 230cd5d9de356a8e84d2c36f91510631317986db Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 27 Apr 2015 22:33:48 +0530
Subject: [PATCH] Adding Closed caption sub test case

Signed-off-by: Anshul Maheshwari 
---
  tests/fate/subtitles.mak |  3 +++
  tests/ref/fate/sub-cc| 13 +
  2 files changed, 16 insertions(+)
  create mode 100644 tests/ref/fate/sub-cc

diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 53cd4cb..7f71602 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -1,6 +1,9 @@
  FATE_SUBTITLES_ASS-$(call ALLYES, AQTITLE_DEMUXER TEXT_DECODER ICONV) += 
fate-sub-aqtitle
  fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc windows-1250 -i 
$(TARGET_SAMPLES)/sub/AQTitle_capability_tester.aqt
  
+FATE_SUBTITLES_ASS-$(call ALLYES, CCAPTION_DECODER ) += fate-sub-cc

+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i 
"movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"

it seems to also depend on TS demuxer, and movie source filter

done.

+
  FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
  fate-sub-jacosub: CMD = fmtstdout ass -i 
$(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
  
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc

new file mode 100644
index 000..5ea8c22
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,13 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, 
OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, 
Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, 
MarginV, Encoding
+Style: 
Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )\NDialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,( explosion )\N( inaudible radio chatter )\NDialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,( inaudible radio chatter 
)\N>> Safety remains our number one\NDialogue: 0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety remains our number one\Npriority.\NDialogue: 0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>> BP can talk about 
safety all\NDialogue: 0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can talk about safety all\Nthey want, but they're not going\NDialogue: 0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want, but they're not going\Nto become a safer 
company.\NDialogue: 0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a safer company.\N>> They base everything on risk.\NDialogue: 0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base everything on risk.\N"How many 
lives can we afford to\NDialogue: 0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many lives can we afford to\Nlose before we need to deal with\NDialogue: 0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before we need to deal 
with\Nthis?"\NDialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.\NDialogue: 0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>> Yes, this plant just blew up!\NDialogue: 
0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this plant just blew up!\N>> From Texas and Alaska to the\NDialogue: 0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From Texas and Alaska to the\NGulf of Mexico...\NDialogue: 
0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of Mexico...\N>> BP apologized again...\NDialogue: 0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP apologized again...\N>> ... Apology after apology.\NDialogue: 
0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ... Apology after apology.\N>> They pledged repeatedly to\NDialogue: 0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They pledged repeatedly to\Nrun a safer operation, yet 
they\NDialogue: 0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer operation, yet they\Ncontinued to cut costs.\NDialogue: 0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to cut costs.\N>> We have a facility here that\NDialogue: 
0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a facility here that\Ncould produce a cloud of gas\NDialogue: 0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could produce a cloud of gas\Nthat would make this place look\NDialogue: 
0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would make this place look\Nlike Hiroshima.\NDialogue: 0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like Hiroshima.\N>> What went wrong at BP?\NDialogue: 
0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went wrong at BP?\N>> The culture of BP management\N

[FFmpeg-devel] Test case for Closed caption decoder.

2015-04-27 Thread Anshul

Hello,

I am attaching patch for closed caption decoder.

Thanks
Anshul
From 230cd5d9de356a8e84d2c36f91510631317986db Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 27 Apr 2015 22:33:48 +0530
Subject: [PATCH] Adding Closed caption sub test case

Signed-off-by: Anshul Maheshwari 
---
 tests/fate/subtitles.mak |  3 +++
 tests/ref/fate/sub-cc| 13 +
 2 files changed, 16 insertions(+)
 create mode 100644 tests/ref/fate/sub-cc

diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index 53cd4cb..7f71602 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -1,6 +1,9 @@
 FATE_SUBTITLES_ASS-$(call ALLYES, AQTITLE_DEMUXER TEXT_DECODER ICONV) += fate-sub-aqtitle
 fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc windows-1250 -i $(TARGET_SAMPLES)/sub/AQTitle_capability_tester.aqt
 
+FATE_SUBTITLES_ASS-$(call ALLYES, CCAPTION_DECODER ) += fate-sub-cc
+fate-sub-cc: CMD = fmtstdout ass -f lavfi -i "movie=$(TARGET_SAMPLES)/sub/Closedcaption_atsc_rollup.ts[out0+subcc]"
+
 FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub
 fate-sub-jacosub: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss
 
diff --git a/tests/ref/fate/sub-cc b/tests/ref/fate/sub-cc
new file mode 100644
index 000..5ea8c22
--- /dev/null
+++ b/tests/ref/fate/sub-cc
@@ -0,0 +1,13 @@
+[Script Info]
+; Script generated by FFmpeg/Lavc
+ScriptType: v4.00+
+PlayResX: 384
+PlayResY: 288
+
+[V4+ Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
+Style: Default,Arial,16,&Hff,&Hff,&H0,&H0,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,0
+
+[Events]
+Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: 0,0:00:36.87,0:00:38.37,Default,,0,0,0,,( explosion )\NDialogue: 0,0:00:38.37,0:00:40.51,Default,,0,0,0,,( explosion )\N( inaudible radio chatter )\NDialogue: 0,0:00:40.51,0:00:41.88,Default,,0,0,0,,( inaudible radio chatter )\N>> Safety remains our number one\NDialogue: 0,0:00:41.88,0:00:43.34,Default,,0,0,0,,>> Safety remains our number one\Npriority.\NDialogue: 0,0:00:43.34,0:00:44.51,Default,,0,0,0,,priority.\N>> BP can talk about safety all\NDialogue: 0,0:00:44.51,0:00:45.88,Default,,0,0,0,,>> BP can talk about safety all\Nthey want, but they're not going\NDialogue: 0,0:00:45.88,0:00:47.95,Default,,0,0,0,,they want, but they're not going\Nto become a safer company.\NDialogue: 0,0:00:47.95,0:00:49.52,Default,,0,0,0,,to become a safer company.\N>> They base everything on risk.\NDialogue: 0,0:00:49.52,0:00:50.65,Default,,0,0,0,,>> They base everything on risk.\N"How many lives can we afford to\NDialogue: 0,0:00:50.65,0:00:51.65,Default,,0,0,0,,"How many lives can we afford to\Nlose before we need to deal with\NDialogue: 0,0:00:51.65,0:00:52.55,Default,,0,0,0,,lose before we need to deal with\Nthis?"\NDialogue: 0,0:00:52.55,0:00:53.25,Default,,0,0,0,,this?"\N>> 9-1.\NDialogue: 0,0:00:53.25,0:00:55.22,Default,,0,0,0,,>> 9-1.\N>> Yes, this plant just blew up!\NDialogue: 0,0:00:55.22,0:00:57.19,Default,,0,0,0,,>> Yes, this plant just blew up!\N>> From Texas and Alaska to the\NDialogue: 0,0:00:57.19,0:00:58.39,Default,,0,0,0,,>> From Texas and Alaska to the\NGulf of Mexico...\NDialogue: 0,0:00:58.39,0:01:00.19,Default,,0,0,0,,Gulf of Mexico...\N>> BP apologized again...\NDialogue: 0,0:01:00.19,0:01:02.33,Default,,0,0,0,,>> BP apologized again...\N>> ... Apology after apology.\NDialogue: 0,0:01:02.33,0:01:03.10,Default,,0,0,0,,>> ... Apology after apology.\N>> They pledged repeatedly to\NDialogue: 0,0:01:03.10,0:01:05.40,Default,,0,0,0,,>> They pledged repeatedly to\Nrun a safer operation, yet they\NDialogue: 0,0:01:05.40,0:01:07.17,Default,,0,0,0,,run a safer operation, yet they\Ncontinued to cut costs.\NDialogue: 0,0:01:07.17,0:01:08.67,Default,,0,0,0,,continued to cut costs.\N>> We have a facility here that\NDialogue: 0,0:01:08.67,0:01:10.17,Default,,0,0,0,,>> We have a facility here that\Ncould produce a cloud of gas\NDialogue: 0,0:01:10.17,0:01:11.57,Default,,0,0,0,,could produce a cloud of gas\Nthat would make this place look\NDialogue: 0,0:01:11.57,0:01:13.04,Default,,0,0,0,,that would make this place look\Nlike Hiroshima.\NDialogue: 0,0:01:13.04,0:01:15.21,Default,,0,0,0,,like Hiroshima.\N>> What went wrong at BP?\NDialogue: 0,0:01:15.21,0:01:17.11,Default,,0,0,0,,>> What went wrong at BP?\N>> The culture of BP management\N
\ No newline at end of file
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Adding Webvtt in hls muxer

2015-04-27 Thread Anshul



On 03/12/2015 08:03 PM, Deron wrote:

On 2/26/15 4:26 AM, Anshul wrote:


On 02/25/2015 10:04 PM, Deron wrote:

On 2/21/15 8:05 AM, Deron wrote:

On 2/15/15 5:44 AM, Anshul wrote:


attached another cleaned patch.

-Anshul


Not sure if I should be posting here, privately, or do the user 
list since it is an unaccepted patch... This patch applies cleanly 
to ffmpeg git of that day, and with minor adjustment to current 
git, but either crashes the same for me right away. Here is the 
back trace from gdb:



Program received signal SIGSEGV, Segmentation fault.
__GI___libc_realloc (oldmem=0x70, bytes=8) at malloc.c:2977
2977malloc.c: No such file or directory.
(gdb) bt
#0  __GI___libc_realloc (oldmem=0x70, bytes=8) at malloc.c:2977
#1  0x77609b99 in avformat_new_stream (s=s@entry=0xe2dbc0, 
c=c@entry=0x0) at libavformat/utils.c:3655
#2  0x775451c4 in hls_mux_init (s=0x6787c0) at 
libavformat/hlsenc.c:194

#3  hls_write_header (s=0x6787c0) at libavformat/hlsenc.c:490
#4  0x775999ec in avformat_write_header 
(s=s@entry=0x6787c0, options=0x6a9948) at libavformat/mux.c:406

#5  0x00424c00 in transcode_init () at ffmpeg.c:3096
#6  0x00407581 in transcode () at ffmpeg.c:3815
#7  main (argc=13, argv=0x7fffe5a8) at ffmpeg.c:4022


The command (I've tried all sorts of combinations. If I don't 
provide a subtitle stream, it does not crash. Otherwise it does. 
Unpatched can generate a webvtt from the subtitle stream without 
crashing.)


ffmpeg -loglevel debug -f lavfi -i movie=out.ts\[out0+subcc\] -f 
hls -hls_segment_filename /var/www/html/stream/kota/v.low.%d.ts 
-hls_subtitle_path /var/www/html/stream/kota/ -y 
/var/www/html/stream/kota/v.low.m3u8




I did find the problem. The patch does not properly initialize 
hls->vtt_oformat (etc) if you provide the "-hls_segment_filename" 
parameter as I have done.


Deron

I have attached new patch with correctly initializing the webvtt, can 
you please check this patch again.


-Anshul 


Besides needing some minor changes to apply to git head, this works.  
I'm not sure that the CC is 100% correct, but I have not sat down and 
compared to any other output yet. Certainly close, it just seems a 
little off and I can't put my finger on it. Not a timing issue, just 
seems jumpy and hard to read. Could just be the Apple player, or could 
be that the segmenter is not duplicating items that span multiple 
segments.


I do have a couple requests, but once this is accepted I think I can 
make the patch. One is the support m3u8 rename like the mpegts 
segments do, and the other is to support WebVTT segmenting on a 
subtitle only stream. I'd like to see/submit an audio only stream 
segmenter patch as well, but that is well outside this patch :-)


Either way, thanks!

Deron
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Hello,

This patch is working in my system from months.
I have also tested most of the option's of hls with this implementation.
I have updated this to most recent git version.

Its a big patch, it take time to again merge with latest git version.
so i am expecting it to merge it with master.

-Please comment
Anshul
>From 50e3fc7b9c6bf1a46afb3ea7908dc0043d9a8b49 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 27 Apr 2015 21:24:12 +0530
Subject: [PATCH] Adding Webvtt in hls

Signed-off-by: Anshul Maheshwari 
---
 libavformat/hlsenc.c | 183 ---
 1 file changed, 175 insertions(+), 8 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7885351..b0912c4 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -39,6 +39,7 @@
 
 typedef struct HLSSegment {
 char filename[1024];
+char sub_filename[1024];
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
@@ -58,8 +59,10 @@ typedef struct HLSContext {
 int64_t sequence;
 int64_t start_sequence;
 AVOutputFormat *oformat;
+AVOutputFormat *vtt_oformat;
 
 AVFormatContext *avf;
+AVFormatContext *vtt_avf;
 
 float time;// Set by a private option.
 int max_nb_segments;   // Set by a private option.
@@ -70,6 +73,7 @@ typedef struct HLSContext {
 int allowcache;
 int64_t recording_time;
 int has_video;
+int has_subtitle;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
@@ -82,9 +86,15 @@ typedef struct HLSContext {
 HLSSegment *old_segments;
 
 char *basename;
+char *vtt_basename;
+char *vtt_m3u8_name;
 char *baseurl;
 char *format_options_str;
+char *vtt_format_options_str;
+char *subtitle_filename;
 AVDictionary *format_options;
+AVDictionary *vtt_format_options;
+
 } HLSContext;
 
 static int hls_delete_old_segments(HLSContext *hls)

Re: [FFmpeg-devel] Adding Webvtt in hls muxer

2015-02-26 Thread Anshul


On 02/25/2015 10:04 PM, Deron wrote:

On 2/21/15 8:05 AM, Deron wrote:

On 2/15/15 5:44 AM, Anshul wrote:


attached another cleaned patch.

-Anshul


Not sure if I should be posting here, privately, or do the user list 
since it is an unaccepted patch... This patch applies cleanly to 
ffmpeg git of that day, and with minor adjustment to current git, but 
either crashes the same for me right away. Here is the back trace 
from gdb:



Program received signal SIGSEGV, Segmentation fault.
__GI___libc_realloc (oldmem=0x70, bytes=8) at malloc.c:2977
2977malloc.c: No such file or directory.
(gdb) bt
#0  __GI___libc_realloc (oldmem=0x70, bytes=8) at malloc.c:2977
#1  0x77609b99 in avformat_new_stream (s=s@entry=0xe2dbc0, 
c=c@entry=0x0) at libavformat/utils.c:3655
#2  0x775451c4 in hls_mux_init (s=0x6787c0) at 
libavformat/hlsenc.c:194

#3  hls_write_header (s=0x6787c0) at libavformat/hlsenc.c:490
#4  0x775999ec in avformat_write_header (s=s@entry=0x6787c0, 
options=0x6a9948) at libavformat/mux.c:406

#5  0x00424c00 in transcode_init () at ffmpeg.c:3096
#6  0x00407581 in transcode () at ffmpeg.c:3815
#7  main (argc=13, argv=0x7fffe5a8) at ffmpeg.c:4022


The command (I've tried all sorts of combinations. If I don't provide 
a subtitle stream, it does not crash. Otherwise it does. Unpatched 
can generate a webvtt from the subtitle stream without crashing.)


ffmpeg -loglevel debug -f lavfi -i movie=out.ts\[out0+subcc\] -f hls 
-hls_segment_filename /var/www/html/stream/kota/v.low.%d.ts 
-hls_subtitle_path /var/www/html/stream/kota/ -y 
/var/www/html/stream/kota/v.low.m3u8




I did find the problem. The patch does not properly initialize 
hls->vtt_oformat (etc) if you provide the "-hls_segment_filename" 
parameter as I have done.


Deron

I have attached new patch with correctly initializing the webvtt, can 
you please check this patch again.


-Anshul

>From 176ee7227e3991925ced0ad593ae670d871a489d Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Thu, 26 Feb 2015 16:53:17 +0530
Subject: [PATCH] Adding WebVtt implementation in hls

---
 libavformat/hlsenc.c | 178 +++
 1 file changed, 167 insertions(+), 11 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 29bf30e..35260a1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -39,6 +39,7 @@
 
 typedef struct HLSSegment {
 char filename[1024];
+char sub_filename[1024];
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
@@ -58,8 +59,10 @@ typedef struct HLSContext {
 int64_t sequence;
 int64_t start_sequence;
 AVOutputFormat *oformat;
+AVOutputFormat *vtt_oformat;
 
 AVFormatContext *avf;
+AVFormatContext *vtt_avf;
 
 float time;// Set by a private option.
 int max_nb_segments;   // Set by a private option.
@@ -70,6 +73,7 @@ typedef struct HLSContext {
 int allowcache;
 int64_t recording_time;
 int has_video;
+int has_subtitle;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
@@ -82,11 +86,17 @@ typedef struct HLSContext {
 HLSSegment *old_segments;
 
 char *basename;
+char *vtt_basename;
+char *vtt_m3u8_name;
 char *baseurl;
 char *format_options_str;
+char *vtt_format_options_str;
+char *subtitle_filename;
 AVDictionary *format_options;
+AVDictionary *vtt_format_options;
 
 AVIOContext *pb;
+AVIOContext *sub_pb;
 } HLSContext;
 
 static int hls_delete_old_segments(HLSContext *hls) {
@@ -158,6 +168,7 @@ static int hls_mux_init(AVFormatContext *s)
 {
 HLSContext *hls = s->priv_data;
 AVFormatContext *oc;
+AVFormatContext *vtt_oc;
 int i, ret;
 
 ret = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
@@ -170,10 +181,25 @@ static int hls_mux_init(AVFormatContext *s)
 oc->max_delay  = s->max_delay;
 av_dict_copy(&oc->metadata, s->metadata, 0);
 
+
+if(hls->vtt_oformat) {
+ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
+if (ret < 0)
+return ret;
+vtt_oc = hls->vtt_avf;
+vtt_oc->oformat   = hls->vtt_oformat;
+av_dict_copy(&vtt_oc->metadata, s->metadata, 0);
+}
+
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st;
-if (!(st = avformat_new_stream(oc, NULL)))
-return AVERROR(ENOMEM);
+if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && hls->vtt_oformat) {
+if (!(st = avformat_new_stream(vtt_oc, NULL)))
+return AVERROR(ENOMEM);
+} else {
+if (!(st = avformat_new_stream(oc, NULL)))
+return AVERROR(ENOMEM);
+}
 avcodec_

Re: [FFmpeg-devel] Adding Webvtt in hls muxer

2015-02-15 Thread Anshul


On 01/19/2015 08:11 PM, Clément Bœsch wrote:

On Wed, Jan 14, 2015 at 04:56:26PM +0530, Anshul wrote:

On 01/13/2015 04:19 PM, Anshul wrote:

Hi

I have attached the patch.

Thanks
Anshul Maheshwari

Another patch freeing memory leakage introduced by this patch.

-Anshul
 From 6829d7013819418011dfba2b40657d3f921bcaee Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Fri, 2 Jan 2015 13:18:11 +0530
Subject: [PATCH 1/2] Added webvtt in hls

Signed-off-by: Anshul Maheshwari 
---
  libavformat/Makefile |   2 +-
  libavformat/hlsenc_vaibhav.c | 600 +++
  2 files changed, 601 insertions(+), 1 deletion(-)
  create mode 100644 libavformat/hlsenc_vaibhav.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 7e4beac..431031d 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -177,7 +177,7 @@ OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
  OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
  OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
  OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
-OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o
+OBJS-$(CONFIG_HLS_MUXER) += hlsenc_vaibhav.o

???

[...]


Sorry for that.



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


attached another cleaned patch.

-Anshul
>From d760b3847104e86ed72bd28ced4b088be6c381d1 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Sun, 15 Feb 2015 18:12:24 +0530
Subject: [PATCH] Implimenting WebVtt in HlS

Signed-off-by: Anshul Maheshwari 
---
 libavformat/hlsenc.c | 176 ---
 1 file changed, 166 insertions(+), 10 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 29bf30e..3826716 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -39,6 +39,7 @@
 
 typedef struct HLSSegment {
 char filename[1024];
+char sub_filename[1024];
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
@@ -58,8 +59,10 @@ typedef struct HLSContext {
 int64_t sequence;
 int64_t start_sequence;
 AVOutputFormat *oformat;
+AVOutputFormat *vtt_oformat;
 
 AVFormatContext *avf;
+AVFormatContext *vtt_avf;
 
 float time;// Set by a private option.
 int max_nb_segments;   // Set by a private option.
@@ -70,6 +73,7 @@ typedef struct HLSContext {
 int allowcache;
 int64_t recording_time;
 int has_video;
+int has_subtitle;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
@@ -82,11 +86,17 @@ typedef struct HLSContext {
 HLSSegment *old_segments;
 
 char *basename;
+char *vtt_basename;
+char *vtt_m3u8_name;
 char *baseurl;
 char *format_options_str;
+char *vtt_format_options_str;
+char *subtitle_filename;
 AVDictionary *format_options;
+AVDictionary *vtt_format_options;
 
 AVIOContext *pb;
+AVIOContext *sub_pb;
 } HLSContext;
 
 static int hls_delete_old_segments(HLSContext *hls) {
@@ -158,6 +168,7 @@ static int hls_mux_init(AVFormatContext *s)
 {
 HLSContext *hls = s->priv_data;
 AVFormatContext *oc;
+AVFormatContext *vtt_oc;
 int i, ret;
 
 ret = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
@@ -170,10 +181,25 @@ static int hls_mux_init(AVFormatContext *s)
 oc->max_delay  = s->max_delay;
 av_dict_copy(&oc->metadata, s->metadata, 0);
 
+
+if(hls->vtt_oformat) {
+ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
+if (ret < 0)
+return ret;
+vtt_oc = hls->vtt_avf;
+vtt_oc->oformat   = hls->vtt_oformat;
+av_dict_copy(&vtt_oc->metadata, s->metadata, 0);
+}
+
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st;
-if (!(st = avformat_new_stream(oc, NULL)))
-return AVERROR(ENOMEM);
+if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+if (!(st = avformat_new_stream(vtt_oc, NULL)))
+return AVERROR(ENOMEM);
+} else {
+if (!(st = avformat_new_stream(oc, NULL)))
+return AVERROR(ENOMEM);
+}
 avcodec_copy_context(st->codec, s->streams[i]->codec);
 st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
 st->time_base = s->streams[i]->time_base;
@@ -195,6 +221,9 @@ static int hls_append_segment(HLSContext *hls, double duration, int64_t pos,
 
 av_strlcpy(en->filename, av_basename(hls->avf->filename), sizeof(en->filename));
 
+if(hls->has_subtitle)
+av_strlcpy(en->sub_filename, av_basename(hls->vtt_avf->filename), sizeof(e

Re: [FFmpeg-devel] Enable stream copy of data

2015-02-15 Thread Anshul


On 02/08/2015 11:10 PM, Michael Niedermayer wrote:

On Sun, Feb 08, 2015 at 10:42:43PM +0530, Anshul wrote:

On 01/16/2015 07:21 AM, Michael Niedermayer wrote:
@@ -1927,6 +1932,11 @@ static int open_output_file(OptionsContext *o, const 
char *filename)
  }
  }
  /* do something with data? */
+if (!o->data_disable && av_guess_codec(oc->oformat, NULL, filename, 
NULL, AVMEDIA_TYPE_DATA) != AV_CODEC_ID_NONE) {
+for (i = 0; i < nb_input_streams; i++)
+if (input_streams[i]->st->codec->codec_type == 
AVMEDIA_TYPE_DATA)
+new_data_stream(o, oc, i);
+}

this probably needs something "more" to work, like we wouldnt
want to matchup a data stream with GPS data to a scte_35 stream
iam not sure how to best do this though
for stream copy the codec_id could be used though i guess


working on it.

-Anshul

I have attached new patch, using codec_id for match.
-Anshul
>From b4480e70d6d18c2eebbbc65a0317b2b790a7ee49 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Sun, 15 Feb 2015 15:24:01 +0530
Subject: [PATCH] Creating new data stream for output format context

Signed-off-by: Anshul Maheshwari 

if input codec Id match with expected data stream of output format context
then only new stream with same codec id is created.
---
 ffmpeg_opt.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 56b882e..3eb8e8c 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1935,7 +1935,15 @@ static int open_output_file(OptionsContext *o, const char *filename)
 }
 }
 }
-/* do something with data? */
+/* Data only if codec id match */
+if (!o->data_disable ) {
+enum AVCodecID codec_id = av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_DATA);
+for (i = 0; codec_id != AV_CODEC_ID_NONE && i < nb_input_streams; i++) {
+if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_DATA
+ && input_streams[i]->st->codec->codec_id == codec_id )
+new_data_stream(o, oc, i);
+}
+}
 } else {
 for (i = 0; i < o->nb_stream_maps; i++) {
 StreamMap *map = &o->stream_maps[i];
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Enable stream copy of data

2015-02-15 Thread Anshul


On 02/09/2015 02:13 PM, Kieran Kunhya wrote:

I am using bmd device to test this.
No one came with more scte_35 video on trac, I thought people putting the 
bounty will give me some video.

How are you testing with a bmd device?

piping out the bmdtool output to ffmpeg.
There is lot of things need to be done if you want to use bmd logic of 
ffmpeg.



As far as I can tell it just works by chance.


I have done some improvement lately now it work without copyts and vsnc 0 if 
splice immidiate is used.

Can you explain your verification steps in detail?

Step1) grab the bmdtools from my git repository.
https://github.com/anshul1912/bmdtools.git

Step2) grab the FFmpeg from my fork repository
https://github.com/anshul1912/FFmpeg.git
Note: This ffmpeg fork is used as my backup of ffmpeg, so commit message
are not very well aligned and there are lots of garbage in this repo.

Step 3) pipe the nut output of bmdtool to ffmpeg
Note: If you do have bmd device, then also take pains by asking your 
broadcaster
on which line they are giving scte data, because there is no predefined 
line for this.


I dont own any bmd device, so I cant give ssh or access to my pc with 
device.


I have tested it for weeks, I don't see any issue with my scte-35 logic yet.

Kieran
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Enable stream copy of data

2015-02-08 Thread Anshul
On February 8, 2015 11:07:12 PM IST, Kieran Kunhya  wrote:
>> It has timestamp inside the data stream, and for making a simple use
>case scte need -copyts and -vsync 0 param. Otherwise user can ignore
>the data as they always did.
>> -Anshul
>
>Is FFmpeg aware of this PTS and how to place the data packet with
>respect to PES packets?
Only scte_35.c file is aware of this patch. I dont know where placing of 
packets is done. I would look and tell how its done.
>How are you testing this patch?
>
I am using bmd device to test this.
No one came with more scte_35 video on trac, I thought people putting the 
bounty will give me some video. 
>As far as I can tell it just works by chance.
>
I have done some improvement lately now it work without copyts and vsnc 0 if 
splice immidiate is used.

>Kieran
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Enable stream copy of data

2015-02-08 Thread Anshul


On 01/16/2015 07:21 AM, Michael Niedermayer wrote:

On Wed, Jan 14, 2015 at 03:11:24PM +0530, Anshul wrote:

Hi

I have enabled demuxing and muxing path for datat stream

Please find attachment

Thanks
Anshul
  ffmpeg.c|2 ++
  ffmpeg_opt.c|   10 ++
  libavcodec/avcodec.h|1 +
  libavcodec/codec_desc.c |6 ++
  libavformat/Makefile|1 +
  libavformat/avformat.h  |   17 +
  libavformat/format.c|2 ++
  libavformat/mpegts.c|   43 +--
  libavformat/utils.c |1 +
  9 files changed, 77 insertions(+), 6 deletions(-)
40306177e8bb3e95b98060f6202b38bb8acba26a  0001-Enable-data-stream-copy.patch
 From 99bcdef2bcd9aa5bd18a0a005e0826e22ad2cf63 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Wed, 14 Jan 2015 15:06:50 +0530
Subject: [PATCH] Enable data stream copy

Signed-off-by: Anshul Maheshwari 
---
  ffmpeg.c|  2 ++
  ffmpeg_opt.c| 10 ++
  libavcodec/avcodec.h|  1 +
  libavcodec/codec_desc.c |  6 ++
  libavformat/Makefile|  1 +
  libavformat/avformat.h  | 17 +
  libavformat/format.c|  2 ++
  libavformat/mpegts.c| 43 +--
  libavformat/utils.c |  1 +
  9 files changed, 77 insertions(+), 6 deletions(-)

applied the generic data stream handling improvments to libavformat
and ffmpeg

please update APIChanges


patch attached.

also
[...]

@@ -1927,6 +1932,11 @@ static int open_output_file(OptionsContext *o, const 
char *filename)
  }
  }
  /* do something with data? */
+if (!o->data_disable && av_guess_codec(oc->oformat, NULL, filename, 
NULL, AVMEDIA_TYPE_DATA) != AV_CODEC_ID_NONE) {
+for (i = 0; i < nb_input_streams; i++)
+if (input_streams[i]->st->codec->codec_type == 
AVMEDIA_TYPE_DATA)
+new_data_stream(o, oc, i);
+}

this probably needs something "more" to work, like we wouldnt
want to matchup a data stream with GPS data to a scte_35 stream
iam not sure how to best do this though
for stream copy the codec_id could be used though i guess


working on it.

-Anshul
>From d9bcc7761fe4f7d98be1b518bed95c177e7504cf Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Sun, 8 Feb 2015 22:37:07 +0530
Subject: [PATCH] updated Data stream changes in APIChange

Signed-off-by: Anshul Maheshwari 
---
 doc/APIchanges | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 65fd599..e46124a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -19,6 +19,9 @@ API changes, most recent first:
   Add AV_PKT_DATA_AUDIO_SERVICE_TYPE and AV_FRAME_DATA_AUDIO_SERVICE_TYPE for
   storing the audio service type as side data.
 
+2015-01-16 - a47c933 - lavf 56.19.100 - avformat.h
+  Add data_codec and data_codec_id for storing codec of data stream
+
 2015-01-11 - 007c33d - lavd 56.4.100 - avdevice.h
   Add avdevice_list_input_sources().
   Add avdevice_list_output_sinks().
-- 
2.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Adding Rollup support in Closed caption

2015-02-06 Thread Anshul


On 02/07/2015 10:30 AM, Michael Niedermayer wrote:

On Fri, Feb 06, 2015 at 08:22:40PM +0530, Anshul wrote:

On 01/30/2015 08:49 AM, Anshul wrote:

On January 30, 2015 4:23:08 AM IST, Michael Niedermayer  
wrote:

@@ -426,10 +466,13 @@ static int process_cc608(CCaptionSubContext
*ctx, int64_t pts, uint8_t hi, uint8

  handle_delete_end_of_row(ctx, hi, lo);
  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x25 ) {
  ctx->rollup = 2;
+ctx->mode = CCMODE_ROLLUP_2;
  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x26 ) {
  ctx->rollup = 3;
+ctx->mode = CCMODE_ROLLUP_3;
  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x27 ) {
  ctx->rollup = 4;
+ctx->mode = CCMODE_ROLLUP_3;

is this intended to be CCMODE_ROLLUP_3 instead of CCMODE_ROLLUP_4 ?

also do you have a file to test this and the other patches ?

thanks

[...]

I tested this on bmd live video, all the rollup values were not tested, I 
implemented this feature when roll up 2 was coming.

I will check the database of ccextractor, if I get some video with different 
rollup.


-Anshul


I have attached the patch which were not commited, In the rollup
functionality there was one more
bug other then typo, the first line was lost while converting the cc.
I have corrected that.

Here 
<http://gsocdev.ccextractor.org/%7Eanshul/test_video/Closedcaption_rollup.ts>
is video with rollup in closed caption.

how can this be used for testing ?
do you have a command line with that video that shows a difference
with the patches ?
the patches themselfs look good

[...]

There is no different Command, its same as used to extract.
./ffmpeg_g -loglevel debug -f lavfi -i 
movie=/home/anshul/test_video/Closedcaption_rollup.ts[out0+subcc] some.srt


The difference between the output is following

Without patch

some line 1
some line 2


some line 3
some line 4

with patch

some line 1
some line 2


some line 2
some line 3


some line 3
some line 4

And rollup functionality is specified in closed caption commands(inside 
video).

So on same video rollup and without rollup is not possible.



@@ -187,7 +187,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
  ret = AVERROR(ENOMEM);
  }
  
-

+fail:
  return ret;
  }
  

i moved this hunk to the 2nd patch and applied first and second
with also module "avcodec/..." prefixes in the commit messages

Thanks

[...]



-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Adding Rollup support in Closed caption

2015-02-06 Thread Anshul


On 01/30/2015 08:49 AM, Anshul wrote:

On January 30, 2015 4:23:08 AM IST, Michael Niedermayer  
wrote:

@@ -426,10 +466,13 @@ static int process_cc608(CCaptionSubContext
*ctx, int64_t pts, uint8_t hi, uint8

  handle_delete_end_of_row(ctx, hi, lo);
  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x25 ) {
  ctx->rollup = 2;
+ctx->mode = CCMODE_ROLLUP_2;
  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x26 ) {
  ctx->rollup = 3;
+ctx->mode = CCMODE_ROLLUP_3;
  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x27 ) {
  ctx->rollup = 4;
+ctx->mode = CCMODE_ROLLUP_3;

is this intended to be CCMODE_ROLLUP_3 instead of CCMODE_ROLLUP_4 ?

also do you have a file to test this and the other patches ?

thanks

[...]

I tested this on bmd live video, all the rollup values were not tested, I 
implemented this feature when roll up 2 was coming.

I will check the database of ccextractor, if I get some video with different 
rollup.


-Anshul

I have attached the patch which were not commited, In the rollup 
functionality there was one more

bug other then typo, the first line was lost while converting the cc.
I have corrected that.

Here 
<http://gsocdev.ccextractor.org/%7Eanshul/test_video/Closedcaption_rollup.ts> 
is video with rollup in closed caption.


-Anshul


>From e8a36edbba5ea1db15d14413bad7db28eec67b5a Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Fri, 6 Feb 2015 20:10:11 +0530
Subject: [PATCH 1/3] Added Roll up functionality

Signed-off-by: Anshul Maheshwari 
---
 libavcodec/ccaption_dec.c | 102 --
 1 file changed, 72 insertions(+), 30 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index 9e78ee5..45b932e 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -151,7 +151,6 @@ struct Screen {
 
 typedef struct CCaptionSubContext {
 AVClass *class;
-int row_cnt;
 struct Screen screen[2];
 int active_screen;
 uint8_t cursor_row;
@@ -179,6 +178,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
 
 av_bprint_init(&ctx->buffer, 0, AV_BPRINT_SIZE_UNLIMITED);
 /* taking by default roll up to 2 */
+ctx->mode = CCMODE_ROLLUP_2;
 ctx->rollup = 2;
 ret = ff_ass_subtitle_header_default(avctx);
 /* allocate pkt buffer */
@@ -187,7 +187,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
 ret = AVERROR(ENOMEM);
 }
 
-
+fail:
 return ret;
 }
 
@@ -280,6 +280,68 @@ static struct Screen *get_writing_screen(CCaptionSubContext *ctx)
 return NULL;
 }
 
+static void roll_up(CCaptionSubContext *ctx)
+{
+struct Screen *screen;
+int i, keep_lines;
+
+if(ctx->mode == CCMODE_TEXT)
+return;
+
+screen = get_writing_screen(ctx);
+
+/* +1 signify cursor_row starts from 0
+ * Can't keep lines less then row cursor pos
+ */
+keep_lines = FFMIN(ctx->cursor_row + 1, ctx->rollup);
+
+for( i = 0; i < ctx->cursor_row - keep_lines; i++ )
+UNSET_FLAG(screen->row_used, i);
+
+
+for( i = 0; i < keep_lines && screen->row_used; i++ ) {
+const int i_row = ctx->cursor_row - keep_lines + i + 1;
+
+memcpy( screen->characters[i_row], screen->characters[i_row+1], SCREEN_COLUMNS );
+memcpy( screen->colors[i_row], screen->colors[i_row+1], SCREEN_COLUMNS);
+memcpy( screen->fonts[i_row], screen->fonts[i_row+1], SCREEN_COLUMNS);
+if(CHECK_FLAG(screen->row_used, i_row + 1))
+SET_FLAG(screen->row_used, i_row);
+
+}
+UNSET_FLAG(screen->row_used, ctx->cursor_row);
+
+}
+
+static int reap_screen(CCaptionSubContext *ctx, int64_t pts)
+{
+int i;
+int ret = 0;
+struct Screen *screen = ctx->screen + ctx->active_screen;
+ctx->start_time = ctx->startv_time;
+
+for( i = 0; screen->row_used && i < SCREEN_ROWS; i++)
+{
+if(CHECK_FLAG(screen->row_used,i)) {
+char *str = screen->characters[i];
+/* skip space */
+while (*str == ' ')
+str++;
+
+av_bprintf(&ctx->buffer, "%s\\N", str);
+ret = av_bprint_is_complete(&ctx->buffer);
+if( ret == 0) {
+ret = AVERROR(ENOMEM);
+break;
+}
+}
+
+}
+ctx->startv_time = pts;
+ctx->end_time = pts;
+return ret;
+}
+
 static void handle_textattr( CCaptionSubContext *ctx, uint8_t hi, uint8_t lo )
 {
 int i = lo - 0x20;
@@ -333,32 +395,12 @@ static void handle_pac( CCaptionSubContext *ctx, uint8_t hi, uint8_t lo )
  */
 static int handle_edm(CCaptionSubContext *ctx,int64_t pts)
 {
-int i;
 int ret = 0;
 struct Screen *screen = ctx->screen + ctx->active_screen;
 
-ctx-

Re: [FFmpeg-devel] [FFmpeg-cvslog] Adding Closed caption Support

2015-01-29 Thread Anshul
On January 30, 2015 4:23:08 AM IST, Michael Niedermayer  
wrote:
>On Tue, Jan 20, 2015 at 04:39:40PM +0530, Anshul wrote:
>> 
>> On 01/13/2015 01:15 PM, Clément Bœsch wrote:
>> >On Tue, Jan 13, 2015 at 08:12:10AM +0100, Clément Bœsch wrote:
>> >>On Tue, Jan 13, 2015 at 11:26:06AM +0530, Anshul Maheshwari wrote:
>> >>[...]
>> >>>>Also added roll-up functionality.
>> >>>>
>> >>>>patch is attached.
>> >>>>Thanks
>> >>>>Anshul
>> >>>>
>> >>>Attaching patch
>> >>> From ca66e917f45bd47dd797930423d488fa9c781c4c Mon Sep 17 00:00:00
>2001
>> >>>From: Anshul Maheshwari 
>> >>>Date: Mon, 12 Jan 2015 06:21:18 -0800
>> >>>Subject: [PATCH] Addig Rollup functionality
>> >>>
>> >>>Signed-off-by: Anshul Maheshwari 
>> >>>---
>> >>>  libavcodec/ccaption_dec.c | 222
>+-
>> >>>  1 file changed, 140 insertions(+), 82 deletions(-)
>> >>>
>> >>Please split your changes.
>> >>
>> >>One patch for the cosmetics
>> >>One patch for the CHAR_DEBUG/av_dlog
>> >>One patch for the addition of av_log
>> >>One patch for the reflow of init_decoder()
>> >>One patch for the roll-up functionality
>> >>One patchset to rule them all.
>> >>
>> >>Thank you.
>> >>
>> >hint: git add -p is your friend
>> >
>> >
>> Thanks still learning it, most of the time git say patch cant be
>applied.
>> 
>> 
>> 
>> Attached all patch.
>> 
>> -Anshul
>
>[...]
>>  ccaption_dec.c |2 ++
>>  1 file changed, 2 insertions(+)
>> 72af7072bc57b3f66911b14cb09b1ed6e74cb125 
>0004-Adding-color-and-fonts-for-future-use-in-screen.patch
>> From 90915dfc6fecb57787b3aad228781ed04f3e7cb9 Mon Sep 17 00:00:00
>2001
>> From: Anshul Maheshwari 
>> Date: Tue, 20 Jan 2015 16:02:29 +0530
>> Subject: [PATCH 4/8] Adding color and fonts for future use in screen
>
>applied
>
>
>[...]
>
>> @@ -426,10 +466,13 @@ static int process_cc608(CCaptionSubContext
>*ctx, int64_t pts, uint8_t hi, uint8
>>  handle_delete_end_of_row(ctx, hi, lo);
>>  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x25 ) {
>>  ctx->rollup = 2;
>> +ctx->mode = CCMODE_ROLLUP_2;
>>  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x26 ) {
>>  ctx->rollup = 3;
>> +ctx->mode = CCMODE_ROLLUP_3;
>>  } else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x27 ) {
>>  ctx->rollup = 4;
>> +ctx->mode = CCMODE_ROLLUP_3;
>
>is this intended to be CCMODE_ROLLUP_3 instead of CCMODE_ROLLUP_4 ?
>
>also do you have a file to test this and the other patches ?
>
>thanks
>
>[...]

I tested this on bmd live video, all the rollup values were not tested, I 
implemented this feature when roll up 2 was coming. 

I will check the database of ccextractor, if I get some video with different 
rollup.


-Anshul

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] Adding Closed caption Support

2015-01-29 Thread Anshul


On 01/20/2015 07:26 PM, Michael Niedermayer wrote:

On Tue, Jan 20, 2015 at 04:39:40PM +0530, Anshul wrote:

On 01/13/2015 01:15 PM, Clément Bœsch wrote:

On Tue, Jan 13, 2015 at 08:12:10AM +0100, Clément Bœsch wrote:

On Tue, Jan 13, 2015 at 11:26:06AM +0530, Anshul Maheshwari wrote:
[...]

Also added roll-up functionality.

patch is attached.
Thanks
Anshul


Attaching patch
 From ca66e917f45bd47dd797930423d488fa9c781c4c Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 12 Jan 2015 06:21:18 -0800
Subject: [PATCH] Addig Rollup functionality

Signed-off-by: Anshul Maheshwari 
---
  libavcodec/ccaption_dec.c | 222 +-
  1 file changed, 140 insertions(+), 82 deletions(-)


Please split your changes.

One patch for the cosmetics
One patch for the CHAR_DEBUG/av_dlog
One patch for the addition of av_log
One patch for the reflow of init_decoder()
One patch for the roll-up functionality
One patchset to rule them all.

Thank you.


hint: git add -p is your friend



Thanks still learning it, most of the time git say patch cant be applied.



Attached all patch.

applied 1-3 and 5, rest left to others, probably ubitux to
review/apply, if noone else does ill look at them

ping.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Decoder for CEA-608 and World System Teletext [WIP]

2015-01-23 Thread Anshul
On January 23, 2015 7:05:28 PM IST, Michael Niedermayer  
wrote:
>On Fri, Jan 23, 2015 at 01:49:44PM +0100, wm4 wrote:
>> On Fri, 23 Jan 2015 13:40:36 +0100
>> Hendrik Leppkes  wrote:
>> 
>> > On Fri, Jan 23, 2015 at 1:33 PM, wm4  wrote:
>> > 
>> > > On Fri, 23 Jan 2015 04:42:22 +0100
>> > > Michael Niedermayer  wrote:
>> > >
>> > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> > > > index 99467bb..6a0fb5b 100644
>> > > > --- a/libavcodec/avcodec.h
>> > > > +++ b/libavcodec/avcodec.h
>> > > > @@ -503,11 +503,13 @@ enum AVCodecID {
>> > > >  AV_CODEC_ID_SSA,
>> > > >  AV_CODEC_ID_MOV_TEXT,
>> > > >  AV_CODEC_ID_HDMV_PGS_SUBTITLE,
>> > > > -AV_CODEC_ID_DVB_TELETEXT,
>> > > > +AV_CODEC_ID_DVB_VBI,
>> > >
>> > > Breaks everything, including API and ABI. I guess that's why the
>patch
>> > > is "WIP"?
>
>ive added the "WIP" to shans patch to indicate that it needs more work,
>iam actually not sure who will work on it (anshul, akira, shan ?),
>
>

I have kept it in my todo list, just now I am working on isdb closed caption, 
will take it over after completing isdb, if someone want to take it over, I 
would help him. For sure. I expect basic isdb to be completed by 10-15 days.

Also I wanted to ask if someone is intrested to buy the spec, or sponsor the 
spec of cc608 it would be highly appreciated,  since I have made this closed 
caption on basis of my knowledge gained at gsoc with ccextractor. So to take 
decision in case of discrepancy that would help a lot.
>> > >
>> > 
>> > Unless I missed something else, ABI is unaffected since the values
>didn't
>> > change, just the name of the enum entry. A #define would take care
>of that
>> > from the API side of things.
>> 
>> That would imply the new codec ID is actually compatible with the old
>> one. Should it still be renamed?
>
>shan is not subscribed AFAIK so if you dont CC him he wont reply
>probably
>
>[...]


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [shan...@gmail.com: [libav-devel] Decoder for CEA-608 and World System Teletext]

2015-01-21 Thread Anshul


On 01/22/2015 12:12 PM, Shan wrote:

On 2015-01-20T11:52:39+0100 u...@pkh.me relayed:


The patches are welcome though, it might be easier to
work with.

Here's a base64 patch for the  CEA-608, EIA-708, Teletext, DVB VBI and
MXF VANC decoder, as well as some other related changes as well as
support in mpegts for Fortis OEM recordings with no PAT.

Shan


Thanks Shan.

I will try to take good part of the patch from it.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] Adding Closed caption Support

2015-01-20 Thread Anshul


On 01/13/2015 01:15 PM, Clément Bœsch wrote:

On Tue, Jan 13, 2015 at 08:12:10AM +0100, Clément Bœsch wrote:

On Tue, Jan 13, 2015 at 11:26:06AM +0530, Anshul Maheshwari wrote:
[...]

Also added roll-up functionality.

patch is attached.
Thanks
Anshul


Attaching patch
 From ca66e917f45bd47dd797930423d488fa9c781c4c Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 12 Jan 2015 06:21:18 -0800
Subject: [PATCH] Addig Rollup functionality

Signed-off-by: Anshul Maheshwari 
---
  libavcodec/ccaption_dec.c | 222 +-
  1 file changed, 140 insertions(+), 82 deletions(-)


Please split your changes.

One patch for the cosmetics
One patch for the CHAR_DEBUG/av_dlog
One patch for the addition of av_log
One patch for the reflow of init_decoder()
One patch for the roll-up functionality
One patchset to rule them all.

Thank you.


hint: git add -p is your friend



Thanks still learning it, most of the time git say patch cant be applied.



Attached all patch.

-Anshul
>From 9c0e055165988ce3d5dfe4734d3736ec01da7b1c Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 20 Jan 2015 15:51:23 +0530
Subject: [PATCH 1/8] Cosmetic changes in cc_caption

Signed-off-by: Anshul Maheshwari 
---
 libavcodec/ccaption_dec.c | 88 ++-
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index e05468f..1f2dfe6 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -27,9 +27,9 @@
 #define SCREEN_ROWS 15
 #define SCREEN_COLUMNS 32
 
-#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
-#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
-#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
+#define SET_FLAG(var, val)   ( (var) |=   ( 1 << (val)) )
+#define UNSET_FLAG(var, val) ( (var) &=  ~( 1 << (val)) )
+#define CHECK_FLAG(var, val) ( (var) &( 1 << (val)) )
 
 /*
  * TODO list
@@ -44,8 +44,7 @@ enum cc_mode {
 CCMODE_TEXT,
 };
 
-enum cc_color_code
-{
+enum cc_color_code {
 CCCOL_WHITE,
 CCCOL_GREEN,
 CCCOL_BLUE,
@@ -58,8 +57,7 @@ enum cc_color_code
 CCCOL_TRANSPARENT,
 };
 
-enum cc_font
-{
+enum cc_font {
 CCFONT_REGULAR,
 CCFONT_ITALICS,
 CCFONT_UNDERLINED,
@@ -68,40 +66,41 @@ enum cc_font
 
 static const unsigned char pac2_attribs[][3] = // Color, font, ident
 {
-{ CCCOL_WHITE, CCFONT_REGULAR, 0 },  // 0x40 || 0x60
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 0 },  // 0x41 || 0x61
-{ CCCOL_GREEN, CCFONT_REGULAR, 0 },  // 0x42 || 0x62
-{ CCCOL_GREEN, CCFONT_UNDERLINED, 0 },  // 0x43 || 0x63
-{ CCCOL_BLUE, CCFONT_REGULAR, 0 },  // 0x44 || 0x64
-{ CCCOL_BLUE, CCFONT_UNDERLINED, 0 },  // 0x45 || 0x65
-{ CCCOL_CYAN, CCFONT_REGULAR, 0 },  // 0x46 || 0x66
-{ CCCOL_CYAN, CCFONT_UNDERLINED, 0 },  // 0x47 || 0x67
-{ CCCOL_RED, CCFONT_REGULAR, 0 },  // 0x48 || 0x68
-{ CCCOL_RED, CCFONT_UNDERLINED, 0 },  // 0x49 || 0x69
-{ CCCOL_YELLOW, CCFONT_REGULAR, 0 },  // 0x4a || 0x6a
-{ CCCOL_YELLOW, CCFONT_UNDERLINED, 0 },  // 0x4b || 0x6b
-{ CCCOL_MAGENTA, CCFONT_REGULAR, 0 },  // 0x4c || 0x6c
-{ CCCOL_MAGENTA, CCFONT_UNDERLINED, 0 },  // 0x4d || 0x6d
-{ CCCOL_WHITE, CCFONT_ITALICS, 0 },  // 0x4e || 0x6e
-{ CCCOL_WHITE, CCFONT_UNDERLINED_ITALICS, 0 },  // 0x4f || 0x6f
-{ CCCOL_WHITE, CCFONT_REGULAR, 0 },  // 0x50 || 0x70
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 0 },  // 0x51 || 0x71
-{ CCCOL_WHITE, CCFONT_REGULAR, 4 },  // 0x52 || 0x72
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 4 },  // 0x53 || 0x73
-{ CCCOL_WHITE, CCFONT_REGULAR, 8 },  // 0x54 || 0x74
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 8 },  // 0x55 || 0x75
-{ CCCOL_WHITE, CCFONT_REGULAR, 12 }, // 0x56 || 0x76
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 12 }, // 0x57 || 0x77
-{ CCCOL_WHITE, CCFONT_REGULAR, 16 }, // 0x58 || 0x78
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 16 }, // 0x59 || 0x79
-{ CCCOL_WHITE, CCFONT_REGULAR, 20 }, // 0x5a || 0x7a
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 20 }, // 0x5b || 0x7b
-{ CCCOL_WHITE, CCFONT_REGULAR, 24 }, // 0x5c || 0x7c
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 24 }, // 0x5d || 0x7d
-{ CCCOL_WHITE, CCFONT_REGULAR, 28 }, // 0x5e || 0x7e
-{ CCCOL_WHITE, CCFONT_UNDERLINED, 28 }  // 0x5f || 0x7f
+{ CCCOL_WHITE,   CCFONT_REGULAR,0 },  // 0x40 || 0x60
+{ CCCOL_WHITE,   CCFONT_UNDERLINED, 0 },  // 0x41 || 0x61
+{ CCCOL_GREEN,   CCFONT_REGULAR,0 },  // 0x42 || 0x62
+{ CCCOL_GREEN,   CCFONT_UNDERLINED, 0 },  // 0x43 || 0x63
+{ CCCOL_BLUE,CCFONT_REGULAR,0 },  // 0x44 || 0x64
+{ CCCOL_BLUE,CCFONT_UNDERLINED, 0 },  // 0x45 || 0x65
+{ CCCOL_CYAN,CCFONT_REGULAR,0 },  // 0x46 || 0x66
+{ CCCOL_CYAN,CCFONT_UNDERLINED, 0 },  // 0x47 || 0x67
+{ CCCOL_RED, CCFONT_REGULAR,0 },  

Re: [FFmpeg-devel] Adding Closed caption in nut muxer

2015-01-20 Thread Anshul


On 01/13/2015 06:50 PM, Michael Niedermayer wrote:

On Tue, Jan 13, 2015 at 12:00:36PM +0100, Nicolas George wrote:

Le quartidi 24 nivôse, an CCXXIII, Anshul a écrit :

Please find attachment.
Using this people can also mux cc608 stream in nut muxer

IIRC, you need to submit a patch to libnut before, because it holds the
official list of codes.

libnut is an implementation of teh nut spec
the nut spec is at
svn://svn.mplayerhq.hu/nut

see docs/nut4cc.txt

also:
https://lists.mplayerhq.hu/mailman/listinfo/nut-devel

to add a new fourcc code to nut, send a patch that changes
docs/nut4cc.txt to nut-devel

I have subscribed the list, but it is still not confirmed yet. So things 
are in process.


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Enable stream copy of data

2015-01-14 Thread Anshul
On January 15, 2015 1:06:19 AM IST, Kieran Kunhya  wrote:
>On 14 January 2015 at 09:41, Anshul  wrote:
>> Hi
>>
>> I have enabled demuxing and muxing path for datat stream
>
>How do you guarantee accuracy of the SCTE-35 stream without a
>timestamp?
I dont do gurantee for all case, mainly when pts is manipulated.

>Note that ffmpeg isn't able to understand timestamps here because it
>should be using an interpolated PCR.
>
It has timestamp inside the data stream, and for making a simple use case scte 
need -copyts and -vsync 0 param. Otherwise user can ignore the data as they 
always did.
-Anshul

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Adding Webvtt in hls muxer

2015-01-14 Thread Anshul
On 01/13/2015 04:19 PM, Anshul wrote:
> Hi
>
> I have attached the patch.
>
> Thanks
> Anshul Maheshwari
Another patch freeing memory leakage introduced by this patch.

-Anshul
>From 6829d7013819418011dfba2b40657d3f921bcaee Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Fri, 2 Jan 2015 13:18:11 +0530
Subject: [PATCH 1/2] Added webvtt in hls

Signed-off-by: Anshul Maheshwari 
---
 libavformat/Makefile |   2 +-
 libavformat/hlsenc_vaibhav.c | 600 +++
 2 files changed, 601 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/hlsenc_vaibhav.c

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 7e4beac..431031d 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -177,7 +177,7 @@ OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o
 OBJS-$(CONFIG_HEVC_DEMUXER)  += hevcdec.o rawdec.o
 OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o
 OBJS-$(CONFIG_HLS_DEMUXER)   += hls.o
-OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o
+OBJS-$(CONFIG_HLS_MUXER) += hlsenc_vaibhav.o
 OBJS-$(CONFIG_HNM_DEMUXER)   += hnm.o
 OBJS-$(CONFIG_ICO_DEMUXER)   += icodec.o
 OBJS-$(CONFIG_ICO_MUXER) += icoenc.o
diff --git a/libavformat/hlsenc_vaibhav.c b/libavformat/hlsenc_vaibhav.c
new file mode 100644
index 000..f80aab0
--- /dev/null
+++ b/libavformat/hlsenc_vaibhav.c
@@ -0,0 +1,600 @@
+/*
+ * Apple HTTP Live Streaming segmenter
+ * Copyright (c) 2012, Luca Barbato
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/parseutils.h"
+#include "libavutil/avstring.h"
+#include "libavutil/opt.h"
+#include "libavutil/log.h"
+
+#include "avformat.h"
+#include "internal.h"
+
+typedef struct HLSSegment {
+char filename[1024];
+char sub_filename[1024];
+double duration; /* in seconds */
+int64_t pos;
+int64_t size;
+
+struct HLSSegment *next;
+} HLSSegment;
+
+typedef enum HLSFlags {
+// Generate a single media file and use byte ranges in the playlist.
+HLS_SINGLE_FILE = (1 << 0),
+} HLSFlags;
+
+typedef struct HLSContext {
+const AVClass *class;  // Class for private options.
+unsigned number;
+int64_t sequence;
+int64_t start_sequence;
+AVOutputFormat *ts_oformat;
+AVOutputFormat *vtt_oformat;
+
+AVFormatContext *ts_avf;
+AVFormatContext *vtt_avf;
+
+float time;// Set by a private option.
+int max_nb_segments;   // Set by a private option.
+int  wrap; // Set by a private option.
+uint32_t flags;// enum HLSFlags
+
+int allowcache;
+int64_t recording_time;
+int has_video;
+int has_subtitle;
+int64_t start_pts;
+int64_t end_pts;
+double duration;  // last segment duration computed so far, in seconds
+int64_t start_pos;// last segment starting position
+int64_t size; // last segment size
+int nb_entries;
+
+HLSSegment *segments;
+HLSSegment *last_segment;
+
+char *ts_basename;
+char *vtt_basename;
+char *vtt_m3u8_name;
+char *baseurl;
+char *ts_format_options_str;
+char *vtt_format_options_str;
+char *subtitle_filename;
+AVDictionary *ts_format_options;
+AVDictionary *vtt_format_options;
+
+AVIOContext *pb;
+AVIOContext *sub_pb;
+} HLSContext;
+
+static int hls_mux_init(AVFormatContext *s)
+{
+HLSContext *hls = s->priv_data;
+AVFormatContext *ts_oc;
+AVFormatContext *vtt_oc;
+int i, ret;
+
+ret = avformat_alloc_output_context2(&hls->ts_avf, hls->ts_oformat, NULL, NULL);
+if (ret < 0)
+return ret;
+
+ts_oc = hls->ts_avf;
+ts_oc->oformat= hls->ts_oformat;
+ts_oc->interrupt_callback = s->interrupt_callback;
+ts_oc->max_delay  = s->max_delay;
+av_dict_copy(&ts_oc->metadata, s->metadata, 0);
+
+if(hls->vtt_oformat) {
+ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, N

[FFmpeg-devel] Enable stream copy of data

2015-01-14 Thread Anshul
Hi

I have enabled demuxing and muxing path for datat stream

Please find attachment

Thanks
Anshul
>From 99bcdef2bcd9aa5bd18a0a005e0826e22ad2cf63 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Wed, 14 Jan 2015 15:06:50 +0530
Subject: [PATCH] Enable data stream copy

Signed-off-by: Anshul Maheshwari 
---
 ffmpeg.c|  2 ++
 ffmpeg_opt.c| 10 ++
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  6 ++
 libavformat/Makefile|  1 +
 libavformat/avformat.h  | 17 +
 libavformat/format.c|  2 ++
 libavformat/mpegts.c| 43 +--
 libavformat/utils.c |  1 +
 9 files changed, 77 insertions(+), 6 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f9aa65f..4b57b45 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2906,6 +2906,8 @@ static int transcode_init(void)
 enc_ctx->height= input_streams[ost->source_index]->st->codec->height;
 }
 break;
+case AVMEDIA_TYPE_DATA:
+break;
 default:
 abort();
 break;
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 5c4df8c..dc55232 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -804,6 +804,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
 char *   video_codec_name = NULL;
 char *   audio_codec_name = NULL;
 char *subtitle_codec_name = NULL;
+char *data_codec_name = NULL;
 int scan_all_pmts_set = 0;
 
 if (o->format) {
@@ -864,6 +865,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
 find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0)->id : AV_CODEC_ID_NONE;
 ic->subtitle_codec_id= subtitle_codec_name ?
 find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : AV_CODEC_ID_NONE;
+ic->data_codec_id= data_codec_name ?
+find_codec_or_die(data_codec_name, AVMEDIA_TYPE_DATA, 0)->id : AV_CODEC_ID_NONE;
 
 if (video_codec_name)
 av_format_set_video_codec   (ic, find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0));
@@ -871,6 +874,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
 av_format_set_audio_codec   (ic, find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0));
 if (subtitle_codec_name)
 av_format_set_subtitle_codec(ic, find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0));
+if (data_codec_name)
+av_format_set_data_codec(ic, find_codec_or_die(data_codec_name, AVMEDIA_TYPE_DATA, 0));
 
 ic->flags |= AVFMT_FLAG_NONBLOCK;
 ic->interrupt_callback = int_cb;
@@ -1927,6 +1932,11 @@ static int open_output_file(OptionsContext *o, const char *filename)
 }
 }
 /* do something with data? */
+if (!o->data_disable && av_guess_codec(oc->oformat, NULL, filename, NULL, AVMEDIA_TYPE_DATA) != AV_CODEC_ID_NONE) {
+for (i = 0; i < nb_input_streams; i++)
+if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_DATA)
+new_data_stream(o, oc, i);
+}
 } else {
 for (i = 0; i < o->nb_stream_maps; i++) {
 StreamMap *map = &o->stream_maps[i];
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 99467bb..edb6389 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -523,6 +523,7 @@ enum AVCodecID {
 /* other specific kind of codecs (generally used for attachments) */
 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,   ///< A dummy ID pointing at the start of various fake codecs.
 AV_CODEC_ID_TTF = 0x18000,
+AV_CODEC_ID_SCTE_35= MKBETAG('C','U','E','I'),
 AV_CODEC_ID_BINTEXT= MKBETAG('B','T','X','T'),
 AV_CODEC_ID_XBIN   = MKBETAG('X','B','I','N'),
 AV_CODEC_ID_IDF= MKBETAG( 0 ,'I','D','F'),
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0af66f4..ae96210 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2739,6 +2739,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("binary data"),
 .mime_types= MT("application/octet-stream"),
 },
+{
+.id= AV_CODEC_ID_SCTE_35,
+.type  = AVMEDIA_TYPE_DATA,
+.name  = "scte_35",
+.long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"),
+},
 
 /* deprecated codec ids */
 {
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5eb834e..85d2b64 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -23,6 +23,7 @@ OBJS = allformats.o \
seek.o

Re: [FFmpeg-devel] Adding Closed caption in nut muxer

2015-01-13 Thread Anshul
On 01/13/2015 04:30 PM, Nicolas George wrote:
> Le quartidi 24 nivôse, an CCXXIII, Anshul a écrit :
>> Please find attachment.
>> Using this people can also mux cc608 stream in nut muxer
> IIRC, you need to submit a patch to libnut before, because it holds the
> official list of codes.
>
>
Who maintains it, is there any mailing list for it?
or an individual  person who maintains it.

On multimedia wiki I see that mplayer, ffmpeg and libav all are
developing it.
on that page buts repo is in ffmpeg domain.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Adding Webvtt in hls muxer

2015-01-13 Thread Anshul
Hi

I have attached the patch.

Thanks
Anshul Maheshwari
>From eacd2356796ae927c500afdca15c040a2318415b Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 13 Jan 2015 16:18:16 +0530
Subject: [PATCH] webvtt in hls muxer

Signed-off-by: Anshul Maheshwari 
---
 libavformat/hlsenc.c | 174 ---
 1 file changed, 164 insertions(+), 10 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 29bf30e..342efc9 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -39,6 +39,7 @@
 
 typedef struct HLSSegment {
 char filename[1024];
+char sub_filename[1024];
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
@@ -58,8 +59,10 @@ typedef struct HLSContext {
 int64_t sequence;
 int64_t start_sequence;
 AVOutputFormat *oformat;
+AVOutputFormat *vtt_oformat;
 
 AVFormatContext *avf;
+AVFormatContext *vtt_avf;
 
 float time;// Set by a private option.
 int max_nb_segments;   // Set by a private option.
@@ -70,6 +73,7 @@ typedef struct HLSContext {
 int allowcache;
 int64_t recording_time;
 int has_video;
+int has_subtitle;
 int64_t start_pts;
 int64_t end_pts;
 double duration;  // last segment duration computed so far, in seconds
@@ -82,11 +86,17 @@ typedef struct HLSContext {
 HLSSegment *old_segments;
 
 char *basename;
+char *vtt_basename;
+char *vtt_m3u8_name;
 char *baseurl;
 char *format_options_str;
+char *vtt_format_options_str;
+char *subtitle_filename;
 AVDictionary *format_options;
+AVDictionary *vtt_format_options;
 
 AVIOContext *pb;
+AVIOContext *sub_pb;
 } HLSContext;
 
 static int hls_delete_old_segments(HLSContext *hls) {
@@ -158,6 +168,7 @@ static int hls_mux_init(AVFormatContext *s)
 {
 HLSContext *hls = s->priv_data;
 AVFormatContext *oc;
+AVFormatContext *vtt_oc;
 int i, ret;
 
 ret = avformat_alloc_output_context2(&hls->avf, hls->oformat, NULL, NULL);
@@ -170,10 +181,25 @@ static int hls_mux_init(AVFormatContext *s)
 oc->max_delay  = s->max_delay;
 av_dict_copy(&oc->metadata, s->metadata, 0);
 
+
+if(hls->vtt_oformat) {
+ret = avformat_alloc_output_context2(&hls->vtt_avf, hls->vtt_oformat, NULL, NULL);
+if (ret < 0)
+return ret;
+vtt_oc = hls->vtt_avf;
+vtt_oc->oformat   = hls->vtt_oformat;
+av_dict_copy(&vtt_oc->metadata, s->metadata, 0);
+}
+
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st;
-if (!(st = avformat_new_stream(oc, NULL)))
-return AVERROR(ENOMEM);
+if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+if (!(st = avformat_new_stream(vtt_oc, NULL)))
+return AVERROR(ENOMEM);
+} else {
+if (!(st = avformat_new_stream(oc, NULL)))
+return AVERROR(ENOMEM);
+}
 avcodec_copy_context(st->codec, s->streams[i]->codec);
 st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
 st->time_base = s->streams[i]->time_base;
@@ -195,6 +221,9 @@ static int hls_append_segment(HLSContext *hls, double duration, int64_t pos,
 
 av_strlcpy(en->filename, av_basename(hls->avf->filename), sizeof(en->filename));
 
+if(hls->has_subtitle)
+av_strlcpy(en->sub_filename, av_basename(hls->vtt_avf->filename), sizeof(en->sub_filename));
+
 en->duration = duration;
 en->pos  = pos;
 en->size = size;
@@ -279,8 +308,37 @@ static int hls_window(AVFormatContext *s, int last)
 if (last)
 avio_printf(hls->pb, "#EXT-X-ENDLIST\n");
 
+if( hls->vtt_m3u8_name ) {
+if ((ret = avio_open2(&hls->sub_pb, hls->vtt_m3u8_name, AVIO_FLAG_WRITE,
+  &s->interrupt_callback, NULL)) < 0)
+goto fail;
+avio_printf(hls->sub_pb, "#EXTM3U\n");
+avio_printf(hls->sub_pb, "#EXT-X-VERSION:%d\n", version);
+if (hls->allowcache == 0 || hls->allowcache == 1) {
+avio_printf(hls->sub_pb, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0 ? "NO" : "YES");
+}
+avio_printf(hls->sub_pb, "#EXT-X-TARGETDURATION:%d\n", target_duration);
+avio_printf(hls->sub_pb, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
+
+av_log(s, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n",
+   sequence);
+
+for (en = hls->segments; en; en = en->next) {
+avio_printf(hls->sub_pb, "#EXTINF:%f,\n", en->duration);
+if (hls->flags & HLS_SINGLE_FILE)
+   

[FFmpeg-devel] Adding Closed caption in nut muxer

2015-01-13 Thread Anshul
Hi

Please find attachment.
Using this people can also mux cc608 stream in nut muxer

-Anshul

>From 996a1d20061e9c966b02c07d98096b1a87fdff10 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Fri, 2 Jan 2015 13:20:13 +0530
Subject: [PATCH 2/2] Added codec tag in nut muxer

Signed-off-by: Anshul Maheshwari 
---
 libavformat/nut.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/nut.c b/libavformat/nut.c
index 86a0301..78cef30 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -31,6 +31,7 @@ const AVCodecTag ff_nut_subtitle_tags[] = {
 { AV_CODEC_ID_DVD_SUBTITLE, MKTAG('D', 'V', 'D', 'S') },
 { AV_CODEC_ID_DVB_SUBTITLE, MKTAG('D', 'V', 'B', 'S') },
 { AV_CODEC_ID_DVB_TELETEXT, MKTAG('D', 'V', 'B', 'T') },
+{ AV_CODEC_ID_EIA_608,  MKTAG('c', '6', '0', '8') },
 { AV_CODEC_ID_NONE, 0 }
 };
 
-- 
1.8.1.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] SCTE-35 development

2015-01-12 Thread Anshul
On 01/12/2015 06:26 PM, Anshul wrote:
> On 01/12/2015 05:59 PM, Anshul wrote:
>> On 01/12/2015 02:48 AM, Michael Niedermayer wrote:
>>> On Mon, Jan 12, 2015 at 01:09:11AM +0530, Anshul wrote:
>>>> On 12/31/2014 07:13 PM, Michael Niedermayer wrote:
>>>>> So SCTE-35 is basically about segmenting a video timewise (primarely
>>>>> to mark Ads but not always) We already have a API to segment videos
>>>>> timewise, its AVFormatContext.chapters that may need some changes to
>>>>> handle incrementally added (and on the muxer side incrementally
>>>>> stored) data or we might even choose a different system entirely than
>>>>> that AVChapter array for such incrementally stored segments but i dont
>>>>> think data decoders with a completely opaque input and output are a
>>>>> reasonable API for communicating such temporal segmenting [...]
>>>> I have not looked at it yet, due to some disadvantage told me on irc,
>>>> sry but I have forgotten those disadvantage of chapters.
>>> It would be better if the reasons behind a design decission are
>>> understood and documented
>>>
>> Yes, I studied the document of AVChapter, just now its only used
>> for mostly header and sometimes trailer.
>> Its structure match very much to interface of scte_35, but it is not
>> sufficient
>> I have to have locking mechanism there, so that I would know whether I
>> am still
>> using it or not.
>> These chapters also look very static, I did not find any logic to cancel
>> the event
>> at last moment.
>>
>> modification to my previous patch were possible with AVChapter, but now
>> I feel
>> i don't require to communicate from demuxer or decoder, because I have
>> written a
>> parser in AVFormat and only used in hls muxer.
>> and If later I would use that parser in filter, ubitux gave me idea to
>> use ff_ap
>>  
>>>> if any one here still believe that chapters approach will be better,  I
>>>> will look at it.
>>>>
>>>> Though I have done some new implementation, it is out of avcodec folder.
>>>> I have tweaked slightly AVFormat public structure.
>>>>
>>>> for details please review attached draft patch.
>>>>
>>>> I would appreciate, if someone pinpoint architecture issue first.
>>>> I really get demoralized when I have to throw all my work after
>>>> considering all review comments.
>>>> then at last some architecture comments.
>>>>
>>>> lots of memory leakage are still there, please ignore it for time being,
>>>> i am working on it.
>>>>
>>>> follwing is the command which is also added in commit message to use
>>>> this patch
>>>> ./ffmpeg_g -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts
>>>> -hls_list_size 1000 -dcodec copy  tmp/some.m3u8
>>>>
>>>> -Anshul
>>>>  ffmpeg.c|6 +-
>>>>  ffmpeg_opt.c|   10 ++
>>>>  libavcodec/avcodec.h|1 +
>>>>  libavcodec/codec_desc.c |6 ++
>>>>  libavformat/Makefile|1 +
>>>>  libavformat/avformat.h  |   17 +
>>>>  libavformat/format.c    |2 ++
>>>>  libavformat/hlsenc.c|   39 +++++++
>>>>  libavformat/mpegts.c|   45 
>>>> +++++++--
>>>>  libavformat/utils.c |1 +
>>> theres some file missing
>>> libavformat/hlsenc.c:39:21: fatal error: scte_35.h: No such file or 
>>> directory
>> I always forget this if I don't check the ffmpeg codec checklist.
>> hope i will gradually get into this habit.
>> and I am sorry for being so annoying to all.
>>
>> attached new patch.
>> -Anshul
>>
> forgot to signoff.
> attached another
>
> -Anshul
in that previous patch av_bprintf did not worked.
Attached another patch

-Anshul
>From 430b4d6061ade894b22cb7685a8b5d9af22b9c24 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 13 Jan 2015 11:53:32 +0530
Subject: [PATCH] Adding rollup functionality

Signed-off-by: Anshul Maheshwari 
---
 libavcodec/ccaption_dec.c | 222 +-
 1 file changed, 140 insertions(+), 82 deletions(-)

diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
index e05468f..debcc93 100644
--- a/libavcodec/ccaption_dec.c
+++ b/libavcodec/ccaption_dec.c
@@ -23,13 +23,12 @@
 

Re: [FFmpeg-devel] [FFmpeg-cvslog] Adding Closed caption Support

2015-01-12 Thread Anshul Maheshwari
On Tue, Jan 13, 2015 at 11:24 AM, Anshul Maheshwari  wrote:

> On 01/12/2015 04:16 PM, Clément Bœsch wrote:
>
> On Sun, Jan 11, 2015 at 11:15:35PM +0100, Anshul Maheshwari wrote:
>
> ffmpeg | branch: master | Anshul Maheshwari  | Tue 
> Jan  6 12:41:34 2015 +0530| [4b6262610bd516320b3fca71ef03ff9bf1aa5066] | 
> committer: Michael Niedermayer
>
> Adding Closed caption Support
>
> Signed-off-by: Anshul Maheshwari 
>
> To test Closed caption use following command
> ffmpeg -f lavfi -i "movie=input.ts[out0+subcc]" -map s output.srt
> Signed-off-by: Michael Niedermayer 
>
> Sorry for the late review, I wasn't available.
>
> Q: how does it compare to libzvbi, do we still need libzvbi (especially
> the text part)?
>
>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b6262610bd516320b3fca71ef03ff9bf1aa5066
>
> ---
>
>  libavcodec/Makefile   |1 +
>  libavcodec/allcodecs.c|1 +
>  libavcodec/ccaption_dec.c |  529 
> +
>  3 files changed, 531 insertions(+)
>
>
> Where is the FATE test for this?
>
>  will make it in week.
>
>  diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 6b85420..80ee389 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>cavsdata.o mpeg12data.o
> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 512711e..29b45f3 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -481,6 +481,7 @@ void avcodec_register_all(void)
>  /* subtitles */
>  REGISTER_ENCDEC (SSA,   ssa);
>  REGISTER_ENCDEC (ASS,   ass);
> +REGISTER_DECODER(CCAPTION,  ccaption);
>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>  REGISTER_ENCDEC (DVDSUB,dvdsub);
>  REGISTER_DECODER(JACOSUB,   jacosub);
> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
> new file mode 100644
> index 000..a92c609
> --- /dev/null
> +++ b/libavcodec/ccaption_dec.c
> @@ -0,0 +1,529 @@
> +/*
> + * Closed Caption Decoding
> + * Copyright (c) 2015 Anshul Maheshwari
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "avcodec.h"
> +#include "ass.h"
> +#include "libavutil/opt.h"
> +
>
> +#define CHAR_DEBUG
>
> We have av_dlog() for that purpose.
>
>  done
>
> +#define SCREEN_ROWS 15
> +#define SCREEN_COLUMNS 32
> +
> +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
> +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
> +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
> +
> +/*
> + * TODO list
> + * 1) handle font and color completely
> + */
> +enum cc_mode {
> +CCMODE_POPON,
> +CCMODE_PAINTON,
> +CCMODE_ROLLUP_2,
> +CCMODE_ROLLUP_3,
> +CCMODE_ROLLUP_4,
> +CCMODE_TEXT,
> +};
> +
> +enum cc_color_code
> +{
>
> The style is broken all over the file, but please at least make it
> consistent with the surrounding one.
>
>  done
>
> +CCCOL_WHITE,
> +CCCOL_GREEN,
> +CCCOL_BLUE,
> +CCCOL_CYAN,
> +CCCOL_RED,
> +CCCOL_YELLOW,
> +CCCOL_MAGENTA,
> +CCCOL_USERDEFINED,
> +CCCOL_BLACK,
> +CCCOL_TRANSPARENT
>
> note: you should keep a trailing comma at the end of such structure to
> reduce later diffs.
>
>  done
>
>  +};
> +
> +en

Re: [FFmpeg-devel] [FFmpeg-cvslog] Adding Closed caption Support

2015-01-12 Thread Anshul Maheshwari
On 01/12/2015 04:16 PM, Clément Bœsch wrote:

On Sun, Jan 11, 2015 at 11:15:35PM +0100, Anshul Maheshwari wrote:

ffmpeg | branch: master | Anshul Maheshwari 
| Tue Jan  6 12:41:34 2015 +0530|
[4b6262610bd516320b3fca71ef03ff9bf1aa5066] | committer: Michael
Niedermayer

Adding Closed caption Support

Signed-off-by: Anshul Maheshwari 

To test Closed caption use following command
ffmpeg -f lavfi -i "movie=input.ts[out0+subcc]" -map s output.srt
Signed-off-by: Michael Niedermayer 

Sorry for the late review, I wasn't available.

Q: how does it compare to libzvbi, do we still need libzvbi (especially
the text part)?


http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b6262610bd516320b3fca71ef03ff9bf1aa5066

---

 libavcodec/Makefile   |1 +
 libavcodec/allcodecs.c|1 +
 libavcodec/ccaption_dec.c |  529 +
 3 files changed, 531 insertions(+)


Where is the FATE test for this?

 will make it in week.

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6b85420..80ee389 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
 OBJS-$(CONFIG_C93_DECODER) += c93.o
 OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
   cavsdata.o mpeg12data.o
+OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
 OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
 OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
 OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 512711e..29b45f3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -481,6 +481,7 @@ void avcodec_register_all(void)
 /* subtitles */
 REGISTER_ENCDEC (SSA,   ssa);
 REGISTER_ENCDEC (ASS,   ass);
+REGISTER_DECODER(CCAPTION,  ccaption);
 REGISTER_ENCDEC (DVBSUB,dvbsub);
 REGISTER_ENCDEC (DVDSUB,dvdsub);
 REGISTER_DECODER(JACOSUB,   jacosub);
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
new file mode 100644
index 000..a92c609
--- /dev/null
+++ b/libavcodec/ccaption_dec.c
@@ -0,0 +1,529 @@
+/*
+ * Closed Caption Decoding
+ * Copyright (c) 2015 Anshul Maheshwari
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "ass.h"
+#include "libavutil/opt.h"
+

+#define CHAR_DEBUG

We have av_dlog() for that purpose.

 done

+#define SCREEN_ROWS 15
+#define SCREEN_COLUMNS 32
+
+#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
+#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
+#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
+
+/*
+ * TODO list
+ * 1) handle font and color completely
+ */
+enum cc_mode {
+CCMODE_POPON,
+CCMODE_PAINTON,
+CCMODE_ROLLUP_2,
+CCMODE_ROLLUP_3,
+CCMODE_ROLLUP_4,
+CCMODE_TEXT,
+};
+
+enum cc_color_code
+{

The style is broken all over the file, but please at least make it
consistent with the surrounding one.

 done

+CCCOL_WHITE,
+CCCOL_GREEN,
+CCCOL_BLUE,
+CCCOL_CYAN,
+CCCOL_RED,
+CCCOL_YELLOW,
+CCCOL_MAGENTA,
+CCCOL_USERDEFINED,
+CCCOL_BLACK,
+CCCOL_TRANSPARENT

note: you should keep a trailing comma at the end of such structure to
reduce later diffs.

 done

+};
+
+enum cc_font
+{
+CCFONT_REGULAR,
+CCFONT_ITALICS,
+CCFONT_UNDERLINED,
+CCFONT_UNDERLINED_ITALICS
+};
+
+static const unsigned char pac2_attribs[][3] = // Color, font, ident
+{
+{ CCCOL_WHITE, CCFONT_REGULAR, 0 },  // 0x40 || 0x60
+{ CCCOL_WHITE, CCFONT_UNDERLINED, 0 },  // 0x41 || 0x61
+{ CCCOL_GREEN, CCFONT_REGULAR, 0 },  // 0x42 || 0x62
+{ CCCOL_GREEN, CCFONT_UNDERLINED, 0 },  // 0x43 || 0x63
+{ CCCOL_BLUE, CCFONT_REGULAR, 0 },  // 0x44 || 0x64
+{ CCCOL_BLUE, CCFONT_UNDERLINED, 0 },  // 0x45 || 0x65
+{ CCCOL_CYAN, CCFONT_REGULAR, 0 },  // 0x46 || 0x66
+{ CCCOL_CYAN, CCFONT_UNDERLINED, 0 },  // 0x47 || 0x67
+{ CCCOL_RED, CCFONT_REGULAR, 0 },  // 0x48 || 0x68
+{ CCCOL_RED, CCFONT_UNDERLINED, 0 },  // 0x49 || 0x69
+{ 

Re: [FFmpeg-devel] SCTE-35 development

2015-01-12 Thread Anshul
On 01/12/2015 05:59 PM, Anshul wrote:
> On 01/12/2015 02:48 AM, Michael Niedermayer wrote:
>> On Mon, Jan 12, 2015 at 01:09:11AM +0530, Anshul wrote:
>>> On 12/31/2014 07:13 PM, Michael Niedermayer wrote:
>>>> So SCTE-35 is basically about segmenting a video timewise (primarely
>>>> to mark Ads but not always) We already have a API to segment videos
>>>> timewise, its AVFormatContext.chapters that may need some changes to
>>>> handle incrementally added (and on the muxer side incrementally
>>>> stored) data or we might even choose a different system entirely than
>>>> that AVChapter array for such incrementally stored segments but i dont
>>>> think data decoders with a completely opaque input and output are a
>>>> reasonable API for communicating such temporal segmenting [...]
>>> I have not looked at it yet, due to some disadvantage told me on irc,
>>> sry but I have forgotten those disadvantage of chapters.
>> It would be better if the reasons behind a design decission are
>> understood and documented
>>
> Yes, I studied the document of AVChapter, just now its only used
> for mostly header and sometimes trailer.
> Its structure match very much to interface of scte_35, but it is not
> sufficient
> I have to have locking mechanism there, so that I would know whether I
> am still
> using it or not.
> These chapters also look very static, I did not find any logic to cancel
> the event
> at last moment.
>
> modification to my previous patch were possible with AVChapter, but now
> I feel
> i don't require to communicate from demuxer or decoder, because I have
> written a
> parser in AVFormat and only used in hls muxer.
> and If later I would use that parser in filter, ubitux gave me idea to
> use ff_ap
>  
>>> if any one here still believe that chapters approach will be better,  I
>>> will look at it.
>>>
>>> Though I have done some new implementation, it is out of avcodec folder.
>>> I have tweaked slightly AVFormat public structure.
>>>
>>> for details please review attached draft patch.
>>>
>>> I would appreciate, if someone pinpoint architecture issue first.
>>> I really get demoralized when I have to throw all my work after
>>> considering all review comments.
>>> then at last some architecture comments.
>>>
>>> lots of memory leakage are still there, please ignore it for time being,
>>> i am working on it.
>>>
>>> follwing is the command which is also added in commit message to use
>>> this patch
>>> ./ffmpeg_g -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts
>>> -hls_list_size 1000 -dcodec copy  tmp/some.m3u8
>>>
>>> -Anshul
>>>  ffmpeg.c|6 +-
>>>  ffmpeg_opt.c|   10 ++
>>>  libavcodec/avcodec.h|1 +
>>>  libavcodec/codec_desc.c |6 ++
>>>  libavformat/Makefile|1 +
>>>  libavformat/avformat.h  |   17 +
>>>  libavformat/format.c|2 ++
>>>  libavformat/hlsenc.c|   39 +++++++
>>>  libavformat/mpegts.c|   45 
>>> +++--
>>>  libavformat/utils.c |1 +
>> theres some file missing
>> libavformat/hlsenc.c:39:21: fatal error: scte_35.h: No such file or directory
> I always forget this if I don't check the ffmpeg codec checklist.
> hope i will gradually get into this habit.
> and I am sorry for being so annoying to all.
>
> attached new patch.
> -Anshul
>
forgot to signoff.
attached another

-Anshul
>From 1933bbcea6a3370d62f4dd188b3de592874255c8 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 12 Jan 2015 18:24:59 +0530
Subject: [PATCH] Adding SCTE 35 implementation in avformat

Signed-off-by: Anshul Maheshwari 

Use following cmd to test it.
./ffmpeg -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts -hls_list_size 1000 -dcodec copy  tmp/some.m3u8
---
 ffmpeg.c|   6 +-
 ffmpeg_opt.c|  10 ++
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   6 +
 libavformat/Makefile|   1 +
 libavformat/avformat.h  |  17 +++
 libavformat/format.c|   2 +
 libavformat/hlsenc.c|  39 +-
 libavformat/mpegts.c|  45 ++-
 libavformat/scte_35.c   | 348 
 libavformat/scte_35.h   |  48 +++
 libavformat/utils.c |   1 +
 12 files changed, 513 insertions(+), 11 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h

diff --git a/ffmpeg.c b/ffmpeg.c
inde

Re: [FFmpeg-devel] SCTE-35 development

2015-01-12 Thread Anshul
On 01/12/2015 02:48 AM, Michael Niedermayer wrote:
> On Mon, Jan 12, 2015 at 01:09:11AM +0530, Anshul wrote:
>> On 12/31/2014 07:13 PM, Michael Niedermayer wrote:
>>> So SCTE-35 is basically about segmenting a video timewise (primarely
>>> to mark Ads but not always) We already have a API to segment videos
>>> timewise, its AVFormatContext.chapters that may need some changes to
>>> handle incrementally added (and on the muxer side incrementally
>>> stored) data or we might even choose a different system entirely than
>>> that AVChapter array for such incrementally stored segments but i dont
>>> think data decoders with a completely opaque input and output are a
>>> reasonable API for communicating such temporal segmenting [...]
>> I have not looked at it yet, due to some disadvantage told me on irc,
>> sry but I have forgotten those disadvantage of chapters.
> It would be better if the reasons behind a design decission are
> understood and documented
>

Yes, I studied the document of AVChapter, just now its only used
for mostly header and sometimes trailer.
Its structure match very much to interface of scte_35, but it is not
sufficient
I have to have locking mechanism there, so that I would know whether I
am still
using it or not.
These chapters also look very static, I did not find any logic to cancel
the event
at last moment.

modification to my previous patch were possible with AVChapter, but now
I feel
i don't require to communicate from demuxer or decoder, because I have
written a
parser in AVFormat and only used in hls muxer.
and If later I would use that parser in filter, ubitux gave me idea to
use ff_ap
 
>> if any one here still believe that chapters approach will be better,  I
>> will look at it.
>>
>> Though I have done some new implementation, it is out of avcodec folder.
>> I have tweaked slightly AVFormat public structure.
>>
>> for details please review attached draft patch.
>>
>> I would appreciate, if someone pinpoint architecture issue first.
>> I really get demoralized when I have to throw all my work after
>> considering all review comments.
>> then at last some architecture comments.
>>
>> lots of memory leakage are still there, please ignore it for time being,
>> i am working on it.
>>
>> follwing is the command which is also added in commit message to use
>> this patch
>> ./ffmpeg_g -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts
>> -hls_list_size 1000 -dcodec copy  tmp/some.m3u8
>>
>> -Anshul
>>  ffmpeg.c|6 +-
>>  ffmpeg_opt.c|   10 ++
>>  libavcodec/avcodec.h|1 +
>>  libavcodec/codec_desc.c |6 ++
>>  libavformat/Makefile|1 +
>>  libavformat/avformat.h  |   17 +
>>  libavformat/format.c|2 ++
>>  libavformat/hlsenc.c|   39 +++
>>  libavformat/mpegts.c|   45 +++--
>>  libavformat/utils.c |1 +
> theres some file missing
> libavformat/hlsenc.c:39:21: fatal error: scte_35.h: No such file or directory
I always forget this if I don't check the ffmpeg codec checklist.
hope i will gradually get into this habit.
and I am sorry for being so annoying to all.

attached new patch.
-Anshul

>From 4c0e25ea5827b03b61d2a49eee287515d7dc031d Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 12 Jan 2015 17:40:10 +0530
Subject: [PATCH] Adding SCTE 35 implementation in avformat

Use following cmd to test it.
./ffmpeg -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts -hls_list_size 1000 -dcodec copy  tmp/some.m3u8
---
 ffmpeg.c|   6 +-
 ffmpeg_opt.c|  10 ++
 libavcodec/avcodec.h|   1 +
 libavcodec/codec_desc.c |   6 +
 libavformat/Makefile|   1 +
 libavformat/avformat.h  |  17 +++
 libavformat/format.c|   2 +
 libavformat/hlsenc.c|  39 +-
 libavformat/mpegts.c|  45 ++-
 libavformat/scte_35.c   | 348 
 libavformat/scte_35.h   |  48 +++
 libavformat/utils.c |   1 +
 12 files changed, 513 insertions(+), 11 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h

diff --git a/ffmpeg.c b/ffmpeg.c
index ddf4272..a7f078b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -60,6 +60,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/time.h"
 #include "libavutil/threadmessage.h"
+#include "libavutil/buffer_internal.h"
 #include "libavformat/os_support.h"
 
 #include "libavformat/ffm.h" // not public API
@@ -2907,6 +2908,8 @@ static int transcode_init(void)
 enc_ctx->height

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-11 Thread Anshul
On 01/06/2015 12:29 PM, Anshul Maheshwari wrote:
>
>
> On Tue, Jan 6, 2015 at 5:47 AM, Michael Niedermayer  <mailto:michae...@gmx.at>> wrote:
>
> On Mon, Jan 05, 2015 at 06:20:15PM +0530, Anshul wrote:
> > On 01/04/2015 10:17 PM, Michael Niedermayer wrote:
> > > the table is constant and does not change, theres no need to have
> > > a copy of it in each context or to "make it every time decode is
> > > called"
> > > a simple static uint8_t parity_table[256];
> > > or even
> > > static const uint8_t parity_table[256] = {...}
> > >
> > done
> > >>>> +int row_cnt;
> > >>>> +struct Screen screen[2];
> > >>>> +int active_screen;
> > >>>> +uint8_t cursor_row;
> > >>>> +uint8_t cursor_column;
> > >>>> +AVBPrint buffer;
> > >>>> +int erase_display_memory;
> > >>>> +int rollup;
> > >>>> +enum  cc_mode mode;
> > >>>> +int64_t start_time;
> > >>>> +/* visible screen time */
> > >>>> +int64_t startv_time;
> > >>>> +int64_t end_time;
> > >>>> +char prev_cmd[2];
> > >>>> +/* buffer to store pkt data */
> > >>>> +AVBufferRef *pktbuf;
> > >>> as you memcopy the data each time, theres no need for a
> AVBufferRef
> > >>> a simple uint8_t * would do the same
> > >>> but i think not even that is needed,
> > >>> all uses of the data go through process_cc608() it would be
> > >>> very simply to strip one bit in the arguments there, so no
> rewriting
> > >>> of the table would be needed
> > >>>
> > >>> [...]
> > >> cant do that, for error resistance we need to escape 1st byte
> > >> if parity does not match, for escaping I write 0x7f instead of
> > >> whatever data is. Some closed caption insert-er don't care
> much for parity
> > >> when they are not using the data.
> > >>
> > >> I was using AVBufferRef instead of uint8_t * , so that I
> don't have to
> > >> take care for length,
> > >> and length and data are in one context. and there is already
> lot of
> > >> error handling is
> > >> done while realloc, means I don't have to copy buffer pointer
> somewhere,
> > >> if realloc fails.
> > >> and in future if someone want to make data channel 1  and
> data channel 2
> > >> to be processed
> > >> in parallel,  then he may use reference thing too.
> > >> still its my opinion, if you think uint8_t will have better
> performance,
> > >> I will change it to that.
> > > if you prefer AVBufferRef, feel free to keep using it, i dont
> think
> > > its the optimal choice though.
> > >
> > > Also isnt there some maximum size for these buffers ?
> > > (this would allow using a fixed size buffer and avoid the need for
> > >  dealing with allocation failures)
> > >
> > There is nothing similar inside spec cc608. since its line 21 data,
> > there must
> > be something in vertical ancillary specification. I have to
> search for
> > that spec.
> > if you can find about max limit of vanc packet, then ccaption
> can not
> > exceed
> > with that.
> > >>>> +static void handle_char(CCaptionSubContext *ctx, char hi,
> char lo, int64_t pts)
> > >>>> +{
> > >>>> +struct Screen *screen = get_writing_screen(ctx);
> > >>>> +char *row = screen->characters[ctx->cursor_row] +
> ctx->cursor_column;
> > >>>> +
> > >>>> +SET_FLAG(screen->row_used,ctx->cursor_row);
> > >>>> +
> > >>>> +*row++ = hi;
> > >>>> +ctx->cursor_column++;
> > >>>> +if(lo) {
> > >>>> +*row++ = lo;
> > >>>> +ctx->cursor_column++;
> > >>>> +}
> > >>>> +*row = 0;
> > >>> this 

Re: [FFmpeg-devel] SCTE-35 development

2015-01-11 Thread Anshul
On 12/31/2014 07:13 PM, Michael Niedermayer wrote:
> So SCTE-35 is basically about segmenting a video timewise (primarely
> to mark Ads but not always) We already have a API to segment videos
> timewise, its AVFormatContext.chapters that may need some changes to
> handle incrementally added (and on the muxer side incrementally
> stored) data or we might even choose a different system entirely than
> that AVChapter array for such incrementally stored segments but i dont
> think data decoders with a completely opaque input and output are a
> reasonable API for communicating such temporal segmenting [...]
I have not looked at it yet, due to some disadvantage told me on irc,
sry but I have forgotten those disadvantage of chapters.
if any one here still believe that chapters approach will be better,  I
will look at it.

Though I have done some new implementation, it is out of avcodec folder.
I have tweaked slightly AVFormat public structure.

for details please review attached draft patch.

I would appreciate, if someone pinpoint architecture issue first.
I really get demoralized when I have to throw all my work after
considering all review comments.
then at last some architecture comments.

lots of memory leakage are still there, please ignore it for time being,
i am working on it.

follwing is the command which is also added in commit message to use
this patch
./ffmpeg_g -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts
-hls_list_size 1000 -dcodec copy  tmp/some.m3u8

-Anshul
>From 1837975dc5f8b1e29d70eec3d0117b7ab6b96c19 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 12 Jan 2015 00:53:08 +0530
Subject: [PATCH] Adding SCTE 35 implementation in avformat

Use follwing cmd to test it.
/ffmpeg_g -vsync 0 -copyts -i ~/test_videos/mpegwithscte35.ts -hls_list_size 1000 -dcodec copy  tmp/some.m3u8
---
 ffmpeg.c|  6 +-
 ffmpeg_opt.c| 10 ++
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  6 ++
 libavformat/Makefile|  1 +
 libavformat/avformat.h  | 17 +
 libavformat/format.c|  2 ++
 libavformat/hlsenc.c| 39 +++
 libavformat/mpegts.c| 45 +++--
 libavformat/utils.c |  1 +
 10 files changed, 117 insertions(+), 11 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index ddf4272..a7f078b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -60,6 +60,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/time.h"
 #include "libavutil/threadmessage.h"
+#include "libavutil/buffer_internal.h"
 #include "libavformat/os_support.h"
 
 #include "libavformat/ffm.h" // not public API
@@ -2907,6 +2908,8 @@ static int transcode_init(void)
 enc_ctx->height= input_streams[ost->source_index]->st->codec->height;
 }
 break;
+case AVMEDIA_TYPE_DATA:
+break;
 default:
 abort();
 break;
@@ -3464,7 +3467,8 @@ static int process_input(int file_index)
 OutputStream *ost = output_streams[j];
 
 if (ost->source_index == ifile->ist_index + i &&
-(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
+(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE
+|| ost->enc->type == AVMEDIA_TYPE_DATA ))
 finish_output_stream(ost);
 }
 }
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index ac93eb5..f5a7b35 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -804,6 +804,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
 char *   video_codec_name = NULL;
 char *   audio_codec_name = NULL;
 char *subtitle_codec_name = NULL;
+char *data_codec_name = NULL;
 int scan_all_pmts_set = 0;
 
 if (o->format) {
@@ -864,6 +865,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
 find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0)->id : AV_CODEC_ID_NONE;
 ic->subtitle_codec_id= subtitle_codec_name ?
 find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : AV_CODEC_ID_NONE;
+ic->data_codec_id= data_codec_name ?
+find_codec_or_die(data_codec_name, AVMEDIA_TYPE_DATA, 0)->id : AV_CODEC_ID_NONE;
 
 if (video_codec_name)
 av_format_set_video_codec   (ic, find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0));
@@ -871,6 +874,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
 av_format_set_audio_codec   (ic, find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0));
 if (subtitle_codec_name)
 av_format_set_subtitle_codec(ic, find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0));
+   

Re: [FFmpeg-devel] [PATCH 1/3] 10 Bit support for Decklink input device

2015-01-11 Thread Anshul
On 01/11/2015 08:08 PM, Georg Lippitsch wrote:
> ---
>  libavdevice/decklink_common_c.h |  1 +
>  libavdevice/decklink_dec.cpp| 18 ++
>  libavdevice/decklink_dec_c.c|  1 +
>  3 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
> index 861a51a..fb2b788 100644
> --- a/libavdevice/decklink_common_c.h
> +++ b/libavdevice/decklink_common_c.h
> @@ -28,5 +28,6 @@ struct decklink_cctx {
>  int list_devices;
>  int list_formats;
>  double preroll;
> +int v210;
>  };
>  
> diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
> index 77a0fe5..747f47e 100644
> --- a/libavdevice/decklink_dec.cpp
> +++ b/libavdevice/decklink_dec.cpp
> @@ -233,6 +233,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
>ctx->video_st->time_base.den);
>  
>  if (videoFrame->GetFlags() & bmdFrameHasNoInputSource) {
> +if (videoFrame->GetPixelFormat() == bmdFormat8BitYUV) {
>  unsigned bars[8] = {
>  0xEA80EA80, 0xD292D210, 0xA910A9A5, 0x90229035,
>  0x6ADD6ACA, 0x51EF515A, 0x286D28EF, 0x10801080 };
> @@ -244,6 +245,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
>  for (int x = 0; x < width; x += 2)
>  *p++ = bars[(x * 8) / width];
>  }
> +}
>  
>  if (!no_video) {
>  av_log(avctx, AV_LOG_WARNING, "Frame received (#%lu) - No 
> input signal detected "
> @@ -466,15 +468,21 @@ av_cold int ff_decklink_read_header(AVFormatContext 
> *avctx)
>  goto error;
>  }
>  st->codec->codec_type  = AVMEDIA_TYPE_VIDEO;
> -st->codec->codec_id= AV_CODEC_ID_RAWVIDEO;
>  st->codec->width   = ctx->bmd_width;
>  st->codec->height  = ctx->bmd_height;
>  
> -st->codec->pix_fmt = AV_PIX_FMT_UYVY422;
>  st->codec->time_base.den  = ctx->bmd_tb_den;
>  st->codec->time_base.num  = ctx->bmd_tb_num;
>  st->codec->bit_rate= avpicture_get_size(st->codec->pix_fmt, 
> ctx->bmd_width, ctx->bmd_height) * 1/av_q2d(st->codec->time_base) * 8;
> -st->codec->codec_tag   = MKTAG('U', 'Y', 'V', 'Y');
> +
> +if (cctx->v210) {
> +st->codec->codec_id= AV_CODEC_ID_V210;
> +st->codec->codec_tag   = MKTAG('V', '2', '1', '0');
> +} else {
> +st->codec->codec_id= AV_CODEC_ID_RAWVIDEO;
> +st->codec->pix_fmt = AV_PIX_FMT_UYVY422;
> +st->codec->codec_tag   = MKTAG('U', 'Y', 'V', 'Y');
> +}
>  
>  avpriv_set_pts_info(st, 64, 1, 100);  /* 64 bits pts in us */
>  
> @@ -487,7 +495,9 @@ av_cold int ff_decklink_read_header(AVFormatContext 
> *avctx)
>  goto error;
>  }
>  
> -result = ctx->dli->EnableVideoInput(ctx->bmd_mode, bmdFormat8BitYUV, 
> bmdVideoInputFlagDefault);
> +result = ctx->dli->EnableVideoInput(ctx->bmd_mode,
> +cctx->v210 ? bmdFormat10BitYUV : 
> bmdFormat8BitYUV,
> +bmdVideoInputFlagDefault);
>  
Why not save bmdFormat10BitYUV in cctx instead of 1 or 0 in cctx->v210 flag?
>  if (result != S_OK) {
>  av_log(avctx, AV_LOG_ERROR, "Cannot enable video input\n");
> diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
> index 2aea277..b1a65e6 100644
> --- a/libavdevice/decklink_dec_c.c
> +++ b/libavdevice/decklink_dec_c.c
> @@ -31,6 +31,7 @@
>  static const AVOption options[] = {
>  { "list_devices", "list available devices"  , OFFSET(list_devices), 
> AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
>  { "list_formats", "list supported formats"  , OFFSET(list_formats), 
> AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
> +{ "bm_v210",  "v210 10 bit per channel" , OFFSET(v210), 
> AV_OPT_TYPE_INT   , { .i64 = 0   }, 0, 1, DEC },
>  { NULL },
>  };
>  
can you please add in commit message how should I test it. it would be
easier for me.
I do have a bmdcard on my linux pc.
It would give me a link to add closed caption, because that comes only
in 10bit yuv bmdcapture
card.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-05 Thread Anshul Maheshwari
On Tue, Jan 6, 2015 at 5:47 AM, Michael Niedermayer 
wrote:

> On Mon, Jan 05, 2015 at 06:20:15PM +0530, Anshul wrote:
> > On 01/04/2015 10:17 PM, Michael Niedermayer wrote:
> > > the table is constant and does not change, theres no need to have
> > > a copy of it in each context or to "make it every time decode is
> > > called"
> > > a simple static uint8_t parity_table[256];
> > > or even
> > > static const uint8_t parity_table[256] = {...}
> > >
> > done
> > >>>> +int row_cnt;
> > >>>> +struct Screen screen[2];
> > >>>> +int active_screen;
> > >>>> +uint8_t cursor_row;
> > >>>> +uint8_t cursor_column;
> > >>>> +AVBPrint buffer;
> > >>>> +int erase_display_memory;
> > >>>> +int rollup;
> > >>>> +enum  cc_mode mode;
> > >>>> +int64_t start_time;
> > >>>> +/* visible screen time */
> > >>>> +int64_t startv_time;
> > >>>> +int64_t end_time;
> > >>>> +char prev_cmd[2];
> > >>>> +/* buffer to store pkt data */
> > >>>> +AVBufferRef *pktbuf;
> > >>> as you memcopy the data each time, theres no need for a AVBufferRef
> > >>> a simple uint8_t * would do the same
> > >>> but i think not even that is needed,
> > >>> all uses of the data go through process_cc608() it would be
> > >>> very simply to strip one bit in the arguments there, so no rewriting
> > >>> of the table would be needed
> > >>>
> > >>> [...]
> > >> cant do that, for error resistance we need to escape 1st byte
> > >> if parity does not match, for escaping I write 0x7f instead of
> > >> whatever data is. Some closed caption insert-er don't care much for
> parity
> > >> when they are not using the data.
> > >>
> > >> I was using AVBufferRef instead of uint8_t * , so that I don't have to
> > >> take care for length,
> > >> and length and data are in one context. and there is already lot of
> > >> error handling is
> > >> done while realloc, means I don't have to copy buffer pointer
> somewhere,
> > >> if realloc fails.
> > >> and in future if someone want to make data channel 1  and data
> channel 2
> > >> to be processed
> > >> in parallel,  then he may use reference thing too.
> > >> still its my opinion, if you think uint8_t will have better
> performance,
> > >> I will change it to that.
> > > if you prefer AVBufferRef, feel free to keep using it, i dont think
> > > its the optimal choice though.
> > >
> > > Also isnt there some maximum size for these buffers ?
> > > (this would allow using a fixed size buffer and avoid the need for
> > >  dealing with allocation failures)
> > >
> > There is nothing similar inside spec cc608. since its line 21 data,
> > there must
> > be something in vertical ancillary specification. I have to search for
> > that spec.
> > if you can find about max limit of vanc packet, then ccaption can not
> > exceed
> > with that.
> > >>>> +static void handle_char(CCaptionSubContext *ctx, char hi, char lo,
> int64_t pts)
> > >>>> +{
> > >>>> +struct Screen *screen = get_writing_screen(ctx);
> > >>>> +char *row = screen->characters[ctx->cursor_row] +
> ctx->cursor_column;
> > >>>> +
> > >>>> +SET_FLAG(screen->row_used,ctx->cursor_row);
> > >>>> +
> > >>>> +*row++ = hi;
> > >>>> +ctx->cursor_column++;
> > >>>> +if(lo) {
> > >>>> +*row++ = lo;
> > >>>> +ctx->cursor_column++;
> > >>>> +}
> > >>>> +*row = 0;
> > >>> this code appears to lack validity checks on the column index
> > >> Added in todo list, will do it while implementing backspace.
> > > out of array accesses are not a "todo for later" they are a
> > > critical issue that could allow an attacker to potentially execute
> > > arbitrary code, that has to be fixed before the patch can be applied
> > done, took you comment wrongly.
> > >
> > > [...]
> > >
> > >
> > >
> 

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-05 Thread Anshul
On 01/04/2015 10:17 PM, Michael Niedermayer wrote:
> the table is constant and does not change, theres no need to have
> a copy of it in each context or to "make it every time decode is
> called"
> a simple static uint8_t parity_table[256];
> or even
> static const uint8_t parity_table[256] = {...}
>
done
>>>> +int row_cnt;
>>>> +struct Screen screen[2];
>>>> +int active_screen;
>>>> +uint8_t cursor_row;
>>>> +uint8_t cursor_column;
>>>> +AVBPrint buffer;
>>>> +int erase_display_memory;
>>>> +int rollup;
>>>> +enum  cc_mode mode;
>>>> +int64_t start_time;
>>>> +/* visible screen time */
>>>> +int64_t startv_time;
>>>> +int64_t end_time;
>>>> +char prev_cmd[2];
>>>> +/* buffer to store pkt data */
>>>> +AVBufferRef *pktbuf;
>>> as you memcopy the data each time, theres no need for a AVBufferRef
>>> a simple uint8_t * would do the same
>>> but i think not even that is needed,
>>> all uses of the data go through process_cc608() it would be
>>> very simply to strip one bit in the arguments there, so no rewriting
>>> of the table would be needed
>>>
>>> [...]
>> cant do that, for error resistance we need to escape 1st byte
>> if parity does not match, for escaping I write 0x7f instead of
>> whatever data is. Some closed caption insert-er don't care much for parity
>> when they are not using the data.
>>  
>> I was using AVBufferRef instead of uint8_t * , so that I don't have to
>> take care for length,
>> and length and data are in one context. and there is already lot of
>> error handling is
>> done while realloc, means I don't have to copy buffer pointer somewhere,
>> if realloc fails.
>> and in future if someone want to make data channel 1  and data channel 2
>> to be processed
>> in parallel,  then he may use reference thing too.
>> still its my opinion, if you think uint8_t will have better performance,
>> I will change it to that.
> if you prefer AVBufferRef, feel free to keep using it, i dont think
> its the optimal choice though.
>
> Also isnt there some maximum size for these buffers ?
> (this would allow using a fixed size buffer and avoid the need for
>  dealing with allocation failures)
>
There is nothing similar inside spec cc608. since its line 21 data,
there must
be something in vertical ancillary specification. I have to search for
that spec.
if you can find about max limit of vanc packet, then ccaption can not
exceed
with that.
>>>> +static void handle_char(CCaptionSubContext *ctx, char hi, char lo, 
>>>> int64_t pts)
>>>> +{
>>>> +struct Screen *screen = get_writing_screen(ctx);
>>>> +char *row = screen->characters[ctx->cursor_row] + ctx->cursor_column;
>>>> +
>>>> +SET_FLAG(screen->row_used,ctx->cursor_row);
>>>> +
>>>> +*row++ = hi;
>>>> +ctx->cursor_column++;
>>>> +if(lo) {
>>>> +*row++ = lo;
>>>> +ctx->cursor_column++;
>>>> +}
>>>> +*row = 0;
>>> this code appears to lack validity checks on the column index
>> Added in todo list, will do it while implementing backspace.
> out of array accesses are not a "todo for later" they are a
> critical issue that could allow an attacker to potentially execute
> arbitrary code, that has to be fixed before the patch can be applied
done, took you comment wrongly.
>
> [...]
>
>
>
>> +static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket 
>> *avpkt)
>> +{
>> +CCaptionSubContext *ctx = avctx->priv_data;
>> +AVSubtitle *sub = data;
>> +uint8_t *bptr = NULL;
>> +int len = avpkt->size;
>> +int ret = 0;
>> +int i;
>> +
>> +if ( ctx->pktbuf->size < len) {
>> +ret = av_buffer_realloc(&ctx->pktbuf, len);
>> +if(ret)
>> +len = ctx->pktbuf->size;
>> +}
> error checks in ffmpeg  are <0 not != 0
> also i doubt that it makes sense to continue with a truncated packet
> and if the code does continue with a data buffer that failed to
> reallocate that would at least need an error/warning message so the
> user knows why what she sees is corrupted
done

attached new patchs, for column number, I have done lots of changes,
you might want to reread the patch.

-Anshul
>From d6e9

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-04 Thread Anshul
On 01/03/2015 08:40 PM, Michael Niedermayer wrote:
> On Sat, Jan 03, 2015 at 12:57:04PM +0530, Anshul wrote:
>> On 01/03/2015 01:42 AM, Michael Niedermayer wrote:
>>> On Wed, Dec 31, 2014 at 07:09:33PM +0530, Anshul wrote:
> [..]
>>  Makefile   |1 
>>  allcodecs.c|1 
>>  ccaption_dec.c |  361 
>> +
>>  3 files changed, 363 insertions(+)
>> 54d4896ef8724994e1022eec6a9c79d0cddec29d  
>> 0001-Adding-Closed-caption-Support.patch
>> From 17a564409b84fc18293833cc3f2151792209bb8b Mon Sep 17 00:00:00 2001
>> From: Anshul Maheshwari 
>> Date: Sat, 3 Jan 2015 12:40:35 +0530
>> Subject: [PATCH 1/2] Adding Closed caption Support
>>
>> Signed-off-by: Anshul Maheshwari 
>>
>> To test Closed caption use following command
>> /ffmpeg -f lavfi -i 
>> "movie=/home/a141982112/test_videos/Starship_Troopers.vob[out0+subcc]" -map 
>> s some.srt
>> ---
>>  libavcodec/Makefile   |   1 +
>>  libavcodec/allcodecs.c|   1 +
>>  libavcodec/ccaption_dec.c | 361 
>> ++
>>  3 files changed, 363 insertions(+)
>>  create mode 100644 libavcodec/ccaption_dec.c
>>
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index 107661b..33051c4 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
>>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>>cavsdata.o mpeg12data.o
>> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>> index 8ceee2f..ef77dec 100644
>> --- a/libavcodec/allcodecs.c
>> +++ b/libavcodec/allcodecs.c
>> @@ -481,6 +481,7 @@ void avcodec_register_all(void)
>>  /* subtitles */
>>  REGISTER_ENCDEC (SSA,   ssa);
>>  REGISTER_ENCDEC (ASS,   ass);
>> +REGISTER_DECODER(CCAPTION,  ccaption);
>>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>>  REGISTER_ENCDEC (DVDSUB,    dvdsub);
>>  REGISTER_DECODER(JACOSUB,   jacosub);
>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>> new file mode 100644
>> index 000..d351efe
>> --- /dev/null
>> +++ b/libavcodec/ccaption_dec.c
>> @@ -0,0 +1,361 @@
>> +/*
>> + * Closed Caption Decoding
>> + * Copyright (c) 2014 Anshul Maheshwari
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>> USA
>> + */
>> +
>> +#include "avcodec.h"
>> +#include "ass.h"
>> +#include "libavutil/opt.h"
>> +
>> +#undef CHAR_DEBUG
>> +#define SCREEN_ROWS 15
>> +#define SCREEN_COLUMNS 32
>> +
>> +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
>> +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
>> +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
>> +
>> +enum cc_mode {
>> +CCMODE_POPON,
>> +CCMODE_PAINTON,
>> +CCMODE_ROLLUP_2,
>> +CCMODE_ROLLUP_3,
>> +CCMODE_ROLLUP_4,
>> +CCMODE_TEXT,
>> +};
>> +
>> +struct Screen {
>> +/* +1 is used to compensate null character of string */
>> +uint8_t characters[SCREEN_ROWS][SCREEN_COLUMNS+1];
>> +/*
>> + * Bitmask of used rows; if a bit is not set, the
>> + * corresponding row is not used.
>> +   

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2015-01-02 Thread Anshul
On 01/03/2015 01:42 AM, Michael Niedermayer wrote:
> On Wed, Dec 31, 2014 at 07:09:33PM +0530, Anshul wrote:
> [...]
>
>> +static void build_parity_table(int *parity_table)
>> +{
>> +unsigned int byte;
>> +int parity_v;
>> +for (byte = 0; byte <= 127; byte++) {
>> +parity_v = av_popcount(byte) & 1;
>> +parity_table[byte] = parity_v;
>> +parity_table[byte | 0x80] = !parity_v;
>> +}
>> +}
> This should not be needed, av_popcount(byte) & 1 could be used
> directly or you could use something like this: (untested)
> (0x6996 >> ((byte ^ (byte>>4)) & 15)) & 1
>
> the code using the parity stuff does not seem speed critical
> but maybe iam missing something ?
parity is checked for each byte of data in closed caption, so I thought
it would be speed critical. only 7 bits are used in each byte. 1 bit is
fr parity.
> [...]
>
>> +static void handle_pac( CCaptionSubContext *ctx, uint8_t hi, uint8_t lo )
>> +{
>> +static const uint8_t row_map[] = {
>> +11, -1, 1, 2, 3, 4, 12, 13, 14, 15, 5, 6, 7, 8, 9, 10
>> +};
> you are having negative values in a unsigned 8bit table
> i assume either of these is not intended
done, -1 was needed.
changed uint8_t to int8_t
>
> [...]
>> +static int process_cc608(CCaptionSubContext *ctx, int64_t pts, uint8_t hi, 
>> uint8_t lo)
>> +{
>> +int ret = 0;
>> +#define COR3(var, with1, with2, with3)  ( (var) == (with1) ||  (var) == 
>> (with2) || (var) == (with3) )
>> +if ( hi == ctx->prev_cmd[0] && lo == ctx->prev_cmd[1]) {
>> +/* ignore redundant command */
>> +} else if ( (hi == 0x10 && (lo >= 0x40 || lo <= 0x5f)) ||
>> +  ( (hi >= 0x11 && hi <= 0x17) && (lo >= 0x40 && lo <= 0x7f) ) 
>> ) {
>> +handle_pac(ctx, hi, lo);
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x20 ) {
>> +/* resume caption loading */
>> +ctx->mode = CCMODE_POPON;
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x25 ) {
>> +ctx->rollup = 2;
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x26 ) {
>> +ctx->rollup = 3;
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x27 ) {
>> +ctx->rollup = 4;
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x29 ) {
>> +/* resume direct captioning */
>> +ctx->mode = CCMODE_PAINTON;
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2C ) {
>> +/* erase display memory */
>> +ret = handle_edm(ctx, pts);
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2D ) {
>> +/* carriage return */
>> +av_log(ctx, AV_LOG_DEBUG,"cdp (handle cr)\n");
>> +ctx->row_cnt++;
>> +if(ctx->row_cnt == ctx->rollup) {
>> +ctx->row_cnt = 0;
>> +ret = handle_edm(ctx, pts);
>> +ctx->active_screen = !ctx->active_screen;
>> +}
>> +} else if ( COR3(hi, 0x14, 0x15, 0x1C) && lo == 0x2F ) {
>> +/* end of caption */
>> +ret = handle_eoc(ctx, pts);
>> +} else if (hi>=0x20) {
>> +/* Standard characters (always in pairs) */
>> +handle_char(ctx, hi, lo, pts);
>> +} else {
>> +/* Ignoring all other non data code */
>> +}
>> +
>> +/* set prev command */
>> + ctx->prev_cmd[0] = hi;
>> + ctx->prev_cmd[1] = lo;
>> +
>> +#undef COR3
>> +return ret;
>> +
>> +}
>> +static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket 
>> *avpkt)
>> +{
>> +CCaptionSubContext *ctx = avctx->priv_data;
>> +AVSubtitle *sub = data;
>> +uint8_t *bptr = avpkt->data;
> The input packets data is read only unless you do something
> (dup/memcpy/whatever) so this should be const
copied data in AVbufferRef.
>
>> +int len = avpkt->size;
>> +int ret = 0;
>> +int i;
>> +
>> +for (i  = 0; i < len; i += 3) {
>> +uint8_t cc_type = *(bptr + i) & 3;
>> +if (validate_cc_data_pair( bptr + i, ctx->parity_table ) )
>> +continue;
>> +/* ignoring data field 1 */
>> +if(cc_type == 1)
>> +continue;
>> +    else
>> +process_cc608(ctx, avpkt->pts, *(bptr + i + 1), *(bptr + i + 
>> 2));
>> +    }
>> +if(ctx-&

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-31 Thread Anshul
On 12/30/2014 11:13 PM, Michael Niedermayer wrote:
> On Tue, Dec 30, 2014 at 07:46:29PM +0530, Anshul wrote:
>> On 12/12/2014 04:23 PM, Anshul wrote:
>>> On 12/06/2014 04:24 PM, Anshul wrote:
>>>> On 12/06/2014 04:22 PM, Anshul wrote:
>>>>> On 12/05/2014 07:56 PM, Nicolas George wrote:
>>>>>> Hi. I had time to look at the code with some more details. Comments are
>>>>>> below.
>>>>>>
>>>>>>> >From 31f69ccfb45247a7cc203084a931b8523284aa13 Mon Sep 17 00:00:00 2001
>>>>>>> From: Anshul Maheshwari 
>>>>>>> Date: Wed, 3 Dec 2014 23:37:22 +0530
>>>>>>> Subject: [PATCH 2/2] Adding Closed caption Decoder
>>>>>>>
>>>>>>> ---
>>>>>>>  libavcodec/Makefile   |   1 +
>>>>>>>  libavcodec/allcodecs.c|   1 +
>>>>>>>  libavcodec/ccaption_dec.c | 318 
>>>>>>> ++
>>>>>>>  3 files changed, 320 insertions(+)
>>>>>>>  create mode 100644 libavcodec/ccaption_dec.c
>>>>>>>
>>>>>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>>>>>> index fa0f53d..bbc516d 100644
>>>>>>> --- a/libavcodec/Makefile
>>>>>>> +++ b/libavcodec/Makefile
>>>>>>> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += 
>>>>>>> brenderpix.o
>>>>>>>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>>>>>>>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>>>>>>>cavsdata.o mpeg12data.o
>>>>>>> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>>>>>>>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>>>>>>>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>>>>>>>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>>>>>>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>>>>>>> index 0d39d33..8c07388 100644
>>>>>>> --- a/libavcodec/allcodecs.c
>>>>>>> +++ b/libavcodec/allcodecs.c
>>>>>>> @@ -480,6 +480,7 @@ void avcodec_register_all(void)
>>>>>>>  /* subtitles */
>>>>>>>  REGISTER_ENCDEC (SSA,   ssa);
>>>>>>>  REGISTER_ENCDEC (ASS,   ass);
>>>>>>> +REGISTER_DECODER(CCAPTION,  ccaption);
>>>>>>>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>>>>>>>  REGISTER_ENCDEC (DVDSUB,dvdsub);
>>>>>>>  REGISTER_DECODER(JACOSUB,   jacosub);
>>>>>>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>>>>>>> new file mode 100644
>>>>>>> index 000..0a7dfd8
>>>>>>> --- /dev/null
>>>>>>> +++ b/libavcodec/ccaption_dec.c
>>>>>>> @@ -0,0 +1,318 @@
>>>>>>> +/*
>>>>>>> + * Closed Caption Decoding
>>>>>>> + * Copyright (c) 2014 Anshul Maheshwari
>>>>>>> + *
>>>>>>> + * This file is part of FFmpeg.
>>>>>>> + *
>>>>>>> + * FFmpeg is free software; you can redistribute it and/or
>>>>>>> + * modify it under the terms of the GNU Lesser General Public
>>>>>>> + * License as published by the Free Software Foundation; either
>>>>>>> + * version 2.1 of the License, or (at your option) any later version.
>>>>>>> + *
>>>>>>> + * FFmpeg is distributed in the hope that it will be useful,
>>>>>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>>>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>>>>>>> + * Lesser General Public License for more details.
>>>>>>> + *
>>>>>>> + * You should have received a copy of the GNU Lesser General Public
>>>>>>> + * License along with FFmpeg; if not, write to the Free Software
>>>>>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
>>>>>>> 02110-1301 USA
>>>>>>> + */
>>>>>&g

Re: [FFmpeg-devel] SCTE-35 development

2014-12-31 Thread Anshul
On 12/31/2014 02:14 AM, Michael Niedermayer wrote:
> On Wed, Dec 31, 2014 at 01:35:59AM +0530, Anshul wrote:
>> On 12/30/2014 10:06 PM, Michael Niedermayer wrote:
>>> On Tue, Dec 30, 2014 at 07:39:38PM +0530, Anshul wrote:
>>>> On 12/30/2014 03:56 PM, Clément Bœsch wrote:
>>>>> They are also probably useless since you can use av_asprintf() directly.
>>>>>
>>>> Thanks I didn't knew about that function.
>>>>
>>>>
>>>> Attached new patch with removing those function.
>>> [...]
>>>> --- a/libavcodec/allcodecs.c
>>>> +++ b/libavcodec/allcodecs.c
>>>> @@ -536,6 +536,8 @@ void avcodec_register_all(void)
>>>>  REGISTER_ENCODER(LIBAACPLUS,libaacplus);
>>>>  
>>>>  /* text */
>>>> +REGISTER_DECODER(SCTE_35,   scte_35)
>>>> +REGISTER_ENCODER(CUE_XML,   cue_xml);
>>> you are missing a ; here
>>>
>> done
>>>>  REGISTER_DECODER(BINTEXT,   bintext);
>>>>  REGISTER_DECODER(XBIN,  xbin);
>>>>  REGISTER_DECODER(IDF,   idf);
>>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>>>> index 99467bb..bd966d5 100644
>>>> --- a/libavcodec/avcodec.h
>>>> +++ b/libavcodec/avcodec.h
>>>> @@ -523,6 +523,8 @@ enum AVCodecID {
>>>>  /* other specific kind of codecs (generally used for attachments) */
>>>>  AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,   ///< A dummy ID 
>>>> pointing at the start of various fake codecs.
>>>>  AV_CODEC_ID_TTF = 0x18000,
>>>> +AV_CODEC_ID_SCTE_35= MKBETAG('C','U','E','I'),
>>>> +AV_CODEC_ID_CUE_XML= MKBETAG('C','U','E','X'),
>>>>  AV_CODEC_ID_BINTEXT= MKBETAG('B','T','X','T'),
>>>>  AV_CODEC_ID_XBIN   = MKBETAG('X','B','I','N'),
>>>>  AV_CODEC_ID_IDF= MKBETAG( 0 ,'I','D','F'),
>>>> @@ -3157,6 +3159,13 @@ typedef struct AVCodecDefault AVCodecDefault;
>>>>  
>>>>  struct AVSubtitle;
>>>>  
>>>> +typedef struct AVData {
>>>> +void *data;
>>>> +int len;
>>>> +int ref_count;
>>>> +int valid;
>>>> +} AVData;
>>> missing documentation
>> removed all of it. used AVBuffer instead
>>>> +
>>>>  /**
>>>>   * AVCodec.
>>>>   */
>>>> @@ -3233,6 +3242,8 @@ typedef struct AVCodec {
>>>>  int (*init)(AVCodecContext *);
>>>>  int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
>>>>const struct AVSubtitle *sub);
>>>> + int (*encode_data)(AVCodecContext *avctx, const AVData *input, 
>>>> AVData *output,
>>>> +enum AVCodecID in_codec_id);
>>>>  /**
>>>>   * Encode data to an AVPacket.
>>>>   *
>>>> @@ -3246,6 +3257,7 @@ typedef struct AVCodec {
>>>>  int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame 
>>>> *frame,
>>>> int *got_packet_ptr);
>>>>  int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, 
>>>> AVPacket *avpkt);
>>>> +int (*decode_data)(AVCodecContext *,AVData *output, const AVPacket 
>>>> *avpkt);
>>>>  int (*close)(AVCodecContext *);
>>>>  /**
>>>>   * Flush buffers.
>>> this breaks ABI
>>>
>> add at end of structure, if that solve problem
>>>> @@ -4195,6 +4207,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, 
>>>> AVSubtitle *sub,
>>>>  int *got_sub_ptr,
>>>>  AVPacket *avpkt);
>>>>  
>>>> +int avcodec_decode_data(AVCodecContext *avctx,
>>>> +  AVData *output,
>>>> +  const AVPacket *avpkt);
>>>>  /**
>>>>   * @defgroup lavc_parsing Frame parsing
>>>>   * @{
>>>> @@ -4585,6 +4600,8 @@ int avcodec_encode_video2(AVCodecContext *avctx, 
>>>> AVPacket *avpkt,
>>>>  
>>>>  int avcodec_enc

Re: [FFmpeg-devel] SCTE-35 development

2014-12-30 Thread Anshul
On 12/30/2014 10:06 PM, Michael Niedermayer wrote:
> On Tue, Dec 30, 2014 at 07:39:38PM +0530, Anshul wrote:
>> On 12/30/2014 03:56 PM, Clément Bœsch wrote:
>>> They are also probably useless since you can use av_asprintf() directly.
>>>
>> Thanks I didn't knew about that function.
>>
>>
>> Attached new patch with removing those function.
> [...]
>> --- a/libavcodec/allcodecs.c
>> +++ b/libavcodec/allcodecs.c
>> @@ -536,6 +536,8 @@ void avcodec_register_all(void)
>>  REGISTER_ENCODER(LIBAACPLUS,libaacplus);
>>  
>>  /* text */
>> +REGISTER_DECODER(SCTE_35,   scte_35)
>> +REGISTER_ENCODER(CUE_XML,   cue_xml);
> you are missing a ; here
>
done
>
>>  REGISTER_DECODER(BINTEXT,   bintext);
>>  REGISTER_DECODER(XBIN,  xbin);
>>  REGISTER_DECODER(IDF,   idf);
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 99467bb..bd966d5 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -523,6 +523,8 @@ enum AVCodecID {
>>  /* other specific kind of codecs (generally used for attachments) */
>>  AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,   ///< A dummy ID pointing 
>> at the start of various fake codecs.
>>  AV_CODEC_ID_TTF = 0x18000,
>> +AV_CODEC_ID_SCTE_35= MKBETAG('C','U','E','I'),
>> +AV_CODEC_ID_CUE_XML= MKBETAG('C','U','E','X'),
>>  AV_CODEC_ID_BINTEXT= MKBETAG('B','T','X','T'),
>>  AV_CODEC_ID_XBIN   = MKBETAG('X','B','I','N'),
>>  AV_CODEC_ID_IDF= MKBETAG( 0 ,'I','D','F'),
>> @@ -3157,6 +3159,13 @@ typedef struct AVCodecDefault AVCodecDefault;
>>  
>>  struct AVSubtitle;
>>  
>> +typedef struct AVData {
>> +void *data;
>> +int len;
>> +int ref_count;
>> +int valid;
>> +} AVData;
> missing documentation
removed all of it. used AVBuffer instead
>
>> +
>>  /**
>>   * AVCodec.
>>   */
>> @@ -3233,6 +3242,8 @@ typedef struct AVCodec {
>>  int (*init)(AVCodecContext *);
>>  int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
>>const struct AVSubtitle *sub);
>> + int (*encode_data)(AVCodecContext *avctx, const AVData *input, AVData 
>> *output,
>> +enum AVCodecID in_codec_id);
>>  /**
>>   * Encode data to an AVPacket.
>>   *
>> @@ -3246,6 +3257,7 @@ typedef struct AVCodec {
>>  int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame 
>> *frame,
>> int *got_packet_ptr);
>>  int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, 
>> AVPacket *avpkt);
>> +int (*decode_data)(AVCodecContext *,AVData *output, const AVPacket 
>> *avpkt);
>>  int (*close)(AVCodecContext *);
>>  /**
>>   * Flush buffers.
> this breaks ABI
>
add at end of structure, if that solve problem
>
>> @@ -4195,6 +4207,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, 
>> AVSubtitle *sub,
>>  int *got_sub_ptr,
>>  AVPacket *avpkt);
>>  
>> +int avcodec_decode_data(AVCodecContext *avctx,
>> +  AVData *output,
>> +  const AVPacket *avpkt);
>>  /**
>>   * @defgroup lavc_parsing Frame parsing
>>   * @{
>> @@ -4585,6 +4600,8 @@ int avcodec_encode_video2(AVCodecContext *avctx, 
>> AVPacket *avpkt,
>>  
>>  int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int 
>> buf_size,
>>  const AVSubtitle *sub);
>> +int avcodec_encode_data(AVCodecContext *avctx,const AVData *input, AVData 
>> *output,
>> +enum AVCodecID in_codec_id);
>>  
>>  
> this is missing documentation
>
added documentation
> [...]
>> diff --git a/libavcodec/scte_35.c b/libavcodec/scte_35.c
>> new file mode 100644
>> index 000..2723225
>> --- /dev/null
>> +++ b/libavcodec/scte_35.c
>> @@ -0,0 +1,294 @@
>> +/*
>> + * SCTE 35 decoder
>> + * Copyright (c) 2014 Anshul Maheshwaari
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
&g

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-30 Thread Anshul
On 12/12/2014 04:23 PM, Anshul wrote:
> On 12/06/2014 04:24 PM, Anshul wrote:
>> On 12/06/2014 04:22 PM, Anshul wrote:
>>> On 12/05/2014 07:56 PM, Nicolas George wrote:
>>>> Hi. I had time to look at the code with some more details. Comments are
>>>> below.
>>>>
>>>>> >From 31f69ccfb45247a7cc203084a931b8523284aa13 Mon Sep 17 00:00:00 2001
>>>>> From: Anshul Maheshwari 
>>>>> Date: Wed, 3 Dec 2014 23:37:22 +0530
>>>>> Subject: [PATCH 2/2] Adding Closed caption Decoder
>>>>>
>>>>> ---
>>>>>  libavcodec/Makefile   |   1 +
>>>>>  libavcodec/allcodecs.c|   1 +
>>>>>  libavcodec/ccaption_dec.c | 318 
>>>>> ++
>>>>>  3 files changed, 320 insertions(+)
>>>>>  create mode 100644 libavcodec/ccaption_dec.c
>>>>>
>>>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>>>> index fa0f53d..bbc516d 100644
>>>>> --- a/libavcodec/Makefile
>>>>> +++ b/libavcodec/Makefile
>>>>> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
>>>>>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>>>>>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>>>>>cavsdata.o mpeg12data.o
>>>>> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>>>>>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>>>>>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>>>>>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>>>>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>>>>> index 0d39d33..8c07388 100644
>>>>> --- a/libavcodec/allcodecs.c
>>>>> +++ b/libavcodec/allcodecs.c
>>>>> @@ -480,6 +480,7 @@ void avcodec_register_all(void)
>>>>>  /* subtitles */
>>>>>  REGISTER_ENCDEC (SSA,   ssa);
>>>>>  REGISTER_ENCDEC (ASS,   ass);
>>>>> +REGISTER_DECODER(CCAPTION,  ccaption);
>>>>>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>>>>>  REGISTER_ENCDEC (DVDSUB,dvdsub);
>>>>>  REGISTER_DECODER(JACOSUB,   jacosub);
>>>>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>>>>> new file mode 100644
>>>>> index 000..0a7dfd8
>>>>> --- /dev/null
>>>>> +++ b/libavcodec/ccaption_dec.c
>>>>> @@ -0,0 +1,318 @@
>>>>> +/*
>>>>> + * Closed Caption Decoding
>>>>> + * Copyright (c) 2014 Anshul Maheshwari
>>>>> + *
>>>>> + * This file is part of FFmpeg.
>>>>> + *
>>>>> + * FFmpeg is free software; you can redistribute it and/or
>>>>> + * modify it under the terms of the GNU Lesser General Public
>>>>> + * License as published by the Free Software Foundation; either
>>>>> + * version 2.1 of the License, or (at your option) any later version.
>>>>> + *
>>>>> + * FFmpeg is distributed in the hope that it will be useful,
>>>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>>>>> + * Lesser General Public License for more details.
>>>>> + *
>>>>> + * You should have received a copy of the GNU Lesser General Public
>>>>> + * License along with FFmpeg; if not, write to the Free Software
>>>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
>>>>> 02110-1301 USA
>>>>> + */
>>>>> +
>>>>> +#include "avcodec.h"
>>>>> +#include "ass.h"
>>>>> +
>>>>> +#define SCREEN_ROWS 15
>>>>> +#define SCREEN_COLUMNS 32
>>>>> +
>>>>> +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
>>>>> +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
>>>>> +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
>>>>> +
>>>>> +enum cc_mode {
>>>>> +CCMODE_POPON,
>>>>> +CCMODE_PAINTON,
>>>>> +CCMODE_ROLLUP_2,
>>>>> +CCMODE_ROLL

Re: [FFmpeg-devel] SCTE-35 development

2014-12-30 Thread Anshul
On 12/30/2014 03:56 PM, Clément Bœsch wrote:
> They are also probably useless since you can use av_asprintf() directly.
>
Thanks I didn't knew about that function.


Attached new patch with removing those function.

-Anshul
>From 6adef31ca9b61e7d8bc9d94c10b0498bf3bcf85e Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Tue, 30 Dec 2014 19:37:24 +0530
Subject: [PATCH] handle scte_35 messagecue

---
 ffmpeg.c|  46 +++-
 ffmpeg_opt.c|   9 +-
 libavcodec/Makefile |   2 +
 libavcodec/allcodecs.c  |   2 +
 libavcodec/avcodec.h|  17 +++
 libavcodec/codec_desc.c |  12 ++
 libavcodec/cue_xml.c| 200 
 libavcodec/scte_35.c| 294 
 libavcodec/scte_35.h|  31 +
 libavcodec/utils.c  |  33 +-
 libavformat/avformat.h  |  16 +++
 libavformat/mpegts.c|  45 +++-
 libavformat/utils.c |   1 +
 13 files changed, 694 insertions(+), 14 deletions(-)
 create mode 100644 libavcodec/cue_xml.c
 create mode 100644 libavcodec/scte_35.c
 create mode 100644 libavcodec/scte_35.h

diff --git a/ffmpeg.c b/ffmpeg.c
index ddf4272..14712cd 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2063,6 +2063,44 @@ fail:
 return err < 0 ? err : ret;
 }
 
+static int transcode_data(InputStream *ist, AVPacket *pkt, int *got_output)
+{
+AVCodecContext *dec = ist->dec_ctx;
+enum AVCodecID in_codec_id = AV_CODEC_ID_NONE;
+AVData input;
+AVData output;
+AVPacket outpkt;
+int ret, i;
+
+if (dec->codec)
+in_codec_id = dec->codec->id;
+
+input.valid = 0;
+update_benchmark(NULL);
+ret = avcodec_decode_data(dec, &input, pkt);
+update_benchmark("decode_data %d.%d", ist->file_index, ist->st->index);
+*got_output = input.valid;
+
+if (ret < 0 || !input.valid) {
+return ret;
+}
+for (i = 0; i < nb_output_streams && *got_output; i++) {
+OutputStream *ost = output_streams[i];
+
+if (!check_output_constraints(ist, ost) || !ost->encoding_needed
+|| ost->enc->type != AVMEDIA_TYPE_DATA)
+continue;
+ret = avcodec_encode_data(output_streams[i]->enc_ctx, &input, &output, in_codec_id);
+av_init_packet(&outpkt);
+outpkt.data = output.data;
+outpkt.size = output.len;
+write_frame(output_files[ost->file_index]->ctx, &outpkt, ost);
+
+}
+
+return ret;
+
+}
 static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
 {
 AVSubtitle subtitle;
@@ -2203,6 +2241,9 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt)
 case AVMEDIA_TYPE_SUBTITLE:
 ret = transcode_subtitles(ist, &avpkt, &got_output);
 break;
+case AVMEDIA_TYPE_DATA:
+ret = transcode_data(ist, &avpkt, &got_output);
+break;
 default:
 return -1;
 }
@@ -2907,6 +2948,8 @@ static int transcode_init(void)
 enc_ctx->height= input_streams[ost->source_index]->st->codec->height;
 }
 break;
+case AVMEDIA_TYPE_DATA:
+break;
 default:
 abort();
 break;
@@ -3464,7 +3507,8 @@ static int process_input(int file_index)
 OutputStream *ost = output_streams[j];
 
 if (ost->source_index == ifile->ist_index + i &&
-(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))
+(ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE
+|| ost->enc->type == AVMEDIA_TYPE_DATA ))
 finish_output_stream(ost);
 }
 }
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index ac93eb5..f7b20fd 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -804,6 +804,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
 char *   video_codec_name = NULL;
 char *   audio_codec_name = NULL;
 char *subtitle_codec_name = NULL;
+char *data_codec_name = NULL;
 int scan_all_pmts_set = 0;
 
 if (o->format) {
@@ -864,6 +865,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
 find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0)->id : AV_CODEC_ID_NONE;
 ic->subtitle_codec_id= subtitle_codec_name ?
 find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : AV_CODEC_ID_NONE;
+ic->data_codec_id= data_codec_name ?
+find_codec_or_die(data_codec_name, AVMEDIA_TYPE_DATA, 0)->id : AV_CODEC_ID_NONE;
 
 if (video_codec_name)
 av_format_set_video_codec   (ic, find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0));
@@ -871,6 +874,8 @@ static int open_in

Re: [FFmpeg-devel] SCTE-35 development

2014-12-30 Thread Anshul
On 12/30/2014 03:05 AM, Michael Niedermayer wrote:
> On Mon, Dec 29, 2014 at 07:19:14PM +0530, Anshul wrote:
>> On 12/29/2014 06:08 PM, Michael Niedermayer wrote:
>>> On Mon, Dec 29, 2014 at 01:31:18PM +0530, Anshul wrote:
>>>> On December 18, 2014 4:08:56 PM IST, Michael Niedermayer
>>>>  wrote:
>>>>> On Wed, Dec 17, 2014 at 11:53:10PM +0530, Anshul wrote:
>>>>>> Hi
>>>>>>
>>>>>> I was doing development of scte-35  message cue in ffmpeg.
>>>>>>
>>>>>> I have attached a draft patch.
>>>>>>
>>>>>> I would like to have some comments of this community.
>>>>>> -Anshul
>>>>>>  libavcodec/Makefile |2 ++
>>>>>>  libavcodec/allcodecs.c  |2 ++
>>>>>>  libavcodec/avcodec.h|1 +
>>>>>>  libavcodec/codec_desc.c |6 ++
>>>>>>  libavformat/mpegts.c|   40
>>>>> +++++---
>>>>>>  5 files changed, 44 insertions(+), 7 deletions(-)
>>>>>> 4b584484a54a78c130c4bbaa48c38551b3ca75fb 
>>>>> 0001-trying-muxing-demuxing-of-scte_35-message-cue.patch
>>>>>> From 2ff4edfdeae131df72ea19005eb6ad85d5332f7c Mon Sep 17 00:00:00
>>>>> 2001
>>>>>> From: Anshul Maheshwari 
>>>>>> Date: Wed, 17 Dec 2014 22:13:10 +0530
>>>>>> Subject: [PATCH] trying muxing demuxing of scte_35 message cue
>>>>>>
>>>>>> ---
>>>>>>  libavcodec/Makefile |  2 ++
>>>>>>  libavcodec/allcodecs.c  |  2 ++
>>>>>>  libavcodec/avcodec.h|  1 +
>>>>>>  libavcodec/codec_desc.c |  6 ++
>>>>>>  libavformat/mpegts.c| 40
>>>>> +---
>>>>>>  5 files changed, 44 insertions(+), 7 deletions(-)
>>>>>>
>>>>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>>>>> index b35a796..9d2a49f 100644
>>>>>> --- a/libavcodec/Makefile
>>>>>> +++ b/libavcodec/Makefile
>>>>>> @@ -408,6 +408,7 @@ OBJS-$(CONFIG_SAMI_DECODER)+=
>>>>> samidec.o ass.o
>>>>>>  OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
>>>>>>  OBJS-$(CONFIG_S302M_ENCODER)   += s302menc.o
>>>>>>  OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
>>>>>> +OBJS-$(CONFIG_SCTE_35_DECODER) += scte_35.o
>>>>> this patch doesnt contain a scte_35.c
>>>>> did you forget git add ?
>>>>>
>>>>> [...]
>>>> I have attached another patch, still its draft.
>>>> I do want some opinion about the approach of this development.
>>>>
>>>> to use this patch, one can pass below command
>>>> ./ffmpeg -loglevel debug -i ~/test_videos/mpegwithscte35.ts -dcodec
>>>> cue_xml -map 0:0 -f rawvideo some.raw
>>>>
>>>> There still some issue with this patch, like I have disabled estimate
>>>> timing of all stream since data stream does not have similar timing, i
>>>> will add condition there.
>>>>
>>>> FFmpeg hangs after running command, it might be because of EOF not
>>>> handled properly, looking at the issue.
>>>>
>>>>
>>>> My vision for this patch is that we can add custom advertisement
>>>> if stream have scte-cue.
>>>>
>>>> This patch might also help end-user to remove advertisements automatically.
>>>>
>>>> for broadcaster it will help to show advertisement in local language.
>>>> or for local product.
>>>> just now I am very far away from my goal but will not always be.
>>>>
>>>>
>>>> This patch have all files which I have developed.
>>> ar: libavcodec/scte_35.o: No such file or directory
>>>
>>> [...]
>>>
>>>
>>>
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> I am sorry, I attached the wrong patch file.
>> -Anshul
>>  ffmpeg.c|   40 ++
>>  ffmpeg_opt.c|9 -
>>  libavcodec/Makefile |2 
>>  libavcodec/allcodecs.c  |2 
>>  libavcodec/avcodec.h|  

Re: [FFmpeg-devel] SCTE-35 development

2014-12-29 Thread Anshul
On 12/29/2014 06:08 PM, Michael Niedermayer wrote:
> On Mon, Dec 29, 2014 at 01:31:18PM +0530, Anshul wrote:
>> On December 18, 2014 4:08:56 PM IST, Michael Niedermayer
>>  wrote:
>>> On Wed, Dec 17, 2014 at 11:53:10PM +0530, Anshul wrote:
>>>> Hi
>>>>
>>>> I was doing development of scte-35  message cue in ffmpeg.
>>>>
>>>> I have attached a draft patch.
>>>>
>>>> I would like to have some comments of this community.
>>>> -Anshul
>>>>  libavcodec/Makefile |2 ++
>>>>  libavcodec/allcodecs.c  |2 ++
>>>>  libavcodec/avcodec.h|1 +
>>>>  libavcodec/codec_desc.c |6 ++
>>>>  libavformat/mpegts.c|   40
>>> +---
>>>>  5 files changed, 44 insertions(+), 7 deletions(-)
>>>> 4b584484a54a78c130c4bbaa48c38551b3ca75fb 
>>> 0001-trying-muxing-demuxing-of-scte_35-message-cue.patch
>>>> From 2ff4edfdeae131df72ea19005eb6ad85d5332f7c Mon Sep 17 00:00:00
>>> 2001
>>>> From: Anshul Maheshwari 
>>>> Date: Wed, 17 Dec 2014 22:13:10 +0530
>>>> Subject: [PATCH] trying muxing demuxing of scte_35 message cue
>>>>
>>>> ---
>>>>  libavcodec/Makefile |  2 ++
>>>>  libavcodec/allcodecs.c  |  2 ++
>>>>  libavcodec/avcodec.h|  1 +
>>>>  libavcodec/codec_desc.c |  6 ++
>>>>  libavformat/mpegts.c| 40
>>> +---
>>>>  5 files changed, 44 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>>> index b35a796..9d2a49f 100644
>>>> --- a/libavcodec/Makefile
>>>> +++ b/libavcodec/Makefile
>>>> @@ -408,6 +408,7 @@ OBJS-$(CONFIG_SAMI_DECODER)+=
>>> samidec.o ass.o
>>>>  OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
>>>>  OBJS-$(CONFIG_S302M_ENCODER)   += s302menc.o
>>>>  OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
>>>> +OBJS-$(CONFIG_SCTE_35_DECODER) += scte_35.o
>>> this patch doesnt contain a scte_35.c
>>> did you forget git add ?
>>>
>>> [...]
>> I have attached another patch, still its draft.
>> I do want some opinion about the approach of this development.
>>
>> to use this patch, one can pass below command
>> ./ffmpeg -loglevel debug -i ~/test_videos/mpegwithscte35.ts -dcodec
>> cue_xml -map 0:0 -f rawvideo some.raw
>>
>> There still some issue with this patch, like I have disabled estimate
>> timing of all stream since data stream does not have similar timing, i
>> will add condition there.
>>
>> FFmpeg hangs after running command, it might be because of EOF not
>> handled properly, looking at the issue.
>>
>>
>> My vision for this patch is that we can add custom advertisement
>> if stream have scte-cue.
>>
>> This patch might also help end-user to remove advertisements automatically.
>>
>> for broadcaster it will help to show advertisement in local language.
>> or for local product.
>> just now I am very far away from my goal but will not always be.
>>
>>
>> This patch have all files which I have developed.
> ar: libavcodec/scte_35.o: No such file or directory
>
> [...]
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
I am sorry, I attached the wrong patch file.
-Anshul
>From 6e04f65c33c4d4f873bbadabcc9d1d8464d49314 Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Mon, 29 Dec 2014 12:42:41 +0530
Subject: [PATCH] trying handle scte_35 messagecue

---
 ffmpeg.c|  40 +++
 ffmpeg_opt.c|   9 +-
 libavcodec/Makefile |   2 +
 libavcodec/allcodecs.c  |   2 +
 libavcodec/avcodec.h|  17 +++
 libavcodec/codec_desc.c |  12 ++
 libavcodec/cue_xml.c| 196 
 libavcodec/scte_35.c| 294 
 libavcodec/scte_35.h|  31 +
 libavcodec/utils.c  |  33 +-
 libavformat/avformat.h  |  16 +++
 libavformat/mpegts.c|  44 ++--
 libavformat/utils.c |   3 +-
 libavutil/avstring.c|  26 -
 libavutil/avstring.h|  15 +++
 15 files changed, 724 insertions(+), 16 deletions(-)
 create mode 100644 libavcodec/cue_xml.c
 create mode 100644 libavcodec/scte_35.c
 create mode 100644 libavcodec/scte_35.h

diff --git a/ffmpeg.c b/ffmpeg.c
index 1fd0ece..4817004 100644
--- a/ffm

Re: [FFmpeg-devel] SCTE-35 development

2014-12-29 Thread Anshul
On December 18, 2014 4:08:56 PM IST, Michael Niedermayer
 wrote:
>On Wed, Dec 17, 2014 at 11:53:10PM +0530, Anshul wrote:
>> Hi
>> 
>> I was doing development of scte-35  message cue in ffmpeg.
>> 
>> I have attached a draft patch.
>> 
>> I would like to have some comments of this community.
>> -Anshul
>
>>  libavcodec/Makefile |2 ++
>>  libavcodec/allcodecs.c  |2 ++
>>  libavcodec/avcodec.h|1 +
>>  libavcodec/codec_desc.c |6 ++
>>  libavformat/mpegts.c|   40
>+---
>>  5 files changed, 44 insertions(+), 7 deletions(-)
>> 4b584484a54a78c130c4bbaa48c38551b3ca75fb 
>0001-trying-muxing-demuxing-of-scte_35-message-cue.patch
>> From 2ff4edfdeae131df72ea19005eb6ad85d5332f7c Mon Sep 17 00:00:00
>2001
>> From: Anshul Maheshwari 
>> Date: Wed, 17 Dec 2014 22:13:10 +0530
>> Subject: [PATCH] trying muxing demuxing of scte_35 message cue
>> 
>> ---
>>  libavcodec/Makefile |  2 ++
>>  libavcodec/allcodecs.c  |  2 ++
>>  libavcodec/avcodec.h|  1 +
>>  libavcodec/codec_desc.c |  6 ++
>>  libavformat/mpegts.c| 40
>+---
>>  5 files changed, 44 insertions(+), 7 deletions(-)
>> 
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index b35a796..9d2a49f 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -408,6 +408,7 @@ OBJS-$(CONFIG_SAMI_DECODER)+=
>samidec.o ass.o
>>  OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
>>  OBJS-$(CONFIG_S302M_ENCODER)   += s302menc.o
>>  OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
>> +OBJS-$(CONFIG_SCTE_35_DECODER) += scte_35.o
>
>this patch doesnt contain a scte_35.c
>did you forget git add ?
>
>[...]

I have attached another patch, still its draft.
I do want some opinion about the approach of this development.

to use this patch, one can pass below command
./ffmpeg -loglevel debug -i ~/test_videos/mpegwithscte35.ts -dcodec
cue_xml -map 0:0 -f rawvideo some.raw

There still some issue with this patch, like I have disabled estimate
timing of all stream since data stream does not have similar timing, i
will add condition there.

FFmpeg hangs after running command, it might be because of EOF not
handled properly, looking at the issue.


My vision for this patch is that we can add custom advertisement
if stream have scte-cue.

This patch might also help end-user to remove advertisements automatically.

for broadcaster it will help to show advertisement in local language.
or for local product.
just now I am very far away from my goal but will not always be.


This patch have all files which I have developed.
-Anshul
>From 2ff4edfdeae131df72ea19005eb6ad85d5332f7c Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Wed, 17 Dec 2014 22:13:10 +0530
Subject: [PATCH] trying muxing demuxing of scte_35 message cue

---
 libavcodec/Makefile |  2 ++
 libavcodec/allcodecs.c  |  2 ++
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  6 ++
 libavformat/mpegts.c| 40 +---
 5 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b35a796..9d2a49f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -408,6 +408,7 @@ OBJS-$(CONFIG_SAMI_DECODER)+= samidec.o ass.o
 OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
 OBJS-$(CONFIG_S302M_ENCODER)   += s302menc.o
 OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
+OBJS-$(CONFIG_SCTE_35_DECODER) += scte_35.o
 OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
 OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
 OBJS-$(CONFIG_SGIRLE_DECODER)  += sgirledec.o
@@ -807,6 +808,7 @@ OBJS-$(CONFIG_MPEGVIDEO_PARSER)+= mpegvideo_parser.o\
 OBJS-$(CONFIG_OPUS_PARSER) += opus_parser.o opus.o vorbis_data.o
 OBJS-$(CONFIG_PNG_PARSER)  += png_parser.o
 OBJS-$(CONFIG_PNM_PARSER)  += pnm_parser.o pnm.o
+OBJS-$(CONFIG_SCTE_35_PARSER)  += scte_35_parser.o
 OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
 OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
 OBJS-$(CONFIG_TAK_PARSER)  += tak_parser.o tak.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 36bbfed..7484ab1 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -535,6 +535,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(LIBAACPLUS,libaacplus);
 
 /* text */
+REGISTER_DECODER(SCTE_35,   scte_35)
 REGISTER_DECODER(BINTEXT,   bintext);
 REGISTER_DECODER(XBIN,  xbin);
 REGISTER_DECODER(IDF,   idf);
@@ -570,6 +571,7 @@ void avco

[FFmpeg-devel] SCTE-35 development

2014-12-17 Thread Anshul
Hi

I was doing development of scte-35  message cue in ffmpeg.

I have attached a draft patch.

I would like to have some comments of this community.
-Anshul
>From 2ff4edfdeae131df72ea19005eb6ad85d5332f7c Mon Sep 17 00:00:00 2001
From: Anshul Maheshwari 
Date: Wed, 17 Dec 2014 22:13:10 +0530
Subject: [PATCH] trying muxing demuxing of scte_35 message cue

---
 libavcodec/Makefile |  2 ++
 libavcodec/allcodecs.c  |  2 ++
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  6 ++
 libavformat/mpegts.c| 40 +---
 5 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index b35a796..9d2a49f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -408,6 +408,7 @@ OBJS-$(CONFIG_SAMI_DECODER)+= samidec.o ass.o
 OBJS-$(CONFIG_S302M_DECODER)   += s302m.o
 OBJS-$(CONFIG_S302M_ENCODER)   += s302menc.o
 OBJS-$(CONFIG_SANM_DECODER)+= sanm.o
+OBJS-$(CONFIG_SCTE_35_DECODER) += scte_35.o
 OBJS-$(CONFIG_SGI_DECODER) += sgidec.o
 OBJS-$(CONFIG_SGI_ENCODER) += sgienc.o rle.o
 OBJS-$(CONFIG_SGIRLE_DECODER)  += sgirledec.o
@@ -807,6 +808,7 @@ OBJS-$(CONFIG_MPEGVIDEO_PARSER)+= mpegvideo_parser.o\
 OBJS-$(CONFIG_OPUS_PARSER) += opus_parser.o opus.o vorbis_data.o
 OBJS-$(CONFIG_PNG_PARSER)  += png_parser.o
 OBJS-$(CONFIG_PNM_PARSER)  += pnm_parser.o pnm.o
+OBJS-$(CONFIG_SCTE_35_PARSER)  += scte_35_parser.o
 OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o
 OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
 OBJS-$(CONFIG_TAK_PARSER)  += tak_parser.o tak.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 36bbfed..7484ab1 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -535,6 +535,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(LIBAACPLUS,libaacplus);
 
 /* text */
+REGISTER_DECODER(SCTE_35,   scte_35)
 REGISTER_DECODER(BINTEXT,   bintext);
 REGISTER_DECODER(XBIN,  xbin);
 REGISTER_DECODER(IDF,   idf);
@@ -570,6 +571,7 @@ void avcodec_register_all(void)
 REGISTER_PARSER(PNM,pnm);
 REGISTER_PARSER(RV30,   rv30);
 REGISTER_PARSER(RV40,   rv40);
+REGISTER_PARSER(SCTE_35,scte_35);
 REGISTER_PARSER(TAK,tak);
 REGISTER_PARSER(VC1,vc1);
 REGISTER_PARSER(VORBIS, vorbis);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index eac3fc7..84b9875 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -522,6 +522,7 @@ enum AVCodecID {
 /* other specific kind of codecs (generally used for attachments) */
 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,   ///< A dummy ID pointing at the start of various fake codecs.
 AV_CODEC_ID_TTF = 0x18000,
+AV_CODEC_ID_SCTE_35= MKBETAG('C','U','E','I'),
 AV_CODEC_ID_BINTEXT= MKBETAG('B','T','X','T'),
 AV_CODEC_ID_XBIN   = MKBETAG('X','B','I','N'),
 AV_CODEC_ID_IDF= MKBETAG( 0 ,'I','D','F'),
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index eeb4505..a98c1c4 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2731,6 +2731,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("binary data"),
 .mime_types= MT("application/octet-stream"),
 },
+{
+.id= AV_CODEC_ID_SCTE_35,
+.type  = AVMEDIA_TYPE_DATA,
+.name  = "scte_35",
+.long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"),
+},
 
 /* deprecated codec ids */
 {
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c01f954..56105a6 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -57,6 +57,7 @@ enum MpegTSFilterType {
 MPEGTS_PES,
 MPEGTS_SECTION,
 MPEGTS_PCR,
+MPEGTS_DATA,
 };
 
 typedef struct MpegTSFilter MpegTSFilter;
@@ -488,6 +489,11 @@ static MpegTSFilter *mpegts_open_pcr_filter(MpegTSContext *ts, unsigned int pid)
 return mpegts_open_filter(ts, pid, MPEGTS_PCR);
 }
 
+static MpegTSFilter *mpegts_open_data_filter(MpegTSContext *ts, unsigned int pid)
+{
+return mpegts_open_filter(ts, pid, MPEGTS_DATA);
+}
+
 static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
 {
 int pid;
@@ -666,6 +672,7 @@ static const StreamType ISO_types[] = {
 { 0x1b, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264   },
 { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC   },
 { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS   },
+{ 0x86, AVMEDIA_TYPE_DATA,  AV_CODEC_ID_SCTE_35},
 

Re: [FFmpeg-devel] ffmpeg nvenc

2014-12-17 Thread Anshul
On 12/17/2014 10:11 PM, Carl Eugen Hoyos wrote:
> compn  mi.rr.com> writes:
>
>>> Should we (1)Add libnvenc on TOT branch but without 
>>> changing Timo's work or (2)Change nvenc on TOT 
>>> branch like an incremental patch on Timo's work. In 
>>> fact I would prefer (1), as it requires less work.
>> probably (1) for now.
> Isn't that the worst-case scenario?
>
> Carl Eugen
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
In my opinion we should try diff of both solution and review the first
one in respect to second, though it would take more effort in review.
Side note: I do have request please quote the reason(pros and cons) for
your opinion of choice.
because decision based on number of opinion does not benefits the
project, but only benefits number of developer (feeling).

-Anshul


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-12 Thread Anshul
On 12/06/2014 04:24 PM, Anshul wrote:
> On 12/06/2014 04:22 PM, Anshul wrote:
>> On 12/05/2014 07:56 PM, Nicolas George wrote:
>>> Hi. I had time to look at the code with some more details. Comments are
>>> below.
>>>
>>>> >From 31f69ccfb45247a7cc203084a931b8523284aa13 Mon Sep 17 00:00:00 2001
>>>> From: Anshul Maheshwari 
>>>> Date: Wed, 3 Dec 2014 23:37:22 +0530
>>>> Subject: [PATCH 2/2] Adding Closed caption Decoder
>>>>
>>>> ---
>>>>  libavcodec/Makefile   |   1 +
>>>>  libavcodec/allcodecs.c|   1 +
>>>>  libavcodec/ccaption_dec.c | 318 
>>>> ++
>>>>  3 files changed, 320 insertions(+)
>>>>  create mode 100644 libavcodec/ccaption_dec.c
>>>>
>>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>>> index fa0f53d..bbc516d 100644
>>>> --- a/libavcodec/Makefile
>>>> +++ b/libavcodec/Makefile
>>>> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
>>>>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>>>>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>>>>cavsdata.o mpeg12data.o
>>>> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>>>>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>>>>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>>>>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>>>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>>>> index 0d39d33..8c07388 100644
>>>> --- a/libavcodec/allcodecs.c
>>>> +++ b/libavcodec/allcodecs.c
>>>> @@ -480,6 +480,7 @@ void avcodec_register_all(void)
>>>>  /* subtitles */
>>>>  REGISTER_ENCDEC (SSA,   ssa);
>>>>  REGISTER_ENCDEC (ASS,   ass);
>>>> +REGISTER_DECODER(CCAPTION,  ccaption);
>>>>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>>>>  REGISTER_ENCDEC (DVDSUB,dvdsub);
>>>>  REGISTER_DECODER(JACOSUB,   jacosub);
>>>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>>>> new file mode 100644
>>>> index 000..0a7dfd8
>>>> --- /dev/null
>>>> +++ b/libavcodec/ccaption_dec.c
>>>> @@ -0,0 +1,318 @@
>>>> +/*
>>>> + * Closed Caption Decoding
>>>> + * Copyright (c) 2014 Anshul Maheshwari
>>>> + *
>>>> + * This file is part of FFmpeg.
>>>> + *
>>>> + * FFmpeg is free software; you can redistribute it and/or
>>>> + * modify it under the terms of the GNU Lesser General Public
>>>> + * License as published by the Free Software Foundation; either
>>>> + * version 2.1 of the License, or (at your option) any later version.
>>>> + *
>>>> + * FFmpeg is distributed in the hope that it will be useful,
>>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>>>> + * Lesser General Public License for more details.
>>>> + *
>>>> + * You should have received a copy of the GNU Lesser General Public
>>>> + * License along with FFmpeg; if not, write to the Free Software
>>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
>>>> 02110-1301 USA
>>>> + */
>>>> +
>>>> +#include "avcodec.h"
>>>> +#include "ass.h"
>>>> +
>>>> +#define SCREEN_ROWS 15
>>>> +#define SCREEN_COLUMNS 32
>>>> +
>>>> +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
>>>> +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
>>>> +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
>>>> +
>>>> +enum cc_mode {
>>>> +CCMODE_POPON,
>>>> +CCMODE_PAINTON,
>>>> +CCMODE_ROLLUP_2,
>>>> +CCMODE_ROLLUP_3,
>>>> +CCMODE_ROLLUP_4,
>>>> +CCMODE_TEXT,
>>>> +};
>>>> +
>>>> +struct Screen {
>>>> +uint8_t characters[SCREEN_ROWS][SCREEN_COLUMNS+1];
>>> Maybe add a comment about the +1?
>> done
>>>> +/*
>>>> + * row used flag will be 0 when none in use 

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-06 Thread Anshul
On 12/06/2014 04:22 PM, Anshul wrote:
> On 12/05/2014 07:56 PM, Nicolas George wrote:
>> Hi. I had time to look at the code with some more details. Comments are
>> below.
>>
>>> >From 31f69ccfb45247a7cc203084a931b8523284aa13 Mon Sep 17 00:00:00 2001
>>> From: Anshul Maheshwari 
>>> Date: Wed, 3 Dec 2014 23:37:22 +0530
>>> Subject: [PATCH 2/2] Adding Closed caption Decoder
>>>
>>> ---
>>>  libavcodec/Makefile   |   1 +
>>>  libavcodec/allcodecs.c|   1 +
>>>  libavcodec/ccaption_dec.c | 318 
>>> ++
>>>  3 files changed, 320 insertions(+)
>>>  create mode 100644 libavcodec/ccaption_dec.c
>>>
>>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>>> index fa0f53d..bbc516d 100644
>>> --- a/libavcodec/Makefile
>>> +++ b/libavcodec/Makefile
>>> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
>>>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>>>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>>>cavsdata.o mpeg12data.o
>>> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>>>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>>>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>>>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>>> index 0d39d33..8c07388 100644
>>> --- a/libavcodec/allcodecs.c
>>> +++ b/libavcodec/allcodecs.c
>>> @@ -480,6 +480,7 @@ void avcodec_register_all(void)
>>>  /* subtitles */
>>>  REGISTER_ENCDEC (SSA,   ssa);
>>>  REGISTER_ENCDEC (ASS,   ass);
>>> +REGISTER_DECODER(CCAPTION,  ccaption);
>>>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>>>  REGISTER_ENCDEC (DVDSUB,dvdsub);
>>>  REGISTER_DECODER(JACOSUB,   jacosub);
>>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>>> new file mode 100644
>>> index 000..0a7dfd8
>>> --- /dev/null
>>> +++ b/libavcodec/ccaption_dec.c
>>> @@ -0,0 +1,318 @@
>>> +/*
>>> + * Closed Caption Decoding
>>> + * Copyright (c) 2014 Anshul Maheshwari
>>> + *
>>> + * This file is part of FFmpeg.
>>> + *
>>> + * FFmpeg is free software; you can redistribute it and/or
>>> + * modify it under the terms of the GNU Lesser General Public
>>> + * License as published by the Free Software Foundation; either
>>> + * version 2.1 of the License, or (at your option) any later version.
>>> + *
>>> + * FFmpeg is distributed in the hope that it will be useful,
>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>>> + * Lesser General Public License for more details.
>>> + *
>>> + * You should have received a copy of the GNU Lesser General Public
>>> + * License along with FFmpeg; if not, write to the Free Software
>>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
>>> 02110-1301 USA
>>> + */
>>> +
>>> +#include "avcodec.h"
>>> +#include "ass.h"
>>> +
>>> +#define SCREEN_ROWS 15
>>> +#define SCREEN_COLUMNS 32
>>> +
>>> +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
>>> +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
>>> +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
>>> +
>>> +enum cc_mode {
>>> +CCMODE_POPON,
>>> +CCMODE_PAINTON,
>>> +CCMODE_ROLLUP_2,
>>> +CCMODE_ROLLUP_3,
>>> +CCMODE_ROLLUP_4,
>>> +CCMODE_TEXT,
>>> +};
>>> +
>>> +struct Screen {
>>> +uint8_t characters[SCREEN_ROWS][SCREEN_COLUMNS+1];
>> Maybe add a comment about the +1?
> done
>>> +/*
>>> + * row used flag will be 0 when none in use other wise it will have its
>>> + * corrosponding bit high.
>> Language nit. I suggest: "Bitmask of used rows; if a bit is not set, the
>> corresponding row is not used."
> done
>>> + * for setting row 1  use row | (1 >> 1)
>>> + * for setting row 15 use row | (1 >> 15)
>> Are you sure that is ">>" and not "<<&q

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-06 Thread Anshul
On 12/05/2014 07:56 PM, Nicolas George wrote:
> Hi. I had time to look at the code with some more details. Comments are
> below.
>
>> >From 31f69ccfb45247a7cc203084a931b8523284aa13 Mon Sep 17 00:00:00 2001
>> From: Anshul Maheshwari 
>> Date: Wed, 3 Dec 2014 23:37:22 +0530
>> Subject: [PATCH 2/2] Adding Closed caption Decoder
>>
>> ---
>>  libavcodec/Makefile   |   1 +
>>  libavcodec/allcodecs.c|   1 +
>>  libavcodec/ccaption_dec.c | 318 
>> ++
>>  3 files changed, 320 insertions(+)
>>  create mode 100644 libavcodec/ccaption_dec.c
>>
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index fa0f53d..bbc516d 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
>>  OBJS-$(CONFIG_C93_DECODER) += c93.o
>>  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
>>cavsdata.o mpeg12data.o
>> +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
>>  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
>>  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
>>  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>> index 0d39d33..8c07388 100644
>> --- a/libavcodec/allcodecs.c
>> +++ b/libavcodec/allcodecs.c
>> @@ -480,6 +480,7 @@ void avcodec_register_all(void)
>>  /* subtitles */
>>  REGISTER_ENCDEC (SSA,   ssa);
>>  REGISTER_ENCDEC (ASS,   ass);
>> +REGISTER_DECODER(CCAPTION,  ccaption);
>>  REGISTER_ENCDEC (DVBSUB,dvbsub);
>>  REGISTER_ENCDEC (DVDSUB,dvdsub);
>>  REGISTER_DECODER(JACOSUB,   jacosub);
>> diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
>> new file mode 100644
>> index 000..0a7dfd8
>> --- /dev/null
>> +++ b/libavcodec/ccaption_dec.c
>> @@ -0,0 +1,318 @@
>> +/*
>> + * Closed Caption Decoding
>> + * Copyright (c) 2014 Anshul Maheshwari
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>> USA
>> + */
>> +
>> +#include "avcodec.h"
>> +#include "ass.h"
>> +
>> +#define SCREEN_ROWS 15
>> +#define SCREEN_COLUMNS 32
>> +
>> +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
>> +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
>> +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
>> +
>> +enum cc_mode {
>> +CCMODE_POPON,
>> +CCMODE_PAINTON,
>> +CCMODE_ROLLUP_2,
>> +CCMODE_ROLLUP_3,
>> +CCMODE_ROLLUP_4,
>> +CCMODE_TEXT,
>> +};
>> +
>> +struct Screen {
>> +uint8_t characters[SCREEN_ROWS][SCREEN_COLUMNS+1];
> Maybe add a comment about the +1?
done
>> +/*
>> + * row used flag will be 0 when none in use other wise it will have its
>> + * corrosponding bit high.
> Language nit. I suggest: "Bitmask of used rows; if a bit is not set, the
> corresponding row is not used."
done
>> + * for setting row 1  use row | (1 >> 1)
>> + * for setting row 15 use row | (1 >> 15)
> Are you sure that is ">>" and not "<<"? And is it a good idea to number
> starting from 1?
It was just commented in wrong way, corrected comment.
>> + */
>> +int16_t  row_used;
>> +};
>> +
>> +
>> +typedef struct CCaptionSubContext {
>> +int parity_table[256];
>> +int row_cnt;
>> +struct Screen screen[2];
>> +int active_screen;
>> +int cursor_row;
>> +i

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-04 Thread Anshul Maheshwari
On Thu, Dec 4, 2014 at 5:43 PM, Nicolas George  wrote:

> Le quartidi 14 frimaire, an CCXXIII, Anshul a écrit :
> > Yes while doing that only I realized,  if we use "i" then cc must be in
> > first stream.
> > When I had multiple stream(with audio), then I was not able to map subcc
> > to my video stream.
> > using stream_idx , we are saying that if we can use  out0+subcc and
> > out1+subcc.
> > "i" logic fails when there is audio in 1st stream, there was no way i
> > could get the subtitle
> > if my first stream is not the one where closed caption are present.
>
> I tested various combinations, and I find it works with my "i" version and
> not with your "stream_idx" version. You can try this:
>
> http://samples.ffmpeg.org/MPEG2/subcc/ClosedCaptions/Starship_Troopers.vob
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket1482/NCIS.wtv
>
> st=~/tmp/samples/Starship_Troopers_with_subcc.vob
> ncis=~/tmp/samples/NCIS_with_subcc_stream.wtv
>
> input="movie=${st}:s=0+1[out0+subcc][out1];movie=${ncis}:s=2+0[out2+subcc][out3]"
> function prefix { sed "s/^/$1 : /" }
>
> ./ffmpeg_g -loglevel error -f lavfi -i $input -y \
>   -map 0:s:0 -f srt >(prefix 1_) \
>   -map 0:s:1 -f srt >(prefix _2)
>
> (the captions in ALL CAPS are from ST, the other ones from NCIS)
>
> The mapping logic is this:
>
> - "${st}:s=0+1[out0+subcc][out1]": take stream #0 (video) and #1 (audio)
>   from ${st} and make them stream #0 and #1 for the device.
>
> - "${ncis}:s=2+0[out2+subcc][out3]": take stream #2 (video) and #0 (audio)
>   from ${ncis} and make them stream #2 and #3 for the device.
>
> - "out0+subcc": output stream #0 (video from $st) has CC, make it the first
>   extra stream, i.e. #4 for the device.
>
> - "out2+subcc": output stream #2 (video from $ncis) has CC, make it the
> next
>   extra stream, i.e. #5 for the device.
>
> - "-map 0:s:0": take the first subtitle stream, i.e. #4, i.e. CC for #2,
>   i.e. CC for video from $st.
>
> - "-map 0:s:1": take the second subtitle stream, i.e. #5.
>
> In other words:
>
>   lavfi:4 = CC for lavfi:0 = CC for st:0
>   lavfi:5 = CC for lavfi:2 = CC for ncis:2
>
> CC streams are created in output stream index order, or, in other words, in
> order of their  index in "out+subcc".
>
> Regards,
>
> --
>   Nicolas George
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> Yes your logic is working fine when you know where is video stream and
where is audio stream.
while with stream_idx, even if I you dont know where is video and audio it
works.
but seeing so may of your use case, I feel you are right,

I think there should be some more way of specifying 0+1, we should also
able to specify 0v+0a
means 1st video and 1st audio in stream.
other wise there are lots of chances of wrong mapping. In my particular use
case I take input from rtp.
and the guys does not have any standard for 1st will be video or audio.

As you said before as per stephan's comment you are making stricter
parsing, please consider something like 0v + 0a.

Thanks
-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-03 Thread Anshul
On 12/04/2014 02:33 AM, Nicolas George wrote:
> Le tridi 13 frimaire, an CCXXIII, Anshul a écrit :
>> Thanks I was searching for this, even I asked for same on Irc.
>>
>> Nicolas: The changes from your pair of patch,
>> 1) I removed c708 part (whole) since both are same, 708 just have some
>> extra feature then 608.
>> In your first patch it was just registering c708, and I have not
>> used that patch.
> Ok, but is it correct? I mean: if the video that is being decoded contains
> c708 with the extra features used, then the output will not be valid 608,
> right? Or am I just writing nonsense?
It would be valid, c708 is backward compatible as far as
I have seen while working with ccextractor.
C708 is made in such a way that people dont have to throw there older TV
sets or device.
if any decoder is not able to decode c708 part, even then they can get
correct subtitle.
>> 2) you used i as the index of subcc, but I have used stream_idx
>> your code was lavfi->sink_stream_subcc_map[i] = !!use_subcc; 
>> I changed it to
>>  lavfi->sink_stream_subcc_map[stream_idx] = !!use_subcc; 
> That looks suspicious. Can you explain your change? Did you test it with
> filter graphs that contains several sinks?
Yes while doing that only I realized,  if we use "i" then cc must be in
first stream.
When I had multiple stream(with audio), then I was not able to map subcc
to my video stream.
using stream_idx , we are saying that if we can use  out0+subcc and
out1+subcc.
"i" logic fails when there is audio in 1st stream, there was no way i 
could get the subtitle
if my first stream is not the one where closed caption are present.

>> There were one more changes but that was  to get your patch in mainstream
>> like av_malloc_array instead av_malloc.
> Ok, seen it, this one looks good.
>
>> I have considered all your comments, but it would be better to check again.
> Will do, of course. But very busy week ahead. Just a few words below:
>
>
>> >From 09a199afa72eeb7b8be8527da7239f4abcc52dbe Mon Sep 17 00:00:00 2001
>> From: Nicolas George 
>> Date: Tue, 28 Oct 2014 14:41:15 +0530
>> Subject: [PATCH 1/2] allow to extract subcc
> The commit message was prefixed with "lavd/lavdi:". You should use "git am"
> to apply patches including commit message and such.
sorry for that
>> --- a/doc/indevs.texi
>> +++ b/doc/indevs.texi
>> @@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input 
>> stream
>>  generated by the device.
>>  The first unlabelled output is automatically assigned to the "out0"
>>  label, but all the others need to be specified explicitly.
>> +The suffix "+subcc" can be appended to the output label to create an extra
>> +stream with the closed captions packets attached to that output
>> +(experimental).
> I have a local change adding "; only for CEA-708 for now" after
> experimental.
>
>>  
>>  if (!strcmp(inout->name, "out"))
>>  stream_idx = 0;
>> -else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
>> +else if (sscanf(inout->name, "out%d+subcc%n\n", &stream_idx, 
>> &use_subcc) != 1) {
>>  av_log(avctx,  AV_LOG_ERROR,
>> "Invalid outpad name '%s'\n", inout->name);
> Stefano requested a stricter parsing here, and I have it in my tree.
>
> I would do a quick git send-email, except I am pretty sure I messed up the
> rebase.
>
> I will be in touch when I can. Thanks for advancing this.
>
> Regards,
>
>
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
thanks for looking.
-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] allow to extract subcc

2014-12-03 Thread Anshul
On 12/04/2014 12:36 AM, wm4 wrote:
> On Wed,  3 Dec 2014 17:58:57 +0530
> anshul.ffm...@gmail.com wrote:
>
>> From: Nicolas George 
>>
>> ---
>>  doc/indevs.texi |  9 ++
>>  libavdevice/lavfi.c | 80 
>> +
>>  2 files changed, 84 insertions(+), 5 deletions(-)
>>
>> diff --git a/doc/indevs.texi b/doc/indevs.texi
>> index 5d2a308..f31e2e3 100644
>> --- a/doc/indevs.texi
>> +++ b/doc/indevs.texi
>> @@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input 
>> stream
>>  generated by the device.
>>  The first unlabelled output is automatically assigned to the "out0"
>>  label, but all the others need to be specified explicitly.
>> +The suffix "+subcc" can be appended to the output label to create an extra
>> +stream with the closed captions packets attached to that output
>> +(experimental).
>>  
>>  If not specified defaults to the filename specified for the input
>>  device.
>> @@ -541,6 +544,12 @@ Read an audio stream and a video stream and play it 
>> back with
>>  ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
>>  @end example
>>  
>> +@item
>> +Dump decoded frames to images and closed captions to a file (experimental):
>> +@example
>> +ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s 
>> -c copy -f rawvideo subcc.bin
>> +@end example
>> +
>>  @end itemize
>>  
>>  @section libcdio
>> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
>> index 1398ece..bc45117 100644
>> --- a/libavdevice/lavfi.c
>> +++ b/libavdevice/lavfi.c
>> @@ -51,7 +51,10 @@ typedef struct {
>>  int *sink_stream_map;
>>  int *sink_eof;
>>  int *stream_sink_map;
>> +int *sink_stream_subcc_map;
>>  AVFrame *decoded_frame;
>> +int nb_sinks;
>> +AVPacket subcc_packet;
>>  } LavfiContext;
>>  
>>  static int *create_all_formats(int n)
>> @@ -82,6 +85,7 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
>>  av_freep(&lavfi->sink_stream_map);
>>  av_freep(&lavfi->sink_eof);
>>  av_freep(&lavfi->stream_sink_map);
>> +av_freep(&lavfi->sink_stream_subcc_map);
>>  av_freep(&lavfi->sinks);
>>  avfilter_graph_free(&lavfi->graph);
>>  av_frame_free(&lavfi->decoded_frame);
>> @@ -89,6 +93,27 @@ av_cold static int lavfi_read_close(AVFormatContext 
>> *avctx)
>>  return 0;
>>  }
>>  
>> +static int create_subcc_streams(AVFormatContext *avctx)
>> +{
>> +LavfiContext *lavfi = avctx->priv_data;
>> +AVStream *st;
>> +int stream_idx, sink_idx;
>> +
>> +for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
>> +sink_idx = lavfi->stream_sink_map[stream_idx];
>> +if (lavfi->sink_stream_subcc_map[sink_idx]) {
>> +lavfi->sink_stream_subcc_map[sink_idx] = avctx->nb_streams;
>> +if (!(st = avformat_new_stream(avctx, NULL)))
>> +return AVERROR(ENOMEM);
>> +st->codec->codec_id = AV_CODEC_ID_EIA_608;
>> +st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
>> +} else {
>> +lavfi->sink_stream_subcc_map[sink_idx] = -1;
>> +}
>> +}
>> +return 0;
>> +}
>> +
>>  av_cold static int lavfi_read_header(AVFormatContext *avctx)
>>  {
>>  LavfiContext *lavfi = avctx->priv_data;
>> @@ -153,6 +178,7 @@ av_cold static int lavfi_read_header(AVFormatContext 
>> *avctx)
>>  
>>  /* count the outputs */
>>  for (n = 0, inout = output_links; inout; n++, inout = inout->next);
>> +lavfi->nb_sinks = n;
>>  
>>  if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n)))
>>  FAIL(AVERROR(ENOMEM));
>> @@ -160,6 +186,8 @@ av_cold static int lavfi_read_header(AVFormatContext 
>> *avctx)
>>  FAIL(AVERROR(ENOMEM));
>>  if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n)))
>>  FAIL(AVERROR(ENOMEM));
>> +if (!(lavfi->sink_stream_subcc_map = av_malloc(sizeof(int) * n)))
>> +FAIL(AVERROR(ENOMEM));
>>  
>>  for (i = 0; i < n; i++)
>>  lavfi->stream_sink_map[i] = -1;
>> @@ -167,10 +195,10 @@ av_cold static int lavfi_read_header(AVFormatContext 
>> *avctx)
>>  /* parse the output link names - they need to be of the form out0, 
>> out1, ...
>>   * create a mapping between them and the streams */
>>  for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
>> -int stream_idx;
>> +int stream_idx, use_subcc = 0;
>>  if (!strcmp(inout->name, "out"))
>>  stream_idx = 0;
>> -else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
>> +else if (sscanf(inout->name, "out%d+subcc%n\n", &stream_idx, 
>> &use_subcc) != 1) {
>>  av_log(avctx,  AV_LOG_ERROR,
>> "Invalid outpad name '%s'\n", inout->name);
>>  FAIL(AVERROR(EINVAL));
>> @@ -192,6 +220,7 @@ av_cold static int lavfi_read_header(AVFormatContext 
>> *avctx)
>>  }
>>  lavfi->sink_stream_map[i] = stream_idx;
>>

Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-03 Thread Anshul
On 12/03/2014 10:19 PM, Clément Bœsch wrote:
> unless i'm mistaken, i think you just want:
> return av_popcount(val & 0x7f) & 1;
>
>
Thanks I was searching for this, even I asked for same on Irc.

Nicolas: The changes from your pair of patch,
1) I removed c708 part (whole) since both are same, 708 just have some
extra feature then 608.
In your first patch it was just registering c708, and I have not
used that patch.

2) you used i as the index of subcc, but I have used stream_idx
your code was lavfi->sink_stream_subcc_map[i] = !!use_subcc; 
I changed it to
 lavfi->sink_stream_subcc_map[stream_idx] = !!use_subcc; 

There were one more changes but that was  to get your patch in mainstream
like av_malloc_array instead av_malloc.


I have considered all your comments, but it would be better to check again.

I have also tested with valgrind, its report is good.

I have attached both patch here.

  -Anshul
>From 09a199afa72eeb7b8be8527da7239f4abcc52dbe Mon Sep 17 00:00:00 2001
From: Nicolas George 
Date: Tue, 28 Oct 2014 14:41:15 +0530
Subject: [PATCH 1/2] allow to extract subcc

---
 doc/indevs.texi |  9 ++
 libavdevice/lavfi.c | 80 +
 2 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 5d2a308..f31e2e3 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input stream
 generated by the device.
 The first unlabelled output is automatically assigned to the "out0"
 label, but all the others need to be specified explicitly.
+The suffix "+subcc" can be appended to the output label to create an extra
+stream with the closed captions packets attached to that output
+(experimental).
 
 If not specified defaults to the filename specified for the input
 device.
@@ -541,6 +544,12 @@ Read an audio stream and a video stream and play it back with
 ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
+@item
+Dump decoded frames to images and closed captions to a file (experimental):
+@example
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
+@end example
+
 @end itemize
 
 @section libcdio
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 1398ece..bc45117 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -51,7 +51,10 @@ typedef struct {
 int *sink_stream_map;
 int *sink_eof;
 int *stream_sink_map;
+int *sink_stream_subcc_map;
 AVFrame *decoded_frame;
+int nb_sinks;
+AVPacket subcc_packet;
 } LavfiContext;
 
 static int *create_all_formats(int n)
@@ -82,6 +85,7 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 av_freep(&lavfi->sink_stream_map);
 av_freep(&lavfi->sink_eof);
 av_freep(&lavfi->stream_sink_map);
+av_freep(&lavfi->sink_stream_subcc_map);
 av_freep(&lavfi->sinks);
 avfilter_graph_free(&lavfi->graph);
 av_frame_free(&lavfi->decoded_frame);
@@ -89,6 +93,27 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 return 0;
 }
 
+static int create_subcc_streams(AVFormatContext *avctx)
+{
+LavfiContext *lavfi = avctx->priv_data;
+AVStream *st;
+int stream_idx, sink_idx;
+
+for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
+sink_idx = lavfi->stream_sink_map[stream_idx];
+if (lavfi->sink_stream_subcc_map[sink_idx]) {
+lavfi->sink_stream_subcc_map[sink_idx] = avctx->nb_streams;
+if (!(st = avformat_new_stream(avctx, NULL)))
+return AVERROR(ENOMEM);
+st->codec->codec_id = AV_CODEC_ID_EIA_608;
+st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+} else {
+lavfi->sink_stream_subcc_map[sink_idx] = -1;
+}
+}
+return 0;
+}
+
 av_cold static int lavfi_read_header(AVFormatContext *avctx)
 {
 LavfiContext *lavfi = avctx->priv_data;
@@ -153,6 +178,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 
 /* count the outputs */
 for (n = 0, inout = output_links; inout; n++, inout = inout->next);
+lavfi->nb_sinks = n;
 
 if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
@@ -160,6 +186,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 FAIL(AVERROR(ENOMEM));
 if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
+if (!(lavfi->sink_stream_subcc_map = av_malloc(sizeof(int) * n)))
+FAIL(AVERROR(ENOMEM));
 
 for (i = 0; i < n; i++)
 lavfi->stream_sink_map[i] = -1;
@@ -167,10 +195,10 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 /* parse the output link names - they

[FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-03 Thread anshul . ffmpeg
From: Anshul Maheshwari 

---
I did implement lots of other thing, with respect to older patch.
like multi screen and rollup feature.

This implementation is working well with srt output format.
As of now ffplay is not able to show the decoded frames on screen.
I dont know why?

May be someone look at output and help, that what is missing.

 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/ccaption_dec.c | 376 ++
 3 files changed, 378 insertions(+)
 create mode 100644 libavcodec/ccaption_dec.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fa0f53d..bbc516d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
 OBJS-$(CONFIG_C93_DECODER) += c93.o
 OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
   cavsdata.o mpeg12data.o
+OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
 OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
 OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
 OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 0d39d33..8c07388 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -480,6 +480,7 @@ void avcodec_register_all(void)
 /* subtitles */
 REGISTER_ENCDEC (SSA,   ssa);
 REGISTER_ENCDEC (ASS,   ass);
+REGISTER_DECODER(CCAPTION,  ccaption);
 REGISTER_ENCDEC (DVBSUB,dvbsub);
 REGISTER_ENCDEC (DVDSUB,dvdsub);
 REGISTER_DECODER(JACOSUB,   jacosub);
diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
new file mode 100644
index 000..57443e4
--- /dev/null
+++ b/libavcodec/ccaption_dec.c
@@ -0,0 +1,376 @@
+/*
+ * Closed Caption Decoding
+ * Copyright (c) 2014 Anshul Maheshwari
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "libavcodec/ass.h"
+
+#define SCREEN_ROWS 15
+#define SCREEN_COLUMNS 32
+
+#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
+#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
+#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
+
+enum cc_mode {
+CCMODE_POPON,
+CCMODE_PAINTON,
+CCMODE_ROLLUP_2,
+CCMODE_ROLLUP_3,
+CCMODE_ROLLUP_4,
+CCMODE_TEXT,
+};
+typedef struct {
+int row;
+int column;
+} cursor_t;
+
+// buffer for CC
+typedef struct {
+uint8_t characters[SCREEN_ROWS][SCREEN_COLUMNS+1];
+/*
+ * row used flag will be 0 when none in use other wise it will have its
+ * corrosponding bit high.
+ * for setting row 1  use row | (1 >> 1)
+ * for setting row 15 use row | (1 >> 15)
+ */
+int16_t  row_used;
+} screen_t;
+
+
+typedef struct CCaptionSubContext {
+int parity_table[256];
+int row_cnt;
+screen_t screen[2];
+int active_screen;
+cursor_t cursor;
+char *buffer;
+int index;
+int data_len;
+int buf_len;
+/* erase display memory */
+int edm;
+int rollup;
+enum  cc_mode mode;
+int64_t start_time;
+/* visible screen time */
+int64_t startv_time;
+int64_t end_time;
+char prev_cmd[2];
+}CCaptionSubContext;
+
+static unsigned int av_always_inline is_oddparity1p7(unsigned int val)
+{
+//#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || 
defined(_M_IX86)
+#if 0
+asm goto (
+"and  $0x7F, %0\n\t"
+"jnp %l1 \/n\t"
+:/* no output */
+:"r"(val)
+:"cc"
+:odd
+);
+val = !(val&0x8);
+odd:
+val = !!(val&0x80);
+#else
+int ones = 0;
+int i = 0;
+
+for (i = 0; i < 7; i++) {
+if (val & (1 << i))
+ones++;
+}
+val = ones & 1;
+#endif
+return val;
+}
+
+static void build_parity_table(int *parity_table)
+{
+unsigned int byte;
+int parity_v;
+for (byte = 0; byte <= 127; byte++) {
+parity_v = is_oddparity1p7(byte);
+parity_table[byte] = parity_v;
+parity_table[byte | 0x80] 

[FFmpeg-devel] [PATCH 1/2] allow to extract subcc

2014-12-03 Thread anshul . ffmpeg
From: Nicolas George 

---
 doc/indevs.texi |  9 ++
 libavdevice/lavfi.c | 80 +
 2 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 5d2a308..f31e2e3 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input 
stream
 generated by the device.
 The first unlabelled output is automatically assigned to the "out0"
 label, but all the others need to be specified explicitly.
+The suffix "+subcc" can be appended to the output label to create an extra
+stream with the closed captions packets attached to that output
+(experimental).
 
 If not specified defaults to the filename specified for the input
 device.
@@ -541,6 +544,12 @@ Read an audio stream and a video stream and play it back 
with
 ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
+@item
+Dump decoded frames to images and closed captions to a file (experimental):
+@example
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c 
copy -f rawvideo subcc.bin
+@end example
+
 @end itemize
 
 @section libcdio
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 1398ece..bc45117 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -51,7 +51,10 @@ typedef struct {
 int *sink_stream_map;
 int *sink_eof;
 int *stream_sink_map;
+int *sink_stream_subcc_map;
 AVFrame *decoded_frame;
+int nb_sinks;
+AVPacket subcc_packet;
 } LavfiContext;
 
 static int *create_all_formats(int n)
@@ -82,6 +85,7 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 av_freep(&lavfi->sink_stream_map);
 av_freep(&lavfi->sink_eof);
 av_freep(&lavfi->stream_sink_map);
+av_freep(&lavfi->sink_stream_subcc_map);
 av_freep(&lavfi->sinks);
 avfilter_graph_free(&lavfi->graph);
 av_frame_free(&lavfi->decoded_frame);
@@ -89,6 +93,27 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 return 0;
 }
 
+static int create_subcc_streams(AVFormatContext *avctx)
+{
+LavfiContext *lavfi = avctx->priv_data;
+AVStream *st;
+int stream_idx, sink_idx;
+
+for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
+sink_idx = lavfi->stream_sink_map[stream_idx];
+if (lavfi->sink_stream_subcc_map[sink_idx]) {
+lavfi->sink_stream_subcc_map[sink_idx] = avctx->nb_streams;
+if (!(st = avformat_new_stream(avctx, NULL)))
+return AVERROR(ENOMEM);
+st->codec->codec_id = AV_CODEC_ID_EIA_608;
+st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+} else {
+lavfi->sink_stream_subcc_map[sink_idx] = -1;
+}
+}
+return 0;
+}
+
 av_cold static int lavfi_read_header(AVFormatContext *avctx)
 {
 LavfiContext *lavfi = avctx->priv_data;
@@ -153,6 +178,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 
 /* count the outputs */
 for (n = 0, inout = output_links; inout; n++, inout = inout->next);
+lavfi->nb_sinks = n;
 
 if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
@@ -160,6 +186,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 FAIL(AVERROR(ENOMEM));
 if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
+if (!(lavfi->sink_stream_subcc_map = av_malloc(sizeof(int) * n)))
+FAIL(AVERROR(ENOMEM));
 
 for (i = 0; i < n; i++)
 lavfi->stream_sink_map[i] = -1;
@@ -167,10 +195,10 @@ av_cold static int lavfi_read_header(AVFormatContext 
*avctx)
 /* parse the output link names - they need to be of the form out0, out1, 
...
  * create a mapping between them and the streams */
 for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
-int stream_idx;
+int stream_idx, use_subcc = 0;
 if (!strcmp(inout->name, "out"))
 stream_idx = 0;
-else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
+else if (sscanf(inout->name, "out%d+subcc%n\n", &stream_idx, 
&use_subcc) != 1) {
 av_log(avctx,  AV_LOG_ERROR,
"Invalid outpad name '%s'\n", inout->name);
 FAIL(AVERROR(EINVAL));
@@ -192,6 +220,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 }
 lavfi->sink_stream_map[i] = stream_idx;
 lavfi->stream_sink_map[stream_idx] = i;
+lavfi->sink_stream_subcc_map[stream_idx] = !!use_subcc;
 }
 
 /* for each open output create a corresponding stream */
@@ -203,7 +232,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 }
 
 /* create a sink for each output and connect them to the graph */
-lavfi->sinks = av_malloc_array(avctx->nb_streams, sizeof(AVFilterContext 
*));
+lavfi->sinks = av_malloc_array(lavfi->nb_sinks, sizeof(AVFilterContext *

Re: [FFmpeg-devel] need help

2014-12-03 Thread Anshul
On 12/03/2014 03:57 PM, Chetan wrote:
>  
>
> Hi i want to create video using Text with html tages and effect ...
> please let me know .. command 
I would suggest, use this ffmpeg user questions 
mailing list
please.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] ffmpeg developer needed

2014-12-03 Thread Anshul
On 12/03/2014 03:18 PM, james gordon wrote:
> Hi All,
>
> I am currently looking for a developer to work on a remote project,
> details
> below;
>
> Basically I am working with an open source Android which is based on the
> PJSIP sipstack. Currently FFMPEG is used for H264 video
> encoding/decoding
> (software) and it is pretty slow on most Android devices.
>
> I am aware that that FFMPEG has some support for H264 HW decoding on the
> Android platform using libstagefright, however I could not get this to
> build.
>
> Ideally what I would like is to add support into FFMPEG to use the new
> Android MediaCodec API for H264 HW decoding and encoding
>
> Summary: Add Android MediaCodec API support into FFMPEG / OR / fix
> libstagefright and add encoding support.
>
> Let me know if your interested.
>
> Thanks
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
I would suggest put this requirement as feature or wish in
https://trac.ffmpeg.org/
and put Whatever bounty you prefer to give to the person who complete
this work.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Implementing closed caption for FFmpeg

2014-12-01 Thread Anshul
On 12/02/2014 12:51 AM, Carl Eugen Hoyos wrote:
> Anshul  gmail.com> writes:
>
>>> This is basic implementation where all features 
>>> of closed caption are not implemented.
> What does the decoder output?
> Can it be used to produce ass-in-mkv?
>
> Thank you, Carl Eugen
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


I have only tested with srt and webvtt files, but it should support all
text based output format.

I use following command to decode cc inside h264 user data
./ffmpeg -f lavfi -i
"movie=/home/a141982112/test_videos/cap_eng_sub1.ts[out0+subcc]" some.srt


for cc as separate stream it will work
ffmpeg -i some.ts some.srt


-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Implementing closed caption for FFmpeg

2014-12-01 Thread Anshul
On 12/01/2014 10:31 PM, Anshul wrote:
> Hi
>
> This is basic implementation where all features of closed caption are
> not implemented.
>
> -Anshul
>
>
>
I have attached another patch with copyright thing on top of file.
>From 09a199afa72eeb7b8be8527da7239f4abcc52dbe Mon Sep 17 00:00:00 2001
From: Nicolas George 
Date: Tue, 28 Oct 2014 14:41:15 +0530
Subject: [PATCH 1/2] allow to extract subcc

---
 doc/indevs.texi |  9 ++
 libavdevice/lavfi.c | 80 +
 2 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 5d2a308..f31e2e3 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input stream
 generated by the device.
 The first unlabelled output is automatically assigned to the "out0"
 label, but all the others need to be specified explicitly.
+The suffix "+subcc" can be appended to the output label to create an extra
+stream with the closed captions packets attached to that output
+(experimental).
 
 If not specified defaults to the filename specified for the input
 device.
@@ -541,6 +544,12 @@ Read an audio stream and a video stream and play it back with
 ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
+@item
+Dump decoded frames to images and closed captions to a file (experimental):
+@example
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
+@end example
+
 @end itemize
 
 @section libcdio
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 1398ece..bc45117 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -51,7 +51,10 @@ typedef struct {
 int *sink_stream_map;
 int *sink_eof;
 int *stream_sink_map;
+int *sink_stream_subcc_map;
 AVFrame *decoded_frame;
+int nb_sinks;
+AVPacket subcc_packet;
 } LavfiContext;
 
 static int *create_all_formats(int n)
@@ -82,6 +85,7 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 av_freep(&lavfi->sink_stream_map);
 av_freep(&lavfi->sink_eof);
 av_freep(&lavfi->stream_sink_map);
+av_freep(&lavfi->sink_stream_subcc_map);
 av_freep(&lavfi->sinks);
 avfilter_graph_free(&lavfi->graph);
 av_frame_free(&lavfi->decoded_frame);
@@ -89,6 +93,27 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 return 0;
 }
 
+static int create_subcc_streams(AVFormatContext *avctx)
+{
+LavfiContext *lavfi = avctx->priv_data;
+AVStream *st;
+int stream_idx, sink_idx;
+
+for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
+sink_idx = lavfi->stream_sink_map[stream_idx];
+if (lavfi->sink_stream_subcc_map[sink_idx]) {
+lavfi->sink_stream_subcc_map[sink_idx] = avctx->nb_streams;
+if (!(st = avformat_new_stream(avctx, NULL)))
+return AVERROR(ENOMEM);
+st->codec->codec_id = AV_CODEC_ID_EIA_608;
+st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+} else {
+lavfi->sink_stream_subcc_map[sink_idx] = -1;
+}
+}
+return 0;
+}
+
 av_cold static int lavfi_read_header(AVFormatContext *avctx)
 {
 LavfiContext *lavfi = avctx->priv_data;
@@ -153,6 +178,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 
 /* count the outputs */
 for (n = 0, inout = output_links; inout; n++, inout = inout->next);
+lavfi->nb_sinks = n;
 
 if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
@@ -160,6 +186,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 FAIL(AVERROR(ENOMEM));
 if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
+if (!(lavfi->sink_stream_subcc_map = av_malloc(sizeof(int) * n)))
+FAIL(AVERROR(ENOMEM));
 
 for (i = 0; i < n; i++)
 lavfi->stream_sink_map[i] = -1;
@@ -167,10 +195,10 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 /* parse the output link names - they need to be of the form out0, out1, ...
  * create a mapping between them and the streams */
 for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
-int stream_idx;
+int stream_idx, use_subcc = 0;
 if (!strcmp(inout->name, "out"))
 stream_idx = 0;
-else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
+else if (sscanf(inout->name, "out%d+subcc%n\n", &stream_idx, &use_subcc) != 1) {
 av_log(avctx,  AV_LOG_ERROR,
"Invalid outpad name '%s'\n", inout->name);
 FAIL(AVERROR(EINVAL));
@@ -192,6 +220,7 @@

[FFmpeg-devel] Implementing closed caption for FFmpeg

2014-12-01 Thread Anshul
Hi

This is basic implementation where all features of closed caption are
not implemented.

-Anshul



>From 09a199afa72eeb7b8be8527da7239f4abcc52dbe Mon Sep 17 00:00:00 2001
From: Nicolas George 
Date: Tue, 28 Oct 2014 14:41:15 +0530
Subject: [PATCH 1/2] allow to extract subcc

---
 doc/indevs.texi |  9 ++
 libavdevice/lavfi.c | 80 +
 2 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index 5d2a308..f31e2e3 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -494,6 +494,9 @@ number starting from 0 corresponding to the mapped input stream
 generated by the device.
 The first unlabelled output is automatically assigned to the "out0"
 label, but all the others need to be specified explicitly.
+The suffix "+subcc" can be appended to the output label to create an extra
+stream with the closed captions packets attached to that output
+(experimental).
 
 If not specified defaults to the filename specified for the input
 device.
@@ -541,6 +544,12 @@ Read an audio stream and a video stream and play it back with
 ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
 @end example
 
+@item
+Dump decoded frames to images and closed captions to a file (experimental):
+@example
+ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
+@end example
+
 @end itemize
 
 @section libcdio
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 1398ece..bc45117 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -51,7 +51,10 @@ typedef struct {
 int *sink_stream_map;
 int *sink_eof;
 int *stream_sink_map;
+int *sink_stream_subcc_map;
 AVFrame *decoded_frame;
+int nb_sinks;
+AVPacket subcc_packet;
 } LavfiContext;
 
 static int *create_all_formats(int n)
@@ -82,6 +85,7 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 av_freep(&lavfi->sink_stream_map);
 av_freep(&lavfi->sink_eof);
 av_freep(&lavfi->stream_sink_map);
+av_freep(&lavfi->sink_stream_subcc_map);
 av_freep(&lavfi->sinks);
 avfilter_graph_free(&lavfi->graph);
 av_frame_free(&lavfi->decoded_frame);
@@ -89,6 +93,27 @@ av_cold static int lavfi_read_close(AVFormatContext *avctx)
 return 0;
 }
 
+static int create_subcc_streams(AVFormatContext *avctx)
+{
+LavfiContext *lavfi = avctx->priv_data;
+AVStream *st;
+int stream_idx, sink_idx;
+
+for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
+sink_idx = lavfi->stream_sink_map[stream_idx];
+if (lavfi->sink_stream_subcc_map[sink_idx]) {
+lavfi->sink_stream_subcc_map[sink_idx] = avctx->nb_streams;
+if (!(st = avformat_new_stream(avctx, NULL)))
+return AVERROR(ENOMEM);
+st->codec->codec_id = AV_CODEC_ID_EIA_608;
+st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
+} else {
+lavfi->sink_stream_subcc_map[sink_idx] = -1;
+}
+}
+return 0;
+}
+
 av_cold static int lavfi_read_header(AVFormatContext *avctx)
 {
 LavfiContext *lavfi = avctx->priv_data;
@@ -153,6 +178,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 
 /* count the outputs */
 for (n = 0, inout = output_links; inout; n++, inout = inout->next);
+lavfi->nb_sinks = n;
 
 if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
@@ -160,6 +186,8 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 FAIL(AVERROR(ENOMEM));
 if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n)))
 FAIL(AVERROR(ENOMEM));
+if (!(lavfi->sink_stream_subcc_map = av_malloc(sizeof(int) * n)))
+FAIL(AVERROR(ENOMEM));
 
 for (i = 0; i < n; i++)
 lavfi->stream_sink_map[i] = -1;
@@ -167,10 +195,10 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 /* parse the output link names - they need to be of the form out0, out1, ...
  * create a mapping between them and the streams */
 for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
-int stream_idx;
+int stream_idx, use_subcc = 0;
 if (!strcmp(inout->name, "out"))
 stream_idx = 0;
-else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
+else if (sscanf(inout->name, "out%d+subcc%n\n", &stream_idx, &use_subcc) != 1) {
 av_log(avctx,  AV_LOG_ERROR,
"Invalid outpad name '%s'\n", inout->name);
 FAIL(AVERROR(EINVAL));
@@ -192,6 +220,7 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx)
 }
 lavfi->sink_stream_map[i] = stream_idx;
 

Re: [FFmpeg-devel] DVB subtitles with multiple langage

2014-11-27 Thread Anshul
On November 27, 2014 2:27:59 PM IST, "Frédéric HUGENELL" 
 wrote:
>hello
>
>I just uploaded a few minutes ago a sample of a movie in the incoming
>folder, as requested by ffmpeg as you can see on the picture in attach
>
>I recorded this movie on french sat tv, it contains 2 audio streams and
>2
>subtitles stream, voir for french langage and the other one for deaf
>people
>
>hope it can help for improving the features
>
>thank you
>
>PS: the file is named
>"14-11-27_sample_DVBsub_multiple_langage_frenchTV.ts"
>
>
>
>
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Thanks I eill check it out

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] New FATE Server Based on Node.js

2014-11-02 Thread Anshul


On 11/1/2014 10:37 PM, Timothy Gu wrote:

Some more information...

On Sat, Nov 1, 2014 at 10:33 PM, Timothy Gu  wrote:


## To-Dos

Nevertheless, this is still an WIP. I have written history, results, and log
pages, but not yet the index page. There might be bugs I have not
discovered. The source is covered with redundant file existence checks that
can be eliminated after the server is finished.

I also want to add branch support.

A nice error page is needed also.


## Demos and Benchmarks

A demo is up on http://104.131.148.213:8080/history/tgdo-test-nothing.

For those with broken mail readers that consider trailing dots a part
of the URL, here you go:

http://104.131.148.213:8080/history/tgdo-test-nothing

[...]

Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Where should I look for code, that you have coded to make fate server in 
node.js


I like this change, just because I never understand perl.

-Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Facebook page

2014-10-05 Thread Anshul
On October 6, 2014 1:20:17 AM IST, Kieran Kunhya  wrote:
>On 5 October 2014 19:19, Thomas Volkert  wrote:
>> Okay, I started with some first steps...
>>
>> 1.)
>> If I see this correctly, the url http://www.facebook.com/ffmpeg is
>already
>> registered by some anime fan.  But it is possible to contact him/her
>by
>> Facebook messages. Maybe he/she is willing to leave this url for
>FFmpeg. So,
>> I wrote a message to him/her.
>> Alternatively, we could use another name:
>> http://www.facebook.com/ffmpeg.devel,
>> http://www.facebook.com/ffmpeg.framework,
>> http://www.facebook.com/multimedia.framework, ...
>> @all: What is your opinion about these alternative solutions?
>
>I think you can register as an organisation and it will kick that
>person off.
>___

I think we should wait for day or 2 for 
Fan reply.

>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] delete the old segment file from hls list

2014-09-01 Thread Anshul


On 8/31/2014 8:28 PM, Steven Liu wrote:

CC  Anshul

The Follow is the result of the parameter with -hls_wrap 7,It in the older
mail of this mail list.

When use the option  -hls_wrap 7
./ffmpeg -i shaolinzuqiu.rm -vcodec libx264 -preset ultrafast -an -f hls
-hls_wrap 7 a.m3u8
it dose not remove the nouse file:
[root@localhost ffmpeg]# ls *.ts;cat a.m3u8
a0.ts  a1.ts  a2.ts  a3.ts  a4.ts  a5.ts  a6.ts

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:11
#EXT-X-MEDIA-SEQUENCE:20
#EXTINF:10.427075,
a6.ts
#EXTINF:10.427075,
a0.ts
#EXTINF:10.427075,
a1.ts
#EXTINF:10.427075,
a2.ts
#EXTINF:10.427075,
a3.ts
If you knew this, and still want to add your patch, then carry on(I wont 
bother you).

Thanks
Anshul
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] delete the old segment file from hls list

2014-08-30 Thread Anshul
On August 30, 2014 8:57:12 AM IST, Steven Liu  wrote:
>
>On Aug 28, 2014, at 4:52 AM, Anshul  wrote:
>
>> On August 22, 2014 8:01:20 AM IST, Steven Liu
> wrote:
>>> repost new patch:
>>> 
>>> when update the hls m3u8 list, the old file is not unlinked
>>> this patch can do this operation
>>> delete the old ts segment which not show in m3u8,
>>> use hls_sync_list.
>>> 
>>> Signed-off-by: Steven Liu 
>>> ---
>>> libavformat/hlsenc.c |   15 ++-
>>> 1 files changed, 14 insertions(+), 1 deletions(-)
>>> 
>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>> index 11f1e5b..fc1063e 100644
>>> --- a/libavformat/hlsenc.c
>>> +++ b/libavformat/hlsenc.c
>>> @@ -30,6 +30,10 @@
>>> 
>>> #include "avformat.h"
>>> #include "internal.h"
>>> +#if HAVE_UNISTD_H
>>> +#include 
>>> +#endif
>>> +
>>> 
>>> typedef struct HLSSegment {
>>>char filename[1024];
>>> @@ -50,6 +54,7 @@ typedef struct HLSContext {
>>>float time;// Set by a private option.
>>>int max_nb_segments;   // Set by a private option.
>>>int  wrap; // Set by a private option.
>>> +int  sync_list;
>>> 
>>>int64_t recording_time;
>>>int has_video;
>>> @@ -96,6 +101,7 @@ static int hls_mux_init(AVFormatContext *s)
>>> static int hls_append_segment(HLSContext *hls, double duration)
>>> {
>>>HLSSegment *en = av_malloc(sizeof(*en));
>>> +int ret = 0;
>>> 
>>>if (!en)
>>>return AVERROR(ENOMEM);
>>> @@ -115,7 +121,13 @@ static int hls_append_segment(HLSContext *hls,
>>> double
>>> duration)
>>> if (hls->max_nb_segments && hls->nb_entries >= hls->max_nb_segments)
>{
>>>en = hls->segments;
>>>hls->segments = en->next;
>>> -av_free(en);
>>> +if (hls->sync_list) {
>>> +ret = unlink(en->filename);
>>> +if (ret < 0) {
>>> +av_log(hls->avf, AV_LOG_WARNING, "remove %s
>failed\n",
>>> en->filename);
>>> +}
>>> +}
>>> +av_free(en);
>>>} else
>>>hls->nb_entries++;
>>> 
>>> @@ -340,6 +352,7 @@ static const AVOption options[] = {
>>>{"hls_list_size", "set maximum number of playlist entries",
>>> OFFSET(max_nb_segments),AV_OPT_TYPE_INT,{.i64 = 5}, 0,
>>> INT_MAX,
>>> E},
>>>{"hls_wrap",  "set number after which the index wraps",
>>> OFFSET(wrap),AV_OPT_TYPE_INT,{.i64 = 0}, 0, INT_MAX, E},
>>>{"hls_base_url",  "url to prepend to each playlist entry",
>>> OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,   E},
>>> +{"hls_sync_list", "remove old ts segment for sync the file with
>>> the
>>> m3u8 list",  OFFSET(sync_list),AV_OPT_TYPE_INT,{.i64 = 0},  
> 
>>> 0,
>>> INT_MAX, E},
>>>{ NULL },
>>> };
>>> 
>>> --
>>> 1.7.1
>>> 
>>> 
>>> 
>>> 2014-08-21 16:51 GMT+08:00 Steven Liu :
>>> 
>>>> Hi Stefano,
>>>> if unistd is not available under Linux,
>>>> it will output error message when compile the source code.
>>>> 
>>>>  [root@testrtmp ffmpeg]# make
>>>> CC  libavformat/hlsenc.o
>>>> libavformat/hlsenc.c: In function ‘hls_append_segment’:
>>>> libavformat/hlsenc.c:125: error: implicit declaration of function
>>> ‘unlink’
>>>> make: *** [libavformat/hlsenc.o] Error 1
>>>> [root@testrtmp ffmpeg]#
>>>> 
>>>> 
>>>> 
>>>> the follow is the new patch:
>>>> 
>>>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>>>> index 11f1e5b..fc1063e 100644
>>>> 
>>>> --- a/libavformat/hlsenc.c
>>>> +++ b/libavformat/hlsenc.c
>>>> @@ -30,6 +30,10 @@
>>>> 
>>>> #include "avformat.h"
>>>> #include "internal.h"
>>>> +#if HAVE_UNISTD_H
>>>> +#include 
>>>> +#endif
>>>> +
>>>> 
>>>> typedef struct HLSSegment {
>

  1   2   >