Re: [FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Michael Niedermayer
On Wed, Jul 01, 2015 at 06:33:52PM +0300, Vadim Belov wrote:
 ---
  libavformat/Makefile |   2 +-
  libavformat/asf.c|   4 +
  libavformat/asf.h|  12 ++-
  libavformat/asf_ex.h |  58 ++
  libavformat/asf_trim.c   | 228 
 +++
  libavformat/asf_trim.h   |  95 
  libavformat/asfdec.c |  17 ++-
  libavformat/asfenc.c |  64 ++-
  8 files changed, 954 insertions(+), 485 deletions(-)
  create mode 100644 libavformat/asf_ex.h
  create mode 100644 libavformat/asf_trim.c
  create mode 100644 libavformat/asf_trim.h
 
  1.9.5.msysgit.1
 
 diff --git a/ffmpeg.c b/ffmpeg.c
 index a89ae39..a3cca09 100644
 --- a/ffmpeg.c
 +++ b/ffmpeg.c

there is something wrong with the patch
this hunk changes ffmpeg.c, yet that is not in the stats above
the change to ffmpeg.c doesnt belong in the patch

also the patch still contain sprintf(), tabs and other issues
is this the patch you wanted to post or an old one ?

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Vadim Belov
Sorry, please don't post, I'll send a new one,
Thanks!
On Jul 1, 2015 7:12 PM, Michael Niedermayer michae...@gmx.at wrote:

 On Wed, Jul 01, 2015 at 06:33:52PM +0300, Vadim Belov wrote:
  ---
   libavformat/Makefile |   2 +-
   libavformat/asf.c|   4 +
   libavformat/asf.h|  12 ++-
   libavformat/asf_ex.h |  58 ++
   libavformat/asf_trim.c   | 228
 +++
   libavformat/asf_trim.h   |  95 
   libavformat/asfdec.c |  17 ++-
   libavformat/asfenc.c |  64 ++-
   8 files changed, 954 insertions(+), 485 deletions(-)
   create mode 100644 libavformat/asf_ex.h
   create mode 100644 libavformat/asf_trim.c
   create mode 100644 libavformat/asf_trim.h
 
   1.9.5.msysgit.1
 
  diff --git a/ffmpeg.c b/ffmpeg.c
  index a89ae39..a3cca09 100644
  --- a/ffmpeg.c
  +++ b/ffmpeg.c

 there is something wrong with the patch
 this hunk changes ffmpeg.c, yet that is not in the stats above
 the change to ffmpeg.c doesnt belong in the patch

 also the patch still contain sprintf(), tabs and other issues
 is this the patch you wanted to post or an old one ?

 [...]
 --
 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

 Dictatorship naturally arises out of democracy, and the most aggravated
 form of tyranny and slavery out of the most extreme liberty. -- Plato

 ___
 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


[FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Vadim Belov
---
 libavformat/Makefile |   2 +-
 libavformat/asf.c|   4 +
 libavformat/asf.h|  12 ++-
 libavformat/asf_ex.h |  58 ++
 libavformat/asf_trim.c   | 228 +++
 libavformat/asf_trim.h   |  95 
 libavformat/asfdec.c |  17 ++-
 libavformat/asfenc.c |  64 ++-
 8 files changed, 954 insertions(+), 485 deletions(-)
 create mode 100644 libavformat/asf_ex.h
 create mode 100644 libavformat/asf_trim.c
 create mode 100644 libavformat/asf_trim.h

 1.9.5.msysgit.1

 Signed-off-by: Vadim Belov vadim.be...@gmail.com

diff --git a/libavformat/Makefile b/libavformat/Makefile
index bca9d5b..2743467 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -84,7 +84,7 @@ OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
 avlanguage.o
-OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
+OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o asf_trim.o
 OBJS-$(CONFIG_ASS_DEMUXER)   += assdec.o subtitles.o
 OBJS-$(CONFIG_ASS_MUXER) += assenc.o
 OBJS-$(CONFIG_AST_DEMUXER)   += ast.o astdec.o
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 80d24db..d2a0a8f 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -143,6 +143,10 @@ const ff_asf_guid ff_asf_digital_signature = {
 0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 
0xc9, 0x55, 0xfc, 0x6e
 };
 
+const ff_asf_guid ff_asf_index_header = {
+0xd3, 0x29, 0xe2, 0xd6, 0xda, 0x35, 0xd1, 0x11, 0x90, 0x34, 0x00, 0xa0, 
0xc9, 0x03, 0x49, 0xbe
+};
+
 /* List of official tags at 
http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
 const AVMetadataConv ff_asf_metadata_conv[] = {
 { WM/AlbumArtist,  album_artist },
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 0c9598a..0ef4ea6 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2015 Vadim Belov
  *
  * This file is part of FFmpeg.
  *
@@ -28,6 +29,11 @@
 
 #define PACKET_SIZE 3200
 
+/** 
+ * asf_ex.h is IMPORTANT to be placed After PACKET_SIZE definition
+ */
+#include asf_ex.h
+
 typedef struct ASFPayload {
 uint8_t type;
 uint16_t size;
@@ -57,7 +63,9 @@ typedef struct ASFStream {
 uint32_t palette[256];
 
 int payload_ext_ct;
-ASFPayload payload[8];
+ASFPayload payload[8]; 
+
+ASFIndexData idx_data;
 } ASFStream;
 
 typedef struct ASFMainHeader {
@@ -123,7 +131,7 @@ extern const ff_asf_guid ff_asf_language_guid;
 extern const ff_asf_guid ff_asf_content_encryption;
 extern const ff_asf_guid ff_asf_ext_content_encryption;
 extern const ff_asf_guid ff_asf_digital_signature;
-
+extern const ff_asf_guid ff_asf_index_header;
 extern const AVMetadataConv ff_asf_metadata_conv[];
 
 #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 
diff --git a/libavformat/asf_ex.h b/libavformat/asf_ex.h
new file mode 100644
index 000..480105a
--- /dev/null
+++ b/libavformat/asf_ex.h
@@ -0,0 +1,58 @@
+/**
+ * @file asf_ex.h
+ * Extensions to ASF handling
+ * @author Vadim Belov
+ *
+ * Copyright (c) 2015 Vadim Belov
+ *
+ * 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
+ */
+
+#ifndef AVFORMAT_ASF_EX_H
+#define AVFORMAT_ASF_EX_H
+
+#include stdint.h
+
+/**
+ * Packet size according to the size that Custom ASF File Creator writes 
+ * to its output packets:
+ * ASF_PACKET_SIZE is 8192, but is decremented later.
+ * Final result: in the ASF core file the value is 8032 
+ */
+#ifdef PACKET_SIZE
+#undef PACKET_SIZE
+#endif
+#define PACKET_SIZE 8032 
+
+#define STREAM_DIRECTION_STR streamDirection
+#define DIRECTION_DICT_KEY direction
+#define NO_STREAM_DIRECTION -1
+#define ASF_MAX_STREAMS_NUM 128
+
+typedef struct ASFStreamIndex { // Index Entry value 
+uint64_t offset;
+} ASFStreamIndex;
+
+typedef struct ASFIndexData { 
+ASFStreamIndex* indices;   // array of ASFStreamIndex
+uint32_t indices_max_count; // allocated size
+ 

Re: [FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Michael Niedermayer
On Wed, Jul 01, 2015 at 03:49:11PM +0300, Vadim Belov wrote:
 ---
  libavformat/Makefile |   2 +-
  libavformat/asf.c|   4 +
  libavformat/asf.h|  12 ++-
  libavformat/asf_ex.h |  58 ++
  libavformat/asf_trim.c   | 228 
 +++
  libavformat/asf_trim.h   |  95 
  libavformat/asfdec.c |  17 ++-
  libavformat/asfenc.c |  64 ++-
  8 files changed, 954 insertions(+), 485 deletions(-)
  create mode 100644 libavformat/asf_ex.h
  create mode 100644 libavformat/asf_trim.c
  create mode 100644 libavformat/asf_trim.h
 
  1.9.5.msysgit.1
 
  Signed-off-by: Vadim Belov vadim.be...@gmail.com
 
 diff --git a/libavformat/Makefile b/libavformat/Makefile
 index bca9d5b..2743467 100644
 --- a/libavformat/Makefile
 +++ b/libavformat/Makefile
 @@ -84,7 +84,7 @@ OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
  OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
  OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
  avlanguage.o
 -OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
 +OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o asf_trim.o
  OBJS-$(CONFIG_ASS_DEMUXER)   += assdec.o subtitles.o
  OBJS-$(CONFIG_ASS_MUXER) += assenc.o
  OBJS-$(CONFIG_AST_DEMUXER)   += ast.o astdec.o
 diff --git a/libavformat/asf.c b/libavformat/asf.c
 index 80d24db..d2a0a8f 100644
 --- a/libavformat/asf.c
 +++ b/libavformat/asf.c
 @@ -143,6 +143,10 @@ const ff_asf_guid ff_asf_digital_signature = {
  0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 
 0xc9, 0x55, 0xfc, 0x6e
  };
  
 +const ff_asf_guid ff_asf_index_header = {
 +0xd3, 0x29, 0xe2, 0xd6, 0xda, 0x35, 0xd1, 0x11, 0x90, 0x34, 0x00, 0xa0, 
 0xc9, 0x03, 0x49, 0xbe
 +};
 +
  /* List of official tags at 
 http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
  const AVMetadataConv ff_asf_metadata_conv[] = {
  { WM/AlbumArtist,  album_artist },
 diff --git a/libavformat/asf.h b/libavformat/asf.h
 index 0c9598a..0ef4ea6 100644
 --- a/libavformat/asf.h
 +++ b/libavformat/asf.h
 @@ -1,5 +1,6 @@
  /*
   * Copyright (c) 2000, 2001 Fabrice Bellard
 + * Copyright (c) 2015 Vadim Belov
   *
   * This file is part of FFmpeg.
   *
 @@ -28,6 +29,11 @@
  
  #define PACKET_SIZE 3200
  
 +/** 
 + * asf_ex.h is IMPORTANT to be placed After PACKET_SIZE definition
 + */
 +#include asf_ex.h
 +
  typedef struct ASFPayload {
  uint8_t type;
  uint16_t size;
 @@ -57,7 +63,9 @@ typedef struct ASFStream {
  uint32_t palette[256];
  
  int payload_ext_ct;
 -ASFPayload payload[8];
 +ASFPayload payload[8];   
 +
 +ASFIndexData idx_data;
  } ASFStream;
  
  typedef struct ASFMainHeader {
 @@ -123,7 +131,7 @@ extern const ff_asf_guid ff_asf_language_guid;
  extern const ff_asf_guid ff_asf_content_encryption;
  extern const ff_asf_guid ff_asf_ext_content_encryption;
  extern const ff_asf_guid ff_asf_digital_signature;
 -
 +extern const ff_asf_guid ff_asf_index_header;
  extern const AVMetadataConv ff_asf_metadata_conv[];
  
  #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 
 diff --git a/libavformat/asf_ex.h b/libavformat/asf_ex.h
 new file mode 100644
 index 000..480105a
 --- /dev/null
 +++ b/libavformat/asf_ex.h
 @@ -0,0 +1,58 @@
 +/**
 + * @file asf_ex.h
 + * Extensions to ASF handling
 + * @author Vadim Belov
 + *
 + * Copyright (c) 2015 Vadim Belov
 + *
 + * 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
 + */
 +
 +#ifndef AVFORMAT_ASF_EX_H
 +#define AVFORMAT_ASF_EX_H
 +
 +#include stdint.h
 +

 +/**
 + * Packet size according to the size that Custom ASF File Creator writes 
 + * to its output packets:
 + * ASF_PACKET_SIZE is 8192, but is decremented later.
 + * Final result: in the ASF core file the value is 8032 
 + */
 +#ifdef PACKET_SIZE
 +#undef PACKET_SIZE
 +#endif
 +#define PACKET_SIZE 8032 

is this specific value needed ?
are there any disadvantages in using it ?

either way if its changed it should be changed not overriden by undef
also PACKET_SIZE could be moved to asfenc.c in 

[FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Vadim Belov
---
 libavformat/Makefile |   2 +-
 libavformat/asf.c|   4 +
 libavformat/asf.h|  12 ++-
 libavformat/asf_ex.h |  58 ++
 libavformat/asf_trim.c   | 228 +++
 libavformat/asf_trim.h   |  95 
 libavformat/asfdec.c |  17 ++-
 libavformat/asfenc.c |  64 ++-
 8 files changed, 954 insertions(+), 485 deletions(-)
 create mode 100644 libavformat/asf_ex.h
 create mode 100644 libavformat/asf_trim.c
 create mode 100644 libavformat/asf_trim.h

 1.9.5.msysgit.1

diff --git a/ffmpeg.c b/ffmpeg.c
index a89ae39..a3cca09 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -36,9 +36,6 @@
 #if HAVE_IO_H
 #include io.h
 #endif
-#if HAVE_UNISTD_H
-#include unistd.h
-#endif
 #endif
 
 #include libavformat/avformat.h
@@ -75,6 +72,10 @@
 #elif HAVE_GETPROCESSTIMES
 #include windows.h
 #endif
+#if HAVE_UNISTD_H
+#include unistd.h
+#endif
+
 #if HAVE_GETPROCESSMEMORYINFO
 #include windows.h
 #include psapi.h
diff --git a/libavformat/Makefile b/libavformat/Makefile
index bca9d5b..2743467 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -84,7 +84,7 @@ OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
 avlanguage.o
-OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
+OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o asf_trim.o
 OBJS-$(CONFIG_ASS_DEMUXER)   += assdec.o subtitles.o
 OBJS-$(CONFIG_ASS_MUXER) += assenc.o
 OBJS-$(CONFIG_AST_DEMUXER)   += ast.o astdec.o
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 80d24db..d2a0a8f 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -143,6 +143,10 @@ const ff_asf_guid ff_asf_digital_signature = {
 0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 
0xc9, 0x55, 0xfc, 0x6e
 };
 
+const ff_asf_guid ff_asf_index_header = {
+0xd3, 0x29, 0xe2, 0xd6, 0xda, 0x35, 0xd1, 0x11, 0x90, 0x34, 0x00, 0xa0, 
0xc9, 0x03, 0x49, 0xbe
+};
+
 /* List of official tags at 
http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
 const AVMetadataConv ff_asf_metadata_conv[] = {
 { WM/AlbumArtist,  album_artist },
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 0c9598a..1ea848d 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2015 Vadim Belov
  *
  * This file is part of FFmpeg.
  *
@@ -25,6 +26,7 @@
 #include avformat.h
 #include metadata.h
 #include riff.h
+#include asf_ex.h
 
 #define PACKET_SIZE 3200
 
@@ -57,7 +59,9 @@ typedef struct ASFStream {
 uint32_t palette[256];
 
 int payload_ext_ct;
-ASFPayload payload[8];
+ASFPayload payload[8]; 
+
+ASFIndexData idx_data;
 } ASFStream;
 
 typedef struct ASFMainHeader {
@@ -123,7 +127,7 @@ extern const ff_asf_guid ff_asf_language_guid;
 extern const ff_asf_guid ff_asf_content_encryption;
 extern const ff_asf_guid ff_asf_ext_content_encryption;
 extern const ff_asf_guid ff_asf_digital_signature;
-
+extern const ff_asf_guid ff_asf_index_header;
 extern const AVMetadataConv ff_asf_metadata_conv[];
 
 #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 
diff --git a/libavformat/asf_ex.h b/libavformat/asf_ex.h
new file mode 100644
index 000..5e46a2b
--- /dev/null
+++ b/libavformat/asf_ex.h
@@ -0,0 +1,47 @@
+/**
+ * @file asf_ex.h
+ * Extensions to ASF handling
+ * @author Vadim Belov
+ *
+ * Copyright (c) 2015 Vadim Belov
+ *
+ * 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
+ */
+
+#ifndef AVFORMAT_ASF_EX_H
+#define AVFORMAT_ASF_EX_H
+
+#include stdint.h
+
+#define STREAM_DIRECTION_STR streamDirection
+#define DIRECTION_DICT_KEY direction
+#define NO_STREAM_DIRECTION -1
+#define ASF_MAX_STREAMS_NUM 128
+
+typedef struct ASFStreamIndex { // Index Entry value 
+uint64_t offset;
+} ASFStreamIndex;
+
+typedef struct ASFIndexData {
+ASFStreamIndex* indices;   // array of ASFStreamIndex
+uint32_t indices_max_count; // allocated size
+uint32_t 

Re: [FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Vadim Belov
Thanks Michael,
I've sent a fix of this patch,

Currently it doesn't change PACKET_SIZE, which was pretty specific for the
product I'm dealing with.


On Wed, Jul 1, 2015 at 4:21 PM, Michael Niedermayer michae...@gmx.at
wrote:

 On Wed, Jul 01, 2015 at 03:49:11PM +0300, Vadim Belov wrote:
  ---
   libavformat/Makefile |   2 +-
   libavformat/asf.c|   4 +
   libavformat/asf.h|  12 ++-
   libavformat/asf_ex.h |  58 ++
   libavformat/asf_trim.c   | 228
 +++
   libavformat/asf_trim.h   |  95 
   libavformat/asfdec.c |  17 ++-
   libavformat/asfenc.c |  64 ++-
   8 files changed, 954 insertions(+), 485 deletions(-)
   create mode 100644 libavformat/asf_ex.h
   create mode 100644 libavformat/asf_trim.c
   create mode 100644 libavformat/asf_trim.h
 
   1.9.5.msysgit.1
 
   Signed-off-by: Vadim Belov vadim.be...@gmail.com
 
  diff --git a/libavformat/Makefile b/libavformat/Makefile
  index bca9d5b..2743467 100644
  --- a/libavformat/Makefile
  +++ b/libavformat/Makefile
  @@ -84,7 +84,7 @@ OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
   OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
   OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
   avlanguage.o
  -OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
  +OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o asf_trim.o
   OBJS-$(CONFIG_ASS_DEMUXER)   += assdec.o subtitles.o
   OBJS-$(CONFIG_ASS_MUXER) += assenc.o
   OBJS-$(CONFIG_AST_DEMUXER)   += ast.o astdec.o
  diff --git a/libavformat/asf.c b/libavformat/asf.c
  index 80d24db..d2a0a8f 100644
  --- a/libavformat/asf.c
  +++ b/libavformat/asf.c
  @@ -143,6 +143,10 @@ const ff_asf_guid ff_asf_digital_signature = {
   0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00,
 0xa0, 0xc9, 0x55, 0xfc, 0x6e
   };
 
  +const ff_asf_guid ff_asf_index_header = {
  +0xd3, 0x29, 0xe2, 0xd6, 0xda, 0x35, 0xd1, 0x11, 0x90, 0x34, 0x00,
 0xa0, 0xc9, 0x03, 0x49, 0xbe
  +};
  +
   /* List of official tags at
 http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
   const AVMetadataConv ff_asf_metadata_conv[] = {
   { WM/AlbumArtist,  album_artist },
  diff --git a/libavformat/asf.h b/libavformat/asf.h
  index 0c9598a..0ef4ea6 100644
  --- a/libavformat/asf.h
  +++ b/libavformat/asf.h
  @@ -1,5 +1,6 @@
   /*
* Copyright (c) 2000, 2001 Fabrice Bellard
  + * Copyright (c) 2015 Vadim Belov
*
* This file is part of FFmpeg.
*
  @@ -28,6 +29,11 @@
 
   #define PACKET_SIZE 3200
 
  +/**
  + * asf_ex.h is IMPORTANT to be placed After PACKET_SIZE definition
  + */
  +#include asf_ex.h
  +
   typedef struct ASFPayload {
   uint8_t type;
   uint16_t size;
  @@ -57,7 +63,9 @@ typedef struct ASFStream {
   uint32_t palette[256];
 
   int payload_ext_ct;
  -ASFPayload payload[8];
  +ASFPayload payload[8];
  +
  +ASFIndexData idx_data;
   } ASFStream;
 
   typedef struct ASFMainHeader {
  @@ -123,7 +131,7 @@ extern const ff_asf_guid ff_asf_language_guid;
   extern const ff_asf_guid ff_asf_content_encryption;
   extern const ff_asf_guid ff_asf_ext_content_encryption;
   extern const ff_asf_guid ff_asf_digital_signature;
  -
  +extern const ff_asf_guid ff_asf_index_header;
   extern const AVMetadataConv ff_asf_metadata_conv[];
 
   #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 
  diff --git a/libavformat/asf_ex.h b/libavformat/asf_ex.h
  new file mode 100644
  index 000..480105a
  --- /dev/null
  +++ b/libavformat/asf_ex.h
  @@ -0,0 +1,58 @@
  +/**
  + * @file asf_ex.h
  + * Extensions to ASF handling
  + * @author Vadim Belov
  + *
  + * Copyright (c) 2015 Vadim Belov
  + *
  + * 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
  + */
  +
  +#ifndef AVFORMAT_ASF_EX_H
  +#define AVFORMAT_ASF_EX_H
  +
  +#include stdint.h
  +

  +/**
  + * Packet size according to the size that Custom ASF File Creator writes
  + * to its output packets:
  + * ASF_PACKET_SIZE is 8192, but is decremented later.
  + * 

Re: [FFmpeg-devel] [PATCH 1/1] Extended ASF functionality

2015-07-01 Thread Vadim Belov
Hi,
Please see the last patch with more detailed explanation.
Thanks,
Vadim

On Wed, Jul 1, 2015 at 7:16 PM, Hendrik Leppkes h.lepp...@gmail.com wrote:

 On Wed, Jul 1, 2015 at 6:11 PM, Michael Niedermayer michae...@gmx.at
 wrote:
  On Wed, Jul 01, 2015 at 06:33:52PM +0300, Vadim Belov wrote:
  ---
   libavformat/Makefile |   2 +-
   libavformat/asf.c|   4 +
   libavformat/asf.h|  12 ++-
   libavformat/asf_ex.h |  58 ++
   libavformat/asf_trim.c   | 228
 +++
   libavformat/asf_trim.h   |  95 
   libavformat/asfdec.c |  17 ++-
   libavformat/asfenc.c |  64 ++-
   8 files changed, 954 insertions(+), 485 deletions(-)
   create mode 100644 libavformat/asf_ex.h
   create mode 100644 libavformat/asf_trim.c
   create mode 100644 libavformat/asf_trim.h
 
   1.9.5.msysgit.1
 
  diff --git a/ffmpeg.c b/ffmpeg.c
  index a89ae39..a3cca09 100644
  --- a/ffmpeg.c
  +++ b/ffmpeg.c
 
  there is something wrong with the patch
  this hunk changes ffmpeg.c, yet that is not in the stats above
  the change to ffmpeg.c doesnt belong in the patch
 
  also the patch still contain sprintf(), tabs and other issues
  is this the patch you wanted to post or an old one ?
 

 Maybe you could also explain what this thing does?
 The only comment I saw elsewhere was ASF streams metadata copy, but
 this patch is huge, hundreds of lines of new code. I cannot believe
 that copying metadata from one asf file into another would require
 these many changes.

 So please elaborate what this is doing and what the changes add to our
 code.

 - Hendrik
 ___
 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


[FFmpeg-devel] [PATCH 1/1] Extended ASF functionality:

2015-07-01 Thread Vadim Belov
 1. Copy stream metadata specific attribute named streamDirection
 2. Create top-level Index Object for output file with intervals of 10sec
 3. Change of Preroll time to 0 for player to start playing the file immediately
 
---
 libavformat/Makefile |   2 +-
 libavformat/asf.c|   4 +
 libavformat/asf.h|  12 ++-
 libavformat/asf_ex.h |  58 ++
 libavformat/asf_trim.c   | 228 +++
 libavformat/asf_trim.h   |  95 
 libavformat/asfdec.c |  17 ++-
 libavformat/asfenc.c |  64 ++-
 8 files changed, 954 insertions(+), 485 deletions(-)
 create mode 100644 libavformat/asf_ex.h
 create mode 100644 libavformat/asf_trim.c
 create mode 100644 libavformat/asf_trim.h

 1.9.5.msysgit.1

 Signed-off-by: Vadim Belov vadim.be...@gmail.com

diff --git a/libavformat/Makefile b/libavformat/Makefile
index bca9d5b..2743467 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -84,7 +84,7 @@ OBJS-$(CONFIG_APNG_MUXER)+= apngenc.o
 OBJS-$(CONFIG_AQTITLE_DEMUXER)   += aqtitledec.o subtitles.o
 OBJS-$(CONFIG_ASF_DEMUXER)   += asfdec.o asf.o asfcrypt.o \
 avlanguage.o
-OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o
+OBJS-$(CONFIG_ASF_MUXER) += asfenc.o asf.o asf_trim.o
 OBJS-$(CONFIG_ASS_DEMUXER)   += assdec.o subtitles.o
 OBJS-$(CONFIG_ASS_MUXER) += assenc.o
 OBJS-$(CONFIG_AST_DEMUXER)   += ast.o astdec.o
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 80d24db..d2a0a8f 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -143,6 +143,10 @@ const ff_asf_guid ff_asf_digital_signature = {
 0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 
0xc9, 0x55, 0xfc, 0x6e
 };
 
+const ff_asf_guid ff_asf_index_header = {
+0xd3, 0x29, 0xe2, 0xd6, 0xda, 0x35, 0xd1, 0x11, 0x90, 0x34, 0x00, 0xa0, 
0xc9, 0x03, 0x49, 0xbe
+};
+
 /* List of official tags at 
http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
 const AVMetadataConv ff_asf_metadata_conv[] = {
 { WM/AlbumArtist,  album_artist },
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 0c9598a..1ea848d 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2015 Vadim Belov
  *
  * This file is part of FFmpeg.
  *
@@ -25,6 +26,7 @@
 #include avformat.h
 #include metadata.h
 #include riff.h
+#include asf_ex.h
 
 #define PACKET_SIZE 3200
 
@@ -57,7 +59,9 @@ typedef struct ASFStream {
 uint32_t palette[256];
 
 int payload_ext_ct;
-ASFPayload payload[8];
+ASFPayload payload[8]; 
+
+ASFIndexData idx_data;
 } ASFStream;
 
 typedef struct ASFMainHeader {
@@ -123,7 +127,7 @@ extern const ff_asf_guid ff_asf_language_guid;
 extern const ff_asf_guid ff_asf_content_encryption;
 extern const ff_asf_guid ff_asf_ext_content_encryption;
 extern const ff_asf_guid ff_asf_digital_signature;
-
+extern const ff_asf_guid ff_asf_index_header;
 extern const AVMetadataConv ff_asf_metadata_conv[];
 
 #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 
diff --git a/libavformat/asf_ex.h b/libavformat/asf_ex.h
new file mode 100644
index 000..5e46a2b
--- /dev/null
+++ b/libavformat/asf_ex.h
@@ -0,0 +1,47 @@
+/**
+ * @file asf_ex.h
+ * Extensions to ASF handling
+ * @author Vadim Belov
+ *
+ * Copyright (c) 2015 Vadim Belov
+ *
+ * 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
+ */
+
+#ifndef AVFORMAT_ASF_EX_H
+#define AVFORMAT_ASF_EX_H
+
+#include stdint.h
+
+#define STREAM_DIRECTION_STR streamDirection
+#define DIRECTION_DICT_KEY direction
+#define NO_STREAM_DIRECTION -1
+#define ASF_MAX_STREAMS_NUM 128
+
+typedef struct ASFStreamIndex { // Index Entry value 
+uint64_t offset;
+} ASFStreamIndex;
+
+typedef struct ASFIndexData {
+ASFStreamIndex* indices;   // array of ASFStreamIndex
+uint32_t indices_max_count; // allocated size
+uint32_t next_duration_mark; // for next index
+uint32_t indices_count; // current index 
+int64_t  duration_overall;
+} ASFIndexData;
+
+#endif /*